program atcoder
implicit none
integer :: n, m, i, j, r, z, dz
integer, allocatable :: a(:), b(:), dp(:)
character(len=16384) :: ans

read(*,*) n,m
allocate(a(m),b(m),dp(0:n)) ! i本のマッチをちょうど使って作れる最大の桁数
read(*,*) (a(i), i=1,m)

call reverse_sort(m,a)

do i = 1, m
	call num(a(i), b(i))
end do

dp = -1 !初期値

dp(0) = 0

do i = 1, n
	do j = 1, m
    	if(i-b(j) >= 0)then
			call chmax(dp(i),dp(i-b(j))+1)
        end if
    end do
end do

ans = ''
z = n
do j = 1, maxval(dp)
	do i = 1, m
		if(dp(z)-1 == dp(z-b(i)) .and. z-b(i) >= 0)then
    		ans(j:j) = achar(48+a(i))
			z = z - b(i)
            exit
    	end if
	end do
end do

deallocate(a,b,dp)
write(*,'(a)') trim(ans)

contains

subroutine chmax(dp,x)
implicit none
integer :: dp, x

if (dp < x) then
	dp = x
	return
end if
end subroutine

subroutine num(r,s)
implicit none
integer :: r, s
if(r == 1)then
    s = 2
end if
if(r == 2 .or. r == 3 .or. r == 5)then
	s = 5
end if
if(r == 4)then
    s = 4
end if
if(r == 6 .or. r == 9)then
    s = 6
end if
if(r == 7)then
	s = 3
end if
if(r == 8)then
	s = 7
end if
end subroutine

subroutine reverse_sort(m,a)
    implicit none
    integer, intent(in)    :: m
    integer, intent(inout) :: a(m)
    integer                :: i, j
    do i = m-1, 1, -1
      do j = 1, i
        if (a(j) .lt. a(j+1)) call swap(a(j),a(j+1))
      end do
    end do
    return
end subroutine reverse_sort
 
subroutine swap(a,b)
    implicit none
    integer, intent(inout) :: a, b
    integer                :: c
    c = a
    a = b
	b = c
	return
end subroutine swap

end program atcoder

; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QFEa.0 = internal unnamed_addr global ptr null
@_QFEans = internal global [16384 x i8] undef
@_QFEb.0 = internal unnamed_addr global ptr null
@_QFEdp.0 = internal unnamed_addr global ptr null
@_QFEdp.7 = internal unnamed_addr global i64 1
@_QFEdp.8 = internal unnamed_addr global i64 0
@_QQcl.9a251b7825fbe3655348f119780345fc = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_4952/source.f\00"
@_QQcl.16373402fa3425c6e46827601abb88fa = linkonce constant [76 x i8] c"array left hand side must be allocated when the right hand side is a scalar\00"
@_QQcl.286129 = linkonce constant [3 x i8] c"(a)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8 }, align 8
  %2 = alloca { ptr, i64, i32, i8, i8, i8, i8 }, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.9a251b7825fbe3655348f119780345fc, i32 7)
  %6 = call i1 @_FortranAioInputInteger(ptr %5, ptr nonnull %4, i32 4)
  %7 = call i1 @_FortranAioInputInteger(ptr %5, ptr nonnull %3, i32 4)
  %8 = call i32 @_FortranAioEndIoStatement(ptr %5)
  %9 = load i32, ptr %3, align 4, !tbaa !3
  %10 = call i32 @llvm.smax.i32(i32 %9, i32 0)
  %11 = zext i32 %10 to i64
  %12 = shl nuw nsw i64 %11, 2
  %13 = call ptr @malloc(i64 %12)
  store ptr %13, ptr @_QFEa.0, align 8, !tbaa !7
  %14 = call ptr @malloc(i64 %12)
  store ptr %14, ptr @_QFEb.0, align 8, !tbaa !7
  %15 = load i32, ptr %4, align 4, !tbaa !3
  %16 = call i32 @llvm.smax.i32(i32 %15, i32 -1)
  %17 = sext i32 %16 to i64
  %18 = add nsw i64 %17, 1
  %19 = shl nuw nsw i64 %18, 2
  %20 = call ptr @malloc(i64 %19)
  %21 = icmp eq i64 %18, 0
  %22 = zext i1 %21 to i64
  store ptr %20, ptr @_QFEdp.0, align 8, !tbaa !7
  store i64 %22, ptr @_QFEdp.7, align 8, !tbaa !7
  store i64 %18, ptr @_QFEdp.8, align 8, !tbaa !7
  %23 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.9a251b7825fbe3655348f119780345fc, i32 9)
  %24 = load i32, ptr %3, align 4, !tbaa !3
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %26 = zext i32 %24 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %27 = phi i64 [ %32, %.lr.ph ], [ 1, %.lr.ph.preheader ]
  %.unpack1183 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %sext = shl i64 %27, 32
  %28 = ashr exact i64 %sext, 32
  %29 = add nsw i64 %28, -1
  %30 = getelementptr i32, ptr %.unpack1183, i64 %29
  %31 = call i1 @_FortranAioInputInteger(ptr %23, ptr %30, i32 4)
  %32 = add nuw nsw i64 %27, 1
  %exitcond.not = icmp eq i64 %27, %26
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %33 = call i32 @_FortranAioEndIoStatement(ptr %23)
  %.unpack = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %34 = load i32, ptr %3, align 4, !tbaa !3
  %35 = add i32 %34, -1
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.lr.ph7.preheader.i, label %_QFPreverse_sort.exit

