program main
  implicit none
  integer :: N
  integer,allocatable :: A(:)
  integer,allocatable :: A2(:)
  integer :: i
  integer :: mloc_tmp(1)
  integer :: mval, mloc
  read(*,*) N
  allocate(A(N))
  allocate(A2(N-1))
  do i = 1,N
     read(*,*) A(i)
  end do
  mloc_tmp = maxloc(A)
  mval = maxval(A)
  mloc = mloc_tmp(1)
  !
  do i = 1,mloc-1
     A2(i) = A(i)
  end do
  do i = mloc+1,N
     A2(i-1) = A(i)
  end do
  !
  do i = 1,N
     if ( i == mloc ) then
        write(*,'(i0)') maxval(A2)
     else
        write(*,'(i0)') mval
     end if
  end do

  deallocate(A2,A)
  stop
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"

@_QFEa.0 = internal unnamed_addr global ptr null
@_QFEa.8 = internal unnamed_addr global i64 0
@_QFEa2.0 = internal unnamed_addr global ptr null
@_QFEa2.8 = internal unnamed_addr global i64 0
@_QQcl.a381292fed6a7d49ec761d83f0141ed9 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3730/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #2 {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %3 = alloca i32, align 4
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.a381292fed6a7d49ec761d83f0141ed9, i32 9)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 4)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %7 = load i32, ptr %3, align 4, !tbaa !3
  %8 = call i32 @llvm.smax.i32(i32 %7, i32 0)
  %9 = zext i32 %8 to i64
  %10 = shl nuw nsw i64 %9, 2
  %11 = call ptr @malloc(i64 %10)
  store ptr %11, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 %9, ptr @_QFEa.8, align 8, !tbaa !7
  %12 = add i32 %7, -1
  %13 = call i32 @llvm.smax.i32(i32 %12, i32 0)
  %14 = zext i32 %13 to i64
  %15 = shl nuw nsw i64 %14, 2
  %16 = call ptr @malloc(i64 %15)
  store ptr %16, ptr @_QFEa2.0, align 8, !tbaa !7
  store i64 %14, ptr @_QFEa2.8, align 8, !tbaa !7
  %17 = icmp sgt i32 %7, 0
  br i1 %17, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %18 = zext i32 %7 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %19 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.a381292fed6a7d49ec761d83f0141ed9, i32 13)
  %.unpack750 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %20 = add nsw i64 %indvars.iv, -1
  %21 = getelementptr i32, ptr %.unpack750, i64 %20
  %22 = call i1 @_FortranAioInputInteger(ptr %19, ptr %21, i32 4)
  %23 = call i32 @_FortranAioEndIoStatement(ptr %19)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %18
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %.lr.ph

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.unpack.pre = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack649.unpack.unpack651.pre = load i64, ptr @_QFEa.8, align 8, !tbaa !7
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %0
  %.unpack649.unpack.unpack651 = phi i64 [ %.unpack649.unpack.unpack651.pre, %._crit_edge.loopexit ], [ %9, %0 ]
  %.unpack = phi ptr [ %.unpack.pre, %._crit_edge.loopexit ], [ %11, %0 ]
  store ptr %.unpack, ptr %1, align 8, !tbaa !7
  %.fca.1.gep162 = 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.gep162, align 8, !tbaa !7
  %.fca.2.gep164 = 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.gep164, align 8, !tbaa !7
  %.fca.3.gep166 = 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.gep166, align 4, !tbaa !7
  %.fca.4.gep168 = 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.gep168, align 1, !tbaa !7
  %.fca.5.gep170 = 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.gep170, align 2, !tbaa !7
  %.fca.6.gep172 = 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.gep172, align 1, !tbaa !7
  %.fca.7.0.0.gep174 = 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.gep174, align 8, !tbaa !7
  %.fca.7.0.1.gep176 = 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 %.unpack649.unpack.unpack651, ptr %.fca.7.0.1.gep176, align 8, !tbaa !7
  %.fca.7.0.2.gep178 = 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.gep178, align 8, !tbaa !7
  store ptr null, ptr %2, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 1
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !7
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !7
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, 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 %2, i64 0, i32 4
  store i8 9, ptr %.fca.4.gep, align 1, !tbaa !7
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 5
  store i8 2, ptr %.fca.5.gep, align 2, !tbaa !7
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, 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 %2, 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 %2, i64 0, i32 7, i64 0, i64 1
  store i64 0, 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 %2, i64 0, i32 7, i64 0, i64 2
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %24 = call {} @_FortranAMaxlocInteger4(ptr nonnull %2, ptr nonnull %1, i32 4, ptr nonnull @_QQcl.a381292fed6a7d49ec761d83f0141ed9, i32 15, ptr null, i1 false)
  %.fca.0.load = load ptr, ptr %2, align 8, !tbaa !7
  %25 = load i32, ptr %.fca.0.load, align 4, !tbaa !3
  call void @free(ptr %.fca.0.load)
  %.unpack654 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack654805 = ptrtoint ptr %.unpack654 to i64
  %.unpack661.unpack.unpack663 = load i64, ptr @_QFEa.8, align 8, !tbaa !7
  %26 = icmp sgt i64 %.unpack661.unpack.unpack663, 0
  br i1 %26, label %.lr.ph.i.preheader, label %_FortranAMaxvalInteger4x1_contract_simplified.exit

