module subprogram
	implicit none
contains
subroutine heapsort(n,array)
  implicit none
  integer,intent(in) :: n
  integer,intent(inout) :: array(1:n)
  
  integer ::i,k,j,l
  double precision :: t
  
  if(n.le.0)then
     write(6,*)"Error, at heapsort"; stop
  endif
  if(n.eq.1)return

  l=n/2+1
  k=n
  do while(k.ne.1)
     if(l.gt.1)then
        l=l-1
        t=array(L)
     else
        t=array(k)
        array(k)=array(1)
        k=k-1
        if(k.eq.1) then
           array(1)=t
           exit
        endif
     endif
     i=l
     j=l+l
     do while(j.le.k)
        if(j.lt.k)then
           if(array(j).lt.array(j+1))j=j+1
        endif
        if (t.lt.array(j))then
           array(i)=array(j)
           i=j
           j=j+j
        else
           j=k+1
        endif
     enddo
     array(i)=t
  enddo

  return
end subroutine heapsort

end module subprogram

program main
	use subprogram
	implicit none
    integer N, i, l
	integer(8) S
	integer, allocatable :: A(:)
	read(*, *) N
	allocate(A(1:N))
	read(*, *) A(1:N)
	do i = 1, N
		A(i) = A(i) - i
	end do
	call heapsort(N,A)
	if(mod(N, 2) == 0) then
		l = A(N/2)
		do i = 1, N
			A(i) = A(i) - l
		end do
		S = 0
		do i = 1, N
			S = S + abs(A(i))
		end do
		write(*, *) S
	else
		l = A((N+1)/2)
		do i = 1, N
			A(i) = A(i) - l
		end do
		S = 0
		do i = 1, N
			S = S + abs(A(i))
		end do
		write(*, *) S
	end if
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"

@_QQcl.455af014ec4e8665315c83b0e70679f2 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5800/source.f\00"
@_QQcl.4572726F722C2061742068656170736F7274 = linkonce constant [18 x i8] c"Error, at heapsort"
@_QFEa.0 = internal unnamed_addr global ptr null
@_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