.lr.ph7.preheader.i:                              ; preds = %._crit_edge
  %37 = zext i32 %35 to i64
  br label %.lr.ph7.i

.lr.ph7.i:                                        ; preds = %._crit_edge.i, %.lr.ph7.preheader.i
  %38 = phi i64 [ %54, %._crit_edge.i ], [ %37, %.lr.ph7.preheader.i ]
  %indvars10.i = trunc i64 %38 to i32
  %39 = icmp sgt i32 %indvars10.i, 0
  br i1 %39, label %.lr.ph.preheader.i, label %._crit_edge.i

.lr.ph.preheader.i:                               ; preds = %.lr.ph7.i
  %sext.i = shl i64 %38, 32
  %40 = ashr exact i64 %sext.i, 32
  br label %.lr.ph.i

.lr.ph.i:                                         ; preds = %51, %.lr.ph.preheader.i
  %indvars.iv.i = phi i64 [ 1, %.lr.ph.preheader.i ], [ %indvars.iv.next.i, %51 ]
  %41 = phi i64 [ %40, %.lr.ph.preheader.i ], [ %52, %51 ]
  %42 = add nsw i64 %indvars.iv.i, -1
  %43 = getelementptr i32, ptr %.unpack, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !3
  %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
  %sext11.i = shl i64 %indvars.iv.next.i, 32
  %45 = ashr exact i64 %sext11.i, 32
  %46 = add nsw i64 %45, -1
  %47 = getelementptr i32, ptr %.unpack, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !3
  %49 = icmp slt i32 %44, %48
  br i1 %49, label %50, label %51

50:                                               ; preds = %.lr.ph.i
  store i32 %48, ptr %43, align 4, !tbaa !3
  store i32 %44, ptr %47, align 4, !tbaa !3
  br label %51

51:                                               ; preds = %50, %.lr.ph.i
  %52 = add nsw i64 %41, -1
  %53 = icmp sgt i64 %41, 1
  br i1 %53, label %.lr.ph.i, label %._crit_edge.i

._crit_edge.i:                                    ; preds = %51, %.lr.ph7.i
  %54 = add nsw i64 %38, -1
  %55 = icmp sgt i64 %38, 1
  br i1 %55, label %.lr.ph7.i, label %_QFPreverse_sort.exit.loopexit

_QFPreverse_sort.exit.loopexit:                   ; preds = %._crit_edge.i
  %.pre = load i32, ptr %3, align 4, !tbaa !3
  br label %_QFPreverse_sort.exit

_QFPreverse_sort.exit:                            ; preds = %_QFPreverse_sort.exit.loopexit, %._crit_edge
  %56 = phi i32 [ %.pre, %_QFPreverse_sort.exit.loopexit ], [ %34, %._crit_edge ]
  %57 = icmp sgt i32 %56, 0
  br i1 %57, label %.lr.ph1201, label %._crit_edge1202

