program atcoder
    implicit none
    integer(8) :: i,j,k,n
    integer(8),allocatable,dimension(:,:) :: dp
    integer(8),allocatable,dimension(:) :: a,sum
    read*,n
    allocate(dp(0:n,0:n))
    allocate(a(0:n))
    allocate(sum(0:n))

    ! dp(i,j) := i番目のスライムからj番目のスライムを合体させるための最小コスト
    dp = lshift( 1_8, 50 ) ! // 最小を求めたいので、初期値は大きい値にしておく
    sum = 0_8
    a = 0_8
    read(*,*)(a(i),i=1,n) ! スライムの大きさを受け取る
    do i=1,n
        sum(i) = sum(i-1) + a(i) ! 累積和を計算しておく -> 合体のコストを高速に計算するため
        dp(i,i) = 0_8 ! i==jではスライムが1体しかいないので合体コストは0,この情報からどのようにループをすればいいか考える
        ! 1体の次は2体の結合、次は3体の結合...と求められそう
        !    -> 考える区間が大きくなっていく
    enddo
    
    do i = 1,n ! i := 幅 -> 区間の幅が小さいものから決まっていくから
        do j = 1,n-i ! j := 左端 -> [j,j+i]の区間を考える
            do k = j,j+i-1 ! [j,k]と[k+1,j]の合体を考える , それぞれ今考えている区間の長さより短いので計算済みである
                dp(j,j+i) = min(dp(j,j+i) , dp(j,k)+dp(k+1,j+i)+sum(j+i)-sum(j-1))
                ! [i,j+i]のコストは[i,k],[k+1,j+i]にそれぞれかかったコストと今回かかるコストの和
                ! それぞれのkでminを取る
            enddo
        enddo
    enddo
    write(*,'(I0)')dp(1,n)

    stop 
contains
end program atcoder

; 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.7 = internal unnamed_addr global i64 1
@_QFEa.8 = internal unnamed_addr global i64 0
@_QFEdp.0 = internal unnamed_addr global ptr null
@_QFEdp.7 = internal unnamed_addr global i64 1
@_QFEdp.8 = internal unnamed_addr global i64 0
@_QFEdp.10 = internal unnamed_addr global i64 1
@_QFEsum.0 = internal unnamed_addr global ptr null
@_QFEsum.7 = internal unnamed_addr global i64 1
@_QFEsum.8 = internal unnamed_addr global i64 0
@_QQcl.9e07b68d8bca2f77de157e9aab976104 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5208/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"
@_QQcl.28493029 = 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: noreturn
define void @_QQmain() local_unnamed_addr #1 {
  %1 = alloca i64, align 8
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.9e07b68d8bca2f77de157e9aab976104, i32 6)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 8)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = load i64, ptr %1, align 8, !tbaa !3
  %6 = add i64 %5, 1
  %7 = call i64 @llvm.smax.i64(i64 %6, i64 0)
  %8 = shl i64 %7, 3
  %9 = mul i64 %8, %7
  %10 = call ptr @malloc(i64 %9)
  %11 = icmp ugt i64 %5, 9223372036854775806
  %12 = zext i1 %11 to i64
  store ptr %10, ptr @_QFEdp.0, align 8, !tbaa !7
  store i64 %12, ptr @_QFEdp.7, align 8, !tbaa !7
  store i64 %7, ptr @_QFEdp.8, align 8, !tbaa !7
  store i64 %12, ptr @_QFEdp.10, align 8, !tbaa !7
  %13 = call ptr @malloc(i64 %8)
  store ptr %13, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 %12, ptr @_QFEa.7, align 8, !tbaa !7
  store i64 %7, ptr @_QFEa.8, align 8, !tbaa !7
  %14 = call ptr @malloc(i64 %8)
  store ptr %14, ptr @_QFEsum.0, align 8, !tbaa !7
  store i64 %12, ptr @_QFEsum.7, align 8, !tbaa !7
  store i64 %7, ptr @_QFEsum.8, align 8, !tbaa !7
  %.not = icmp eq ptr %10, null
  br i1 %.not, label %33, label %.preheader779

.preheader779:                                    ; preds = %0
  br i1 %11, label %._crit_edge780, label %.preheader778.us.preheader

.preheader778.us.preheader:                       ; preds = %.preheader779
  %15 = call i64 @llvm.smax.i64(i64 %6, i64 1)
  %min.iters.check = icmp ult i64 %15, 4
  %n.vec = and i64 %15, 9223372036854775804
  %ind.end = sub nsw i64 %7, %n.vec
  %cmp.n = icmp eq i64 %15, %n.vec
  br label %.preheader778.us

