integer N
integer,allocatable,dimension(:,:)::A,B
read*,N
allocate(A(2,N),B(2,N))
read*,A(1,:)
read*,A(2,:)
B(1,1)=A(1,1)
do i=2,N
  B(1,i)=B(1,i-1)+A(1,i)
end do
B(2,1)=B(1,1)+A(2,1)
do i=2,N
  B(2,i)=max(B(1,i),B(2,i-1))+A(2,i)
end do
print"(i0)",B(2,N)
end
; 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.11 = internal unnamed_addr global i64 0
@_QFEb.0 = internal unnamed_addr global ptr null
@_QQcl.9c084f1a1ec47f613f27ad0f50614f58 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6334/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

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 i32, align 4
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.9c084f1a1ec47f613f27ad0f50614f58, i32 3)
  %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, 3
  %11 = call ptr @malloc(i64 %10)
  store ptr %11, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 %9, ptr @_QFEa.11, align 8, !tbaa !7
  %12 = call ptr @malloc(i64 %10)
  store ptr %12, ptr @_QFEb.0, align 8, !tbaa !7
  %13 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.9c084f1a1ec47f613f27ad0f50614f58, i32 5)
  %.unpack = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack509.unpack510.unpack515 = load i64, ptr @_QFEa.11, align 8, !tbaa !7
  %14 = call i64 @llvm.smax.i64(i64 %.unpack509.unpack510.unpack515, i64 0)
  store ptr %.unpack, 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 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 %14, 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
  %15 = call i1 @_FortranAioInputDescriptor(ptr %13, ptr nonnull %2)
  %16 = call i32 @_FortranAioEndIoStatement(ptr %13)
  %17 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.9c084f1a1ec47f613f27ad0f50614f58, i32 6)
  %.unpack518 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack525.unpack526.unpack531 = load i64, ptr @_QFEa.11, align 8, !tbaa !7
  %18 = call i64 @llvm.smax.i64(i64 %.unpack525.unpack526.unpack531, i64 0)
  %19 = getelementptr i32, ptr %.unpack518, i64 1
  store ptr %19, ptr %1, align 8, !tbaa !7
  %.fca.1.gep141 = 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.gep141, align 8, !tbaa !7
  %.fca.2.gep143 = 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.gep143, align 8, !tbaa !7
  %.fca.3.gep145 = 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.gep145, align 4, !tbaa !7
  %.fca.4.gep147 = 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.gep147, align 1, !tbaa !7
  %.fca.5.gep149 = 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.gep149, align 2, !tbaa !7
  %.fca.6.gep151 = 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.gep151, align 1, !tbaa !7
  %.fca.7.0.0.gep153 = 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.gep153, align 8, !tbaa !7
  %.fca.7.0.1.gep155 = 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 %18, ptr %.fca.7.0.1.gep155, align 8, !tbaa !7
  %.fca.7.0.2.gep157 = 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.gep157, align 8, !tbaa !7
  %20 = call i1 @_FortranAioInputDescriptor(ptr %17, ptr nonnull %1)
  %21 = call i32 @_FortranAioEndIoStatement(ptr %17)
  %.unpack534 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %22 = load i32, ptr %.unpack534, align 4, !tbaa !3
  %.unpack550 = load ptr, ptr @_QFEb.0, align 8, !tbaa !7
  store i32 %22, ptr %.unpack550, align 4, !tbaa !3
  %23 = load i32, ptr %3, align 4, !tbaa !3
  %24 = icmp sgt i32 %23, 1
  br i1 %24, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %25 = zext i32 %23 to i64
  %26 = add nsw i64 %25, -1
  %xtraiter = and i64 %26, 1
  %27 = icmp eq i32 %23, 2
  br i1 %27, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

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

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 2, %.lr.ph.preheader.new ], [ %indvars.iv.next.1, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %28 = shl nuw i64 %indvars.iv, 1
  %29 = add i64 %28, -4
  %30 = getelementptr i32, ptr %.unpack550, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !3
  %32 = shl nuw i64 %indvars.iv, 1
  %33 = add i64 %32, -2
  %34 = getelementptr i32, ptr %.unpack534, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !3
  %36 = add i32 %35, %31
  %37 = shl nuw i64 %indvars.iv, 1
  %38 = add i64 %37, -2
  %39 = getelementptr i32, ptr %.unpack550, i64 %38
  store i32 %36, ptr %39, align 4, !tbaa !3
  %indvars.iv.next = or i64 %indvars.iv, 1
  %40 = shl nuw i64 %indvars.iv.next, 1
  %41 = add i64 %40, -4
  %42 = getelementptr i32, ptr %.unpack550, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !3
  %44 = shl nuw i64 %indvars.iv.next, 1
  %45 = add nsw i64 %44, -2
  %46 = getelementptr i32, ptr %.unpack534, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !3
  %48 = add i32 %47, %43
  %49 = shl nuw i64 %indvars.iv.next, 1
  %50 = add nsw i64 %49, -2
  %51 = getelementptr i32, ptr %.unpack550, i64 %50
  store i32 %48, ptr %51, align 4, !tbaa !3
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %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.loopexit, label %.lr.ph

._crit_edge.loopexit.unr-lcssa.loopexit:          ; preds = %.lr.ph
  %52 = shl nuw i64 %indvars.iv.next.1, 1
  br label %._crit_edge.loopexit.unr-lcssa

._crit_edge.loopexit.unr-lcssa:                   ; preds = %._crit_edge.loopexit.unr-lcssa.loopexit, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 4, %.lr.ph.preheader ], [ %52, %._crit_edge.loopexit.unr-lcssa.loopexit ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge.loopexit, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa
  %53 = add i64 %indvars.iv.unr, -4
  %54 = getelementptr i32, ptr %.unpack550, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !3
  %56 = add i64 %indvars.iv.unr, -2
  %57 = getelementptr i32, ptr %.unpack534, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !3
  %59 = add i32 %58, %55
  %60 = add i64 %indvars.iv.unr, -2
  %61 = getelementptr i32, ptr %.unpack550, i64 %60
  store i32 %59, ptr %61, align 4, !tbaa !3
  br label %._crit_edge.loopexit

._crit_edge.loopexit:                             ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil
  %.pre = load i32, ptr %.unpack550, align 4, !tbaa !3
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %0
  %62 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %22, %0 ]
  %63 = getelementptr i32, ptr %.unpack534, i64 1
  %64 = load i32, ptr %63, align 4, !tbaa !3
  %65 = add i32 %64, %62
  %66 = getelementptr i32, ptr %.unpack550, i64 1
  store i32 %65, ptr %66, align 4, !tbaa !3
  %67 = load i32, ptr %3, align 4, !tbaa !3
  %68 = icmp sgt i32 %67, 1
  br i1 %68, label %.lr.ph680.preheader, label %._crit_edge681