.lr.ph1201:                                       ; preds = %_QFPreverse_sort.exit
  %58 = zext i32 %56 to i64
  %.unpack1171 = load ptr, ptr @_QFEb.0, align 8, !tbaa !7
  br label %59

59:                                               ; preds = %.lr.ph1201, %_QFPnum.exit
  %indvars.iv = phi i64 [ 1, %.lr.ph1201 ], [ %indvars.iv.next, %_QFPnum.exit ]
  %60 = add nsw i64 %indvars.iv, -1
  %61 = getelementptr i32, ptr %.unpack, i64 %60
  %62 = add nsw i64 %indvars.iv, -1
  %63 = getelementptr i32, ptr %.unpack1171, i64 %62
  %64 = load i32, ptr %61, align 4, !tbaa !3
  %65 = icmp eq i32 %64, 1
  br i1 %65, label %66, label %67

66:                                               ; preds = %59
  store i32 2, ptr %63, align 4, !tbaa !3
  %.pr.i = load i32, ptr %61, align 4, !tbaa !3
  br label %67

67:                                               ; preds = %66, %59
  %68 = phi i32 [ %.pr.i, %66 ], [ %64, %59 ]
  switch i32 %68, label %70 [
    i32 5, label %69
    i32 3, label %69
    i32 2, label %69
  ]

69:                                               ; preds = %67, %67, %67
  store i32 5, ptr %63, align 4, !tbaa !3
  %.pre.i = load i32, ptr %61, align 4, !tbaa !3
  br label %70

70:                                               ; preds = %69, %67
  %71 = phi i32 [ %68, %67 ], [ %.pre.i, %69 ]
  %72 = icmp eq i32 %71, 4
  br i1 %72, label %73, label %74

73:                                               ; preds = %70
  store i32 4, ptr %63, align 4, !tbaa !3
  %.pr1.i = load i32, ptr %61, align 4, !tbaa !3
  br label %74

74:                                               ; preds = %73, %70
  %75 = phi i32 [ %.pr1.i, %73 ], [ %71, %70 ]
  switch i32 %75, label %77 [
    i32 9, label %76
    i32 6, label %76
  ]

76:                                               ; preds = %74, %74
  store i32 6, ptr %63, align 4, !tbaa !3
  %.pre3.i = load i32, ptr %61, align 4, !tbaa !3
  br label %77

77:                                               ; preds = %76, %74
  %78 = phi i32 [ %75, %74 ], [ %.pre3.i, %76 ]
  %79 = icmp eq i32 %78, 7
  br i1 %79, label %80, label %81

80:                                               ; preds = %77
  store i32 3, ptr %63, align 4, !tbaa !3
  %.pr2.i = load i32, ptr %61, align 4, !tbaa !3
  br label %81

81:                                               ; preds = %80, %77
  %82 = phi i32 [ %.pr2.i, %80 ], [ %78, %77 ]
  %83 = icmp eq i32 %82, 8
  br i1 %83, label %84, label %_QFPnum.exit

84:                                               ; preds = %81
  store i32 7, ptr %63, align 4, !tbaa !3
  br label %_QFPnum.exit

_QFPnum.exit:                                     ; preds = %81, %84
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond1225.not = icmp eq i64 %indvars.iv, %58
  br i1 %exitcond1225.not, label %._crit_edge1202, label %59

._crit_edge1202:                                  ; preds = %_QFPnum.exit, %_QFPreverse_sort.exit
  %.unpack994 = load ptr, ptr @_QFEdp.0, align 8, !tbaa !7
  %.unpack1001.unpack.unpack1003 = load i64, ptr @_QFEdp.8, align 8, !tbaa !7
  %.not = icmp eq ptr %.unpack994, null
  br i1 %.not, label %87, label %.preheader1197

.preheader1197:                                   ; preds = %._crit_edge1202
  %85 = icmp sgt i64 %.unpack1001.unpack.unpack1003, 0
  br i1 %85, label %.lr.ph1203.preheader, label %.loopexit1198

