program both_sides_merger
  implicit none
  integer :: n, i, j, k, x, w(1000)
  integer(8) :: a(1000), odd, evn, m
  w = 0
  a = 0_8
  odd = 0_8
  evn = 0_8
  read(*,*) n
  read(*,*) a(1:n)
  do i = 1, n
    if (a(i).gt.0_8) then
      if (mod(i,2).eq.1) then
        odd = odd+a(i)
      else
        evn = evn+a(i)
      end if
    end if
  end do
  if (odd.eq.0_8.and.evn.eq.0_8) then
    j = maxloc(a(1:n),1)
    write(*,'(i0)') a(j)
    write(*,'(i0)') n-1
    do i = n, j+1, -1
      write(*,'(i0)') i
    end do
    do i = 1, j-1
      write(*,'(i0)') 1
    end do
    stop
  end if
  write(*,'(i0)') max(odd,evn)
  k = n
  x = 0
  if (evn.gt.odd) then
    a(1:k-1) = a(2:k)
    k = k-1
    x = x+1
    w(x) = 1
  end if
  do while (k.gt.1)
    if (k.eq.2) then
      k = k-1
      x = x+1
      w(x) = 2
      cycle
    end if
    if (a(1).lt.0_8) then
      a(1:k-2) = a(3:k)
      k = k-2
      x = x+2
      w(x-1:x) = 1
      cycle
    end if
    if (a(3).ge.0_8) then
      a(3) = a(1)+a(3)
      a(1:k-2) = a(3:k)
      k = k-2
      x = x+1
      w(x) = 2
      cycle
    end if
    if (k.eq.3) then
      k = k-1
      x = x+1
      w(x) = 3
      cycle
    end if
    a(4) = a(2)+a(4)
    a(2:k-2) = a(4:k)
    k = k-2
    x = x+1
    w(x) = 3
  end do
  write(*,'(i0)') x
  do i = 1, x
    write(*,'(i0)') w(i)
  end do
  stop
end program both_sides_merger
; 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 = internal global [1000 x i64] undef
@_QFEw = internal unnamed_addr global [1000 x i32] undef
@_QQcl.f3e353636d374e01daf08a75b9578a18 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6172/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_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

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #2 {
.preheader155.preheader:
  %0 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca { ptr, i64, i32, i8, i8, i8, i8 }, align 8
  %3 = alloca i32, align 4
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000) @_QFEw, i8 0, i64 4000, i1 false), !tbaa !3
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8000) @_QFEa, i8 0, i64 8000, i1 false), !tbaa !3
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.f3e353636d374e01daf08a75b9578a18, i32 9)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 4)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %7 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.f3e353636d374e01daf08a75b9578a18, i32 10)
  %8 = load i32, ptr %3, align 4, !tbaa !3
  %9 = call i32 @llvm.smax.i32(i32 %8, i32 0)
  %10 = zext i32 %9 to i64
  store ptr @_QFEa, ptr %1, align 8, !tbaa !7
  %.fca.1.gep58 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 8, ptr %.fca.1.gep58, align 8, !tbaa !7
  %.fca.2.gep60 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep60, align 8, !tbaa !7
  %.fca.3.gep62 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep62, align 4, !tbaa !7
  %.fca.4.gep64 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 10, ptr %.fca.4.gep64, align 1, !tbaa !7
  %.fca.5.gep66 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep66, align 2, !tbaa !7
  %.fca.6.gep68 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep68, align 1, !tbaa !7
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !7
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  store i64 %10, ptr %.fca.7.0.1.gep, align 8, !tbaa !7
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  store i64 8, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %11 = call i1 @_FortranAioInputDescriptor(ptr %7, ptr nonnull %1)
  %12 = call i32 @_FortranAioEndIoStatement(ptr %7)
  %13 = load i32, ptr %3, align 4, !tbaa !3
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.preheader155.preheader
  %15 = zext i32 %13 to i64
  %xtraiter = and i64 %15, 1
  %16 = icmp eq i32 %13, 1
  br i1 %16, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %15, 4294967294
  br label %.lr.ph

.lr.ph:                                           ; preds = %38, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader.new ], [ %indvars.iv.next.1, %38 ]
  %.0121157 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %.1.1, %38 ]
  %.0123156 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %.1124.1, %38 ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %38 ]
  %17 = add nsw i64 %indvars.iv, -1
  %18 = getelementptr [1000 x i64], ptr @_QFEa, i64 0, i64 %17
  %19 = load i64, ptr %18, align 8, !tbaa !3
  %20 = icmp sgt i64 %19, 0
  br i1 %20, label %21, label %.lr.ph.1

