!
! The below module was made in reference to 
! https://ufcpp.net/study/algorithm/col_heap.html
!
module heappq
  
  implicit none
  integer(8),allocatable :: hp(:)

contains 
subroutine heapinit(n)
  
  integer, intent(in) :: n

  allocate( hp(n) ); hp = 0

end subroutine heapinit

subroutine heappush( newnp, newn )
  
  integer, intent(in)    :: newn
  integer, intent(in)    :: newnp
  integer :: i,ln, tmp
 
  ln = newn
  hp(ln) = newnp
  
  do while ( ln /= 1 )
    i = ln/2
    if ( hp(i) < hp(ln) ) then
      tmp    = hp(ln) 
      hp(ln) = hp(i) 
      hp(i)  = tmp 
    end if
    ln = i
  end do

end subroutine heappush

subroutine heappop( n )
  
  integer :: i,j,tmp
  integer,intent(in) :: n
  
  hp(1) = hp(n)
  
  i = 1 
  do while ( 2*i < n )
    j = 2*i 
    if ( j /= n - 1 .and. hp(j+1) > hp(j) ) j = j + 1
    if ( hp(i) < hp(j) ) then
      tmp    = hp(j) 
      hp(j) = hp(i) 
      hp(i)  = tmp 
    end if
    i = j
  end do

end subroutine heappop
 
end module heappq

program main
  
  use heappq  

  implicit none ! 02;01
  integer :: n, m
  integer, allocatable :: a(:)
  integer :: i,j, tmp, tmpo
  integer(8) :: money
  
  read(*,*) n,m
  allocate( a(n) )
  read(*,*) a
  
  call heapinit(n)
  
  do i = 1, n
    call heappush( a(i), i )
  end do

  do j = 1, m
    tmp = hp(1) / 2 
    call heappop(n)

    call heappush(tmp, n)

  end do

  a = hp 
  money = 0
  do i = 1, n
    money = money + int( a(i), kind = 8 )
  end do
  print*, money

end program main


; 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"

@_QMheappqEhp = local_unnamed_addr global { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } { ptr null, i64 ptrtoint (ptr getelementptr (i64, ptr null, i32 1) to i64), i32 20180515, i8 1, i8 10, i8 2, i8 0, [1 x [3 x i64]] [[3 x i64] [i64 1, i64 0, i64 ptrtoint (ptr getelementptr (i64, ptr null, i32 1) to i64)]] }
@_QQcl.123a0a149777795c02a044be7e38ef6a = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3260/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"
@_QFEa.0 = internal unnamed_addr global ptr null
@_QFEa.8 = internal unnamed_addr global i64 0
@_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 @_QMheappqPheapinit(ptr nocapture readonly %0) local_unnamed_addr {
  %2 = load i32, ptr %0, align 4, !tbaa !3
  %3 = tail call i32 @llvm.smax.i32(i32 %2, i32 0)
  %4 = zext i32 %3 to i64
  %5 = shl nuw nsw i64 %4, 3
  %6 = tail call ptr @malloc(i64 %5)
  store ptr %6, ptr @_QMheappqEhp, align 16, !tbaa !7
  store i64 8, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 1), align 8, !tbaa !7
  store i32 20180515, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 2), align 16, !tbaa !7
  store i8 1, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 3), align 4, !tbaa !7
  store i8 10, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 4), align 1, !tbaa !7
  store i8 2, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 5), align 2, !tbaa !7
  store i8 0, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 6), align 1, !tbaa !7
  store i64 1, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 7), align 8, !tbaa !7
  store i64 %4, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 7, i64 0, i64 1), align 16, !tbaa !7
  store i64 8, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 7, i64 0, i64 2), align 8, !tbaa !7
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %9, label %.preheader

.preheader:                                       ; preds = %1
  %.not117 = icmp slt i32 %2, 1
  br i1 %.not117, label %.loopexit, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %7 = tail call i64 @llvm.smax.i64(i64 %4, i64 1)
  %8 = shl nuw nsw i64 %7, 3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 8 %6, i8 0, i64 %8, i1 false), !tbaa !3
  br label %.loopexit

9:                                                ; preds = %1
  %10 = tail call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.123a0a149777795c02a044be7e38ef6a, i32 15)
  %.unpack103.unpack.unpack = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 7), align 8, !tbaa !7
  %11 = icmp slt i32 %2, 1
  %12 = select i1 %11, i64 1, i64 %.unpack103.unpack.unpack
  store ptr null, ptr @_QMheappqEhp, align 16, !tbaa !7
  store i64 8, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 1), align 8, !tbaa !7
  store i32 20180515, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 2), align 16, !tbaa !7
  store i8 1, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 3), align 4, !tbaa !7
  store i8 10, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 4), align 1, !tbaa !7
  store i8 2, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 5), align 2, !tbaa !7
  store i8 0, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 6), align 1, !tbaa !7
  store i64 %12, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 7), align 8, !tbaa !7
  store i64 %4, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 7, i64 0, i64 1), align 16, !tbaa !7
  store i64 8, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 7, i64 0, i64 2), align 8, !tbaa !7
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph.preheader, %.preheader, %9
  ret void
}

; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none)
define void @_QMheappqPheappush(ptr nocapture readonly %0, ptr nocapture readonly %1) local_unnamed_addr #2 {
  %3 = load i32, ptr %1, align 4, !tbaa !3
  %4 = load i32, ptr %0, align 4, !tbaa !3
  %5 = sext i32 %4 to i64
  %.unpack = load ptr, ptr @_QMheappqEhp, align 16, !tbaa !7
  %.unpack99.unpack.unpack = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 7), align 8, !tbaa !7
  %6 = sext i32 %3 to i64
  %7 = sub i64 %6, %.unpack99.unpack.unpack
  %8 = getelementptr i64, ptr %.unpack, i64 %7
  store i64 %5, ptr %8, align 8, !tbaa !3
  %.not128 = icmp eq i32 %3, 1
  br i1 %.not128, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %21
  %.0129 = phi i32 [ %9, %21 ], [ %3, %2 ]
  %9 = sdiv i32 %.0129, 2
  %10 = sext i32 %9 to i64
  %11 = sub i64 %10, %.unpack99.unpack.unpack
  %12 = getelementptr i64, ptr %.unpack, i64 %11
  %13 = load i64, ptr %12, align 8, !tbaa !3
  %14 = sext i32 %.0129 to i64
  %15 = sub i64 %14, %.unpack99.unpack.unpack
  %16 = getelementptr i64, ptr %.unpack, i64 %15
  %17 = load i64, ptr %16, align 8, !tbaa !3
  %18 = icmp slt i64 %13, %17
  br i1 %18, label %19, label %21

19:                                               ; preds = %.lr.ph
  store i64 %13, ptr %16, align 8, !tbaa !3
  %sext = shl i64 %17, 32
  %20 = ashr exact i64 %sext, 32
  store i64 %20, ptr %12, align 8, !tbaa !3
  br label %21

21:                                               ; preds = %19, %.lr.ph
  %22 = and i32 %.0129, -2
  %.not = icmp eq i32 %22, 2
  br i1 %.not, label %._crit_edge, label %.lr.ph

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

; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none)
define void @_QMheappqPheappop(ptr nocapture readonly %0) local_unnamed_addr #2 {
  %.unpack = load ptr, ptr @_QMheappqEhp, align 16, !tbaa !7
  %.unpack123.unpack.unpack = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 7), align 8, !tbaa !7
  %2 = load i32, ptr %0, align 4, !tbaa !3
  %3 = sext i32 %2 to i64
  %4 = sub i64 %3, %.unpack123.unpack.unpack
  %5 = getelementptr i64, ptr %.unpack, i64 %4
  %6 = load i64, ptr %5, align 8, !tbaa !3
  %7 = sub i64 1, %.unpack123.unpack.unpack
  %8 = getelementptr i64, ptr %.unpack, i64 %7
  store i64 %6, ptr %8, align 8, !tbaa !3
  %9 = load i32, ptr %0, align 4, !tbaa !3
  %10 = icmp sgt i32 %9, 2
  br i1 %10, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %1, %37
  %11 = phi i32 [ %38, %37 ], [ %9, %1 ]
  %12 = phi i32 [ %39, %37 ], [ 2, %1 ]
  %.0164 = phi i32 [ %spec.select, %37 ], [ 1, %1 ]
  %13 = add nsw i32 %11, -1
  %14 = icmp ne i32 %12, %13
  %15 = or i32 %12, 1
  %16 = sext i32 %15 to i64
  %17 = sub i64 %16, %.unpack123.unpack.unpack
  %18 = getelementptr i64, ptr %.unpack, i64 %17
  %19 = load i64, ptr %18, align 8, !tbaa !3
  %20 = sext i32 %12 to i64
  %21 = sub i64 %20, %.unpack123.unpack.unpack
  %22 = getelementptr i64, ptr %.unpack, i64 %21
  %23 = load i64, ptr %22, align 8, !tbaa !3
  %24 = icmp sgt i64 %19, %23
  %25 = and i1 %14, %24
  %spec.select = select i1 %25, i32 %15, i32 %12
  %26 = sext i32 %.0164 to i64
  %27 = sub i64 %26, %.unpack123.unpack.unpack
  %28 = getelementptr i64, ptr %.unpack, i64 %27
  %29 = load i64, ptr %28, align 8, !tbaa !3
  %30 = sext i32 %spec.select to i64
  %31 = sub i64 %30, %.unpack123.unpack.unpack
  %32 = getelementptr i64, ptr %.unpack, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !3
  %34 = icmp slt i64 %29, %33
  br i1 %34, label %35, label %37

35:                                               ; preds = %.lr.ph
  store i64 %29, ptr %32, align 8, !tbaa !3
  %sext = shl i64 %33, 32
  %36 = ashr exact i64 %sext, 32
  store i64 %36, ptr %28, align 8, !tbaa !3
  %.pre = load i32, ptr %0, align 4, !tbaa !3
  br label %37