.lr.ph1203.preheader:                             ; preds = %.preheader1197
  %86 = shl nuw i64 %.unpack1001.unpack.unpack1003, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %.unpack994, i8 -1, i64 %86, i1 false), !tbaa !3
  br label %.loopexit1198

87:                                               ; preds = %._crit_edge1202
  %88 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.9a251b7825fbe3655348f119780345fc, i32 17)
  %.unpack1145.unpack.unpack = load i64, ptr @_QFEdp.7, align 8, !tbaa !7
  %89 = icmp eq i64 %.unpack1001.unpack.unpack1003, 0
  %90 = select i1 %89, i64 1, i64 %.unpack1145.unpack.unpack
  store ptr null, ptr @_QFEdp.0, align 8, !tbaa !7
  store i64 %90, ptr @_QFEdp.7, align 8, !tbaa !7
  br label %.loopexit1198

.loopexit1198:                                    ; preds = %.lr.ph1203.preheader, %.preheader1197, %87
  %.unpack1013.unpack.unpack = load i64, ptr @_QFEdp.7, align 8, !tbaa !7
  %91 = sub i64 0, %.unpack1013.unpack.unpack
  %92 = getelementptr i32, ptr %.unpack994, i64 %91
  store i32 0, ptr %92, align 4, !tbaa !3
  %93 = load i32, ptr %4, align 4, !tbaa !3
  %94 = icmp sgt i32 %93, 0
  br i1 %94, label %.lr.ph1208, label %.preheader

.lr.ph1208:                                       ; preds = %.loopexit1198
  %95 = zext i32 %93 to i64
  %.unpack1114 = load ptr, ptr @_QFEb.0, align 8
  br label %105

.preheader.loopexit:                              ; preds = %._crit_edge1206
  %.pre1237 = load i32, ptr %4, align 4, !tbaa !3
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %.loopexit1198
  %96 = phi i32 [ %.pre1237, %.preheader.loopexit ], [ %93, %.loopexit1198 ]
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16384) @_QFEans, i8 32, i64 16384, i1 false), !tbaa !3
  %97 = icmp sgt i64 %.unpack1001.unpack.unpack1003, 0
  br i1 %97, label %.lr.ph.i1195.preheader, label %_FortranAMaxvalInteger4x1_contract_simplified.exit.._crit_edge1218_crit_edge

.lr.ph.i1195.preheader:                           ; preds = %.preheader
  %min.iters.check = icmp ult i64 %.unpack1001.unpack.unpack1003, 8
  br i1 %min.iters.check, label %.lr.ph.i1195.preheader1255, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.i1195.preheader
  %n.vec = and i64 %.unpack1001.unpack.unpack1003, -8
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, %vector.ph ], [ %101, %vector.body ]
  %vec.phi1250 = phi <4 x i32> [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, %vector.ph ], [ %102, %vector.body ]
  %98 = shl i64 %index, 2
  %99 = getelementptr i8, ptr %.unpack994, i64 %98
  %wide.load = load <4 x i32>, ptr %99, align 4, !tbaa !3
  %100 = getelementptr i32, ptr %99, i64 4
  %wide.load1251 = load <4 x i32>, ptr %100, align 4, !tbaa !3
  %101 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load, <4 x i32> %vec.phi)
  %102 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load1251, <4 x i32> %vec.phi1250)
  %index.next = add nuw i64 %index, 8
  %103 = icmp eq i64 %index.next, %n.vec
  br i1 %103, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %rdx.minmax.select = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %101, <4 x i32> %102)
  %104 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax.select)
  %cmp.n = icmp eq i64 %.unpack1001.unpack.unpack1003, %n.vec
  br i1 %cmp.n, label %_FortranAMaxvalInteger4x1_contract_simplified.exit, label %.lr.ph.i1195.preheader1255