define void @_QMsubprogramPheapsort(ptr nocapture readonly %0, ptr nocapture %1) local_unnamed_addr {
  %3 = load i32, ptr %0, align 4, !tbaa !3
  %4 = icmp slt i32 %3, 1
  br i1 %4, label %5, label %10

5:                                                ; preds = %2
  %6 = tail call ptr @_FortranAioBeginExternalListOutput(i32 6, ptr nonnull @_QQcl.455af014ec4e8665315c83b0e70679f2, i32 13)
  %7 = tail call i1 @_FortranAioOutputAscii(ptr %6, ptr nonnull @_QQcl.4572726F722C2061742068656170736F7274, i64 18)
  %8 = tail call i32 @_FortranAioEndIoStatement(ptr %6)
  %9 = tail call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

10:                                               ; preds = %2
  %11 = icmp eq i32 %3, 1
  br i1 %11, label %91, label %12

12:                                               ; preds = %10
  %13 = lshr i32 %3, 1
  %14 = add nuw nsw i32 %13, 1
  br label %15

15:                                               ; preds = %.split47.us, %12
  %.026 = phi i32 [ %3, %12 ], [ %.127.fr, %.split47.us ]
  %.025 = phi i32 [ %14, %12 ], [ %.1, %.split47.us ]
  %16 = icmp sgt i32 %.025, 1
  br i1 %16, label %17, label %23

17:                                               ; preds = %15
  %18 = add nsw i32 %.025, -1
  %19 = zext i32 %18 to i64
  %20 = add nsw i64 %19, -1
  %21 = getelementptr i32, ptr %1, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !3
  br label %32

23:                                               ; preds = %15
  %24 = zext i32 %.026 to i64
  %25 = add nsw i64 %24, -1
  %26 = getelementptr i32, ptr %1, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !3
  %28 = load i32, ptr %1, align 4, !tbaa !3
  store i32 %28, ptr %26, align 4, !tbaa !3
  %29 = add i32 %.026, -1
  %30 = icmp eq i32 %29, 1
  br i1 %30, label %31, label %32

31:                                               ; preds = %23
  store i32 %27, ptr %1, align 4, !tbaa !3
  br label %91

32:                                               ; preds = %17, %23
  %.127 = phi i32 [ %.026, %17 ], [ %29, %23 ]
  %.1 = phi i32 [ %18, %17 ], [ 1, %23 ]
  %.0.in = phi i32 [ %22, %17 ], [ %27, %23 ]
  %.127.fr = freeze i32 %.127
  %33 = shl nuw i32 %.1, 1
  %.not3441 = icmp sgt i32 %33, %.127.fr
  br i1 %.not3441, label %.split47.us, label %.lr.ph.lr.ph

.lr.ph.lr.ph:                                     ; preds = %32
  %.not.not = icmp eq i32 %.127.fr, 2147483647
  br i1 %.not.not, label %.lr.ph.preheader, label %.lr.ph.us

.lr.ph.preheader:                                 ; preds = %.lr.ph.lr.ph
  %.127.fr.le = freeze i32 %.127
  %34 = add i32 %.127.fr.le, 1
  %.not = icmp eq i32 %34, 2147483647
  %35 = sext i32 %34 to i64
  %36 = add nsw i64 %35, -1
  %37 = getelementptr i32, ptr %1, i64 %36
  %38 = getelementptr i32, ptr %1, i64 %35
  br label %59

.lr.ph.us:                                        ; preds = %.lr.ph.lr.ph, %.split.us.us
  %.028.ph43.us = phi i32 [ %58, %.split.us.us ], [ %33, %.lr.ph.lr.ph ]
  %.030.ph42.us = phi i32 [ %.129.us.us, %.split.us.us ], [ %.1, %.lr.ph.lr.ph ]
  %39 = icmp slt i32 %.028.ph43.us, %.127.fr
  br i1 %39, label %40, label %49

40:                                               ; preds = %.lr.ph.us
  %41 = sext i32 %.028.ph43.us to i64
  %42 = add nsw i64 %41, -1
  %43 = getelementptr i32, ptr %1, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !3
  %45 = getelementptr i32, ptr %1, i64 %41
  %46 = load i32, ptr %45, align 4, !tbaa !3
  %47 = icmp slt i32 %44, %46
  %48 = zext i1 %47 to i32
  %spec.select.us.us = or i32 %.028.ph43.us, %48
  br label %49

49:                                               ; preds = %40, %.lr.ph.us
  %.129.us.us = phi i32 [ %.028.ph43.us, %.lr.ph.us ], [ %spec.select.us.us, %40 ]
  %50 = sext i32 %.129.us.us to i64
  %51 = add nsw i64 %50, -1
  %52 = getelementptr i32, ptr %1, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !3
  %54 = icmp slt i32 %.0.in, %53
  br i1 %54, label %.split.us.us, label %.split47.us

.split.us.us:                                     ; preds = %49
  %55 = sext i32 %.030.ph42.us to i64
  %56 = add nsw i64 %55, -1
  %57 = getelementptr i32, ptr %1, i64 %56
  store i32 %53, ptr %57, align 4, !tbaa !3
  %58 = shl i32 %.129.us.us, 1
  %.not34.us = icmp sgt i32 %58, %.127.fr
  br i1 %.not34.us, label %.split47.us, label %.lr.ph.us

59:                                               ; preds = %.split, %.lr.ph.preheader
  %.028.ph43 = phi i32 [ %87, %.split ], [ %33, %.lr.ph.preheader ]
  %.030.ph42 = phi i32 [ %.129.lcssa, %.split ], [ %.1, %.lr.ph.preheader ]
  %60 = sext i32 %.028.ph43 to i64
  %61 = add nsw i64 %60, -1
  %62 = getelementptr i32, ptr %1, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !3
  %64 = getelementptr i32, ptr %1, i64 %60
  %65 = load i32, ptr %64, align 4, !tbaa !3
  %66 = icmp slt i32 %63, %65
  %67 = zext i1 %66 to i32
  %spec.select.peel = or i32 %.028.ph43, %67
  %68 = sext i32 %spec.select.peel to i64
  %69 = add nsw i64 %68, -1
  %70 = getelementptr i32, ptr %1, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !3
  %72 = icmp slt i32 %.0.in, %71
  br i1 %72, label %.split, label %.peel.next

.peel.next:                                       ; preds = %59, %78
  br i1 %.not, label %78, label %73

73:                                               ; preds = %.peel.next
  %74 = load i32, ptr %37, align 4, !tbaa !3
  %75 = load i32, ptr %38, align 4, !tbaa !3
  %76 = icmp slt i32 %74, %75
  %77 = zext i1 %76 to i32
  %spec.select = add nsw i32 %34, %77
  br label %78

78:                                               ; preds = %73, %.peel.next
  %.129 = phi i32 [ 2147483647, %.peel.next ], [ %spec.select, %73 ]
  %79 = sext i32 %.129 to i64
  %80 = add nsw i64 %79, -1
  %81 = getelementptr i32, ptr %1, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !3
  %83 = icmp slt i32 %.0.in, %82
  br i1 %83, label %.split, label %.peel.next, !llvm.loop !7

.split:                                           ; preds = %78, %59
  %.129.lcssa = phi i32 [ %spec.select.peel, %59 ], [ %.129, %78 ]
  %.lcssa = phi i32 [ %71, %59 ], [ %82, %78 ]
  %84 = sext i32 %.030.ph42 to i64
  %85 = add nsw i64 %84, -1
  %86 = getelementptr i32, ptr %1, i64 %85
  store i32 %.lcssa, ptr %86, align 4, !tbaa !3
  %87 = shl i32 %.129.lcssa, 1
  br label %59

.split47.us:                                      ; preds = %.split.us.us, %49, %32
  %.030.ph.lcssa = phi i32 [ %.1, %32 ], [ %.030.ph42.us, %49 ], [ %.129.us.us, %.split.us.us ]
  %88 = sext i32 %.030.ph.lcssa to i64
  %89 = add nsw i64 %88, -1
  %90 = getelementptr i32, ptr %1, i64 %89
  store i32 %.0.in, ptr %90, align 4, !tbaa !3
  br label %15

91:                                               ; preds = %31, %10
  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 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.455af014ec4e8665315c83b0e70679f2, i32 60)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 4)
  %5 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %6 = load i32, ptr %2, align 4, !tbaa !3
  %7 = call i32 @llvm.smax.i32(i32 %6, i32 0)
  %8 = zext i32 %7 to i64
  %9 = shl nuw nsw i64 %8, 2
  %10 = call ptr @malloc(i64 %9)
  store ptr %10, ptr @_QFEa.0, align 8, !tbaa !9
  %11 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.455af014ec4e8665315c83b0e70679f2, i32 62)
  %.unpack = load ptr, ptr @_QFEa.0, align 8, !tbaa !9
  %12 = load i32, ptr %2, align 4, !tbaa !3
  %13 = call i32 @llvm.smax.i32(i32 %12, i32 0)
  %14 = zext i32 %13 to i64
  store ptr %.unpack, ptr %1, align 8, !tbaa !9
  %.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 !9
  %.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 !9
  %.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 !9
  %.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 !9
  %.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 !9
  %.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 !9
  %.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 !9
  %.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 %14, ptr %.fca.7.0.1.gep, align 8, !tbaa !9
  %.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 !9
  %15 = call i1 @_FortranAioInputDescriptor(ptr %11, ptr nonnull %1)
  %16 = call i32 @_FortranAioEndIoStatement(ptr %11)
  %17 = load i32, ptr %2, align 4, !tbaa !3
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.unpack317.pre = load ptr, ptr @_QFEa.0, align 8, !tbaa !9
  br label %._crit_edge