37:                                               ; preds = %35, %.lr.ph
  %38 = phi i32 [ %.pre, %35 ], [ %11, %.lr.ph ]
  %39 = shl i32 %spec.select, 1
  %40 = icmp slt i32 %39, %38
  br i1 %40, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %37, %1
  ret void
}

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.123a0a149777795c02a044be7e38ef6a, i32 73)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 4)
  %6 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %2, i32 4)
  %7 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %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
  %11 = shl nuw nsw i64 %10, 2
  %12 = call ptr @malloc(i64 %11)
  store ptr %12, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 %10, ptr @_QFEa.8, align 8, !tbaa !7
  %13 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.123a0a149777795c02a044be7e38ef6a, i32 75)
  %.unpack = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack261.unpack.unpack263 = load i64, ptr @_QFEa.8, align 8, !tbaa !7
  store ptr %.unpack, ptr %1, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, 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, [1 x [3 x i64]] }, ptr %1, 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, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !7
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, 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, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !7
  %.fca.6.gep = 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.gep, 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 %.unpack261.unpack.unpack263, 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 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %14 = call i1 @_FortranAioInputDescriptor(ptr %13, ptr nonnull %1)
  %15 = call i32 @_FortranAioEndIoStatement(ptr %13)
  %16 = load i32, ptr %3, align 4, !tbaa !3
  %17 = call i32 @llvm.smax.i32(i32 %16, i32 0)
  %18 = zext i32 %17 to i64
  %19 = shl nuw nsw i64 %18, 3
  %20 = call ptr @malloc(i64 %19)
  store ptr %20, ptr @_QMheappqEhp, align 16, !tbaa !7
  store i64 8, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 1), align 8, !tbaa !7
  store i32 20180515, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 2), align 16, !tbaa !7
  store i8 1, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 3), align 4, !tbaa !7
  store i8 10, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 4), align 1, !tbaa !7
  store i8 2, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 5), align 2, !tbaa !7
  store i8 0, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 6), align 1, !tbaa !7
  store i64 1, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 7), align 8, !tbaa !7
  store i64 %18, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 7, i64 0, i64 1), align 16, !tbaa !7
  store i64 8, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 7, i64 0, i64 2), align 8, !tbaa !7
  %.not.i = icmp eq ptr %20, null
  br i1 %.not.i, label %_QMheappqPheapinit.exit, label %.preheader.i

.preheader.i:                                     ; preds = %0
  %.not117.i = icmp slt i32 %16, 1
  br i1 %.not117.i, label %_QMheappqPheapinit.exit.thread386, label %_QMheappqPheapinit.exit.thread

_QMheappqPheapinit.exit.thread386:                ; preds = %.preheader.i
  %21 = sext i32 %16 to i64
  br label %._crit_edge

_QMheappqPheapinit.exit.thread:                   ; preds = %.preheader.i
  %22 = call i64 @llvm.smax.i64(i64 %18, i64 1)
  %23 = shl nuw nsw i64 %22, 3
  call void @llvm.memset.p0.i64(ptr nonnull align 8 %20, i8 0, i64 %23, i1 false), !tbaa !3
  %24 = zext i32 %16 to i64
  br label %.lr.ph

_QMheappqPheapinit.exit:                          ; preds = %0
  %25 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.123a0a149777795c02a044be7e38ef6a, i32 15)
  %.unpack103.unpack.unpack.i = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 7), align 8, !tbaa !7
  %26 = icmp slt i32 %16, 1
  %27 = select i1 %26, i64 1, i64 %.unpack103.unpack.unpack.i
  store ptr null, ptr @_QMheappqEhp, align 16, !tbaa !7
  store i64 8, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 1), align 8, !tbaa !7
  store i32 20180515, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 2), align 16, !tbaa !7
  store i8 1, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 3), align 4, !tbaa !7
  store i8 10, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 4), align 1, !tbaa !7
  store i8 2, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 5), align 2, !tbaa !7
  store i8 0, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 6), align 1, !tbaa !7
  store i64 %27, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 7), align 8, !tbaa !7
  store i64 %18, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 7, i64 0, i64 1), align 16, !tbaa !7
  store i64 8, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMheappqEhp, i64 0, i32 7, i64 0, i64 2), align 8, !tbaa !7
  %.pre = load i32, ptr %3, align 4, !tbaa !3
  %28 = sext i32 %.pre to i64
  %29 = icmp sgt i32 %.pre, 0
  br i1 %29, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %_QMheappqPheapinit.exit.thread, %_QMheappqPheapinit.exit
  %30 = phi i64 [ %24, %_QMheappqPheapinit.exit.thread ], [ %28, %_QMheappqPheapinit.exit ]
  %31 = phi i32 [ %16, %_QMheappqPheapinit.exit.thread ], [ %.pre, %_QMheappqPheapinit.exit ]
  %.unpack318.unpack.unpack382 = phi i64 [ 1, %_QMheappqPheapinit.exit.thread ], [ %27, %_QMheappqPheapinit.exit ]
  %.unpack323 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  br label %32

32:                                               ; preds = %.lr.ph, %_QMheappqPheappush.exit
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %_QMheappqPheappush.exit ]
  %33 = add nsw i64 %indvars.iv, -1
  %34 = getelementptr i32, ptr %.unpack323, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !3
  %36 = sext i32 %35 to i64
  %37 = sub i64 %indvars.iv, %.unpack318.unpack.unpack382
  %38 = getelementptr i64, ptr %20, i64 %37
  store i64 %36, ptr %38, align 8, !tbaa !3
  %.not128.i = icmp eq i64 %indvars.iv, 1
  br i1 %.not128.i, label %_QMheappqPheappush.exit, label %.lr.ph.i.preheader