.lr.ph.i.preheader:                               ; preds = %._crit_edge
  %min.iters.check = icmp ult i64 %.unpack661.unpack.unpack663, 8
  br i1 %min.iters.check, label %.lr.ph.i.preheader864, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.i.preheader
  %n.vec = and i64 %.unpack661.unpack.unpack663, -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 ], [ %30, %vector.body ]
  %vec.phi802 = phi <4 x i32> [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, %vector.ph ], [ %31, %vector.body ]
  %27 = shl i64 %index, 2
  %28 = getelementptr i8, ptr %.unpack654, i64 %27
  %wide.load = load <4 x i32>, ptr %28, align 4, !tbaa !3
  %29 = getelementptr i32, ptr %28, i64 4
  %wide.load803 = load <4 x i32>, ptr %29, align 4, !tbaa !3
  %30 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load, <4 x i32> %vec.phi)
  %31 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load803, <4 x i32> %vec.phi802)
  %index.next = add nuw i64 %index, 8
  %32 = icmp eq i64 %index.next, %n.vec
  br i1 %32, 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> %30, <4 x i32> %31)
  %33 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax.select)
  %cmp.n = icmp eq i64 %.unpack661.unpack.unpack663, %n.vec
  br i1 %cmp.n, label %_FortranAMaxvalInteger4x1_contract_simplified.exit, label %.lr.ph.i.preheader864