.lr.ph680.preheader:                              ; preds = %._crit_edge
  %69 = zext i32 %67 to i64
  br label %.lr.ph680

.lr.ph680:                                        ; preds = %.lr.ph680.preheader, %.lr.ph680
  %indvars.iv683 = phi i64 [ 2, %.lr.ph680.preheader ], [ %indvars.iv.next684, %.lr.ph680 ]
  %70 = shl nuw i64 %indvars.iv683, 1
  %71 = add i64 %70, -2
  %72 = getelementptr i32, ptr %.unpack550, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !3
  %74 = shl nuw i64 %indvars.iv683, 1
  %75 = add i64 %74, -3
  %76 = getelementptr i32, ptr %.unpack550, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !3
  %78 = call i32 @llvm.smax.i32(i32 %73, i32 %77)
  %79 = shl nuw i64 %indvars.iv683, 1
  %80 = add i64 %79, -1
  %81 = getelementptr i32, ptr %.unpack534, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !3
  %83 = add i32 %78, %82
  %84 = add i64 %70, -1
  %85 = getelementptr i32, ptr %.unpack550, i64 %84
  store i32 %83, ptr %85, align 4, !tbaa !3
  %indvars.iv.next684 = add nuw nsw i64 %indvars.iv683, 1
  %exitcond686.not = icmp eq i64 %indvars.iv683, %69
  br i1 %exitcond686.not, label %._crit_edge681, label %.lr.ph680

._crit_edge681:                                   ; preds = %.lr.ph680, %._crit_edge
  %86 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.9c084f1a1ec47f613f27ad0f50614f58, i32 15)
  %.unpack598 = load ptr, ptr @_QFEb.0, align 8, !tbaa !7
  %87 = load i32, ptr %3, align 4, !tbaa !3
  %88 = sext i32 %87 to i64
  %89 = shl nsw i64 %88, 1
  %90 = add nsw i64 %89, -1
  %91 = getelementptr i32, ptr %.unpack598, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !3
  %93 = call i1 @_FortranAioOutputInteger32(ptr %86, i32 %92)
  %94 = call i32 @_FortranAioEndIoStatement(ptr %86)
  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 @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) 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 nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #1

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) }

!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}