.lr.ph.i.preheader:                               ; preds = %32
  %39 = trunc i64 %indvars.iv to i32
  br label %.lr.ph.i

.lr.ph.i:                                         ; preds = %.lr.ph.i.preheader, %52
  %.0129.i = phi i32 [ %40, %52 ], [ %39, %.lr.ph.i.preheader ]
  %40 = sdiv i32 %.0129.i, 2
  %41 = sext i32 %40 to i64
  %42 = sub i64 %41, %.unpack318.unpack.unpack382
  %43 = getelementptr i64, ptr %20, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !3
  %45 = sext i32 %.0129.i to i64
  %46 = sub i64 %45, %.unpack318.unpack.unpack382
  %47 = getelementptr i64, ptr %20, i64 %46
  %48 = load i64, ptr %47, align 8, !tbaa !3
  %49 = icmp slt i64 %44, %48
  br i1 %49, label %50, label %52

50:                                               ; preds = %.lr.ph.i
  store i64 %44, ptr %47, align 8, !tbaa !3
  %sext.i = shl i64 %48, 32
  %51 = ashr exact i64 %sext.i, 32
  store i64 %51, ptr %43, align 8, !tbaa !3
  br label %52

52:                                               ; preds = %50, %.lr.ph.i
  %53 = and i32 %.0129.i, -2
  %.not.i335 = icmp eq i32 %53, 2
  br i1 %.not.i335, label %_QMheappqPheappush.exit, label %.lr.ph.i

_QMheappqPheappush.exit:                          ; preds = %52, %32
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %30
  br i1 %exitcond.not, label %._crit_edge, label %32

._crit_edge:                                      ; preds = %_QMheappqPheappush.exit, %_QMheappqPheapinit.exit.thread386, %_QMheappqPheapinit.exit
  %54 = phi i64 [ %28, %_QMheappqPheapinit.exit ], [ %21, %_QMheappqPheapinit.exit.thread386 ], [ %30, %_QMheappqPheappush.exit ]
  %55 = phi i32 [ %.pre, %_QMheappqPheapinit.exit ], [ %16, %_QMheappqPheapinit.exit.thread386 ], [ %31, %_QMheappqPheappush.exit ]
  %.unpack318.unpack.unpack383 = phi i64 [ %27, %_QMheappqPheapinit.exit ], [ 1, %_QMheappqPheapinit.exit.thread386 ], [ %.unpack318.unpack.unpack382, %_QMheappqPheappush.exit ]
  %56 = load i32, ptr %2, align 4, !tbaa !3
  %57 = icmp sgt i32 %56, 0
  br i1 %57, label %.lr.ph353, label %._crit_edge354

.lr.ph353:                                        ; preds = %._crit_edge
  %58 = zext i32 %56 to i64
  %59 = sub i64 1, %.unpack318.unpack.unpack383
  %60 = getelementptr i64, ptr %20, i64 %59
  %61 = sub i64 %54, %.unpack318.unpack.unpack383
  %62 = getelementptr i64, ptr %20, i64 %61
  %63 = icmp sgt i32 %55, 2
  %64 = add nsw i32 %55, -1
  %.not128.i341 = icmp eq i32 %55, 1
  br label %65

65:                                               ; preds = %.lr.ph353, %_QMheappqPheappush.exit346
  %66 = phi i64 [ %58, %.lr.ph353 ], [ %112, %_QMheappqPheappush.exit346 ]
  %67 = load i64, ptr %60, align 8, !tbaa !3
  %68 = sdiv i64 %67, 2
  %69 = load i64, ptr %62, align 8, !tbaa !3
  store i64 %69, ptr %60, align 8, !tbaa !3
  br i1 %63, label %.lr.ph.i337, label %_QMheappqPheappop.exit

.lr.ph.i337:                                      ; preds = %65, %94
  %70 = phi i32 [ %95, %94 ], [ 2, %65 ]
  %.0164.i = phi i32 [ %spec.select.i, %94 ], [ 1, %65 ]
  %71 = icmp ne i32 %70, %64
  %72 = or i32 %70, 1
  %73 = sext i32 %72 to i64
  %74 = sub i64 %73, %.unpack318.unpack.unpack383
  %75 = getelementptr i64, ptr %20, i64 %74
  %76 = load i64, ptr %75, align 8, !tbaa !3
  %77 = sext i32 %70 to i64
  %78 = sub i64 %77, %.unpack318.unpack.unpack383
  %79 = getelementptr i64, ptr %20, i64 %78
  %80 = load i64, ptr %79, align 8, !tbaa !3
  %81 = icmp sgt i64 %76, %80
  %82 = and i1 %71, %81
  %spec.select.i = select i1 %82, i32 %72, i32 %70
  %83 = sext i32 %.0164.i to i64
  %84 = sub i64 %83, %.unpack318.unpack.unpack383
  %85 = getelementptr i64, ptr %20, i64 %84
  %86 = load i64, ptr %85, align 8, !tbaa !3
  %87 = sext i32 %spec.select.i to i64
  %88 = sub i64 %87, %.unpack318.unpack.unpack383
  %89 = getelementptr i64, ptr %20, i64 %88
  %90 = load i64, ptr %89, align 8, !tbaa !3
  %91 = icmp slt i64 %86, %90
  br i1 %91, label %92, label %94