21:                                               ; preds = %.lr.ph
  %22 = and i64 %indvars.iv, 2147483649
  %23 = icmp eq i64 %22, 1
  br i1 %23, label %24, label %26

24:                                               ; preds = %21
  %25 = add i64 %19, %.0121157
  br label %.lr.ph.1

26:                                               ; preds = %21
  %27 = add i64 %19, %.0123156
  br label %.lr.ph.1

.lr.ph.1:                                         ; preds = %24, %26, %.lr.ph
  %.1124 = phi i64 [ %.0123156, %24 ], [ %27, %26 ], [ %.0123156, %.lr.ph ]
  %.1 = phi i64 [ %25, %24 ], [ %.0121157, %26 ], [ %.0121157, %.lr.ph ]
  %28 = getelementptr [1000 x i64], ptr @_QFEa, i64 0, i64 %indvars.iv
  %29 = load i64, ptr %28, align 8, !tbaa !3
  %30 = icmp sgt i64 %29, 0
  br i1 %30, label %31, label %38

31:                                               ; preds = %.lr.ph.1
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %32 = and i64 %indvars.iv.next, 2147483649
  %33 = icmp eq i64 %32, 1
  br i1 %33, label %36, label %34

34:                                               ; preds = %31
  %35 = add i64 %29, %.1124
  br label %38

36:                                               ; preds = %31
  %37 = add i64 %29, %.1
  br label %38

38:                                               ; preds = %36, %34, %.lr.ph.1
  %.1124.1 = phi i64 [ %.1124, %36 ], [ %35, %34 ], [ %.1124, %.lr.ph.1 ]
  %.1.1 = phi i64 [ %37, %36 ], [ %.1, %34 ], [ %.1, %.lr.ph.1 ]
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph

._crit_edge.loopexit.unr-lcssa:                   ; preds = %38, %.lr.ph.preheader
  %.1124.lcssa.ph = phi i64 [ undef, %.lr.ph.preheader ], [ %.1124.1, %38 ]
  %.1.lcssa.ph = phi i64 [ undef, %.lr.ph.preheader ], [ %.1.1, %38 ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next.1, %38 ]
  %.0121157.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %.1.1, %38 ]
  %.0123156.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %.1124.1, %38 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa
  %39 = add nsw i64 %indvars.iv.unr, -1
  %40 = getelementptr [1000 x i64], ptr @_QFEa, i64 0, i64 %39
  %41 = load i64, ptr %40, align 8, !tbaa !3
  %42 = icmp sgt i64 %41, 0
  br i1 %42, label %43, label %._crit_edge

43:                                               ; preds = %.lr.ph.epil
  %44 = and i64 %indvars.iv.unr, 2147483649
  %45 = icmp eq i64 %44, 1
  br i1 %45, label %48, label %46

46:                                               ; preds = %43
  %47 = add i64 %41, %.0123156.unr
  br label %._crit_edge

48:                                               ; preds = %43
  %49 = add i64 %41, %.0121157.unr
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %48, %46, %.lr.ph.epil, %.preheader155.preheader
  %.0123.lcssa = phi i64 [ 0, %.preheader155.preheader ], [ %.1124.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %.0123156.unr, %48 ], [ %47, %46 ], [ %.0123156.unr, %.lr.ph.epil ]
  %.0121.lcssa = phi i64 [ 0, %.preheader155.preheader ], [ %.1.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %49, %48 ], [ %.0121157.unr, %46 ], [ %.0121157.unr, %.lr.ph.epil ]
  %50 = or i64 %.0121.lcssa, %.0123.lcssa
  %51 = icmp eq i64 %50, 0
  br i1 %51, label %52, label %95

