program probC
  implicit none
  integer*8,allocatable :: ame(:,:)
  integer*8 N,j,tot,tmp

  read(*,*) N
  allocate(ame(1:n,2))
  ame=0

  read(*,*) ame(1:n,1)
  read(*,*) ame(1:n,2)


  tot=0
  tmp=0
  
  do j=1,n
     tmp=sum(ame(1:j,1))+sum(ame(j:n,2))
     if(tot<tmp) tot=tmp
  end do
  
  write(*,*) tot
  
end program probC

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

@_QFEame.0 = internal unnamed_addr global ptr null
@_QFEame.7 = internal unnamed_addr global i64 1
@_QFEame.8 = internal unnamed_addr global i64 0
@_QQcl.2c9fa67e4968c0305c9ca7f4d671ad25 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6338/source.f\00"
@_QQcl.16373402fa3425c6e46827601abb88fa = linkonce constant [76 x i8] c"array left hand side must be allocated when the right hand side is a scalar\00"
@_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, [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 i64, align 8
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.2c9fa67e4968c0305c9ca7f4d671ad25, i32 6)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 8)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %7 = load i64, ptr %3, align 8, !tbaa !3
  %8 = call i64 @llvm.smax.i64(i64 %7, i64 0)
  %9 = shl i64 %8, 4
  %10 = call ptr @malloc(i64 %9)
  %11 = icmp slt i64 %7, 1
  store ptr %10, ptr @_QFEame.0, align 8, !tbaa !7
  store i64 1, ptr @_QFEame.7, align 8, !tbaa !7
  store i64 %8, ptr @_QFEame.8, align 8, !tbaa !7
  %.not = icmp eq ptr %10, null
  br i1 %.not, label %12, label %.preheader466

.preheader466:                                    ; preds = %0
  br i1 %11, label %.split.us, label %.preheader.us.preheader

.preheader.us.preheader:                          ; preds = %.preheader466
  call void @llvm.memset.p0.i64(ptr nonnull align 8 %10, i8 0, i64 %9, i1 false), !tbaa !3
  br label %.split.us

12:                                               ; preds = %0
  %13 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.2c9fa67e4968c0305c9ca7f4d671ad25, i32 8)
  %.unpack429.unpack.unpack.pre = load i64, ptr @_QFEame.7, align 8, !tbaa !7
  %14 = select i1 %11, i64 1, i64 %.unpack429.unpack.unpack.pre
  store ptr %10, ptr @_QFEame.0, align 8, !tbaa !7
  store i64 %14, ptr @_QFEame.7, align 8, !tbaa !7
  store i64 %8, ptr @_QFEame.8, align 8, !tbaa !7
  br label %.split.us

.split.us:                                        ; preds = %.preheader.us.preheader, %.preheader466, %12
  %15 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.2c9fa67e4968c0305c9ca7f4d671ad25, i32 10)
  %.unpack = load ptr, ptr @_QFEame.0, align 8, !tbaa !7
  %.unpack365.unpack.unpack = load i64, ptr @_QFEame.7, align 8, !tbaa !7
  %16 = load i64, ptr %3, align 8, !tbaa !3
  %17 = sub i64 1, %.unpack365.unpack.unpack
  %18 = call i64 @llvm.smax.i64(i64 %16, i64 0)
  %19 = getelementptr i64, ptr %.unpack, i64 %17
  store ptr %19, 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 8, 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 10, 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 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 %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 %18, 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 8, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %20 = call i1 @_FortranAioInputDescriptor(ptr %15, ptr nonnull %2)
  %21 = call i32 @_FortranAioEndIoStatement(ptr %15)
  %22 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.2c9fa67e4968c0305c9ca7f4d671ad25, i32 11)
  %.unpack374 = load ptr, ptr @_QFEame.0, align 8, !tbaa !7
  %.unpack381.unpack.unpack = load i64, ptr @_QFEame.7, align 8, !tbaa !7
  %.unpack381.unpack.unpack384 = load i64, ptr @_QFEame.8, align 8, !tbaa !7
  %23 = load i64, ptr %3, align 8, !tbaa !3
  %24 = sub i64 1, %.unpack381.unpack.unpack
  %25 = call i64 @llvm.smax.i64(i64 %23, i64 0)
  %26 = add i64 %24, %.unpack381.unpack.unpack384
  %27 = getelementptr i64, ptr %.unpack374, i64 %26
  store ptr %27, ptr %1, align 8, !tbaa !7
  %.fca.1.gep121 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 8, ptr %.fca.1.gep121, align 8, !tbaa !7
  %.fca.2.gep123 = 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.gep123, align 8, !tbaa !7
  %.fca.3.gep125 = 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.gep125, align 4, !tbaa !7
  %.fca.4.gep127 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 10, ptr %.fca.4.gep127, align 1, !tbaa !7
  %.fca.5.gep129 = 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.gep129, align 2, !tbaa !7
  %.fca.6.gep131 = 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.gep131, align 1, !tbaa !7
  %.fca.7.0.0.gep133 = 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.gep133, align 8, !tbaa !7
  %.fca.7.0.1.gep135 = 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 %25, ptr %.fca.7.0.1.gep135, align 8, !tbaa !7
  %.fca.7.0.2.gep137 = 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 8, ptr %.fca.7.0.2.gep137, align 8, !tbaa !7
  %28 = call i1 @_FortranAioInputDescriptor(ptr %22, ptr nonnull %1)
  %29 = call i32 @_FortranAioEndIoStatement(ptr %22)
  %30 = load i64, ptr %3, align 8, !tbaa !3
  %31 = icmp sgt i64 %30, 0
  br i1 %31, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.split.us
  %.unpack390 = load ptr, ptr @_QFEame.0, align 8, !tbaa !7
  %.unpack397.unpack.unpack = load i64, ptr @_QFEame.7, align 8, !tbaa !7
  %.unpack397.unpack.unpack400 = load i64, ptr @_QFEame.8, align 8, !tbaa !7
  %32 = sub i64 1, %.unpack397.unpack.unpack
  %33 = getelementptr i64, ptr %.unpack390, i64 %32
  br label %34