.preheader778.us:                                 ; preds = %.preheader778.us.preheader, %._crit_edge.us
  %16 = phi i64 [ %31, %._crit_edge.us ], [ %7, %.preheader778.us.preheader ]
  %17 = phi i64 [ %30, %._crit_edge.us ], [ 0, %.preheader778.us.preheader ]
  %18 = mul i64 %17, %7
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.body

vector.body:                                      ; preds = %.preheader778.us, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %.preheader778.us ]
  %19 = add i64 %index, %18
  %20 = getelementptr i64, ptr %10, i64 %19
  store <2 x i64> <i64 1125899906842624, i64 1125899906842624>, ptr %20, align 8, !tbaa !3
  %21 = getelementptr i64, ptr %20, i64 2
  store <2 x i64> <i64 1125899906842624, i64 1125899906842624>, ptr %21, align 8, !tbaa !3
  %index.next = add nuw i64 %index, 4
  %22 = icmp eq i64 %index.next, %n.vec
  br i1 %22, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge.us, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %.preheader778.us, %middle.block
  %.ph817 = phi i64 [ %7, %.preheader778.us ], [ %ind.end, %middle.block ]
  %.ph818 = phi i64 [ 0, %.preheader778.us ], [ %n.vec, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %23 = phi i64 [ %28, %scalar.ph ], [ %.ph817, %scalar.ph.preheader ]
  %24 = phi i64 [ %25, %scalar.ph ], [ %.ph818, %scalar.ph.preheader ]
  %25 = add nuw nsw i64 %24, 1
  %26 = add i64 %24, %18
  %27 = getelementptr i64, ptr %10, i64 %26
  store i64 1125899906842624, ptr %27, align 8, !tbaa !3
  %28 = add nsw i64 %23, -1
  %29 = icmp sgt i64 %23, 1
  br i1 %29, label %scalar.ph, label %._crit_edge.us, !llvm.loop !12

._crit_edge.us:                                   ; preds = %scalar.ph, %middle.block
  %30 = add nuw nsw i64 %17, 1
  %31 = add nsw i64 %16, -1
  %32 = icmp sgt i64 %16, 1
  br i1 %32, label %.preheader778.us, label %._crit_edge780

33:                                               ; preds = %0
  %34 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.9e07b68d8bca2f77de157e9aab976104, i32 12)
  %.unpack589.unpack.unpack591.pre.pre = load i64, ptr @_QFEsum.8, align 8, !tbaa !7
  %.unpack582.pre.pre = load ptr, ptr @_QFEsum.0, align 8, !tbaa !7
  %.unpack753.unpack754.unpack.pre = load i64, ptr @_QFEdp.10, align 8, !tbaa !7
  %.unpack753.unpack.unpack.pre = load i64, ptr @_QFEdp.7, align 8, !tbaa !7
  %35 = select i1 %11, i64 1, i64 %.unpack753.unpack.unpack.pre
  %36 = select i1 %11, i64 1, i64 %.unpack753.unpack754.unpack.pre
  store ptr %10, ptr @_QFEdp.0, align 8, !tbaa !7
  store i64 %35, ptr @_QFEdp.7, align 8, !tbaa !7
  store i64 %7, ptr @_QFEdp.8, align 8, !tbaa !7
  store i64 %36, ptr @_QFEdp.10, align 8, !tbaa !7
  br label %._crit_edge780

._crit_edge780:                                   ; preds = %._crit_edge.us, %.preheader779, %33
  %.unpack589.unpack.unpack591 = phi i64 [ %.unpack589.unpack.unpack591.pre.pre, %33 ], [ %7, %.preheader779 ], [ %7, %._crit_edge.us ]
  %.unpack582 = phi ptr [ %.unpack582.pre.pre, %33 ], [ %14, %.preheader779 ], [ %14, %._crit_edge.us ]
  %.not594 = icmp eq ptr %.unpack582, null
  br i1 %.not594, label %39, label %.preheader776

.preheader776:                                    ; preds = %._crit_edge780
  %37 = icmp sgt i64 %.unpack589.unpack.unpack591, 0
  br i1 %37, label %.lr.ph.preheader, label %.loopexit777

.lr.ph.preheader:                                 ; preds = %.preheader776
  %38 = shl nuw i64 %.unpack589.unpack.unpack591, 3
  call void @llvm.memset.p0.i64(ptr nonnull align 8 %.unpack582, i8 0, i64 %38, i1 false), !tbaa !3
  br label %.loopexit777