92:                                               ; preds = %.lr.ph.i337
  store i64 %86, ptr %89, align 8, !tbaa !3
  %sext.i338 = shl i64 %90, 32
  %93 = ashr exact i64 %sext.i338, 32
  store i64 %93, ptr %85, align 8, !tbaa !3
  br label %94

94:                                               ; preds = %92, %.lr.ph.i337
  %95 = shl i32 %spec.select.i, 1
  %96 = icmp slt i32 %95, %55
  br i1 %96, label %.lr.ph.i337, label %_QMheappqPheappop.exit

_QMheappqPheappop.exit:                           ; preds = %94, %65
  %sext = shl i64 %68, 32
  %97 = ashr exact i64 %sext, 32
  store i64 %97, ptr %62, align 8, !tbaa !3
  br i1 %.not128.i341, label %_QMheappqPheappush.exit346, label %.lr.ph.i343

.lr.ph.i343:                                      ; preds = %_QMheappqPheappop.exit, %110
  %.0129.i342 = phi i32 [ %98, %110 ], [ %55, %_QMheappqPheappop.exit ]
  %98 = sdiv i32 %.0129.i342, 2
  %99 = sext i32 %98 to i64
  %100 = sub i64 %99, %.unpack318.unpack.unpack383
  %101 = getelementptr i64, ptr %20, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !3
  %103 = sext i32 %.0129.i342 to i64
  %104 = sub i64 %103, %.unpack318.unpack.unpack383
  %105 = getelementptr i64, ptr %20, i64 %104
  %106 = load i64, ptr %105, align 8, !tbaa !3
  %107 = icmp slt i64 %102, %106
  br i1 %107, label %108, label %110

108:                                              ; preds = %.lr.ph.i343
  store i64 %102, ptr %105, align 8, !tbaa !3
  %sext.i344 = shl i64 %106, 32
  %109 = ashr exact i64 %sext.i344, 32
  store i64 %109, ptr %101, align 8, !tbaa !3
  br label %110

110:                                              ; preds = %108, %.lr.ph.i343
  %111 = and i32 %.0129.i342, -2
  %.not.i345 = icmp eq i32 %111, 2
  br i1 %.not.i345, label %_QMheappqPheappush.exit346, label %.lr.ph.i343

_QMheappqPheappush.exit346:                       ; preds = %110, %_QMheappqPheappop.exit
  %112 = add nsw i64 %66, -1
  %113 = icmp sgt i64 %66, 1
  br i1 %113, label %65, label %._crit_edge354

._crit_edge354:                                   ; preds = %_QMheappqPheappush.exit346, %._crit_edge
  %.unpack278 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.not = icmp eq ptr %.unpack278, null
  br i1 %.not, label %170, label %114

114:                                              ; preds = %._crit_edge354
  %.unpack285.unpack.unpack287 = load i64, ptr @_QFEa.8, align 8, !tbaa !7
  %.not350 = icmp eq i64 %.unpack285.unpack.unpack287, %18
  br i1 %.not350, label %.preheader, label %133

.preheader:                                       ; preds = %114
  %.not378 = icmp slt i32 %16, 1
  br i1 %.not378, label %._crit_edge358, label %.lr.ph357.preheader

.lr.ph357.preheader:                              ; preds = %.preheader
  %min.iters.check400 = icmp ult i32 %17, 14
  br i1 %min.iters.check400, label %.lr.ph357.preheader442, label %vector.memcheck

vector.memcheck:                                  ; preds = %.lr.ph357.preheader
  %115 = shl nuw nsw i64 %18, 2
  %uglygep = getelementptr i8, ptr %.unpack278, i64 %115
  %116 = shl nuw nsw i64 %18, 3
  %uglygep397 = getelementptr i8, ptr %20, i64 %116
  %bound0 = icmp ult ptr %.unpack278, %uglygep397
  %bound1 = icmp ult ptr %20, %uglygep
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %.lr.ph357.preheader442, label %vector.ph401

vector.ph401:                                     ; preds = %vector.memcheck
  %n.vec403 = and i64 %18, 2147483644
  br label %vector.body406

vector.body406:                                   ; preds = %vector.body406, %vector.ph401
  %index407 = phi i64 [ 0, %vector.ph401 ], [ %index.next410, %vector.body406 ]
  %117 = getelementptr i64, ptr %20, i64 %index407
  %wide.load408 = load <2 x i64>, ptr %117, align 8, !tbaa !3, !alias.scope !9
  %118 = getelementptr i64, ptr %117, i64 2
  %wide.load409 = load <2 x i64>, ptr %118, align 8, !tbaa !3, !alias.scope !9
  %119 = trunc <2 x i64> %wide.load408 to <2 x i32>
  %120 = trunc <2 x i64> %wide.load409 to <2 x i32>
  %121 = getelementptr i32, ptr %.unpack278, i64 %index407
  store <2 x i32> %119, ptr %121, align 4, !tbaa !3, !alias.scope !12, !noalias !9
  %122 = getelementptr i32, ptr %121, i64 2
  store <2 x i32> %120, ptr %122, align 4, !tbaa !3, !alias.scope !12, !noalias !9
  %index.next410 = add nuw i64 %index407, 4
  %123 = icmp eq i64 %index.next410, %n.vec403
  br i1 %123, label %middle.block398, label %vector.body406, !llvm.loop !14