52:                                               ; preds = %._crit_edge
  %53 = call i32 @llvm.smax.i32(i32 %13, i32 0)
  %54 = zext i32 %53 to i64
  store ptr @_QFEa, ptr %0, align 8, !tbaa !7
  %.fca.1.gep72 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 1
  store i64 8, ptr %.fca.1.gep72, align 8, !tbaa !7
  %.fca.2.gep74 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep74, align 8, !tbaa !7
  %.fca.3.gep76 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep76, align 4, !tbaa !7
  %.fca.4.gep78 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 4
  store i8 10, ptr %.fca.4.gep78, align 1, !tbaa !7
  %.fca.5.gep80 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep80, align 2, !tbaa !7
  %.fca.6.gep82 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep82, align 1, !tbaa !7
  %.fca.7.0.0.gep84 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep84, align 8, !tbaa !7
  %.fca.7.0.1.gep86 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 7, i64 0, i64 1
  store i64 %54, ptr %.fca.7.0.1.gep86, align 8, !tbaa !7
  %.fca.7.0.2.gep88 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i64 0, i32 7, i64 0, i64 2
  store i64 8, ptr %.fca.7.0.2.gep88, align 8, !tbaa !7
  store ptr null, ptr %2, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 1
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !7
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 2
  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 9, 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
  %55 = call {} @_FortranAMaxlocDim(ptr nonnull %2, ptr nonnull %0, i32 4, i32 1, ptr nonnull @_QQcl.f3e353636d374e01daf08a75b9578a18, i32 21, ptr null, i1 false)
  %.fca.0.load = load ptr, ptr %2, align 8, !tbaa !7
  %56 = load i32, ptr %.fca.0.load, align 4, !tbaa !3
  call void @free(ptr %.fca.0.load)
  %57 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.f3e353636d374e01daf08a75b9578a18, i32 22)
  %58 = sext i32 %56 to i64
  %59 = add nsw i64 %58, -1
  %60 = getelementptr [1000 x i64], ptr @_QFEa, i64 0, i64 %59
  %61 = load i64, ptr %60, align 8, !tbaa !3
  %62 = call i1 @_FortranAioOutputInteger64(ptr %57, i64 %61)
  %63 = call i32 @_FortranAioEndIoStatement(ptr %57)
  %64 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.f3e353636d374e01daf08a75b9578a18, i32 23)
  %65 = load i32, ptr %3, align 4, !tbaa !3
  %66 = add i32 %65, -1
  %67 = call i1 @_FortranAioOutputInteger32(ptr %64, i32 %66)
  %68 = call i32 @_FortranAioEndIoStatement(ptr %64)
  %69 = load i32, ptr %3, align 4, !tbaa !3
  %70 = add i32 %56, 1
  %71 = sext i32 %70 to i64
  %72 = xor i32 %69, -1
  %73 = sext i32 %72 to i64
  %74 = add nsw i64 %71, %73
  %75 = icmp slt i64 %74, 0
  br i1 %75, label %.lr.ph174.preheader, label %._crit_edge175

.lr.ph174.preheader:                              ; preds = %52
  %76 = sub nsw i64 0, %74
  br label %.lr.ph174

.lr.ph174:                                        ; preds = %.lr.ph174.preheader, %.lr.ph174
  %77 = phi i64 [ %83, %.lr.ph174 ], [ %76, %.lr.ph174.preheader ]
  %78 = phi i32 [ %82, %.lr.ph174 ], [ %69, %.lr.ph174.preheader ]
  %79 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.f3e353636d374e01daf08a75b9578a18, i32 25)
  %80 = call i1 @_FortranAioOutputInteger32(ptr %79, i32 %78)
  %81 = call i32 @_FortranAioEndIoStatement(ptr %79)
  %82 = add i32 %78, -1
  %83 = add nsw i64 %77, -1
  %84 = icmp ugt i64 %77, 1
  br i1 %84, label %.lr.ph174, label %._crit_edge175

._crit_edge175:                                   ; preds = %.lr.ph174, %52
  %85 = add i32 %56, -1
  %86 = icmp sgt i32 %85, 0
  br i1 %86, label %.lr.ph177.preheader, label %._crit_edge178

.lr.ph177.preheader:                              ; preds = %._crit_edge175
  %87 = zext i32 %85 to i64
  br label %.lr.ph177

.lr.ph177:                                        ; preds = %.lr.ph177.preheader, %.lr.ph177
  %88 = phi i64 [ %92, %.lr.ph177 ], [ %87, %.lr.ph177.preheader ]
  %89 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.f3e353636d374e01daf08a75b9578a18, i32 28)
  %90 = call i1 @_FortranAioOutputInteger32(ptr %89, i32 1)
  %91 = call i32 @_FortranAioEndIoStatement(ptr %89)
  %92 = add nsw i64 %88, -1
  %93 = icmp ugt i64 %88, 1
  br i1 %93, label %.lr.ph177, label %._crit_edge178

