program prob1
    implicit none
    integer(8)::N, i, j, maxf, count, ans, fc, ec
    integer, allocatable::h(:), m(:)
    read(*,*) N
    allocate(h(N))
    allocate(m(N))
    read(*,*) h
    maxf = maxval(h)
    ans = 0

    do while(maxf /= 0)
        count = 0
        do i = 1, N-1
            if(h(i) == 0 .and. h(i+1) > 0) then
                if(count == 0)then
                    fc = i
                end if
                ec = i
                count = count + 1
            end if
        end do
        count = count + 1

        if(sum(h(1:fc)) == 0) then
            count = count -1
        end if
        ans = ans + count

        do i = 1, N
            if(h(i) > 0) then
                h(i) = h(i) - 1
            end if
        end do

        maxf  = maxval(h)
    end do

    write(*,*) ans

    deallocate(h)
    deallocate(m)
    stop
end program prob1
; 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"

@_QFEh.0 = internal unnamed_addr global ptr null
@_QFEh.8 = internal unnamed_addr global i64 0
@_QFEm.0 = internal unnamed_addr global ptr null
@_QQcl.25839a824db9b30f25f701028f9b26c3 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5088/source.f\00"
@_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 {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i64, align 8
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.25839a824db9b30f25f701028f9b26c3, i32 5)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 8)
  %5 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %6 = load i64, ptr %2, align 8, !tbaa !3
  %7 = call i64 @llvm.smax.i64(i64 %6, i64 0)
  %8 = shl i64 %7, 2
  %9 = call ptr @malloc(i64 %8)
  store ptr %9, ptr @_QFEh.0, align 8, !tbaa !7
  store i64 %7, ptr @_QFEh.8, align 8, !tbaa !7
  %10 = call ptr @malloc(i64 %8)
  store ptr %10, ptr @_QFEm.0, align 8, !tbaa !7
  %11 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.25839a824db9b30f25f701028f9b26c3, i32 8)
  %.unpack = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %.unpack499.unpack.unpack501 = load i64, ptr @_QFEh.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 %.unpack499.unpack.unpack501, 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
  %12 = call i1 @_FortranAioInputDescriptor(ptr %11, ptr nonnull %1)
  %13 = call i32 @_FortranAioEndIoStatement(ptr %11)
  %.unpack504 = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %.unpack511.unpack.unpack513 = load i64, ptr @_QFEh.8, align 8, !tbaa !7
  %14 = icmp sgt i64 %.unpack511.unpack.unpack513, 0
  br i1 %14, label %.lr.ph.i.preheader, label %.lr.ph631.preheader

.lr.ph.i.preheader:                               ; preds = %0
  %min.iters.check = icmp ult i64 %.unpack511.unpack.unpack513, 8
  br i1 %min.iters.check, label %.lr.ph.i.preheader722, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.i.preheader
  %n.vec = and i64 %.unpack511.unpack.unpack513, -8
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, %vector.ph ], [ %18, %vector.body ]
  %vec.phi645 = phi <4 x i32> [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, %vector.ph ], [ %19, %vector.body ]
  %15 = shl i64 %index, 2
  %16 = getelementptr i8, ptr %.unpack504, i64 %15
  %wide.load = load <4 x i32>, ptr %16, align 4, !tbaa !3
  %17 = getelementptr i32, ptr %16, i64 4
  %wide.load646 = load <4 x i32>, ptr %17, align 4, !tbaa !3
  %18 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load, <4 x i32> %vec.phi)
  %19 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load646, <4 x i32> %vec.phi645)
  %index.next = add nuw i64 %index, 8
  %20 = icmp eq i64 %index.next, %n.vec
  br i1 %20, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %rdx.minmax.select = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %18, <4 x i32> %19)
  %21 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax.select)
  %cmp.n = icmp eq i64 %.unpack511.unpack.unpack513, %n.vec
  br i1 %cmp.n, label %_FortranAMaxvalInteger4x1_contract_simplified.exit, label %.lr.ph.i.preheader722