.lr.ph.i.preheader864:                            ; preds = %.lr.ph.i.preheader, %middle.block
  %.ph865 = phi i32 [ -2147483648, %.lr.ph.i.preheader ], [ %33, %middle.block ]
  %.ph866 = phi i64 [ 0, %.lr.ph.i.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph.i

.lr.ph.i:                                         ; preds = %.lr.ph.i.preheader864, %.lr.ph.i
  %34 = phi i32 [ %39, %.lr.ph.i ], [ %.ph865, %.lr.ph.i.preheader864 ]
  %35 = phi i64 [ %40, %.lr.ph.i ], [ %.ph866, %.lr.ph.i.preheader864 ]
  %36 = shl i64 %35, 2
  %37 = getelementptr i8, ptr %.unpack654, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !3
  %39 = call i32 @llvm.smax.i32(i32 %38, i32 %34)
  %40 = add nuw nsw i64 %35, 1
  %exitcond.not.i = icmp eq i64 %40, %.unpack661.unpack.unpack663
  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, %._crit_edge
  %.lcssa.i = phi i32 [ -2147483648, %._crit_edge ], [ %33, %middle.block ], [ %39, %.lr.ph.i ]
  %41 = add i32 %25, -1
  %42 = icmp sgt i32 %41, 0
  br i1 %42, label %.lr.ph780, label %._crit_edge781

.lr.ph780:                                        ; preds = %_FortranAMaxvalInteger4x1_contract_simplified.exit
  %43 = zext i32 %41 to i64
  %.unpack738 = load ptr, ptr @_QFEa2.0, align 8, !tbaa !7
  %min.iters.check808 = icmp ult i32 %41, 8
  %.unpack738804 = ptrtoint ptr %.unpack738 to i64
  %44 = sub i64 %.unpack738804, %.unpack654805
  %diff.check = icmp ult i64 %44, 32
  %or.cond = select i1 %min.iters.check808, i1 true, i1 %diff.check
  br i1 %or.cond, label %scalar.ph807.preheader, label %vector.ph809

vector.ph809:                                     ; preds = %.lr.ph780
  %n.vec811 = and i64 %43, 4294967288
  %ind.end = or i64 %n.vec811, 1
  br label %vector.body814

vector.body814:                                   ; preds = %vector.body814, %vector.ph809
  %index815 = phi i64 [ 0, %vector.ph809 ], [ %index.next818, %vector.body814 ]
  %45 = getelementptr i32, ptr %.unpack654, i64 %index815
  %wide.load816 = load <4 x i32>, ptr %45, align 4, !tbaa !3
  %46 = getelementptr i32, ptr %45, i64 4
  %wide.load817 = load <4 x i32>, ptr %46, align 4, !tbaa !3
  %47 = getelementptr i32, ptr %.unpack738, i64 %index815
  store <4 x i32> %wide.load816, ptr %47, align 4, !tbaa !3
  %48 = getelementptr i32, ptr %47, i64 4
  store <4 x i32> %wide.load817, ptr %48, align 4, !tbaa !3
  %index.next818 = add nuw i64 %index815, 8
  %49 = icmp eq i64 %index.next818, %n.vec811
  br i1 %49, label %middle.block806, label %vector.body814, !llvm.loop !13

middle.block806:                                  ; preds = %vector.body814
  %cmp.n813 = icmp eq i64 %n.vec811, %43
  br i1 %cmp.n813, label %._crit_edge781, label %scalar.ph807.preheader

scalar.ph807.preheader:                           ; preds = %.lr.ph780, %middle.block806
  %indvars.iv791.ph = phi i64 [ 1, %.lr.ph780 ], [ %ind.end, %middle.block806 ]
  %50 = add nuw nsw i64 %43, 1
  %51 = sub nsw i64 %50, %indvars.iv791.ph
  %52 = sub nsw i64 %43, %indvars.iv791.ph
  %xtraiter = and i64 %51, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %scalar.ph807.prol.loopexit, label %scalar.ph807.prol

scalar.ph807.prol:                                ; preds = %scalar.ph807.preheader, %scalar.ph807.prol
  %indvars.iv791.prol = phi i64 [ %indvars.iv.next792.prol, %scalar.ph807.prol ], [ %indvars.iv791.ph, %scalar.ph807.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph807.prol ], [ 0, %scalar.ph807.preheader ]
  %53 = add i64 %indvars.iv791.prol, -1
  %54 = getelementptr i32, ptr %.unpack654, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !3
  %56 = add i64 %indvars.iv791.prol, -1
  %57 = getelementptr i32, ptr %.unpack738, i64 %56
  store i32 %55, ptr %57, align 4, !tbaa !3
  %indvars.iv.next792.prol = add nuw nsw i64 %indvars.iv791.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.ph807.prol.loopexit, label %scalar.ph807.prol, !llvm.loop !14

scalar.ph807.prol.loopexit:                       ; preds = %scalar.ph807.prol, %scalar.ph807.preheader
  %indvars.iv791.unr = phi i64 [ %indvars.iv791.ph, %scalar.ph807.preheader ], [ %indvars.iv.next792.prol, %scalar.ph807.prol ]
  %58 = icmp ult i64 %52, 3
  br i1 %58, label %._crit_edge781, label %scalar.ph807

scalar.ph807:                                     ; preds = %scalar.ph807.prol.loopexit, %scalar.ph807
  %indvars.iv791 = phi i64 [ %indvars.iv.next792.3, %scalar.ph807 ], [ %indvars.iv791.unr, %scalar.ph807.prol.loopexit ]
  %59 = add i64 %indvars.iv791, -1
  %60 = getelementptr i32, ptr %.unpack654, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !3
  %62 = add i64 %indvars.iv791, -1
  %63 = getelementptr i32, ptr %.unpack738, i64 %62
  store i32 %61, ptr %63, align 4, !tbaa !3
  %indvars.iv.next792 = add nuw nsw i64 %indvars.iv791, 1
  %64 = getelementptr i32, ptr %.unpack654, i64 %indvars.iv791
  %65 = load i32, ptr %64, align 4, !tbaa !3
  %66 = getelementptr i32, ptr %.unpack738, i64 %indvars.iv791
  store i32 %65, ptr %66, align 4, !tbaa !3
  %indvars.iv.next792.1 = add nuw nsw i64 %indvars.iv791, 2
  %67 = getelementptr i32, ptr %.unpack654, i64 %indvars.iv.next792
  %68 = load i32, ptr %67, align 4, !tbaa !3
  %69 = getelementptr i32, ptr %.unpack738, i64 %indvars.iv.next792
  store i32 %68, ptr %69, align 4, !tbaa !3
  %indvars.iv.next792.2 = add nuw nsw i64 %indvars.iv791, 3
  %70 = getelementptr i32, ptr %.unpack654, i64 %indvars.iv.next792.1
  %71 = load i32, ptr %70, align 4, !tbaa !3
  %72 = getelementptr i32, ptr %.unpack738, i64 %indvars.iv.next792.1
  store i32 %71, ptr %72, align 4, !tbaa !3
  %indvars.iv.next792.3 = add nuw nsw i64 %indvars.iv791, 4
  %exitcond794.not.3 = icmp eq i64 %indvars.iv.next792.2, %43
  br i1 %exitcond794.not.3, label %._crit_edge781, label %scalar.ph807, !llvm.loop !16

._crit_edge781:                                   ; preds = %scalar.ph807.prol.loopexit, %scalar.ph807, %middle.block806, %_FortranAMaxvalInteger4x1_contract_simplified.exit
  %73 = add i32 %25, 1
  %74 = sext i32 %73 to i64
  %75 = load i32, ptr %3, align 4, !tbaa !3
  %76 = sext i32 %75 to i64
  %77 = sub nsw i64 1, %74
  %78 = add nsw i64 %77, %76
  %79 = icmp sgt i64 %78, 0
  br i1 %79, label %.lr.ph783, label %._crit_edge784

.lr.ph783:                                        ; preds = %._crit_edge781
  %.unpack714 = load ptr, ptr @_QFEa2.0, align 8, !tbaa !7
  %.unpack714820 = ptrtoint ptr %.unpack714 to i64
  %min.iters.check824 = icmp ult i64 %78, 20
  br i1 %min.iters.check824, label %scalar.ph823.preheader, label %vector.scevcheck

vector.scevcheck:                                 ; preds = %.lr.ph783
  %80 = sub nsw i64 %76, %74
  %81 = trunc i64 %80 to i32
  %82 = add i32 %25, %81
  %83 = icmp slt i32 %82, %25
  %84 = trunc i64 %80 to i32
  %85 = add i32 %73, %84
  %86 = icmp slt i32 %85, %73
  %87 = icmp ugt i64 %80, 4294967295
  %88 = or i1 %86, %87
  %89 = or i1 %83, %88
  br i1 %89, label %scalar.ph823.preheader, label %vector.memcheck819

vector.memcheck819:                               ; preds = %vector.scevcheck
  %90 = sext i32 %25 to i64
  %91 = shl nsw i64 %90, 2
  %92 = add i64 %91, %.unpack714820
  %93 = shl nsw i64 %74, 2
  %94 = add i64 %93, %.unpack654805
  %95 = sub i64 %92, %94
  %diff.check821 = icmp ult i64 %95, 32
  br i1 %diff.check821, label %scalar.ph823.preheader, label %vector.ph825

vector.ph825:                                     ; preds = %vector.memcheck819
  %n.vec827 = and i64 %78, -8
  %ind.end828 = and i64 %78, 7
  %.cast = trunc i64 %n.vec827 to i32
  %ind.end830 = add i32 %73, %.cast
  br label %vector.body833

vector.body833:                                   ; preds = %vector.body833, %vector.ph825
  %index834 = phi i64 [ 0, %vector.ph825 ], [ %index.next839, %vector.body833 ]
  %.cast835 = trunc i64 %index834 to i32
  %offset.idx836 = add i32 %73, %.cast835
  %96 = sext i32 %offset.idx836 to i64
  %97 = add nsw i64 %96, -1
  %98 = getelementptr i32, ptr %.unpack654, i64 %97
  %wide.load837 = load <4 x i32>, ptr %98, align 4, !tbaa !3
  %99 = getelementptr i32, ptr %98, i64 4
  %wide.load838 = load <4 x i32>, ptr %99, align 4, !tbaa !3
  %100 = add i32 %25, %.cast835
  %101 = sext i32 %100 to i64
  %102 = add nsw i64 %101, -1
  %103 = getelementptr i32, ptr %.unpack714, i64 %102
  store <4 x i32> %wide.load837, ptr %103, align 4, !tbaa !3
  %104 = getelementptr i32, ptr %103, i64 4
  store <4 x i32> %wide.load838, ptr %104, align 4, !tbaa !3
  %index.next839 = add nuw i64 %index834, 8
  %105 = icmp eq i64 %index.next839, %n.vec827
  br i1 %105, label %middle.block822, label %vector.body833, !llvm.loop !17

middle.block822:                                  ; preds = %vector.body833
  %cmp.n832 = icmp eq i64 %78, %n.vec827
  br i1 %cmp.n832, label %._crit_edge784.loopexit, label %scalar.ph823.preheader

scalar.ph823.preheader:                           ; preds = %vector.memcheck819, %vector.scevcheck, %.lr.ph783, %middle.block822
  %.ph862 = phi i64 [ %78, %vector.memcheck819 ], [ %78, %vector.scevcheck ], [ %78, %.lr.ph783 ], [ %ind.end828, %middle.block822 ]
  %.ph863 = phi i32 [ %73, %vector.memcheck819 ], [ %73, %vector.scevcheck ], [ %73, %.lr.ph783 ], [ %ind.end830, %middle.block822 ]
  br label %scalar.ph823

scalar.ph823:                                     ; preds = %scalar.ph823.preheader, %scalar.ph823
  %106 = phi i64 [ %117, %scalar.ph823 ], [ %.ph862, %scalar.ph823.preheader ]
  %107 = phi i32 [ %116, %scalar.ph823 ], [ %.ph863, %scalar.ph823.preheader ]
  %108 = sext i32 %107 to i64
  %109 = add nsw i64 %108, -1
  %110 = getelementptr i32, ptr %.unpack654, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !3
  %112 = add i32 %107, -1
  %113 = sext i32 %112 to i64
  %114 = add nsw i64 %113, -1
  %115 = getelementptr i32, ptr %.unpack714, i64 %114
  store i32 %111, ptr %115, align 4, !tbaa !3
  %116 = add i32 %107, 1
  %117 = add nsw i64 %106, -1
  %118 = icmp ugt i64 %106, 1
  br i1 %118, label %scalar.ph823, label %._crit_edge784.loopexit, !llvm.loop !18

._crit_edge784.loopexit:                          ; preds = %scalar.ph823, %middle.block822
  %.pre = load i32, ptr %3, align 4, !tbaa !3
  %.pre799 = sext i32 %.pre to i64
  br label %._crit_edge784

._crit_edge784:                                   ; preds = %._crit_edge784.loopexit, %._crit_edge781
  %.pre-phi = phi i64 [ %.pre799, %._crit_edge784.loopexit ], [ %76, %._crit_edge781 ]
  %119 = phi i32 [ %.pre, %._crit_edge784.loopexit ], [ %75, %._crit_edge781 ]
  %120 = icmp sgt i32 %119, 0
  br i1 %120, label %.lr.ph786, label %._crit_edge787

.lr.ph786:                                        ; preds = %._crit_edge784, %145
  %121 = phi i64 [ %148, %145 ], [ %.pre-phi, %._crit_edge784 ]
  %122 = phi i32 [ %147, %145 ], [ 1, %._crit_edge784 ]
  %123 = icmp eq i32 %122, %25
  br i1 %123, label %124, label %142

124:                                              ; preds = %.lr.ph786
  %125 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.a381292fed6a7d49ec761d83f0141ed9, i32 28)
  %.unpack690 = load ptr, ptr @_QFEa2.0, align 8, !tbaa !7
  %.unpack697.unpack.unpack699 = load i64, ptr @_QFEa2.8, align 8, !tbaa !7
  %126 = icmp sgt i64 %.unpack697.unpack.unpack699, 0
  br i1 %126, label %.lr.ph.i762.preheader, label %_FortranAMaxvalInteger4x1_contract_simplified.exit765