34:                                               ; preds = %.lr.ph, %_FortranASumInteger8x1_contract_simplified.exit453
  %indvar = phi i64 [ 0, %.lr.ph ], [ %indvar.next, %_FortranASumInteger8x1_contract_simplified.exit453 ]
  %35 = phi i64 [ 1, %.lr.ph ], [ %74, %_FortranASumInteger8x1_contract_simplified.exit453 ]
  %.0468 = phi i64 [ 0, %.lr.ph ], [ %spec.select, %_FortranASumInteger8x1_contract_simplified.exit453 ]
  %36 = xor i64 %indvar, -1
  %37 = add i64 %30, %36
  %smax = call i64 @llvm.smax.i64(i64 %37, i64 -1)
  %38 = add i64 %smax, 1
  %39 = call i64 @llvm.smax.i64(i64 %35, i64 0)
  %.not464 = icmp slt i64 %35, 1
  br i1 %.not464, label %_FortranASumInteger8x1_contract_simplified.exit, label %.lr.ph.i.preheader

.lr.ph.i.preheader:                               ; preds = %34
  %min.iters.check479 = icmp ult i64 %35, 4
  br i1 %min.iters.check479, label %.lr.ph.i.preheader496, label %vector.ph480

vector.ph480:                                     ; preds = %.lr.ph.i.preheader
  %n.vec482 = and i64 %35, -4
  br label %vector.body485

vector.body485:                                   ; preds = %vector.body485, %vector.ph480
  %index486 = phi i64 [ 0, %vector.ph480 ], [ %index.next491, %vector.body485 ]
  %vec.phi487 = phi <2 x i64> [ zeroinitializer, %vector.ph480 ], [ %43, %vector.body485 ]
  %vec.phi488 = phi <2 x i64> [ zeroinitializer, %vector.ph480 ], [ %44, %vector.body485 ]
  %40 = shl i64 %index486, 3
  %41 = getelementptr i8, ptr %33, i64 %40
  %wide.load489 = load <2 x i64>, ptr %41, align 8, !tbaa !3
  %42 = getelementptr i64, ptr %41, i64 2
  %wide.load490 = load <2 x i64>, ptr %42, align 8, !tbaa !3
  %43 = add <2 x i64> %wide.load489, %vec.phi487
  %44 = add <2 x i64> %wide.load490, %vec.phi488
  %index.next491 = add nuw i64 %index486, 4
  %45 = icmp eq i64 %index.next491, %n.vec482
  br i1 %45, label %middle.block477, label %vector.body485, !llvm.loop !9

middle.block477:                                  ; preds = %vector.body485
  %bin.rdx492 = add <2 x i64> %44, %43
  %46 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx492)
  %cmp.n484 = icmp eq i64 %35, %n.vec482
  br i1 %cmp.n484, label %_FortranASumInteger8x1_contract_simplified.exit, label %.lr.ph.i.preheader496

.lr.ph.i.preheader496:                            ; preds = %.lr.ph.i.preheader, %middle.block477
  %.ph497 = phi i64 [ 0, %.lr.ph.i.preheader ], [ %46, %middle.block477 ]
  %.ph498 = phi i64 [ 0, %.lr.ph.i.preheader ], [ %n.vec482, %middle.block477 ]
  br label %.lr.ph.i

.lr.ph.i:                                         ; preds = %.lr.ph.i.preheader496, %.lr.ph.i
  %47 = phi i64 [ %52, %.lr.ph.i ], [ %.ph497, %.lr.ph.i.preheader496 ]
  %48 = phi i64 [ %53, %.lr.ph.i ], [ %.ph498, %.lr.ph.i.preheader496 ]
  %49 = shl i64 %48, 3
  %50 = getelementptr i8, ptr %33, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !3
  %52 = add i64 %51, %47
  %53 = add nuw nsw i64 %48, 1
  %exitcond.not.i = icmp eq i64 %53, %39
  br i1 %exitcond.not.i, label %_FortranASumInteger8x1_contract_simplified.exit, label %.lr.ph.i, !llvm.loop !12