39:                                               ; preds = %._crit_edge780
  %40 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.9e07b68d8bca2f77de157e9aab976104, i32 13)
  %.unpack732.unpack.unpack = load i64, ptr @_QFEsum.7, align 8, !tbaa !7
  %41 = icmp eq i64 %.unpack589.unpack.unpack591, 0
  %42 = select i1 %41, i64 1, i64 %.unpack732.unpack.unpack
  store ptr null, ptr @_QFEsum.0, align 8, !tbaa !7
  store i64 %42, ptr @_QFEsum.7, align 8, !tbaa !7
  store i64 %.unpack589.unpack.unpack591, ptr @_QFEsum.8, align 8, !tbaa !7
  br label %.loopexit777

.loopexit777:                                     ; preds = %.lr.ph.preheader, %.preheader776, %39
  %.unpack595 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack602.unpack.unpack604 = load i64, ptr @_QFEa.8, align 8, !tbaa !7
  %.not607 = icmp eq ptr %.unpack595, null
  br i1 %.not607, label %45, label %.preheader

.preheader:                                       ; preds = %.loopexit777
  %43 = icmp sgt i64 %.unpack602.unpack.unpack604, 0
  br i1 %43, label %.lr.ph781.preheader, label %.loopexit

.lr.ph781.preheader:                              ; preds = %.preheader
  %44 = shl nuw i64 %.unpack602.unpack.unpack604, 3
  call void @llvm.memset.p0.i64(ptr nonnull align 8 %.unpack595, i8 0, i64 %44, i1 false), !tbaa !3
  br label %.loopexit

45:                                               ; preds = %.loopexit777
  %46 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.9e07b68d8bca2f77de157e9aab976104, i32 14)
  %.unpack711.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %47 = icmp eq i64 %.unpack602.unpack.unpack604, 0
  %48 = select i1 %47, i64 1, i64 %.unpack711.unpack.unpack
  store ptr null, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 %48, ptr @_QFEa.7, align 8, !tbaa !7
  store i64 %.unpack602.unpack.unpack604, ptr @_QFEa.8, align 8, !tbaa !7
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph781.preheader, %.preheader, %45
  %49 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.9e07b68d8bca2f77de157e9aab976104, i32 15)
  %50 = load i64, ptr %1, align 8, !tbaa !3
  %51 = icmp sgt i64 %50, 0
  br i1 %51, label %.lr.ph782, label %._crit_edge

.lr.ph782:                                        ; preds = %.loopexit, %.lr.ph782
  %52 = phi i64 [ %56, %.lr.ph782 ], [ 1, %.loopexit ]
  %.unpack692 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack699.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %53 = sub i64 %52, %.unpack699.unpack.unpack
  %54 = getelementptr i64, ptr %.unpack692, i64 %53
  %55 = call i1 @_FortranAioInputInteger(ptr %49, ptr %54, i32 8)
  %56 = add nuw i64 %52, 1
  %exitcond.not = icmp eq i64 %52, %50
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph782

._crit_edge:                                      ; preds = %.lr.ph782, %.loopexit
  %57 = call i32 @_FortranAioEndIoStatement(ptr %49)
  %58 = load i64, ptr %1, align 8, !tbaa !3
  %59 = icmp sgt i64 %58, 0
  br i1 %59, label %.lver.check, label %._crit_edge794