._crit_edge178:                                   ; preds = %.lr.ph177, %._crit_edge175
  %94 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

95:                                               ; preds = %._crit_edge
  %96 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.f3e353636d374e01daf08a75b9578a18, i32 32)
  %97 = call i64 @llvm.smax.i64(i64 %.0121.lcssa, i64 %.0123.lcssa)
  %98 = call i1 @_FortranAioOutputInteger64(ptr %96, i64 %97)
  %99 = call i32 @_FortranAioEndIoStatement(ptr %96)
  %100 = load i32, ptr %3, align 4, !tbaa !3
  %101 = icmp sgt i64 %.0123.lcssa, %.0121.lcssa
  br i1 %101, label %.preheader154, label %.preheader152

.preheader154:                                    ; preds = %95
  %102 = add i32 %100, -1
  %103 = call dereferenceable_or_null(8000) ptr @malloc(i64 8000)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(8000) %103, ptr noundef nonnull align 16 dereferenceable(8000) @_QFEa, i64 8000, i1 false), !tbaa !3
  %.not180 = icmp slt i32 %102, 1
  br i1 %.not180, label %.preheader153, label %.lr.ph159.preheader

.lr.ph159.preheader:                              ; preds = %.preheader154
  %104 = zext i32 %102 to i64
  %105 = shl nuw nsw i64 %104, 3
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 %103, ptr nonnull align 8 getelementptr inbounds ([1000 x i64], ptr @_QFEa, i64 0, i64 1), i64 %105, i1 false), !tbaa !3
  br label %.preheader153

.preheader153:                                    ; preds = %.lr.ph159.preheader, %.preheader154
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(8000) @_QFEa, ptr noundef nonnull align 8 dereferenceable(8000) %103, i64 8000, i1 false), !tbaa !3
  call void @free(ptr nonnull %103)
  store i32 1, ptr @_QFEw, align 16, !tbaa !3
  br label %.preheader152

.preheader152:                                    ; preds = %95, %.preheader153
  %.0122.ph = phi i32 [ %100, %95 ], [ %102, %.preheader153 ]
  %.0.ph = phi i32 [ 0, %95 ], [ 1, %.preheader153 ]
  %106 = icmp sgt i32 %.0122.ph, 1
  br i1 %106, label %.lr.ph167, label %._crit_edge168

.lr.ph167:                                        ; preds = %.preheader152, %.backedge
  %.0166 = phi i32 [ %.0.be, %.backedge ], [ %.0.ph, %.preheader152 ]
  %.0122165 = phi i32 [ %.0122.be, %.backedge ], [ %.0122.ph, %.preheader152 ]
  %107 = icmp eq i32 %.0122165, 2
  br i1 %107, label %.backedge.thread, label %112

.backedge.thread:                                 ; preds = %.lr.ph167
  %108 = add i32 %.0166, 1
  %109 = sext i32 %108 to i64
  %110 = add nsw i64 %109, -1
  %111 = getelementptr [1000 x i32], ptr @_QFEw, i64 0, i64 %110
  store i32 2, ptr %111, align 4, !tbaa !3
  br label %._crit_edge168

112:                                              ; preds = %.lr.ph167
  %113 = load i64, ptr @_QFEa, align 16, !tbaa !3
  %114 = icmp slt i64 %113, 0
  br i1 %114, label %.preheader, label %142

.preheader:                                       ; preds = %112
  %115 = add nsw i32 %.0122165, -2
  %116 = call dereferenceable_or_null(8000) ptr @malloc(i64 8000)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(8000) %116, ptr noundef nonnull align 16 dereferenceable(8000) @_QFEa, i64 8000, i1 false), !tbaa !3
  %117 = zext i32 %115 to i64
  %118 = shl nuw nsw i64 %117, 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %116, ptr nonnull align 16 getelementptr inbounds ([1000 x i64], ptr @_QFEa, i64 0, i64 2), i64 %118, i1 false), !tbaa !3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(8000) @_QFEa, ptr noundef nonnull align 8 dereferenceable(8000) %116, i64 8000, i1 false), !tbaa !3
  call void @free(ptr %116)
  %119 = add i32 %.0166, 2
  %120 = add i32 %.0166, 1
  %121 = sext i32 %120 to i64
  %122 = sext i32 %119 to i64
  %123 = sub nsw i64 %122, %121
  %124 = icmp sgt i64 %123, -1
  br i1 %124, label %.lr.ph164, label %.backedge