.lr.ph:                                           ; preds = %0
  %19 = zext i32 %17 to i64
  %.unpack401 = load ptr, ptr @_QFEa.0, align 8, !tbaa !9
  %min.iters.check = icmp ult i32 %17, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %19, 4294967288
  %ind.end = or i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %20 = getelementptr i32, ptr %.unpack401, i64 %index
  %wide.load = load <4 x i32>, ptr %20, align 4, !tbaa !3
  %21 = getelementptr i32, ptr %20, i64 4
  %wide.load456 = load <4 x i32>, ptr %21, align 4, !tbaa !3
  %22 = sub <4 x i32> %wide.load, %vec.ind
  %23 = sub <4 x i32> %wide.load456, %step.add
  store <4 x i32> %22, ptr %20, align 4, !tbaa !3
  store <4 x i32> %23, ptr %21, align 4, !tbaa !3
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %24 = icmp eq i64 %index.next, %n.vec
  br i1 %24, label %middle.block, label %vector.body, !llvm.loop !11

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

scalar.ph.preheader:                              ; preds = %.lr.ph, %middle.block
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph ], [ %ind.end, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %25 = add i64 %indvars.iv, -1
  %26 = getelementptr i32, ptr %.unpack401, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !3
  %28 = trunc i64 %indvars.iv to i32
  %29 = sub i32 %27, %28
  store i32 %29, ptr %26, align 4, !tbaa !3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %19
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !14

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %.._crit_edge_crit_edge
  %.unpack317 = phi ptr [ %.unpack317.pre, %.._crit_edge_crit_edge ], [ %.unpack401, %middle.block ], [ %.unpack401, %scalar.ph ]
  call void @_QMsubprogramPheapsort(ptr nonnull %2, ptr %.unpack317)
  %30 = load i32, ptr %2, align 4, !tbaa !3
  %31 = and i32 %30, 1
  %32 = icmp eq i32 %31, 0
  %.unpack365 = load ptr, ptr @_QFEa.0, align 8, !tbaa !9
  br i1 %32, label %33, label %68

33:                                               ; preds = %._crit_edge
  %34 = sdiv i32 %30, 2
  %narrow528 = add nsw i32 %34, -1
  %35 = sext i32 %narrow528 to i64
  %36 = getelementptr i32, ptr %.unpack365, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !3
  %38 = sext i32 %30 to i64
  %39 = icmp sgt i32 %30, 0
  br i1 %39, label %.lr.ph421.preheader, label %._crit_edge426

.lr.ph421.preheader:                              ; preds = %33
  %min.iters.check492 = icmp ult i32 %30, 8
  br i1 %min.iters.check492, label %.lr.ph421.preheader532, label %vector.ph493

vector.ph493:                                     ; preds = %.lr.ph421.preheader
  %n.vec495 = and i64 %38, -8
  %ind.end496 = or i64 %n.vec495, 1
  %broadcast.splatinsert504 = insertelement <4 x i32> poison, i32 %37, i64 0
  %broadcast.splat505 = shufflevector <4 x i32> %broadcast.splatinsert504, <4 x i32> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert506 = insertelement <4 x i32> poison, i32 %37, i64 0
  %broadcast.splat507 = shufflevector <4 x i32> %broadcast.splatinsert506, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body499

vector.body499:                                   ; preds = %vector.body499, %vector.ph493
  %index500 = phi i64 [ 0, %vector.ph493 ], [ %index.next508, %vector.body499 ]
  %40 = getelementptr i32, ptr %.unpack365, i64 %index500
  %wide.load502 = load <4 x i32>, ptr %40, align 4, !tbaa !3
  %41 = getelementptr i32, ptr %40, i64 4
  %wide.load503 = load <4 x i32>, ptr %41, align 4, !tbaa !3
  %42 = sub <4 x i32> %wide.load502, %broadcast.splat505
  %43 = sub <4 x i32> %wide.load503, %broadcast.splat507
  store <4 x i32> %42, ptr %40, align 4, !tbaa !3
  store <4 x i32> %43, ptr %41, align 4, !tbaa !3
  %index.next508 = add nuw i64 %index500, 8
  %44 = icmp eq i64 %index.next508, %n.vec495
  br i1 %44, label %middle.block490, label %vector.body499, !llvm.loop !15

middle.block490:                                  ; preds = %vector.body499
  %cmp.n498 = icmp eq i64 %n.vec495, %38
  br i1 %cmp.n498, label %._crit_edge422, label %.lr.ph421.preheader532

.lr.ph421.preheader532:                           ; preds = %.lr.ph421.preheader, %middle.block490
  %indvars.iv438.ph = phi i64 [ 1, %.lr.ph421.preheader ], [ %ind.end496, %middle.block490 ]
  br label %.lr.ph421

.lr.ph421:                                        ; preds = %.lr.ph421.preheader532, %.lr.ph421
  %indvars.iv438 = phi i64 [ %indvars.iv.next439, %.lr.ph421 ], [ %indvars.iv438.ph, %.lr.ph421.preheader532 ]
  %45 = add i64 %indvars.iv438, -1
  %46 = getelementptr i32, ptr %.unpack365, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !3
  %48 = sub i32 %47, %37
  store i32 %48, ptr %46, align 4, !tbaa !3
  %indvars.iv.next439 = add nuw nsw i64 %indvars.iv438, 1
  %exitcond441.not = icmp eq i64 %indvars.iv438, %38
  br i1 %exitcond441.not, label %._crit_edge422, label %.lr.ph421, !llvm.loop !16

._crit_edge422:                                   ; preds = %.lr.ph421, %middle.block490
  %.pre447 = load i32, ptr %2, align 4, !tbaa !3
  %.pre448 = sext i32 %.pre447 to i64
  %49 = icmp sgt i32 %.pre447, 0
  br i1 %49, label %.lr.ph425.preheader, label %._crit_edge426

.lr.ph425.preheader:                              ; preds = %._crit_edge422
  %min.iters.check511 = icmp ult i32 %.pre447, 4
  br i1 %min.iters.check511, label %.lr.ph425.preheader529, label %vector.ph512

vector.ph512:                                     ; preds = %.lr.ph425.preheader
  %n.vec514 = and i64 %.pre448, -4
  %ind.end515 = or i64 %n.vec514, 1
  br label %vector.body518

vector.body518:                                   ; preds = %vector.body518, %vector.ph512
  %index519 = phi i64 [ 0, %vector.ph512 ], [ %index.next525, %vector.body518 ]
  %vec.phi520 = phi <2 x i64> [ zeroinitializer, %vector.ph512 ], [ %56, %vector.body518 ]
  %vec.phi521 = phi <2 x i64> [ zeroinitializer, %vector.ph512 ], [ %57, %vector.body518 ]
  %50 = getelementptr i32, ptr %.unpack365, i64 %index519
  %wide.load523 = load <2 x i32>, ptr %50, align 4, !tbaa !3
  %51 = getelementptr i32, ptr %50, i64 2
  %wide.load524 = load <2 x i32>, ptr %51, align 4, !tbaa !3
  %52 = call <2 x i32> @llvm.abs.v2i32(<2 x i32> %wide.load523, i1 false)
  %53 = call <2 x i32> @llvm.abs.v2i32(<2 x i32> %wide.load524, i1 false)
  %54 = sext <2 x i32> %52 to <2 x i64>
  %55 = sext <2 x i32> %53 to <2 x i64>
  %56 = add <2 x i64> %vec.phi520, %54
  %57 = add <2 x i64> %vec.phi521, %55
  %index.next525 = add nuw i64 %index519, 4
  %58 = icmp eq i64 %index.next525, %n.vec514
  br i1 %58, label %middle.block509, label %vector.body518, !llvm.loop !17

middle.block509:                                  ; preds = %vector.body518
  %bin.rdx526 = add <2 x i64> %57, %56
  %59 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx526)
  %cmp.n517 = icmp eq i64 %n.vec514, %.pre448
  br i1 %cmp.n517, label %._crit_edge426, label %.lr.ph425.preheader529