.lr.ph.i.preheader722:                            ; preds = %.lr.ph.i.preheader, %middle.block
  %.ph723 = phi i32 [ -2147483648, %.lr.ph.i.preheader ], [ %21, %middle.block ]
  %.ph724 = phi i64 [ 0, %.lr.ph.i.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph.i

.lr.ph.i:                                         ; preds = %.lr.ph.i.preheader722, %.lr.ph.i
  %22 = phi i32 [ %27, %.lr.ph.i ], [ %.ph723, %.lr.ph.i.preheader722 ]
  %23 = phi i64 [ %28, %.lr.ph.i ], [ %.ph724, %.lr.ph.i.preheader722 ]
  %24 = shl i64 %23, 2
  %25 = getelementptr i8, ptr %.unpack504, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !3
  %27 = call i32 @llvm.smax.i32(i32 %26, i32 %22)
  %28 = add nuw nsw i64 %23, 1
  %exitcond.not.i = icmp eq i64 %28, %.unpack511.unpack.unpack513
  br i1 %exitcond.not.i, label %_FortranAMaxvalInteger4x1_contract_simplified.exit, label %.lr.ph.i, !llvm.loop !12

_FortranAMaxvalInteger4x1_contract_simplified.exit: ; preds = %.lr.ph.i, %middle.block
  %.lcssa644 = phi i32 [ %21, %middle.block ], [ %27, %.lr.ph.i ]
  %29 = icmp eq i32 %.lcssa644, 0
  br i1 %29, label %._crit_edge632, label %.lr.ph631.preheader

.lr.ph631.preheader:                              ; preds = %0, %_FortranAMaxvalInteger4x1_contract_simplified.exit
  %min.iters.check649 = icmp ult i64 %.unpack511.unpack.unpack513, 8
  %n.vec652 = and i64 %.unpack511.unpack.unpack513, -8
  %cmp.n654 = icmp eq i64 %.unpack511.unpack.unpack513, %n.vec652
  br label %.lr.ph631

.lr.ph631:                                        ; preds = %.lr.ph631.preheader, %_FortranAMaxvalInteger4x1_contract_simplified.exit595
  %.0467630 = phi i64 [ %.1.lcssa, %_FortranAMaxvalInteger4x1_contract_simplified.exit595 ], [ undef, %.lr.ph631.preheader ]
  %.0468629 = phi i64 [ %90, %_FortranAMaxvalInteger4x1_contract_simplified.exit595 ], [ 0, %.lr.ph631.preheader ]
  %30 = load i64, ptr %2, align 8, !tbaa !3
  %31 = add i64 %30, -1
  %32 = icmp sgt i64 %31, 0
  br i1 %32, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.lr.ph631
  %xtraiter = and i64 %31, 1
  %33 = icmp eq i64 %30, 2
  br i1 %33, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %31, -2
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %34 = phi i64 [ 1, %.lr.ph.preheader.new ], [ %50, %.lr.ph ]
  %.1623 = phi i64 [ %.0467630, %.lr.ph.preheader.new ], [ %.3.1, %.lr.ph ]
  %.0469622 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %.1470.1, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %35 = add nsw i64 %34, -1
  %36 = getelementptr i32, ptr %.unpack504, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !3
  %38 = icmp eq i32 %37, 0
  %39 = add nuw i64 %34, 1
  %40 = getelementptr i32, ptr %.unpack504, i64 %34
  %41 = load i32, ptr %40, align 4, !tbaa !3
  %42 = icmp sgt i32 %41, 0
  %43 = and i1 %38, %42
  %44 = icmp eq i64 %.0469622, 0
  %45 = zext i1 %43 to i64
  %.1470 = add i64 %.0469622, %45
  %46 = select i1 %43, i1 %44, i1 false
  %.3 = select i1 %46, i64 %34, i64 %.1623
  %47 = getelementptr i32, ptr %.unpack504, i64 %34
  %48 = load i32, ptr %47, align 4, !tbaa !3
  %49 = icmp eq i32 %48, 0
  %50 = add nuw i64 %34, 2
  %51 = getelementptr i32, ptr %.unpack504, i64 %39
  %52 = load i32, ptr %51, align 4, !tbaa !3
  %53 = icmp sgt i32 %52, 0
  %54 = and i1 %49, %53
  %55 = icmp eq i64 %.1470, 0
  %56 = zext i1 %54 to i64
  %.1470.1 = add i64 %.1470, %56
  %57 = select i1 %54, i1 %55, i1 false
  %.3.1 = select i1 %57, i64 %39, i64 %.3
  %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 = %.lr.ph, %.lr.ph.preheader
  %.1470.lcssa.ph = phi i64 [ undef, %.lr.ph.preheader ], [ %.1470.1, %.lr.ph ]
  %.3.lcssa.ph = phi i64 [ undef, %.lr.ph.preheader ], [ %.3.1, %.lr.ph ]
  %.unr = phi i64 [ 1, %.lr.ph.preheader ], [ %50, %.lr.ph ]
  %.1623.unr = phi i64 [ %.0467630, %.lr.ph.preheader ], [ %.3.1, %.lr.ph ]
  %.0469622.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %.1470.1, %.lr.ph ]
  %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
  %58 = add i64 %.unr, -1
  %59 = getelementptr i32, ptr %.unpack504, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !3
  %61 = icmp eq i32 %60, 0
  %62 = getelementptr i32, ptr %.unpack504, i64 %.unr
  %63 = load i32, ptr %62, align 4, !tbaa !3
  %64 = icmp sgt i32 %63, 0
  %65 = and i1 %61, %64
  %66 = icmp eq i64 %.0469622.unr, 0
  %67 = zext i1 %65 to i64
  %.1470.epil = add i64 %.0469622.unr, %67
  %68 = select i1 %65, i1 %66, i1 false
  %.3.epil = select i1 %68, i64 %.unr, i64 %.1623.unr
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.epil, %._crit_edge.loopexit.unr-lcssa, %.lr.ph631
  %.0469.lcssa = phi i64 [ 0, %.lr.ph631 ], [ %.1470.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %.1470.epil, %.lr.ph.epil ]
  %.1.lcssa = phi i64 [ %.0467630, %.lr.ph631 ], [ %.3.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %.3.epil, %.lr.ph.epil ]
  %69 = add i64 %.0469.lcssa, 1
  %70 = call i64 @llvm.smax.i64(i64 %.1.lcssa, i64 0)
  %.not618 = icmp slt i64 %.1.lcssa, 1
  br i1 %.not618, label %_FortranASumInteger4x1_contract_simplified.exit.thread, label %.lr.ph.i589.preheader