.lr.ph.i762.preheader:                            ; preds = %124
  %min.iters.check842 = icmp ult i64 %.unpack697.unpack.unpack699, 8
  br i1 %min.iters.check842, label %.lr.ph.i762.preheader858, label %vector.ph843

vector.ph843:                                     ; preds = %.lr.ph.i762.preheader
  %n.vec845 = and i64 %.unpack697.unpack.unpack699, -8
  br label %vector.body848

vector.body848:                                   ; preds = %vector.body848, %vector.ph843
  %index849 = phi i64 [ 0, %vector.ph843 ], [ %index.next854, %vector.body848 ]
  %vec.phi850 = phi <4 x i32> [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, %vector.ph843 ], [ %130, %vector.body848 ]
  %vec.phi851 = phi <4 x i32> [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, %vector.ph843 ], [ %131, %vector.body848 ]
  %127 = shl i64 %index849, 2
  %128 = getelementptr i8, ptr %.unpack690, i64 %127
  %wide.load852 = load <4 x i32>, ptr %128, align 4, !tbaa !3
  %129 = getelementptr i32, ptr %128, i64 4
  %wide.load853 = load <4 x i32>, ptr %129, align 4, !tbaa !3
  %130 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load852, <4 x i32> %vec.phi850)
  %131 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load853, <4 x i32> %vec.phi851)
  %index.next854 = add nuw i64 %index849, 8
  %132 = icmp eq i64 %index.next854, %n.vec845
  br i1 %132, label %middle.block840, label %vector.body848, !llvm.loop !19