middle.block398:                                  ; preds = %vector.body406
  %cmp.n405 = icmp eq i64 %n.vec403, %18
  br i1 %cmp.n405, label %._crit_edge358, label %.lr.ph357.preheader442

.lr.ph357.preheader442:                           ; preds = %vector.memcheck, %.lr.ph357.preheader, %middle.block398
  %.ph443 = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph357.preheader ], [ %n.vec403, %middle.block398 ]
  %124 = xor i64 %.ph443, -1
  %125 = add nsw i64 %124, %18
  %xtraiter = and i64 %18, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph357.prol.loopexit, label %.lr.ph357.prol

.lr.ph357.prol:                                   ; preds = %.lr.ph357.preheader442, %.lr.ph357.prol
  %126 = phi i64 [ %130, %.lr.ph357.prol ], [ %.ph443, %.lr.ph357.preheader442 ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph357.prol ], [ 0, %.lr.ph357.preheader442 ]
  %127 = getelementptr i64, ptr %20, i64 %126
  %128 = load i64, ptr %127, align 8, !tbaa !3
  %129 = trunc i64 %128 to i32
  %130 = add nuw nsw i64 %126, 1
  %131 = getelementptr i32, ptr %.unpack278, i64 %126
  store i32 %129, ptr %131, align 4, !tbaa !3
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph357.prol.loopexit, label %.lr.ph357.prol, !llvm.loop !17

.lr.ph357.prol.loopexit:                          ; preds = %.lr.ph357.prol, %.lr.ph357.preheader442
  %.unr = phi i64 [ %.ph443, %.lr.ph357.preheader442 ], [ %130, %.lr.ph357.prol ]
  %132 = icmp ult i64 %125, 3
  br i1 %132, label %._crit_edge358, label %.lr.ph357

133:                                              ; preds = %114
  %134 = shl nuw nsw i64 %18, 2
  %135 = call ptr @malloc(i64 %134)
  %.not377 = icmp slt i32 %16, 1
  br i1 %.not377, label %.thread349, label %.lr.ph356.preheader

.lr.ph356.preheader:                              ; preds = %133
  %min.iters.check = icmp ult i32 %17, 4
  br i1 %min.iters.check, label %.lr.ph356.preheader444, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph356.preheader
  %n.vec = and i64 %18, 2147483644
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %136 = getelementptr i64, ptr %20, i64 %index
  %wide.load = load <2 x i64>, ptr %136, align 8, !tbaa !3
  %137 = getelementptr i64, ptr %136, i64 2
  %wide.load396 = load <2 x i64>, ptr %137, align 8, !tbaa !3
  %138 = trunc <2 x i64> %wide.load to <2 x i32>
  %139 = trunc <2 x i64> %wide.load396 to <2 x i32>
  %140 = getelementptr i32, ptr %135, i64 %index
  store <2 x i32> %138, ptr %140, align 4, !tbaa !3
  %141 = getelementptr i32, ptr %140, i64 2
  store <2 x i32> %139, ptr %141, align 4, !tbaa !3
  %index.next = add nuw i64 %index, 4
  %142 = icmp eq i64 %index.next, %n.vec
  br i1 %142, label %middle.block, label %vector.body, !llvm.loop !19

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %18
  br i1 %cmp.n, label %.loopexit, label %.lr.ph356.preheader444