.lr.ph.i589.preheader:                            ; preds = %._crit_edge
  %min.iters.check694 = icmp ult i64 %70, 8
  br i1 %min.iters.check694, label %.lr.ph.i589.preheader712, label %vector.ph695

vector.ph695:                                     ; preds = %.lr.ph.i589.preheader
  %n.vec697 = and i64 %70, 9223372036854775800
  br label %vector.body700

vector.body700:                                   ; preds = %vector.body700, %vector.ph695
  %index701 = phi i64 [ 0, %vector.ph695 ], [ %index.next706, %vector.body700 ]
  %vec.phi702 = phi <4 x i32> [ zeroinitializer, %vector.ph695 ], [ %76, %vector.body700 ]
  %vec.phi703 = phi <4 x i32> [ zeroinitializer, %vector.ph695 ], [ %77, %vector.body700 ]
  %71 = shl i64 %index701, 2
  %72 = getelementptr i8, ptr %.unpack504, i64 %71
  %wide.load704 = load <4 x i32>, ptr %72, align 4, !tbaa !3
  %73 = getelementptr i32, ptr %72, i64 4
  %wide.load705 = load <4 x i32>, ptr %73, align 4, !tbaa !3
  %74 = freeze <4 x i32> %wide.load704
  %75 = freeze <4 x i32> %wide.load705
  %76 = add <4 x i32> %74, %vec.phi702
  %77 = add <4 x i32> %75, %vec.phi703
  %index.next706 = add nuw i64 %index701, 8
  %78 = icmp eq i64 %index.next706, %n.vec697
  br i1 %78, label %middle.block692, label %vector.body700, !llvm.loop !13