.lr.ph425.preheader529:                           ; preds = %.lr.ph425.preheader, %middle.block509
  %indvars.iv442.ph = phi i64 [ 1, %.lr.ph425.preheader ], [ %ind.end515, %middle.block509 ]
  %.0423.ph = phi i64 [ 0, %.lr.ph425.preheader ], [ %59, %middle.block509 ]
  br label %.lr.ph425

.lr.ph425:                                        ; preds = %.lr.ph425.preheader529, %.lr.ph425
  %indvars.iv442 = phi i64 [ %indvars.iv.next443, %.lr.ph425 ], [ %indvars.iv442.ph, %.lr.ph425.preheader529 ]
  %.0423 = phi i64 [ %65, %.lr.ph425 ], [ %.0423.ph, %.lr.ph425.preheader529 ]
  %60 = add i64 %indvars.iv442, -1
  %61 = getelementptr i32, ptr %.unpack365, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !3
  %63 = call i32 @llvm.abs.i32(i32 %62, i1 false)
  %64 = sext i32 %63 to i64
  %65 = add i64 %.0423, %64
  %indvars.iv.next443 = add nuw nsw i64 %indvars.iv442, 1
  %exitcond445.not = icmp eq i64 %indvars.iv442, %.pre448
  br i1 %exitcond445.not, label %._crit_edge426, label %.lr.ph425, !llvm.loop !18