.lver.check:                                      ; preds = %._crit_edge
  %.unpack652 = load ptr, ptr @_QFEsum.0, align 8, !tbaa !7
  %.unpack659.unpack.unpack = load i64, ptr @_QFEsum.7, align 8, !tbaa !7
  %60 = xor i64 %.unpack659.unpack.unpack, -1
  %.unpack664 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack671.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %.unpack676 = load ptr, ptr @_QFEdp.0, align 8, !tbaa !7
  %.unpack683.unpack.unpack = load i64, ptr @_QFEdp.7, align 8, !tbaa !7
  %.unpack683.unpack.unpack686 = load i64, ptr @_QFEdp.8, align 8, !tbaa !7
  %.unpack683.unpack684.unpack = load i64, ptr @_QFEdp.10, align 8, !tbaa !7
  %61 = mul i64 %.unpack659.unpack.unpack, -8
  %uglygep = getelementptr i8, ptr %.unpack652, i64 %61
  %62 = shl i64 %58, 3
  %63 = add i64 %62, 8
  %64 = shl i64 %.unpack659.unpack.unpack, 3
  %65 = sub i64 %63, %64
  %uglygep810 = getelementptr i8, ptr %.unpack652, i64 %65
  %66 = sub i64 1, %.unpack683.unpack684.unpack
  %67 = mul i64 %.unpack683.unpack.unpack686, %66
  %68 = shl i64 %67, 3
  %69 = add i64 %58, -1
  %70 = shl i64 %.unpack683.unpack.unpack686, 3
  %71 = add i64 %70, 8
  %72 = mul i64 %69, %71
  %73 = add i64 %68, %72
  %74 = add i64 %73, 8
  %75 = shl i64 %.unpack683.unpack.unpack, 3
  %76 = sub i64 %74, %75
  %uglygep811 = getelementptr i8, ptr %.unpack676, i64 %76
  %77 = add i64 %68, 8
  %78 = sub i64 %77, %75
  %uglygep812 = getelementptr i8, ptr %.unpack676, i64 %78
  %79 = icmp ult ptr %uglygep811, %uglygep812
  %umin = select i1 %79, ptr %uglygep811, ptr %uglygep812
  %80 = icmp ugt ptr %uglygep811, %uglygep812
  %umax = select i1 %80, ptr %uglygep811, ptr %uglygep812
  %uglygep813 = getelementptr i8, ptr %umax, i64 8
  %bound0 = icmp ult ptr %uglygep, %uglygep813
  %bound1 = icmp ult ptr %umin, %uglygep810
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %.ph.lver.orig, label %.ph

.ph.lver.orig:                                    ; preds = %.lver.check, %.ph.lver.orig
  %81 = phi i64 [ %96, %.ph.lver.orig ], [ 1, %.lver.check ]
  %82 = add i64 %81, %60
  %83 = getelementptr i64, ptr %.unpack652, i64 %82
  %84 = load i64, ptr %83, align 8, !tbaa !3
  %85 = sub i64 %81, %.unpack671.unpack.unpack
  %86 = getelementptr i64, ptr %.unpack664, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !3
  %88 = add i64 %87, %84
  %89 = sub i64 %81, %.unpack659.unpack.unpack
  %90 = getelementptr i64, ptr %.unpack652, i64 %89
  store i64 %88, ptr %90, align 8, !tbaa !3
  %91 = sub i64 %81, %.unpack683.unpack.unpack
  %92 = sub i64 %81, %.unpack683.unpack684.unpack
  %93 = mul i64 %92, %.unpack683.unpack.unpack686
  %94 = add i64 %91, %93
  %95 = getelementptr i64, ptr %.unpack676, i64 %94
  store i64 0, ptr %95, align 8, !tbaa !3
  %96 = add nuw i64 %81, 1
  %exitcond797.not.lver.orig = icmp eq i64 %81, %58
  br i1 %exitcond797.not.lver.orig, label %._crit_edge785, label %.ph.lver.orig

.ph:                                              ; preds = %.lver.check
  %97 = mul i64 %.unpack659.unpack.unpack, -8
  %uglygep815 = getelementptr i8, ptr %.unpack652, i64 %97
  %load_initial = load i64, ptr %uglygep815, align 8
  %xtraiter = and i64 %58, 1
  %98 = icmp eq i64 %58, 1
  br i1 %98, label %._crit_edge785.loopexit816.unr-lcssa, label %.ph.new

.ph.new:                                          ; preds = %.ph
  %unroll_iter = and i64 %58, -2
  br label %99