middle.block692:                                  ; preds = %vector.body700
  %bin.rdx = add <4 x i32> %77, %76
  %79 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n699 = icmp eq i64 %70, %n.vec697
  br i1 %cmp.n699, label %_FortranASumInteger4x1_contract_simplified.exit, label %.lr.ph.i589.preheader712

.lr.ph.i589.preheader712:                         ; preds = %.lr.ph.i589.preheader, %middle.block692
  %.ph713 = phi i32 [ 0, %.lr.ph.i589.preheader ], [ %79, %middle.block692 ]
  %.ph714 = phi i64 [ 0, %.lr.ph.i589.preheader ], [ %n.vec697, %middle.block692 ]
  br label %.lr.ph.i589

.lr.ph.i589:                                      ; preds = %.lr.ph.i589.preheader712, %.lr.ph.i589
  %80 = phi i32 [ %85, %.lr.ph.i589 ], [ %.ph713, %.lr.ph.i589.preheader712 ]
  %81 = phi i64 [ %86, %.lr.ph.i589 ], [ %.ph714, %.lr.ph.i589.preheader712 ]
  %82 = shl i64 %81, 2
  %83 = getelementptr i8, ptr %.unpack504, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !3
  %.fr619 = freeze i32 %84
  %85 = add i32 %.fr619, %80
  %86 = add nuw nsw i64 %81, 1
  %exitcond.not.i590 = icmp eq i64 %86, %70
  br i1 %exitcond.not.i590, label %_FortranASumInteger4x1_contract_simplified.exit, label %.lr.ph.i589, !llvm.loop !14

_FortranASumInteger4x1_contract_simplified.exit:  ; preds = %.lr.ph.i589, %middle.block692
  %.lcssa = phi i32 [ %79, %middle.block692 ], [ %85, %.lr.ph.i589 ]
  %87 = icmp eq i32 %.lcssa, 0
  br i1 %87, label %_FortranASumInteger4x1_contract_simplified.exit.thread, label %88

_FortranASumInteger4x1_contract_simplified.exit.thread: ; preds = %._crit_edge, %_FortranASumInteger4x1_contract_simplified.exit
  br label %88

88:                                               ; preds = %_FortranASumInteger4x1_contract_simplified.exit, %_FortranASumInteger4x1_contract_simplified.exit.thread
  %89 = phi i64 [ %.0469.lcssa, %_FortranASumInteger4x1_contract_simplified.exit.thread ], [ %69, %_FortranASumInteger4x1_contract_simplified.exit ]
  %90 = add i64 %89, %.0468629
  %91 = icmp sgt i64 %30, 0
  br i1 %91, label %.lr.ph626.preheader, label %._crit_edge627

.lr.ph626.preheader:                              ; preds = %88
  %min.iters.check667 = icmp ult i64 %30, 8
  br i1 %min.iters.check667, label %.lr.ph626.preheader710, label %vector.ph668

vector.ph668:                                     ; preds = %.lr.ph626.preheader
  %n.vec670 = and i64 %30, -8
  %ind.end = or i64 %n.vec670, 1
  br label %vector.body673