.lr.ph.i1195.preheader1255:                       ; preds = %.lr.ph.i1195.preheader, %middle.block
  %.ph = phi i32 [ -2147483648, %.lr.ph.i1195.preheader ], [ %104, %middle.block ]
  %.ph1256 = phi i64 [ 0, %.lr.ph.i1195.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph.i1195

105:                                              ; preds = %.lr.ph1208, %._crit_edge1206
  %indvars.iv1230 = phi i64 [ 1, %.lr.ph1208 ], [ %indvars.iv.next1231, %._crit_edge1206 ]
  %106 = load i32, ptr %3, align 4, !tbaa !3
  %107 = icmp sgt i32 %106, 0
  br i1 %107, label %.lr.ph1205, label %._crit_edge1206

.lr.ph1205:                                       ; preds = %105
  %108 = zext i32 %106 to i64
  %109 = sub i64 %indvars.iv1230, %.unpack1013.unpack.unpack
  %110 = getelementptr i32, ptr %.unpack994, i64 %109
  %111 = trunc i64 %indvars.iv1230 to i32
  br label %112

112:                                              ; preds = %.lr.ph1205, %_QFPchmax.exit
  %indvars.iv1226 = phi i64 [ 1, %.lr.ph1205 ], [ %indvars.iv.next1227, %_QFPchmax.exit ]
  %113 = add nsw i64 %indvars.iv1226, -1
  %114 = getelementptr i32, ptr %.unpack1114, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !3
  %116 = sub i32 %111, %115
  %117 = icmp sgt i32 %116, -1
  br i1 %117, label %118, label %_QFPchmax.exit

118:                                              ; preds = %112
  %119 = zext i32 %116 to i64
  %120 = sub i64 %119, %.unpack1013.unpack.unpack
  %121 = getelementptr i32, ptr %.unpack994, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !3
  %123 = add i32 %122, 1
  %124 = load i32, ptr %110, align 4, !tbaa !3
  %125 = icmp slt i32 %124, %123
  br i1 %125, label %126, label %_QFPchmax.exit

126:                                              ; preds = %118
  store i32 %123, ptr %110, align 4, !tbaa !3
  br label %_QFPchmax.exit

_QFPchmax.exit:                                   ; preds = %126, %118, %112
  %indvars.iv.next1227 = add nuw nsw i64 %indvars.iv1226, 1
  %exitcond1229.not = icmp eq i64 %indvars.iv1226, %108
  br i1 %exitcond1229.not, label %._crit_edge1206, label %112

._crit_edge1206:                                  ; preds = %_QFPchmax.exit, %105
  %indvars.iv.next1231 = add nuw nsw i64 %indvars.iv1230, 1
  %exitcond1233.not = icmp eq i64 %indvars.iv1230, %95
  br i1 %exitcond1233.not, label %.preheader.loopexit, label %105

.lr.ph.i1195:                                     ; preds = %.lr.ph.i1195.preheader1255, %.lr.ph.i1195
  %127 = phi i32 [ %132, %.lr.ph.i1195 ], [ %.ph, %.lr.ph.i1195.preheader1255 ]
  %128 = phi i64 [ %133, %.lr.ph.i1195 ], [ %.ph1256, %.lr.ph.i1195.preheader1255 ]
  %129 = shl i64 %128, 2
  %130 = getelementptr i8, ptr %.unpack994, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !3
  %132 = call i32 @llvm.smax.i32(i32 %131, i32 %127)
  %133 = add nuw nsw i64 %128, 1
  %exitcond.not.i = icmp eq i64 %133, %.unpack1001.unpack.unpack1003
  br i1 %exitcond.not.i, label %_FortranAMaxvalInteger4x1_contract_simplified.exit, label %.lr.ph.i1195, !llvm.loop !12

_FortranAMaxvalInteger4x1_contract_simplified.exit: ; preds = %.lr.ph.i1195, %middle.block
  %.lcssa1249 = phi i32 [ %104, %middle.block ], [ %132, %.lr.ph.i1195 ]
  %134 = icmp sgt i32 %.lcssa1249, 0
  br i1 %134, label %.lr.ph1217, label %_FortranAMaxvalInteger4x1_contract_simplified.exit.._crit_edge1218_crit_edge

_FortranAMaxvalInteger4x1_contract_simplified.exit.._crit_edge1218_crit_edge: ; preds = %.preheader, %_FortranAMaxvalInteger4x1_contract_simplified.exit
  %.unpack1030.pre = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack1042.pre = load ptr, ptr @_QFEb.0, align 8, !tbaa !7
  br label %._crit_edge1218

.lr.ph1217:                                       ; preds = %_FortranAMaxvalInteger4x1_contract_simplified.exit
  %135 = load i32, ptr %3, align 4, !tbaa !3
  %136 = icmp sgt i32 %135, 0
  %.unpack1078 = load ptr, ptr @_QFEb.0, align 8
  %.unpack1090 = load ptr, ptr @_QFEa.0, align 8
  br i1 %136, label %.lr.ph1213.us, label %._crit_edge1218

.lr.ph1213.us:                                    ; preds = %.lr.ph1217, %..loopexit_crit_edge.us
  %.01216.us = phi i32 [ %.1.us, %..loopexit_crit_edge.us ], [ %96, %.lr.ph1217 ]
  %.09441215.us = phi i32 [ %169, %..loopexit_crit_edge.us ], [ 1, %.lr.ph1217 ]
  %137 = sext i32 %.01216.us to i64
  %138 = sub i64 %137, %.unpack1013.unpack.unpack
  %139 = getelementptr i32, ptr %.unpack994, i64 %138
  %140 = load i32, ptr %139, align 4, !tbaa !3
  %141 = add i32 %140, -1
  br label %142

142:                                              ; preds = %.lr.ph1213.us, %155
  %.09451211.us = phi i32 [ 1, %.lr.ph1213.us ], [ %156, %155 ]
  %143 = sext i32 %.09451211.us to i64
  %144 = add nsw i64 %143, -1
  %145 = getelementptr i32, ptr %.unpack1078, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !3
  %147 = sub i32 %.01216.us, %146
  %148 = sext i32 %147 to i64
  %149 = sub i64 %148, %.unpack1013.unpack.unpack
  %150 = getelementptr i32, ptr %.unpack994, i64 %149
  %151 = load i32, ptr %150, align 4, !tbaa !3
  %152 = icmp eq i32 %141, %151
  %153 = icmp sgt i32 %147, -1
  %154 = and i1 %152, %153
  br i1 %154, label %157, label %155

155:                                              ; preds = %142
  %156 = add nuw i32 %.09451211.us, 1
  %exitcond1234.not = icmp eq i32 %.09451211.us, %135
  br i1 %exitcond1234.not, label %..loopexit_crit_edge.us, label %142

157:                                              ; preds = %142
  %158 = getelementptr i32, ptr %.unpack1078, i64 %144
  %159 = add nsw i64 %143, -1
  %160 = getelementptr i32, ptr %.unpack1090, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !3
  %162 = trunc i32 %161 to i8
  %163 = add i8 %162, 48
  %164 = sext i32 %.09441215.us to i64
  %165 = add nsw i64 %164, -1
  %166 = getelementptr [16384 x [1 x i8]], ptr @_QFEans, i64 0, i64 %165
  store i8 %163, ptr %166, align 1
  %167 = load i32, ptr %158, align 4, !tbaa !3
  %168 = sub i32 %.01216.us, %167
  br label %..loopexit_crit_edge.us

..loopexit_crit_edge.us:                          ; preds = %155, %157
  %.1.us = phi i32 [ %168, %157 ], [ %.01216.us, %155 ]
  %169 = add nuw i32 %.09441215.us, 1
  %exitcond1235.not = icmp eq i32 %.09441215.us, %.lcssa1249
  br i1 %exitcond1235.not, label %._crit_edge1218, label %.lr.ph1213.us

._crit_edge1218:                                  ; preds = %..loopexit_crit_edge.us, %.lr.ph1217, %_FortranAMaxvalInteger4x1_contract_simplified.exit.._crit_edge1218_crit_edge
  %.unpack1042 = phi ptr [ %.unpack1042.pre, %_FortranAMaxvalInteger4x1_contract_simplified.exit.._crit_edge1218_crit_edge ], [ %.unpack1078, %.lr.ph1217 ], [ %.unpack1078, %..loopexit_crit_edge.us ]
  %.unpack1030 = phi ptr [ %.unpack1030.pre, %_FortranAMaxvalInteger4x1_contract_simplified.exit.._crit_edge1218_crit_edge ], [ %.unpack1090, %.lr.ph1217 ], [ %.unpack1090, %..loopexit_crit_edge.us ]
  call void @free(ptr %.unpack1030)
  store ptr null, ptr @_QFEa.0, align 8, !tbaa !7
  call void @free(ptr %.unpack1042)
  store ptr null, ptr @_QFEb.0, align 8, !tbaa !7
  call void @free(ptr %.unpack994)
  store ptr null, ptr @_QFEdp.0, align 8, !tbaa !7
  store i64 1, ptr @_QFEdp.7, align 8, !tbaa !7
  store i64 0, ptr @_QFEdp.8, align 8, !tbaa !7
  %170 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.286129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.9a251b7825fbe3655348f119780345fc, i32 42)
  store ptr @_QFEans, ptr %1, align 8, !tbaa !7
  %.fca.1.gep510 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 1
  store i64 16384, ptr %.fca.1.gep510, align 8, !tbaa !7
  %.fca.2.gep511 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep511, align 8, !tbaa !7
  %.fca.3.gep512 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 3
  store i8 0, ptr %.fca.3.gep512, align 4, !tbaa !7
  %.fca.4.gep513 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 4
  store i8 40, ptr %.fca.4.gep513, align 1, !tbaa !7
  %.fca.5.gep514 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep514, align 2, !tbaa !7
  %.fca.6.gep515 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep515, align 1, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 1
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 2
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %2, i8 0, i64 16, i1 false)
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !7
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 3
  store i8 0, ptr %.fca.3.gep, align 4, !tbaa !7
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 4
  store i8 40, ptr %.fca.4.gep, align 1, !tbaa !7
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 5
  store i8 2, ptr %.fca.5.gep, align 2, !tbaa !7
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !7
  %171 = call {} @_FortranATrim(ptr nonnull %2, ptr nonnull %1, ptr nonnull @_QQcl.9a251b7825fbe3655348f119780345fc, i32 42)
  %.fca.0.load = load ptr, ptr %2, align 8, !tbaa !7
  %.fca.1.load = load i64, ptr %.fca.1.gep, align 8, !tbaa !7
  %172 = call i1 @_FortranAioOutputAscii(ptr %170, ptr %.fca.0.load, i64 %.fca.1.load)
  call void @free(ptr %.fca.0.load)
  %173 = call i32 @_FortranAioEndIoStatement(ptr %170)
  ret void
}

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
define void @_QFPchmax(ptr nocapture %0, ptr nocapture readonly %1) local_unnamed_addr #2 {
  %3 = load i32, ptr %0, align 4, !tbaa !3
  %4 = load i32, ptr %1, align 4, !tbaa !3
  %5 = icmp slt i32 %3, %4
  br i1 %5, label %6, label %7