.lr.ph164:                                        ; preds = %.preheader
  %125 = add nsw i64 %123, 1
  %126 = add nsw i64 %121, -1
  %127 = add nsw i64 %122, 2
  %128 = icmp ne i64 %125, 0
  %umin.neg = sext i1 %128 to i64
  %129 = add nsw i64 %127, %umin.neg
  %130 = sub nsw i64 %129, %121
  %min.iters.check = icmp ult i64 %130, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph164
  %n.vec = and i64 %130, -8
  %ind.end = sub nsw i64 %125, %n.vec
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %131 = add nsw i64 %126, %index
  %132 = getelementptr i32, ptr @_QFEw, i64 %131
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %132, align 4, !tbaa !3
  %133 = getelementptr i32, ptr %132, i64 4
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %133, align 4, !tbaa !3
  %index.next = add nuw i64 %index, 8
  %134 = icmp eq i64 %index.next, %n.vec
  br i1 %134, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %130, %n.vec
  br i1 %cmp.n, label %.backedge, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %.lr.ph164, %middle.block
  %.ph = phi i64 [ %125, %.lr.ph164 ], [ %ind.end, %middle.block ]
  %.ph198 = phi i64 [ 0, %.lr.ph164 ], [ %n.vec, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %135 = phi i64 [ %140, %scalar.ph ], [ %.ph, %scalar.ph.preheader ]
  %136 = phi i64 [ %137, %scalar.ph ], [ %.ph198, %scalar.ph.preheader ]
  %137 = add nuw nsw i64 %136, 1
  %138 = add nsw i64 %126, %136
  %139 = getelementptr i32, ptr @_QFEw, i64 %138
  store i32 1, ptr %139, align 4, !tbaa !3
  %140 = add nsw i64 %135, -1
  %141 = icmp ugt i64 %135, 1
  br i1 %141, label %scalar.ph, label %.backedge, !llvm.loop !12

142:                                              ; preds = %112
  %143 = load i64, ptr getelementptr inbounds ([1000 x i64], ptr @_QFEa, i64 0, i64 2), align 16, !tbaa !3
  %144 = icmp sgt i64 %143, -1
  br i1 %144, label %.preheader148, label %150

.preheader148:                                    ; preds = %142
  %145 = add nuw i64 %143, %113
  store i64 %145, ptr getelementptr inbounds ([1000 x i64], ptr @_QFEa, i64 0, i64 2), align 16, !tbaa !3
  %146 = add nsw i32 %.0122165, -2
  %147 = call dereferenceable_or_null(8000) ptr @malloc(i64 8000)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(8000) %147, ptr noundef nonnull align 16 dereferenceable(8000) @_QFEa, i64 8000, i1 false), !tbaa !3
  %148 = zext i32 %146 to i64
  %149 = shl nuw nsw i64 %148, 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %147, ptr nonnull align 16 getelementptr inbounds ([1000 x i64], ptr @_QFEa, i64 0, i64 2), i64 %149, i1 false), !tbaa !3
  br label %.backedge.sink.split.sink.split

150:                                              ; preds = %142
  %151 = icmp eq i32 %.0122165, 3
  br i1 %151, label %.backedge.sink.split, label %.preheader150

.preheader150:                                    ; preds = %150
  %152 = load i64, ptr getelementptr inbounds ([1000 x i64], ptr @_QFEa, i64 0, i64 1), align 8, !tbaa !3
  %153 = load i64, ptr getelementptr inbounds ([1000 x i64], ptr @_QFEa, i64 0, i64 3), align 8, !tbaa !3
  %154 = add i64 %153, %152
  store i64 %154, ptr getelementptr inbounds ([1000 x i64], ptr @_QFEa, i64 0, i64 3), align 8, !tbaa !3
  %155 = add nsw i32 %.0122165, -2
  %156 = call dereferenceable_or_null(8000) ptr @malloc(i64 8000)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(8000) %156, ptr noundef nonnull align 16 dereferenceable(8000) @_QFEa, i64 8000, i1 false), !tbaa !3
  %157 = zext i32 %155 to i64
  %uglygep = getelementptr i8, ptr %156, i64 8
  %158 = shl nuw nsw i64 %157, 3
  %159 = add nsw i64 %158, -8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %uglygep, ptr nonnull align 8 getelementptr inbounds ([1000 x i64], ptr @_QFEa, i64 0, i64 3), i64 %159, i1 false), !tbaa !3
  br label %.backedge.sink.split.sink.split