vector.body673:                                   ; preds = %pred.store.continue690, %vector.ph668
  %index674 = phi i64 [ 0, %vector.ph668 ], [ %index.next691, %pred.store.continue690 ]
  %92 = getelementptr i32, ptr %.unpack504, i64 %index674
  %wide.load675 = load <4 x i32>, ptr %92, align 4, !tbaa !3
  %93 = getelementptr i32, ptr %92, i64 4
  %wide.load676 = load <4 x i32>, ptr %93, align 4, !tbaa !3
  %94 = icmp sgt <4 x i32> %wide.load675, zeroinitializer
  %95 = icmp sgt <4 x i32> %wide.load676, zeroinitializer
  %96 = extractelement <4 x i1> %94, i64 0
  br i1 %96, label %pred.store.if, label %pred.store.continue

pred.store.if:                                    ; preds = %vector.body673
  %97 = getelementptr i32, ptr %.unpack504, i64 %index674
  %98 = extractelement <4 x i32> %wide.load675, i64 0
  %99 = add nsw i32 %98, -1
  store i32 %99, ptr %97, align 4, !tbaa !3
  br label %pred.store.continue

pred.store.continue:                              ; preds = %pred.store.if, %vector.body673
  %100 = extractelement <4 x i1> %94, i64 1
  br i1 %100, label %pred.store.if677, label %pred.store.continue678

pred.store.if677:                                 ; preds = %pred.store.continue
  %101 = or i64 %index674, 1
  %102 = getelementptr i32, ptr %.unpack504, i64 %101
  %103 = extractelement <4 x i32> %wide.load675, i64 1
  %104 = add nsw i32 %103, -1
  store i32 %104, ptr %102, align 4, !tbaa !3
  br label %pred.store.continue678

pred.store.continue678:                           ; preds = %pred.store.if677, %pred.store.continue
  %105 = extractelement <4 x i1> %94, i64 2
  br i1 %105, label %pred.store.if679, label %pred.store.continue680

pred.store.if679:                                 ; preds = %pred.store.continue678
  %106 = or i64 %index674, 2
  %107 = getelementptr i32, ptr %.unpack504, i64 %106
  %108 = extractelement <4 x i32> %wide.load675, i64 2
  %109 = add nsw i32 %108, -1
  store i32 %109, ptr %107, align 4, !tbaa !3
  br label %pred.store.continue680

pred.store.continue680:                           ; preds = %pred.store.if679, %pred.store.continue678
  %110 = extractelement <4 x i1> %94, i64 3
  br i1 %110, label %pred.store.if681, label %pred.store.continue682

pred.store.if681:                                 ; preds = %pred.store.continue680
  %111 = or i64 %index674, 3
  %112 = getelementptr i32, ptr %.unpack504, i64 %111
  %113 = extractelement <4 x i32> %wide.load675, i64 3
  %114 = add nsw i32 %113, -1
  store i32 %114, ptr %112, align 4, !tbaa !3
  br label %pred.store.continue682

pred.store.continue682:                           ; preds = %pred.store.if681, %pred.store.continue680
  %115 = extractelement <4 x i1> %95, i64 0
  br i1 %115, label %pred.store.if683, label %pred.store.continue684

pred.store.if683:                                 ; preds = %pred.store.continue682
  %116 = or i64 %index674, 4
  %117 = getelementptr i32, ptr %.unpack504, i64 %116
  %118 = extractelement <4 x i32> %wide.load676, i64 0
  %119 = add nsw i32 %118, -1
  store i32 %119, ptr %117, align 4, !tbaa !3
  br label %pred.store.continue684

pred.store.continue684:                           ; preds = %pred.store.if683, %pred.store.continue682
  %120 = extractelement <4 x i1> %95, i64 1
  br i1 %120, label %pred.store.if685, label %pred.store.continue686

pred.store.if685:                                 ; preds = %pred.store.continue684
  %121 = or i64 %index674, 5
  %122 = getelementptr i32, ptr %.unpack504, i64 %121
  %123 = extractelement <4 x i32> %wide.load676, i64 1
  %124 = add nsw i32 %123, -1
  store i32 %124, ptr %122, align 4, !tbaa !3
  br label %pred.store.continue686