middle.block840:                                  ; preds = %vector.body848
  %rdx.minmax.select856 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %130, <4 x i32> %131)
  %133 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax.select856)
  %cmp.n847 = icmp eq i64 %.unpack697.unpack.unpack699, %n.vec845
  br i1 %cmp.n847, label %_FortranAMaxvalInteger4x1_contract_simplified.exit765, label %.lr.ph.i762.preheader858

.lr.ph.i762.preheader858:                         ; preds = %.lr.ph.i762.preheader, %middle.block840
  %.ph = phi i32 [ -2147483648, %.lr.ph.i762.preheader ], [ %133, %middle.block840 ]
  %.ph859 = phi i64 [ 0, %.lr.ph.i762.preheader ], [ %n.vec845, %middle.block840 ]
  br label %.lr.ph.i762

.lr.ph.i762:                                      ; preds = %.lr.ph.i762.preheader858, %.lr.ph.i762
  %134 = phi i32 [ %139, %.lr.ph.i762 ], [ %.ph, %.lr.ph.i762.preheader858 ]
  %135 = phi i64 [ %140, %.lr.ph.i762 ], [ %.ph859, %.lr.ph.i762.preheader858 ]
  %136 = shl i64 %135, 2
  %137 = getelementptr i8, ptr %.unpack690, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !3
  %139 = call i32 @llvm.smax.i32(i32 %138, i32 %134)
  %140 = add nuw nsw i64 %135, 1
  %exitcond.not.i763 = icmp eq i64 %140, %.unpack697.unpack.unpack699
  br i1 %exitcond.not.i763, label %_FortranAMaxvalInteger4x1_contract_simplified.exit765, label %.lr.ph.i762, !llvm.loop !20