._crit_edge426:                                   ; preds = %.lr.ph425, %middle.block509, %33, %._crit_edge422
  %.0.lcssa = phi i64 [ 0, %._crit_edge422 ], [ 0, %33 ], [ %59, %middle.block509 ], [ %65, %.lr.ph425 ]
  %66 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.455af014ec4e8665315c83b0e70679f2, i32 76)
  %67 = call i1 @_FortranAioOutputInteger64(ptr %66, i64 %.0.lcssa)
  br label %104

68:                                               ; preds = %._crit_edge
  %69 = add i32 %30, 1
  %70 = sdiv i32 %69, 2
  %narrow = add nsw i32 %70, -1
  %71 = sext i32 %narrow to i64
  %72 = getelementptr i32, ptr %.unpack365, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !3
  %74 = sext i32 %30 to i64
  %75 = icmp sgt i32 %30, 0
  br i1 %75, label %.lr.ph414.preheader, label %._crit_edge419

.lr.ph414.preheader:                              ; preds = %68
  %min.iters.check459 = icmp ult i32 %30, 8
  br i1 %min.iters.check459, label %.lr.ph414.preheader537, label %vector.ph460

vector.ph460:                                     ; preds = %.lr.ph414.preheader
  %n.vec462 = and i64 %74, -8
  %ind.end463 = or i64 %n.vec462, 1
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %73, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert471 = insertelement <4 x i32> poison, i32 %73, i64 0
  %broadcast.splat472 = shufflevector <4 x i32> %broadcast.splatinsert471, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body466