99:                                               ; preds = %99, %.ph.new
  %store_forwarded = phi i64 [ %load_initial, %.ph.new ], [ %116, %99 ]
  %100 = phi i64 [ 1, %.ph.new ], [ %124, %99 ]
  %niter = phi i64 [ 0, %.ph.new ], [ %niter.next.1, %99 ]
  %101 = sub i64 %100, %.unpack671.unpack.unpack
  %102 = getelementptr i64, ptr %.unpack664, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !3
  %104 = add i64 %103, %store_forwarded
  %105 = sub i64 %100, %.unpack659.unpack.unpack
  %106 = getelementptr i64, ptr %.unpack652, i64 %105
  store i64 %104, ptr %106, align 8, !tbaa !3
  %107 = sub i64 %100, %.unpack683.unpack.unpack
  %108 = sub i64 %100, %.unpack683.unpack684.unpack
  %109 = mul i64 %108, %.unpack683.unpack.unpack686
  %110 = add i64 %107, %109
  %111 = getelementptr i64, ptr %.unpack676, i64 %110
  store i64 0, ptr %111, align 8, !tbaa !3
  %112 = add nuw i64 %100, 1
  %113 = sub i64 %112, %.unpack671.unpack.unpack
  %114 = getelementptr i64, ptr %.unpack664, i64 %113
  %115 = load i64, ptr %114, align 8, !tbaa !3
  %116 = add i64 %115, %104
  %117 = sub i64 %112, %.unpack659.unpack.unpack
  %118 = getelementptr i64, ptr %.unpack652, i64 %117
  store i64 %116, ptr %118, align 8, !tbaa !3
  %119 = sub i64 %112, %.unpack683.unpack.unpack
  %120 = sub i64 %112, %.unpack683.unpack684.unpack
  %121 = mul i64 %120, %.unpack683.unpack.unpack686
  %122 = add i64 %119, %121
  %123 = getelementptr i64, ptr %.unpack676, i64 %122
  store i64 0, ptr %123, align 8, !tbaa !3
  %124 = add nuw i64 %100, 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_edge785.loopexit816.unr-lcssa, label %99