_FortranASumInteger8x1_contract_simplified.exit:  ; preds = %.lr.ph.i, %middle.block477, %34
  %.lcssa.i = phi i64 [ 0, %34 ], [ %46, %middle.block477 ], [ %52, %.lr.ph.i ]
  %54 = sub i64 %35, %.unpack397.unpack.unpack
  %55 = sub i64 %30, %35
  %56 = call i64 @llvm.smax.i64(i64 %55, i64 -1)
  %57 = add i64 %54, %.unpack397.unpack.unpack400
  %58 = getelementptr i64, ptr %.unpack390, i64 %57
  %.not465 = icmp ugt i64 %55, 9223372036854775806
  br i1 %.not465, label %_FortranASumInteger8x1_contract_simplified.exit453, label %.lr.ph.i450.preheader

.lr.ph.i450.preheader:                            ; preds = %_FortranASumInteger8x1_contract_simplified.exit
  %min.iters.check = icmp ult i64 %38, 4
  br i1 %min.iters.check, label %.lr.ph.i450.preheader494, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.i450.preheader
  %n.vec = and i64 %38, -4
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %62, %vector.body ]
  %vec.phi475 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %63, %vector.body ]
  %59 = shl i64 %index, 3
  %60 = getelementptr i8, ptr %58, i64 %59
  %wide.load = load <2 x i64>, ptr %60, align 8, !tbaa !3
  %61 = getelementptr i64, ptr %60, i64 2
  %wide.load476 = load <2 x i64>, ptr %61, align 8, !tbaa !3
  %62 = add <2 x i64> %wide.load, %vec.phi
  %63 = add <2 x i64> %wide.load476, %vec.phi475
  %index.next = add nuw i64 %index, 4
  %64 = icmp eq i64 %index.next, %n.vec
  br i1 %64, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %63, %62
  %65 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %38, %n.vec
  br i1 %cmp.n, label %_FortranASumInteger8x1_contract_simplified.exit453, label %.lr.ph.i450.preheader494

.lr.ph.i450.preheader494:                         ; preds = %.lr.ph.i450.preheader, %middle.block
  %.ph = phi i64 [ 0, %.lr.ph.i450.preheader ], [ %65, %middle.block ]
  %.ph495 = phi i64 [ 0, %.lr.ph.i450.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph.i450

.lr.ph.i450:                                      ; preds = %.lr.ph.i450.preheader494, %.lr.ph.i450
  %66 = phi i64 [ %71, %.lr.ph.i450 ], [ %.ph, %.lr.ph.i450.preheader494 ]
  %67 = phi i64 [ %72, %.lr.ph.i450 ], [ %.ph495, %.lr.ph.i450.preheader494 ]
  %68 = shl i64 %67, 3
  %69 = getelementptr i8, ptr %58, i64 %68
  %70 = load i64, ptr %69, align 8, !tbaa !3
  %71 = add i64 %70, %66
  %72 = add nuw nsw i64 %67, 1
  %exitcond.not.i451 = icmp eq i64 %67, %56
  br i1 %exitcond.not.i451, label %_FortranASumInteger8x1_contract_simplified.exit453, label %.lr.ph.i450, !llvm.loop !14

_FortranASumInteger8x1_contract_simplified.exit453: ; preds = %.lr.ph.i450, %middle.block, %_FortranASumInteger8x1_contract_simplified.exit
  %.lcssa.i452 = phi i64 [ 0, %_FortranASumInteger8x1_contract_simplified.exit ], [ %65, %middle.block ], [ %71, %.lr.ph.i450 ]
  %73 = add i64 %.lcssa.i452, %.lcssa.i
  %spec.select = call i64 @llvm.smax.i64(i64 %.0468, i64 %73)
  %74 = add nuw i64 %35, 1
  %exitcond.not = icmp eq i64 %30, %35
  %indvar.next = add i64 %indvar, 1
  br i1 %exitcond.not, label %._crit_edge, label %34

._crit_edge:                                      ; preds = %_FortranASumInteger8x1_contract_simplified.exit453, %.split.us
  %.0.lcssa = phi i64 [ 0, %.split.us ], [ %spec.select, %_FortranASumInteger8x1_contract_simplified.exit453 ]
  %75 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.2c9fa67e4968c0305c9ca7f4d671ad25, i32 22)
  %76 = call i1 @_FortranAioOutputInteger64(ptr %75, i64 %.0.lcssa)
  %77 = call i32 @_FortranAioEndIoStatement(ptr %75)
  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 {} @_FortranAReportFatalUserError(ptr, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

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

declare i1 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #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 i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #3

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 nounwind willreturn memory(argmem: write) }
attributes #3 = { 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}