_FortranAMaxvalInteger4x1_contract_simplified.exit765: ; preds = %.lr.ph.i762, %middle.block840, %124
  %.lcssa.i764 = phi i32 [ -2147483648, %124 ], [ %133, %middle.block840 ], [ %139, %.lr.ph.i762 ]
  %141 = call i1 @_FortranAioOutputInteger32(ptr %125, i32 %.lcssa.i764)
  br label %145

142:                                              ; preds = %.lr.ph786
  %143 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.a381292fed6a7d49ec761d83f0141ed9, i32 30)
  %144 = call i1 @_FortranAioOutputInteger32(ptr %143, i32 %.lcssa.i)
  br label %145

145:                                              ; preds = %_FortranAMaxvalInteger4x1_contract_simplified.exit765, %142
  %.sink = phi ptr [ %125, %_FortranAMaxvalInteger4x1_contract_simplified.exit765 ], [ %143, %142 ]
  %146 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  %147 = add nuw i32 %122, 1
  %148 = add nsw i64 %121, -1
  %149 = icmp sgt i64 %121, 1
  br i1 %149, label %.lr.ph786, label %._crit_edge787.loopexit

._crit_edge787.loopexit:                          ; preds = %145
  %.unpack678.pre = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  br label %._crit_edge787

._crit_edge787:                                   ; preds = %._crit_edge787.loopexit, %._crit_edge784
  %.unpack678 = phi ptr [ %.unpack678.pre, %._crit_edge787.loopexit ], [ %.unpack654, %._crit_edge784 ]
  %.unpack666 = load ptr, ptr @_QFEa2.0, align 8, !tbaa !7
  call void @free(ptr %.unpack666)
  store ptr null, ptr @_QFEa2.0, align 8, !tbaa !7
  store i64 0, ptr @_QFEa2.8, align 8, !tbaa !7
  call void @free(ptr %.unpack678)
  store ptr null, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 0, ptr @_QFEa.8, align 8, !tbaa !7
  %150 = 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 {} @_FortranAMaxlocInteger4(ptr, ptr, i32, ptr, i32, ptr, i1) local_unnamed_addr

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

declare i1 @_FortranAioOutputInteger32(ptr, i32) 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 <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

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, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !11}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !11}
!20 = distinct !{!20, !11, !10}