._crit_edge785.loopexit816.unr-lcssa:             ; preds = %99, %.ph
  %store_forwarded.unr = phi i64 [ %load_initial, %.ph ], [ %116, %99 ]
  %.unr = phi i64 [ 1, %.ph ], [ %124, %99 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge785, label %._crit_edge785.loopexit816.epilog-lcssa

._crit_edge785.loopexit816.epilog-lcssa:          ; preds = %._crit_edge785.loopexit816.unr-lcssa
  %125 = sub i64 %.unr, %.unpack671.unpack.unpack
  %126 = getelementptr i64, ptr %.unpack664, i64 %125
  %127 = load i64, ptr %126, align 8, !tbaa !3
  %128 = add i64 %127, %store_forwarded.unr
  %129 = sub i64 %.unr, %.unpack659.unpack.unpack
  %130 = getelementptr i64, ptr %.unpack652, i64 %129
  store i64 %128, ptr %130, align 8, !tbaa !3
  %131 = sub i64 %.unr, %.unpack683.unpack.unpack
  %132 = sub i64 %.unr, %.unpack683.unpack684.unpack
  %133 = mul i64 %132, %.unpack683.unpack.unpack686
  %134 = add i64 %131, %133
  %135 = getelementptr i64, ptr %.unpack676, i64 %134
  store i64 0, ptr %135, align 8, !tbaa !3
  br label %._crit_edge785

._crit_edge785:                                   ; preds = %._crit_edge785.loopexit816.epilog-lcssa, %._crit_edge785.loopexit816.unr-lcssa, %.ph.lver.orig
  %.pre = load i64, ptr %1, align 8, !tbaa !3
  %136 = icmp sgt i64 %.pre, 0
  br i1 %136, label %.lr.ph793, label %._crit_edge794

.lr.ph793:                                        ; preds = %._crit_edge785
  %.unpack624 = load ptr, ptr @_QFEdp.0, align 8
  %.unpack631.unpack.unpack = load i64, ptr @_QFEdp.7, align 8
  %.unpack631.unpack.unpack634 = load i64, ptr @_QFEdp.8, align 8
  %.unpack631.unpack632.unpack = load i64, ptr @_QFEdp.10, align 8
  %.unpack640 = load ptr, ptr @_QFEsum.0, align 8
  %.unpack647.unpack.unpack = load i64, ptr @_QFEsum.7, align 8
  %137 = xor i64 %.unpack647.unpack.unpack, -1
  %138 = add i64 %.pre, 1
  br label %139

139:                                              ; preds = %.lr.ph793, %._crit_edge791
  %indvars.iv = phi i64 [ 2, %.lr.ph793 ], [ %indvars.iv.next, %._crit_edge791 ]
  %140 = phi i64 [ 1, %.lr.ph793 ], [ %179, %._crit_edge791 ]
  %141 = load i64, ptr %1, align 8, !tbaa !3
  %142 = sub i64 %141, %140
  %143 = icmp sgt i64 %142, 0
  %144 = icmp sgt i64 %140, 0
  %or.cond = and i1 %143, %144
  br i1 %or.cond, label %.lr.ph787.us, label %._crit_edge791

.lr.ph787.us:                                     ; preds = %139, %._crit_edge788.us
  %indvars.iv798 = phi i64 [ %indvars.iv.next799, %._crit_edge788.us ], [ %indvars.iv, %139 ]
  %145 = phi i64 [ %177, %._crit_edge788.us ], [ %142, %139 ]
  %146 = phi i64 [ %176, %._crit_edge788.us ], [ 1, %139 ]
  %147 = add i64 %146, %140
  %148 = sub i64 %146, %.unpack631.unpack.unpack
  %149 = sub i64 %147, %.unpack631.unpack632.unpack
  %150 = mul i64 %149, %.unpack631.unpack.unpack634
  %151 = add i64 %150, %148
  %152 = getelementptr i64, ptr %.unpack624, i64 %151
  %153 = sub i64 %147, %.unpack647.unpack.unpack
  %154 = getelementptr i64, ptr %.unpack640, i64 %153
  %155 = add i64 %146, %137
  %156 = getelementptr i64, ptr %.unpack640, i64 %155
  %.pre806 = load i64, ptr %152, align 8, !tbaa !3
  br label %157

157:                                              ; preds = %.lr.ph787.us, %157
  %158 = phi i64 [ %.pre806, %.lr.ph787.us ], [ %175, %157 ]
  %159 = phi i64 [ %146, %.lr.ph787.us ], [ %165, %157 ]
  %160 = sub i64 %159, %.unpack631.unpack632.unpack
  %161 = mul i64 %160, %.unpack631.unpack.unpack634
  %162 = add i64 %161, %148
  %163 = getelementptr i64, ptr %.unpack624, i64 %162
  %164 = load i64, ptr %163, align 8, !tbaa !3
  %165 = add nuw i64 %159, 1
  %166 = sub i64 %165, %.unpack631.unpack.unpack
  %167 = add i64 %166, %150
  %168 = getelementptr i64, ptr %.unpack624, i64 %167
  %169 = load i64, ptr %168, align 8, !tbaa !3
  %170 = add i64 %169, %164
  %171 = load i64, ptr %154, align 8, !tbaa !3
  %172 = add i64 %170, %171
  %173 = load i64, ptr %156, align 8, !tbaa !3
  %174 = sub i64 %172, %173
  %175 = call i64 @llvm.smin.i64(i64 %158, i64 %174)
  store i64 %175, ptr %152, align 8, !tbaa !3
  %exitcond800.not = icmp eq i64 %165, %indvars.iv798
  br i1 %exitcond800.not, label %._crit_edge788.us, label %157

._crit_edge788.us:                                ; preds = %157
  %176 = add nuw i64 %146, 1
  %177 = add i64 %145, -1
  %178 = icmp sgt i64 %177, 0
  %indvars.iv.next799 = add i64 %indvars.iv798, 1
  br i1 %178, label %.lr.ph787.us, label %._crit_edge791

._crit_edge791:                                   ; preds = %._crit_edge788.us, %139
  %179 = add nuw i64 %140, 1
  %indvars.iv.next = add nuw i64 %indvars.iv, 1
  %exitcond801.not = icmp eq i64 %indvars.iv, %138
  br i1 %exitcond801.not, label %._crit_edge794, label %139

._crit_edge794:                                   ; preds = %._crit_edge791, %._crit_edge, %._crit_edge785
  %180 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28493029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.9e07b68d8bca2f77de157e9aab976104, i32 32)
  %.unpack608 = load ptr, ptr @_QFEdp.0, align 8, !tbaa !7
  %.unpack615.unpack.unpack = load i64, ptr @_QFEdp.7, align 8, !tbaa !7
  %.unpack615.unpack.unpack618 = load i64, ptr @_QFEdp.8, align 8, !tbaa !7
  %.unpack615.unpack616.unpack = load i64, ptr @_QFEdp.10, align 8, !tbaa !7
  %181 = sub i64 1, %.unpack615.unpack.unpack
  %182 = load i64, ptr %1, align 8, !tbaa !3
  %183 = sub i64 %182, %.unpack615.unpack616.unpack
  %184 = mul i64 %183, %.unpack615.unpack.unpack618
  %185 = add i64 %181, %184
  %186 = getelementptr i64, ptr %.unpack608, i64 %185
  %187 = load i64, ptr %186, align 8, !tbaa !3
  %188 = call i1 @_FortranAioOutputInteger64(ptr %180, i64 %187)
  %189 = call i32 @_FortranAioEndIoStatement(ptr %180)
  %190 = 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 {} @_FortranAReportFatalUserError(ptr, ptr, i32) local_unnamed_addr

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

declare i1 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

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

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

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

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

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { noreturn }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }

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