6:                                                ; preds = %2
  store i32 %4, ptr %0, align 4, !tbaa !3
  br label %7

7:                                                ; preds = %6, %2
  ret void
}

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
define void @_QFPnum(ptr nocapture readonly %0, ptr nocapture writeonly %1) local_unnamed_addr #2 {
  %3 = load i32, ptr %0, align 4, !tbaa !3
  %4 = icmp eq i32 %3, 1
  br i1 %4, label %5, label %6

5:                                                ; preds = %2
  store i32 2, ptr %1, align 4, !tbaa !3
  %.pr = load i32, ptr %0, align 4, !tbaa !3
  br label %6

6:                                                ; preds = %5, %2
  %7 = phi i32 [ %.pr, %5 ], [ %3, %2 ]
  switch i32 %7, label %9 [
    i32 5, label %8
    i32 3, label %8
    i32 2, label %8
  ]

8:                                                ; preds = %6, %6, %6
  store i32 5, ptr %1, align 4, !tbaa !3
  %.pre = load i32, ptr %0, align 4, !tbaa !3
  br label %9

9:                                                ; preds = %6, %8
  %10 = phi i32 [ %7, %6 ], [ %.pre, %8 ]
  %11 = icmp eq i32 %10, 4
  br i1 %11, label %12, label %13

