program candy
  implicit none

  integer :: n, i, k
  integer, allocatable :: a(:,:), tot(:)

  read(*,*) n

  allocate(a(n,2))
  read(*,*) a

  allocate(tot(n))

  do i = 1, n
     tot(i) = 0
  end do

  do i = 1, n
     do k = 1, i
        tot(i) = tot(i) + a(k,1)
     end do

     do k = i, n
        tot(i) = tot(i) + a(k,2)
     end do

  end do

  write(*,*) maxval(tot)

end program candy

     

  

  

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

@_QFEa.0 = internal unnamed_addr global ptr null
@_QFEa.8 = internal unnamed_addr global i64 0
@_QFEtot.0 = internal unnamed_addr global ptr null
@_QFEtot.8 = internal unnamed_addr global i64 0
@_QQcl.86ae79d57ccfc0edf64fb46b0cf98590 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6342/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

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] }, align 8
  %2 = alloca i32, align 4
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.86ae79d57ccfc0edf64fb46b0cf98590, i32 7)
  %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, 3
  %10 = call ptr @malloc(i64 %9)
  store ptr %10, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 %8, ptr @_QFEa.8, align 8, !tbaa !7
  %11 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.86ae79d57ccfc0edf64fb46b0cf98590, i32 10)
  %.unpack = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack349.unpack.unpack352 = load i64, ptr @_QFEa.8, align 8, !tbaa !7
  %12 = shl i64 %.unpack349.unpack.unpack352, 2
  store ptr %.unpack, ptr %1, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [2 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, [2 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, [2 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 2, ptr %.fca.3.gep, align 4, !tbaa !7
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [2 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, [2 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, [2 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, [2 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, [2 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  store i64 %.unpack349.unpack.unpack352, ptr %.fca.7.0.1.gep, align 8, !tbaa !7
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [2 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
  %.fca.7.1.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 1, i64 0
  store i64 1, ptr %.fca.7.1.0.gep, align 8, !tbaa !7
  %.fca.7.1.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 1, i64 1
  store i64 2, ptr %.fca.7.1.1.gep, align 8, !tbaa !7
  %.fca.7.1.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 1, i64 2
  store i64 %12, ptr %.fca.7.1.2.gep, align 8, !tbaa !7
  %13 = call i1 @_FortranAioInputDescriptor(ptr %11, ptr nonnull %1)
  %14 = call i32 @_FortranAioEndIoStatement(ptr %11)
  %15 = load i32, ptr %2, align 4, !tbaa !3
  %16 = call i32 @llvm.smax.i32(i32 %15, i32 0)
  %17 = zext i32 %16 to i64
  %18 = shl nuw nsw i64 %17, 2
  %19 = call ptr @malloc(i64 %18)
  store ptr %19, ptr @_QFEtot.0, align 8, !tbaa !7
  store i64 %17, ptr @_QFEtot.8, align 8, !tbaa !7
  %20 = sext i32 %15 to i64
  %21 = icmp sgt i32 %15, 0
  br i1 %21, label %.lr.ph452, label %._crit_edge453

.lr.ph452:                                        ; preds = %0
  %22 = shl nuw nsw i64 %20, 2
  call void @llvm.memset.p0.i64(ptr align 4 %19, i8 0, i64 %22, i1 false), !tbaa !3
  %.unpack419 = load ptr, ptr @_QFEa.0, align 8
  %.unpack426.unpack.unpack429 = load i64, ptr @_QFEa.8, align 8
  %23 = add i64 %.unpack426.unpack.unpack429, %20
  %24 = shl i64 %23, 2
  %uglygep464 = getelementptr i8, ptr %.unpack419, i64 %24
  br label %.lr.ph447

.lr.ph447:                                        ; preds = %._crit_edge450, %.lr.ph452
  %indvar = phi i64 [ %indvar.next, %._crit_edge450 ], [ 0, %.lr.ph452 ]
  %indvars.iv458 = phi i64 [ %indvars.iv.next459, %._crit_edge450 ], [ 1, %.lr.ph452 ]
  %indvars.iv456 = phi i64 [ %indvars.iv.next457, %._crit_edge450 ], [ 2, %.lr.ph452 ]
  %25 = sub i64 %20, %indvar
  %26 = shl nuw nsw i64 %indvar, 2
  %uglygep = getelementptr i8, ptr %19, i64 %26
  %27 = add i64 %26, 4
  %uglygep462 = getelementptr i8, ptr %19, i64 %27
  %28 = add i64 %.unpack426.unpack.unpack429, %indvar
  %29 = shl i64 %28, 2
  %uglygep463 = getelementptr i8, ptr %.unpack419, i64 %29
  %30 = xor i64 %indvar, -1
  %31 = add i64 %30, %20
  %32 = trunc i64 %indvars.iv458 to i32
  %33 = add nsw i64 %indvars.iv458, -1
  %34 = getelementptr i32, ptr %19, i64 %33
  %.promoted = load i32, ptr %34, align 4, !tbaa !3
  %min.iters.check479 = icmp ult i64 %indvars.iv458, 8
  br i1 %min.iters.check479, label %scalar.ph478.preheader, label %vector.memcheck470

vector.memcheck470:                               ; preds = %.lr.ph447
  %35 = shl nuw nsw i64 %indvar, 2
  %36 = add i64 %35, 4
  %uglygep473 = getelementptr i8, ptr %.unpack419, i64 %36
  %uglygep472 = getelementptr i8, ptr %19, i64 %36
  %uglygep471 = getelementptr i8, ptr %19, i64 %35
  %bound0474 = icmp ult ptr %uglygep471, %uglygep473
  %bound1475 = icmp ult ptr %.unpack419, %uglygep472
  %found.conflict476 = and i1 %bound0474, %bound1475
  br i1 %found.conflict476, label %scalar.ph478.preheader, label %vector.ph480

vector.ph480:                                     ; preds = %vector.memcheck470
  %n.vec482 = and i64 %indvars.iv458, 9223372036854775800
  %ind.end483 = or i64 %n.vec482, 1
  %37 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %.promoted, i64 0
  br label %vector.body486

vector.body486:                                   ; preds = %vector.body486, %vector.ph480
  %index487 = phi i64 [ 0, %vector.ph480 ], [ %index.next493, %vector.body486 ]
  %vec.phi488 = phi <4 x i32> [ %37, %vector.ph480 ], [ %40, %vector.body486 ]
  %vec.phi489 = phi <4 x i32> [ zeroinitializer, %vector.ph480 ], [ %41, %vector.body486 ]
  %38 = getelementptr i32, ptr %.unpack419, i64 %index487
  %wide.load491 = load <4 x i32>, ptr %38, align 4, !tbaa !3, !alias.scope !9
  %39 = getelementptr i32, ptr %38, i64 4
  %wide.load492 = load <4 x i32>, ptr %39, align 4, !tbaa !3, !alias.scope !9
  %40 = add <4 x i32> %wide.load491, %vec.phi488
  %41 = add <4 x i32> %wide.load492, %vec.phi489
  %index.next493 = add nuw i64 %index487, 8
  %42 = icmp eq i64 %index.next493, %n.vec482
  br i1 %42, label %middle.block477, label %vector.body486, !llvm.loop !12

middle.block477:                                  ; preds = %vector.body486
  %bin.rdx494 = add <4 x i32> %41, %40
  %43 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx494)
  store i32 %43, ptr %34, align 4, !tbaa !3
  %cmp.n485 = icmp eq i64 %indvars.iv458, %n.vec482
  br i1 %cmp.n485, label %._crit_edge, label %scalar.ph478.preheader

scalar.ph478.preheader:                           ; preds = %vector.memcheck470, %.lr.ph447, %middle.block477
  %indvars.iv.ph = phi i64 [ 1, %vector.memcheck470 ], [ 1, %.lr.ph447 ], [ %ind.end483, %middle.block477 ]
  %.ph519 = phi i32 [ %.promoted, %vector.memcheck470 ], [ %.promoted, %.lr.ph447 ], [ %43, %middle.block477 ]
  %44 = sub i64 %indvars.iv456, %indvars.iv.ph
  %45 = sub i64 %indvars.iv458, %indvars.iv.ph
  %xtraiter = and i64 %44, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %scalar.ph478.prol.loopexit, label %scalar.ph478.prol

scalar.ph478.prol:                                ; preds = %scalar.ph478.preheader, %scalar.ph478.prol
  %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %scalar.ph478.prol ], [ %indvars.iv.ph, %scalar.ph478.preheader ]
  %46 = phi i32 [ %50, %scalar.ph478.prol ], [ %.ph519, %scalar.ph478.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph478.prol ], [ 0, %scalar.ph478.preheader ]
  %47 = add i64 %indvars.iv.prol, -1
  %48 = getelementptr i32, ptr %.unpack419, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !3
  %50 = add i32 %49, %46
  store i32 %50, ptr %34, align 4, !tbaa !3
  %indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
  %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 %scalar.ph478.prol.loopexit, label %scalar.ph478.prol, !llvm.loop !15

scalar.ph478.prol.loopexit:                       ; preds = %scalar.ph478.prol, %scalar.ph478.preheader
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %scalar.ph478.preheader ], [ %indvars.iv.next.prol, %scalar.ph478.prol ]
  %.unr = phi i32 [ %.ph519, %scalar.ph478.preheader ], [ %50, %scalar.ph478.prol ]
  %51 = icmp ult i64 %45, 3
  br i1 %51, label %._crit_edge, label %scalar.ph478

scalar.ph478:                                     ; preds = %scalar.ph478.prol.loopexit, %scalar.ph478
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %scalar.ph478 ], [ %indvars.iv.unr, %scalar.ph478.prol.loopexit ]
  %52 = phi i32 [ %65, %scalar.ph478 ], [ %.unr, %scalar.ph478.prol.loopexit ]
  %53 = add i64 %indvars.iv, -1
  %54 = getelementptr i32, ptr %.unpack419, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !3
  %56 = add i32 %55, %52
  store i32 %56, ptr %34, align 4, !tbaa !3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %57 = getelementptr i32, ptr %.unpack419, i64 %indvars.iv
  %58 = load i32, ptr %57, align 4, !tbaa !3
  %59 = add i32 %58, %56
  store i32 %59, ptr %34, align 4, !tbaa !3
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %60 = getelementptr i32, ptr %.unpack419, i64 %indvars.iv.next
  %61 = load i32, ptr %60, align 4, !tbaa !3
  %62 = add i32 %61, %59
  store i32 %62, ptr %34, align 4, !tbaa !3
  %63 = getelementptr i32, ptr %.unpack419, i64 %indvars.iv.next.1
  %64 = load i32, ptr %63, align 4, !tbaa !3
  %65 = add i32 %64, %62
  store i32 %65, ptr %34, align 4, !tbaa !3
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %indvars.iv456
  br i1 %exitcond.not.3, label %._crit_edge, label %scalar.ph478, !llvm.loop !17

._crit_edge:                                      ; preds = %scalar.ph478.prol.loopexit, %scalar.ph478, %middle.block477
  %66 = sub nsw i64 1, %indvars.iv458
  %67 = add nsw i64 %66, %20
  %68 = icmp sgt i64 %67, 0
  br i1 %68, label %.lr.ph449, label %._crit_edge450

.lr.ph449:                                        ; preds = %._crit_edge
  %69 = add nsw i64 %indvars.iv458, -1
  %70 = getelementptr i32, ptr %19, i64 %69
  %.promoted451 = load i32, ptr %70, align 4, !tbaa !3
  %71 = trunc i64 %indvars.iv458 to i32
  %min.iters.check = icmp ult i64 %25, 12
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.scevcheck

vector.scevcheck:                                 ; preds = %.lr.ph449
  %72 = trunc i64 %31 to i32
  %73 = add i32 %32, %72
  %74 = icmp slt i32 %73, %32
  %75 = icmp ugt i64 %31, 4294967295
  %76 = or i1 %74, %75
  br i1 %76, label %scalar.ph.preheader, label %vector.memcheck

vector.memcheck:                                  ; preds = %vector.scevcheck
  %bound0 = icmp ult ptr %uglygep, %uglygep464
  %bound1 = icmp ult ptr %uglygep463, %uglygep462
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %25, -8
  %ind.end = sub i64 %67, %n.vec
  %.cast = trunc i64 %n.vec to i32
  %ind.end465 = add i32 %71, %.cast
  %77 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %.promoted451, i64 0
  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> [ %77, %vector.ph ], [ %83, %vector.body ]
  %vec.phi467 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %84, %vector.body ]
  %offset.idx = add i64 %indvars.iv458, %index
  %sext = shl i64 %offset.idx, 32
  %78 = ashr exact i64 %sext, 32
  %79 = add nsw i64 %78, -1
  %80 = add i64 %79, %.unpack426.unpack.unpack429
  %81 = getelementptr i32, ptr %.unpack419, i64 %80
  %wide.load = load <4 x i32>, ptr %81, align 4, !tbaa !3, !alias.scope !18
  %82 = getelementptr i32, ptr %81, i64 4
  %wide.load469 = load <4 x i32>, ptr %82, align 4, !tbaa !3, !alias.scope !18
  %83 = add <4 x i32> %wide.load, %vec.phi
  %84 = add <4 x i32> %wide.load469, %vec.phi467
  %index.next = add nuw i64 %index, 8
  %85 = icmp eq i64 %index.next, %n.vec
  br i1 %85, label %middle.block, label %vector.body, !llvm.loop !21

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %84, %83
  %86 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  store i32 %86, ptr %70, align 4, !tbaa !3
  %cmp.n = icmp eq i64 %25, %n.vec
  br i1 %cmp.n, label %._crit_edge450, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %vector.memcheck, %vector.scevcheck, %.lr.ph449, %middle.block
  %.ph516 = phi i32 [ %.promoted451, %vector.memcheck ], [ %.promoted451, %vector.scevcheck ], [ %.promoted451, %.lr.ph449 ], [ %86, %middle.block ]
  %.ph517 = phi i64 [ %67, %vector.memcheck ], [ %67, %vector.scevcheck ], [ %67, %.lr.ph449 ], [ %ind.end, %middle.block ]
  %.ph518 = phi i32 [ %71, %vector.memcheck ], [ %71, %vector.scevcheck ], [ %71, %.lr.ph449 ], [ %ind.end465, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %87 = phi i32 [ %95, %scalar.ph ], [ %.ph516, %scalar.ph.preheader ]
  %88 = phi i64 [ %97, %scalar.ph ], [ %.ph517, %scalar.ph.preheader ]
  %89 = phi i32 [ %96, %scalar.ph ], [ %.ph518, %scalar.ph.preheader ]
  %90 = sext i32 %89 to i64
  %91 = add nsw i64 %90, -1
  %92 = add i64 %91, %.unpack426.unpack.unpack429
  %93 = getelementptr i32, ptr %.unpack419, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !3
  %95 = add i32 %94, %87
  store i32 %95, ptr %70, align 4, !tbaa !3
  %96 = add nuw i32 %89, 1
  %97 = add nsw i64 %88, -1
  %98 = icmp ugt i64 %88, 1
  br i1 %98, label %scalar.ph, label %._crit_edge450, !llvm.loop !22

._crit_edge450:                                   ; preds = %scalar.ph, %middle.block, %._crit_edge
  %indvars.iv.next459 = add nuw nsw i64 %indvars.iv458, 1
  %indvars.iv.next457 = add nuw nsw i64 %indvars.iv456, 1
  %exitcond461.not = icmp eq i64 %indvars.iv458, %20
  %indvar.next = add i64 %indvar, 1
  br i1 %exitcond461.not, label %._crit_edge453, label %.lr.ph447

._crit_edge453:                                   ; preds = %._crit_edge450, %0
  %99 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.86ae79d57ccfc0edf64fb46b0cf98590, i32 29)
  %.unpack367 = load ptr, ptr @_QFEtot.0, align 8, !tbaa !7
  %.unpack374.unpack.unpack376 = load i64, ptr @_QFEtot.8, align 8, !tbaa !7
  %100 = icmp sgt i64 %.unpack374.unpack.unpack376, 0
  br i1 %100, label %.lr.ph.i.preheader, label %_FortranAMaxvalInteger4x1_contract_simplified.exit

.lr.ph.i.preheader:                               ; preds = %._crit_edge453
  %min.iters.check498 = icmp ult i64 %.unpack374.unpack.unpack376, 8
  br i1 %min.iters.check498, label %.lr.ph.i.preheader512, label %vector.ph499

vector.ph499:                                     ; preds = %.lr.ph.i.preheader
  %n.vec501 = and i64 %.unpack374.unpack.unpack376, -8
  br label %vector.body504

vector.body504:                                   ; preds = %vector.body504, %vector.ph499
  %index505 = phi i64 [ 0, %vector.ph499 ], [ %index.next510, %vector.body504 ]
  %vec.phi506 = phi <4 x i32> [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, %vector.ph499 ], [ %104, %vector.body504 ]
  %vec.phi507 = phi <4 x i32> [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, %vector.ph499 ], [ %105, %vector.body504 ]
  %101 = shl i64 %index505, 2
  %102 = getelementptr i8, ptr %.unpack367, i64 %101
  %wide.load508 = load <4 x i32>, ptr %102, align 4, !tbaa !3
  %103 = getelementptr i32, ptr %102, i64 4
  %wide.load509 = load <4 x i32>, ptr %103, align 4, !tbaa !3
  %104 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load508, <4 x i32> %vec.phi506)
  %105 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load509, <4 x i32> %vec.phi507)
  %index.next510 = add nuw i64 %index505, 8
  %106 = icmp eq i64 %index.next510, %n.vec501
  br i1 %106, label %middle.block496, label %vector.body504, !llvm.loop !23

middle.block496:                                  ; preds = %vector.body504
  %rdx.minmax.select = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %104, <4 x i32> %105)
  %107 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax.select)
  %cmp.n503 = icmp eq i64 %.unpack374.unpack.unpack376, %n.vec501
  br i1 %cmp.n503, label %_FortranAMaxvalInteger4x1_contract_simplified.exit, label %.lr.ph.i.preheader512