pred.store.continue686:                           ; preds = %pred.store.if685, %pred.store.continue684
  %125 = extractelement <4 x i1> %95, i64 2
  br i1 %125, label %pred.store.if687, label %pred.store.continue688

pred.store.if687:                                 ; preds = %pred.store.continue686
  %126 = or i64 %index674, 6
  %127 = getelementptr i32, ptr %.unpack504, i64 %126
  %128 = extractelement <4 x i32> %wide.load676, i64 2
  %129 = add nsw i32 %128, -1
  store i32 %129, ptr %127, align 4, !tbaa !3
  br label %pred.store.continue688

pred.store.continue688:                           ; preds = %pred.store.if687, %pred.store.continue686
  %130 = extractelement <4 x i1> %95, i64 3
  br i1 %130, label %pred.store.if689, label %pred.store.continue690

pred.store.if689:                                 ; preds = %pred.store.continue688
  %131 = or i64 %index674, 7
  %132 = getelementptr i32, ptr %.unpack504, i64 %131
  %133 = extractelement <4 x i32> %wide.load676, i64 3
  %134 = add nsw i32 %133, -1
  store i32 %134, ptr %132, align 4, !tbaa !3
  br label %pred.store.continue690

pred.store.continue690:                           ; preds = %pred.store.if689, %pred.store.continue688
  %index.next691 = add nuw i64 %index674, 8
  %135 = icmp eq i64 %index.next691, %n.vec670
  br i1 %135, label %middle.block665, label %vector.body673, !llvm.loop !15

middle.block665:                                  ; preds = %pred.store.continue690
  %cmp.n672 = icmp eq i64 %30, %n.vec670
  br i1 %cmp.n672, label %._crit_edge627, label %.lr.ph626.preheader710

.lr.ph626.preheader710:                           ; preds = %.lr.ph626.preheader, %middle.block665
  %.ph711 = phi i64 [ 1, %.lr.ph626.preheader ], [ %ind.end, %middle.block665 ]
  br label %.lr.ph626

.lr.ph626:                                        ; preds = %.lr.ph626.preheader710, %143
  %136 = phi i64 [ %144, %143 ], [ %.ph711, %.lr.ph626.preheader710 ]
  %137 = add i64 %136, -1
  %138 = getelementptr i32, ptr %.unpack504, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !3
  %140 = icmp sgt i32 %139, 0
  br i1 %140, label %141, label %143

141:                                              ; preds = %.lr.ph626
  %142 = add nsw i32 %139, -1
  store i32 %142, ptr %138, align 4, !tbaa !3
  br label %143

143:                                              ; preds = %141, %.lr.ph626
  %144 = add nuw i64 %136, 1
  %exitcond637.not = icmp eq i64 %136, %30
  br i1 %exitcond637.not, label %._crit_edge627, label %.lr.ph626, !llvm.loop !16

._crit_edge627:                                   ; preds = %143, %middle.block665, %88
  br i1 %14, label %.lr.ph.i592.preheader, label %_FortranAMaxvalInteger4x1_contract_simplified.exit595

.lr.ph.i592.preheader:                            ; preds = %._crit_edge627
  br i1 %min.iters.check649, label %.lr.ph.i592.preheader708, label %vector.body655

vector.body655:                                   ; preds = %.lr.ph.i592.preheader, %vector.body655
  %index656 = phi i64 [ %index.next661, %vector.body655 ], [ 0, %.lr.ph.i592.preheader ]
  %vec.phi657 = phi <4 x i32> [ %148, %vector.body655 ], [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, %.lr.ph.i592.preheader ]
  %vec.phi658 = phi <4 x i32> [ %149, %vector.body655 ], [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, %.lr.ph.i592.preheader ]
  %145 = shl i64 %index656, 2
  %146 = getelementptr i8, ptr %.unpack504, i64 %145
  %wide.load659 = load <4 x i32>, ptr %146, align 4, !tbaa !3
  %147 = getelementptr i32, ptr %146, i64 4
  %wide.load660 = load <4 x i32>, ptr %147, align 4, !tbaa !3
  %148 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load659, <4 x i32> %vec.phi657)
  %149 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load660, <4 x i32> %vec.phi658)
  %index.next661 = add nuw i64 %index656, 8
  %150 = icmp eq i64 %index.next661, %n.vec652
  br i1 %150, label %middle.block647, label %vector.body655, !llvm.loop !17