vector.body466:                                   ; preds = %vector.body466, %vector.ph460
  %index467 = phi i64 [ 0, %vector.ph460 ], [ %index.next473, %vector.body466 ]
  %76 = getelementptr i32, ptr %.unpack365, i64 %index467
  %wide.load469 = load <4 x i32>, ptr %76, align 4, !tbaa !3
  %77 = getelementptr i32, ptr %76, i64 4
  %wide.load470 = load <4 x i32>, ptr %77, align 4, !tbaa !3
  %78 = sub <4 x i32> %wide.load469, %broadcast.splat
  %79 = sub <4 x i32> %wide.load470, %broadcast.splat472
  store <4 x i32> %78, ptr %76, align 4, !tbaa !3
  store <4 x i32> %79, ptr %77, align 4, !tbaa !3
  %index.next473 = add nuw i64 %index467, 8
  %80 = icmp eq i64 %index.next473, %n.vec462
  br i1 %80, label %middle.block457, label %vector.body466, !llvm.loop !19

middle.block457:                                  ; preds = %vector.body466
  %cmp.n465 = icmp eq i64 %n.vec462, %74
  br i1 %cmp.n465, label %._crit_edge415, label %.lr.ph414.preheader537

.lr.ph414.preheader537:                           ; preds = %.lr.ph414.preheader, %middle.block457
  %indvars.iv430.ph = phi i64 [ 1, %.lr.ph414.preheader ], [ %ind.end463, %middle.block457 ]
  br label %.lr.ph414

.lr.ph414:                                        ; preds = %.lr.ph414.preheader537, %.lr.ph414
  %indvars.iv430 = phi i64 [ %indvars.iv.next431, %.lr.ph414 ], [ %indvars.iv430.ph, %.lr.ph414.preheader537 ]
  %81 = add i64 %indvars.iv430, -1
  %82 = getelementptr i32, ptr %.unpack365, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !3
  %84 = sub i32 %83, %73
  store i32 %84, ptr %82, align 4, !tbaa !3
  %indvars.iv.next431 = add nuw nsw i64 %indvars.iv430, 1
  %exitcond433.not = icmp eq i64 %indvars.iv430, %74
  br i1 %exitcond433.not, label %._crit_edge415, label %.lr.ph414, !llvm.loop !20

._crit_edge415:                                   ; preds = %.lr.ph414, %middle.block457
  %.pre = load i32, ptr %2, align 4, !tbaa !3
  %.pre449 = sext i32 %.pre to i64
  %85 = icmp sgt i32 %.pre, 0
  br i1 %85, label %.lr.ph418.preheader, label %._crit_edge419

.lr.ph418.preheader:                              ; preds = %._crit_edge415
  %min.iters.check476 = icmp ult i32 %.pre, 4
  br i1 %min.iters.check476, label %.lr.ph418.preheader533, label %vector.ph477

vector.ph477:                                     ; preds = %.lr.ph418.preheader
  %n.vec479 = and i64 %.pre449, -4
  %ind.end480 = or i64 %n.vec479, 1
  br label %vector.body483