.backedge.sink.split.sink.split:                  ; preds = %.preheader150, %.preheader148
  %.sink195 = phi ptr [ %147, %.preheader148 ], [ %156, %.preheader150 ]
  %.sink.ph = phi i32 [ 2, %.preheader148 ], [ 3, %.preheader150 ]
  %.0122.be.ph.ph = phi i32 [ %146, %.preheader148 ], [ %155, %.preheader150 ]
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(8000) @_QFEa, ptr noundef nonnull align 8 dereferenceable(8000) %.sink195, i64 8000, i1 false), !tbaa !3
  call void @free(ptr %.sink195)
  br label %.backedge.sink.split

.backedge.sink.split:                             ; preds = %.backedge.sink.split.sink.split, %150
  %.sink = phi i32 [ 3, %150 ], [ %.sink.ph, %.backedge.sink.split.sink.split ]
  %.0122.be.ph = phi i32 [ 2, %150 ], [ %.0122.be.ph.ph, %.backedge.sink.split.sink.split ]
  %160 = add i32 %.0166, 1
  %161 = sext i32 %160 to i64
  %162 = add nsw i64 %161, -1
  %163 = getelementptr [1000 x i32], ptr @_QFEw, i64 0, i64 %162
  store i32 %.sink, ptr %163, align 4, !tbaa !3
  br label %.backedge

.backedge:                                        ; preds = %scalar.ph, %middle.block, %.backedge.sink.split, %.preheader
  %.0122.be = phi i32 [ %115, %.preheader ], [ %.0122.be.ph, %.backedge.sink.split ], [ %115, %middle.block ], [ %115, %scalar.ph ]
  %.0.be = phi i32 [ %119, %.preheader ], [ %160, %.backedge.sink.split ], [ %119, %middle.block ], [ %119, %scalar.ph ]
  %164 = icmp sgt i32 %.0122.be, 1
  br i1 %164, label %.lr.ph167, label %._crit_edge168

._crit_edge168:                                   ; preds = %.backedge, %.backedge.thread, %.preheader152
  %.0.lcssa = phi i32 [ %.0.ph, %.preheader152 ], [ %108, %.backedge.thread ], [ %.0.be, %.backedge ]
  %165 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.f3e353636d374e01daf08a75b9578a18, i32 75)
  %166 = call i1 @_FortranAioOutputInteger32(ptr %165, i32 %.0.lcssa)
  %167 = call i32 @_FortranAioEndIoStatement(ptr %165)
  %168 = icmp sgt i32 %.0.lcssa, 0
  br i1 %168, label %.lr.ph171.preheader, label %._crit_edge172

.lr.ph171.preheader:                              ; preds = %._crit_edge168
  %169 = zext i32 %.0.lcssa to i64
  br label %.lr.ph171

.lr.ph171:                                        ; preds = %.lr.ph171.preheader, %.lr.ph171
  %indvars.iv182 = phi i64 [ 1, %.lr.ph171.preheader ], [ %indvars.iv.next183, %.lr.ph171 ]
  %170 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.f3e353636d374e01daf08a75b9578a18, i32 77)
  %171 = add nsw i64 %indvars.iv182, -1
  %172 = getelementptr [1000 x i32], ptr @_QFEw, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !3
  %174 = call i1 @_FortranAioOutputInteger32(ptr %170, i32 %173)
  %175 = call i32 @_FortranAioEndIoStatement(ptr %170)
  %indvars.iv.next183 = add nuw nsw i64 %indvars.iv182, 1
  %exitcond185.not = icmp eq i64 %indvars.iv182, %169
  br i1 %exitcond185.not, label %._crit_edge172, label %.lr.ph171

._crit_edge172:                                   ; preds = %.lr.ph171, %._crit_edge168
  %176 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable
}

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 i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

declare {} @_FortranAMaxlocDim(ptr, ptr, i32, i32, ptr, i32, ptr, i1) local_unnamed_addr

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

declare i1 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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 = { noreturn }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }

!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}