12:                                               ; preds = %9
  store i32 4, ptr %1, align 4, !tbaa !3
  %.pr1 = load i32, ptr %0, align 4, !tbaa !3
  br label %13

13:                                               ; preds = %12, %9
  %14 = phi i32 [ %.pr1, %12 ], [ %10, %9 ]
  switch i32 %14, label %16 [
    i32 9, label %15
    i32 6, label %15
  ]

15:                                               ; preds = %13, %13
  store i32 6, ptr %1, align 4, !tbaa !3
  %.pre3 = load i32, ptr %0, align 4, !tbaa !3
  br label %16

16:                                               ; preds = %13, %15
  %17 = phi i32 [ %14, %13 ], [ %.pre3, %15 ]
  %18 = icmp eq i32 %17, 7
  br i1 %18, label %19, label %20

19:                                               ; preds = %16
  store i32 3, ptr %1, align 4, !tbaa !3
  %.pr2 = load i32, ptr %0, align 4, !tbaa !3
  br label %20

20:                                               ; preds = %19, %16
  %21 = phi i32 [ %.pr2, %19 ], [ %17, %16 ]
  %22 = icmp eq i32 %21, 8
  br i1 %22, label %23, label %24

23:                                               ; preds = %20
  store i32 7, ptr %1, align 4, !tbaa !3
  br label %24