.lr.ph.i.preheader512:                            ; preds = %.lr.ph.i.preheader, %middle.block496
  %.ph = phi i32 [ -2147483648, %.lr.ph.i.preheader ], [ %107, %middle.block496 ]
  %.ph513 = phi i64 [ 0, %.lr.ph.i.preheader ], [ %n.vec501, %middle.block496 ]
  br label %.lr.ph.i

.lr.ph.i:                                         ; preds = %.lr.ph.i.preheader512, %.lr.ph.i
  %108 = phi i32 [ %113, %.lr.ph.i ], [ %.ph, %.lr.ph.i.preheader512 ]
  %109 = phi i64 [ %114, %.lr.ph.i ], [ %.ph513, %.lr.ph.i.preheader512 ]
  %110 = shl i64 %109, 2
  %111 = getelementptr i8, ptr %.unpack367, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !3
  %113 = call i32 @llvm.smax.i32(i32 %112, i32 %108)
  %114 = add nuw nsw i64 %109, 1
  %exitcond.not.i = icmp eq i64 %114, %.unpack374.unpack.unpack376
  br i1 %exitcond.not.i, label %_FortranAMaxvalInteger4x1_contract_simplified.exit, label %.lr.ph.i, !llvm.loop !24

_FortranAMaxvalInteger4x1_contract_simplified.exit: ; preds = %.lr.ph.i, %middle.block496, %._crit_edge453
  %.lcssa.i = phi i32 [ -2147483648, %._crit_edge453 ], [ %107, %middle.block496 ], [ %113, %.lr.ph.i ]
  %115 = call i1 @_FortranAioOutputInteger32(ptr %99, i32 %.lcssa.i)
  %116 = call i32 @_FortranAioEndIoStatement(ptr %99)
  ret void
}

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

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

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

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

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

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

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

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

; 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>) #3

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable 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 = distinct !{!12, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !13}
!18 = !{!19}
!19 = distinct !{!19, !20}
!20 = distinct !{!20, !"LVerDomain"}
!21 = distinct !{!21, !13, !14}
!22 = distinct !{!22, !13}
!23 = distinct !{!23, !13, !14}
!24 = distinct !{!24, !14, !13}