middle.block647:                                  ; preds = %vector.body655
  %rdx.minmax.select663 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %148, <4 x i32> %149)
  %151 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax.select663)
  br i1 %cmp.n654, label %_FortranAMaxvalInteger4x1_contract_simplified.exit595, label %.lr.ph.i592.preheader708

.lr.ph.i592.preheader708:                         ; preds = %.lr.ph.i592.preheader, %middle.block647
  %.ph = phi i32 [ -2147483648, %.lr.ph.i592.preheader ], [ %151, %middle.block647 ]
  %.ph709 = phi i64 [ 0, %.lr.ph.i592.preheader ], [ %n.vec652, %middle.block647 ]
  br label %.lr.ph.i592

.lr.ph.i592:                                      ; preds = %.lr.ph.i592.preheader708, %.lr.ph.i592
  %152 = phi i32 [ %157, %.lr.ph.i592 ], [ %.ph, %.lr.ph.i592.preheader708 ]
  %153 = phi i64 [ %158, %.lr.ph.i592 ], [ %.ph709, %.lr.ph.i592.preheader708 ]
  %154 = shl i64 %153, 2
  %155 = getelementptr i8, ptr %.unpack504, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !3
  %157 = call i32 @llvm.smax.i32(i32 %156, i32 %152)
  %158 = add nuw nsw i64 %153, 1
  %exitcond.not.i593 = icmp eq i64 %158, %.unpack511.unpack.unpack513
  br i1 %exitcond.not.i593, label %_FortranAMaxvalInteger4x1_contract_simplified.exit595, label %.lr.ph.i592, !llvm.loop !18

_FortranAMaxvalInteger4x1_contract_simplified.exit595: ; preds = %.lr.ph.i592, %middle.block647, %._crit_edge627
  %.lcssa.i594 = phi i32 [ -2147483648, %._crit_edge627 ], [ %151, %middle.block647 ], [ %157, %.lr.ph.i592 ]
  %.not = icmp eq i32 %.lcssa.i594, 0
  br i1 %.not, label %._crit_edge632, label %.lr.ph631

._crit_edge632:                                   ; preds = %_FortranAMaxvalInteger4x1_contract_simplified.exit595, %_FortranAMaxvalInteger4x1_contract_simplified.exit
  %.0468.lcssa = phi i64 [ 0, %_FortranAMaxvalInteger4x1_contract_simplified.exit ], [ %90, %_FortranAMaxvalInteger4x1_contract_simplified.exit595 ]
  %159 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.25839a824db9b30f25f701028f9b26c3, i32 39)
  %160 = call i1 @_FortranAioOutputInteger64(ptr %159, i64 %.0468.lcssa)
  %161 = call i32 @_FortranAioEndIoStatement(ptr %159)
  %.unpack516 = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  call void @free(ptr %.unpack516)
  store ptr null, ptr @_QFEh.0, align 8, !tbaa !7
  store i64 0, ptr @_QFEh.8, align 8, !tbaa !7
  %.unpack528 = load ptr, ptr @_QFEm.0, align 8, !tbaa !7
  call void @free(ptr %.unpack528)
  store ptr null, ptr @_QFEm.0, align 8, !tbaa !7
  %162 = 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 ptr @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !11, !10}
!13 = distinct !{!13, !10, !11}
!14 = distinct !{!14, !11, !10}
!15 = distinct !{!15, !10, !11}
!16 = distinct !{!16, !11, !10}
!17 = distinct !{!17, !10, !11}
!18 = distinct !{!18, !11, !10}