.lr.ph356.preheader444:                           ; preds = %.lr.ph356.preheader, %middle.block
  %.ph445 = phi i64 [ 0, %.lr.ph356.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph356

.lr.ph356:                                        ; preds = %.lr.ph356.preheader444, %.lr.ph356
  %143 = phi i64 [ %147, %.lr.ph356 ], [ %.ph445, %.lr.ph356.preheader444 ]
  %144 = getelementptr i64, ptr %20, i64 %143
  %145 = load i64, ptr %144, align 8, !tbaa !3
  %146 = trunc i64 %145 to i32
  %147 = add nuw nsw i64 %143, 1
  %148 = getelementptr i32, ptr %135, i64 %143
  store i32 %146, ptr %148, align 4, !tbaa !3
  %exitcond367.not = icmp eq i64 %147, %18
  br i1 %exitcond367.not, label %.loopexit, label %.lr.ph356, !llvm.loop !20

.lr.ph357:                                        ; preds = %.lr.ph357.prol.loopexit, %.lr.ph357
  %149 = phi i64 [ %168, %.lr.ph357 ], [ %.unr, %.lr.ph357.prol.loopexit ]
  %150 = getelementptr i64, ptr %20, i64 %149
  %151 = load i64, ptr %150, align 8, !tbaa !3
  %152 = trunc i64 %151 to i32
  %153 = add nuw nsw i64 %149, 1
  %154 = getelementptr i32, ptr %.unpack278, i64 %149
  store i32 %152, ptr %154, align 4, !tbaa !3
  %155 = getelementptr i64, ptr %20, i64 %153
  %156 = load i64, ptr %155, align 8, !tbaa !3
  %157 = trunc i64 %156 to i32
  %158 = add nuw nsw i64 %149, 2
  %159 = getelementptr i32, ptr %.unpack278, i64 %153
  store i32 %157, ptr %159, align 4, !tbaa !3
  %160 = getelementptr i64, ptr %20, i64 %158
  %161 = load i64, ptr %160, align 8, !tbaa !3
  %162 = trunc i64 %161 to i32
  %163 = add nuw nsw i64 %149, 3
  %164 = getelementptr i32, ptr %.unpack278, i64 %158
  store i32 %162, ptr %164, align 4, !tbaa !3
  %165 = getelementptr i64, ptr %20, i64 %163
  %166 = load i64, ptr %165, align 8, !tbaa !3
  %167 = trunc i64 %166 to i32
  %168 = add nuw nsw i64 %149, 4
  %169 = getelementptr i32, ptr %.unpack278, i64 %163
  store i32 %167, ptr %169, align 4, !tbaa !3
  %exitcond368.not.3 = icmp eq i64 %168, %18
  br i1 %exitcond368.not.3, label %._crit_edge358, label %.lr.ph357, !llvm.loop !21

170:                                              ; preds = %._crit_edge354
  %171 = shl nuw nsw i64 %18, 2
  %172 = call ptr @malloc(i64 %171)
  %.not379 = icmp slt i32 %16, 1
  br i1 %.not379, label %.loopexit.thread, label %.lr.ph360.preheader

.lr.ph360.preheader:                              ; preds = %170
  %min.iters.check413 = icmp ult i32 %17, 4
  br i1 %min.iters.check413, label %.lr.ph360.preheader440, label %vector.ph414

vector.ph414:                                     ; preds = %.lr.ph360.preheader
  %n.vec416 = and i64 %18, 2147483644
  br label %vector.body419

vector.body419:                                   ; preds = %vector.body419, %vector.ph414
  %index420 = phi i64 [ 0, %vector.ph414 ], [ %index.next423, %vector.body419 ]
  %173 = getelementptr i64, ptr %20, i64 %index420
  %wide.load421 = load <2 x i64>, ptr %173, align 8, !tbaa !3
  %174 = getelementptr i64, ptr %173, i64 2
  %wide.load422 = load <2 x i64>, ptr %174, align 8, !tbaa !3
  %175 = trunc <2 x i64> %wide.load421 to <2 x i32>
  %176 = trunc <2 x i64> %wide.load422 to <2 x i32>
  %177 = getelementptr i32, ptr %172, i64 %index420
  store <2 x i32> %175, ptr %177, align 4, !tbaa !3
  %178 = getelementptr i32, ptr %177, i64 2
  store <2 x i32> %176, ptr %178, align 4, !tbaa !3
  %index.next423 = add nuw i64 %index420, 4
  %179 = icmp eq i64 %index.next423, %n.vec416
  br i1 %179, label %middle.block411, label %vector.body419, !llvm.loop !22

middle.block411:                                  ; preds = %vector.body419
  %cmp.n418 = icmp eq i64 %n.vec416, %18
  br i1 %cmp.n418, label %.loopexit, label %.lr.ph360.preheader440

.lr.ph360.preheader440:                           ; preds = %.lr.ph360.preheader, %middle.block411
  %.ph441 = phi i64 [ 0, %.lr.ph360.preheader ], [ %n.vec416, %middle.block411 ]
  br label %.lr.ph360

.lr.ph360:                                        ; preds = %.lr.ph360.preheader440, %.lr.ph360
  %180 = phi i64 [ %184, %.lr.ph360 ], [ %.ph441, %.lr.ph360.preheader440 ]
  %181 = getelementptr i64, ptr %20, i64 %180
  %182 = load i64, ptr %181, align 8, !tbaa !3
  %183 = trunc i64 %182 to i32
  %184 = add nuw nsw i64 %180, 1
  %185 = getelementptr i32, ptr %172, i64 %180
  store i32 %183, ptr %185, align 4, !tbaa !3
  %exitcond369.not = icmp eq i64 %184, %18
  br i1 %exitcond369.not, label %.loopexit, label %.lr.ph360, !llvm.loop !23

.loopexit:                                        ; preds = %.lr.ph356, %.lr.ph360, %middle.block, %middle.block411
  %.ph = phi ptr [ %172, %middle.block411 ], [ %135, %middle.block ], [ %172, %.lr.ph360 ], [ %135, %.lr.ph356 ]
  br i1 %.not, label %.loopexit.thread, label %.thread349

.thread349:                                       ; preds = %133, %.loopexit
  %.ph393 = phi ptr [ %.ph, %.loopexit ], [ %135, %133 ]
  call void @free(ptr nonnull %.unpack278)
  br label %.loopexit.thread

.loopexit.thread:                                 ; preds = %170, %.thread349, %.loopexit
  %.ph390 = phi ptr [ %.ph393, %.thread349 ], [ %.ph, %.loopexit ], [ %172, %170 ]
  store ptr %.ph390, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 %18, ptr @_QFEa.8, align 8, !tbaa !7
  br label %._crit_edge358

._crit_edge358:                                   ; preds = %.lr.ph357.prol.loopexit, %.lr.ph357, %middle.block398, %.preheader, %.loopexit.thread
  %.unpack290 = phi ptr [ %.ph390, %.loopexit.thread ], [ %.unpack278, %.preheader ], [ %.unpack278, %middle.block398 ], [ %.unpack278, %.lr.ph357 ], [ %.unpack278, %.lr.ph357.prol.loopexit ]
  %186 = load i32, ptr %3, align 4, !tbaa !3
  %187 = icmp sgt i32 %186, 0
  br i1 %187, label %.lr.ph363, label %._crit_edge364

.lr.ph363:                                        ; preds = %._crit_edge358
  %188 = zext i32 %186 to i64
  %min.iters.check426 = icmp ult i32 %186, 4
  br i1 %min.iters.check426, label %scalar.ph425.preheader, label %vector.ph427

vector.ph427:                                     ; preds = %.lr.ph363
  %n.vec429 = and i64 %188, 4294967292
  %ind.end = or i64 %n.vec429, 1
  br label %vector.body432

vector.body432:                                   ; preds = %vector.body432, %vector.ph427
  %index433 = phi i64 [ 0, %vector.ph427 ], [ %index.next437, %vector.body432 ]
  %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph427 ], [ %193, %vector.body432 ]
  %vec.phi434 = phi <2 x i64> [ zeroinitializer, %vector.ph427 ], [ %194, %vector.body432 ]
  %189 = getelementptr i32, ptr %.unpack290, i64 %index433
  %wide.load435 = load <2 x i32>, ptr %189, align 4, !tbaa !3
  %190 = getelementptr i32, ptr %189, i64 2
  %wide.load436 = load <2 x i32>, ptr %190, align 4, !tbaa !3
  %191 = sext <2 x i32> %wide.load435 to <2 x i64>
  %192 = sext <2 x i32> %wide.load436 to <2 x i64>
  %193 = add <2 x i64> %vec.phi, %191
  %194 = add <2 x i64> %vec.phi434, %192
  %index.next437 = add nuw i64 %index433, 4
  %195 = icmp eq i64 %index.next437, %n.vec429
  br i1 %195, label %middle.block424, label %vector.body432, !llvm.loop !24