vector.body483:                                   ; preds = %vector.body483, %vector.ph477
  %index484 = phi i64 [ 0, %vector.ph477 ], [ %index.next489, %vector.body483 ]
  %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph477 ], [ %92, %vector.body483 ]
  %vec.phi485 = phi <2 x i64> [ zeroinitializer, %vector.ph477 ], [ %93, %vector.body483 ]
  %86 = getelementptr i32, ptr %.unpack365, i64 %index484
  %wide.load487 = load <2 x i32>, ptr %86, align 4, !tbaa !3
  %87 = getelementptr i32, ptr %86, i64 2
  %wide.load488 = load <2 x i32>, ptr %87, align 4, !tbaa !3
  %88 = call <2 x i32> @llvm.abs.v2i32(<2 x i32> %wide.load487, i1 false)
  %89 = call <2 x i32> @llvm.abs.v2i32(<2 x i32> %wide.load488, i1 false)
  %90 = sext <2 x i32> %88 to <2 x i64>
  %91 = sext <2 x i32> %89 to <2 x i64>
  %92 = add <2 x i64> %vec.phi, %90
  %93 = add <2 x i64> %vec.phi485, %91
  %index.next489 = add nuw i64 %index484, 4
  %94 = icmp eq i64 %index.next489, %n.vec479
  br i1 %94, label %middle.block474, label %vector.body483, !llvm.loop !21

middle.block474:                                  ; preds = %vector.body483
  %bin.rdx = add <2 x i64> %93, %92
  %95 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n482 = icmp eq i64 %n.vec479, %.pre449
  br i1 %cmp.n482, label %._crit_edge419, label %.lr.ph418.preheader533

.lr.ph418.preheader533:                           ; preds = %.lr.ph418.preheader, %middle.block474
  %indvars.iv434.ph = phi i64 [ 1, %.lr.ph418.preheader ], [ %ind.end480, %middle.block474 ]
  %.1416.ph = phi i64 [ 0, %.lr.ph418.preheader ], [ %95, %middle.block474 ]
  br label %.lr.ph418

.lr.ph418:                                        ; preds = %.lr.ph418.preheader533, %.lr.ph418
  %indvars.iv434 = phi i64 [ %indvars.iv.next435, %.lr.ph418 ], [ %indvars.iv434.ph, %.lr.ph418.preheader533 ]
  %.1416 = phi i64 [ %101, %.lr.ph418 ], [ %.1416.ph, %.lr.ph418.preheader533 ]
  %96 = add i64 %indvars.iv434, -1
  %97 = getelementptr i32, ptr %.unpack365, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !3
  %99 = call i32 @llvm.abs.i32(i32 %98, i1 false)
  %100 = sext i32 %99 to i64
  %101 = add i64 %.1416, %100
  %indvars.iv.next435 = add nuw nsw i64 %indvars.iv434, 1
  %exitcond437.not = icmp eq i64 %indvars.iv434, %.pre449
  br i1 %exitcond437.not, label %._crit_edge419, label %.lr.ph418, !llvm.loop !22

._crit_edge419:                                   ; preds = %.lr.ph418, %middle.block474, %68, %._crit_edge415
  %.1.lcssa = phi i64 [ 0, %._crit_edge415 ], [ 0, %68 ], [ %95, %middle.block474 ], [ %101, %.lr.ph418 ]
  %102 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.455af014ec4e8665315c83b0e70679f2, i32 86)
  %103 = call i1 @_FortranAioOutputInteger64(ptr %102, i64 %.1.lcssa)
  br label %104

104:                                              ; preds = %._crit_edge426, %._crit_edge419
  %.sink = phi ptr [ %66, %._crit_edge426 ], [ %102, %._crit_edge419 ]
  %105 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  ret void
}

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

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

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

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

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

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

declare i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

declare i1 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i32> @llvm.abs.v2i32(<2 x i32>, i1 immarg) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #2

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 = distinct !{!7, !8}
!8 = !{!"llvm.loop.peeled.count", i32 1}
!9 = !{!10, !10, i64 0}
!10 = !{!"descriptor member", !5, i64 0}
!11 = distinct !{!11, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !13, !12}
!15 = distinct !{!15, !12, !13}
!16 = distinct !{!16, !13, !12}
!17 = distinct !{!17, !12, !13}
!18 = distinct !{!18, !13, !12}
!19 = distinct !{!19, !12, !13}
!20 = distinct !{!20, !13, !12}
!21 = distinct !{!21, !12, !13}
!22 = distinct !{!22, !13, !12}