24:                                               ; preds = %23, %20
  ret void
}

; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite)
define void @_QFPreverse_sort(ptr nocapture readonly %0, ptr nocapture %1) local_unnamed_addr #3 {
  %3 = load i32, ptr %0, align 4, !tbaa !3
  %4 = add i32 %3, -1
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph7.preheader, label %._crit_edge8

.lr.ph7.preheader:                                ; preds = %2
  %6 = zext i32 %4 to i64
  br label %.lr.ph7

.lr.ph7:                                          ; preds = %.lr.ph7.preheader, %._crit_edge
  %7 = phi i64 [ %23, %._crit_edge ], [ %6, %.lr.ph7.preheader ]
  %indvars10 = trunc i64 %7 to i32
  %8 = icmp sgt i32 %indvars10, 0
  br i1 %8, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.lr.ph7
  %sext = shl i64 %7, 32
  %9 = ashr exact i64 %sext, 32
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %20
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %20 ]
  %10 = phi i64 [ %9, %.lr.ph.preheader ], [ %21, %20 ]
  %11 = add nsw i64 %indvars.iv, -1
  %12 = getelementptr i32, ptr %1, i64 %11
  %13 = load i32, ptr %12, align 4, !tbaa !3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %sext11 = shl i64 %indvars.iv.next, 32
  %14 = ashr exact i64 %sext11, 32
  %15 = add nsw i64 %14, -1
  %16 = getelementptr i32, ptr %1, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !3
  %18 = icmp slt i32 %13, %17
  br i1 %18, label %19, label %20

19:                                               ; preds = %.lr.ph
  store i32 %17, ptr %12, align 4, !tbaa !3
  store i32 %13, ptr %16, align 4, !tbaa !3
  br label %20

20:                                               ; preds = %19, %.lr.ph
  %21 = add nsw i64 %10, -1
  %22 = icmp sgt i64 %10, 1
  br i1 %22, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %20, %.lr.ph7
  %23 = add nsw i64 %7, -1
  %24 = icmp sgt i64 %7, 1
  br i1 %24, label %.lr.ph7, label %._crit_edge8

._crit_edge8:                                     ; preds = %._crit_edge, %2
  ret void
}

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
define void @_QFPswap(ptr nocapture %0, ptr nocapture %1) local_unnamed_addr #2 {
  %3 = load i32, ptr %0, align 4, !tbaa !3
  %4 = load i32, ptr %1, align 4, !tbaa !3
  store i32 %4, ptr %0, align 4, !tbaa !3
  store i32 %3, ptr %1, align 4, !tbaa !3
  ret void
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare {} @_FortranAReportFatalUserError(ptr, ptr, i32) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

declare {} @_FortranATrim(ptr, ptr, ptr, i32) local_unnamed_addr

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #6

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #7

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nosync nounwind willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !11, !10}