middle.block424:                                  ; preds = %vector.body432
  %bin.rdx = add <2 x i64> %194, %193
  %196 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n431 = icmp eq i64 %n.vec429, %188
  br i1 %cmp.n431, label %._crit_edge364, label %scalar.ph425.preheader

scalar.ph425.preheader:                           ; preds = %.lr.ph363, %middle.block424
  %indvars.iv370.ph = phi i64 [ 1, %.lr.ph363 ], [ %ind.end, %middle.block424 ]
  %.0361.ph = phi i64 [ 0, %.lr.ph363 ], [ %196, %middle.block424 ]
  br label %scalar.ph425

scalar.ph425:                                     ; preds = %scalar.ph425.preheader, %scalar.ph425
  %indvars.iv370 = phi i64 [ %indvars.iv.next371, %scalar.ph425 ], [ %indvars.iv370.ph, %scalar.ph425.preheader ]
  %.0361 = phi i64 [ %201, %scalar.ph425 ], [ %.0361.ph, %scalar.ph425.preheader ]
  %197 = add i64 %indvars.iv370, -1
  %198 = getelementptr i32, ptr %.unpack290, i64 %197
  %199 = load i32, ptr %198, align 4, !tbaa !3
  %200 = sext i32 %199 to i64
  %201 = add i64 %.0361, %200
  %indvars.iv.next371 = add nuw nsw i64 %indvars.iv370, 1
  %exitcond373.not = icmp eq i64 %indvars.iv370, %188
  br i1 %exitcond373.not, label %._crit_edge364, label %scalar.ph425, !llvm.loop !25

._crit_edge364:                                   ; preds = %scalar.ph425, %middle.block424, %._crit_edge358
  %.0.lcssa = phi i64 [ 0, %._crit_edge358 ], [ %196, %middle.block424 ], [ %201, %scalar.ph425 ]
  %202 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.123a0a149777795c02a044be7e38ef6a, i32 96)
  %203 = call i1 @_FortranAioOutputInteger64(ptr %202, i64 %.0.lcssa)
  %204 = call i32 @_FortranAioEndIoStatement(ptr %202)
  ret void
}

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

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 ptr @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger64(ptr, i64) 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 nosync nounwind willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #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 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 = !{!10}
!10 = distinct !{!10, !11}
!11 = distinct !{!11, !"LVerDomain"}
!12 = !{!13}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !15, !16}
!20 = distinct !{!20, !16, !15}
!21 = distinct !{!21, !15}
!22 = distinct !{!22, !15, !16}
!23 = distinct !{!23, !16, !15}
!24 = distinct !{!24, !15, !16}
!25 = distinct !{!25, !16, !15}
