; LLVM IR from upupming/algorithm :: acwing/算法竞赛进阶指南/0x53-区间DP/282. 石子合并 (main)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@n = external dso_local global i32, align 4
@sum = external dso_local global [310 x i32], align 16
@f = external dso_local global [310 x [310 x i32]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %31, %0
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = icmp sle i32 %12, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %34

16:                                               ; preds = %11
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [310 x i32], ptr @sum, i64 0, i64 %18
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %19)
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sub nsw i32 %21, 1
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [310 x i32], ptr @sum, i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [310 x i32], ptr @sum, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = add nsw i32 %29, %25
  store i32 %30, ptr %28, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %16
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %2, align 4, !tbaa !5
  br label %11, !llvm.loop !9

34:                                               ; preds = %15
  call void @llvm.memset.p0.i64(ptr align 16 @f, i8 63, i64 384400, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %47, %34
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = load i32, ptr @n, align 4, !tbaa !5
  %38 = icmp sle i32 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %50

40:                                               ; preds = %35
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [310 x [310 x i32]], ptr @f, i64 0, i64 %42
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [310 x i32], ptr %43, i64 0, i64 %45
  store i32 0, ptr %46, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %40
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %3, align 4, !tbaa !5
  br label %35, !llvm.loop !11

50:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %127, %50
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %54 = icmp sle i32 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %130

56:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %123, %56
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = add nsw i32 %58, %59
  %61 = sub nsw i32 %60, 1
  %62 = load i32, ptr @n, align 4, !tbaa !5
  %63 = icmp sle i32 %61, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %57
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %126

65:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = add nsw i32 %66, %67
  %69 = sub nsw i32 %68, 1
  store i32 %69, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %70 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %70, ptr %8, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %119, %65
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = icmp sle i32 %73, %74
  br i1 %75, label %77, label %76

76:                                               ; preds = %71
  store i32 14, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %122

77:                                               ; preds = %71
  %78 = load i32, ptr %6, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [310 x [310 x i32]], ptr @f, i64 0, i64 %79
  %81 = load i32, ptr %7, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [310 x i32], ptr %80, i64 0, i64 %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [310 x [310 x i32]], ptr @f, i64 0, i64 %85
  %87 = load i32, ptr %8, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [310 x i32], ptr %86, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = load i32, ptr %8, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [310 x [310 x i32]], ptr @f, i64 0, i64 %93
  %95 = load i32, ptr %7, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [310 x i32], ptr %94, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = add nsw i32 %90, %98
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [310 x i32], ptr @sum, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = add nsw i32 %99, %103
  %105 = load i32, ptr %6, align 4, !tbaa !5
  %106 = sub nsw i32 %105, 1
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [310 x i32], ptr @sum, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = sub nsw i32 %104, %109
  store i32 %110, ptr %9, align 4, !tbaa !5
  %111 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %83, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = load i32, ptr %6, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [310 x [310 x i32]], ptr @f, i64 0, i64 %114
  %116 = load i32, ptr %7, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [310 x i32], ptr %115, i64 0, i64 %117
  store i32 %112, ptr %118, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %119

119:                                              ; preds = %77
  %120 = load i32, ptr %8, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %8, align 4, !tbaa !5
  br label %71, !llvm.loop !12

122:                                              ; preds = %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %123

123:                                              ; preds = %122
  %124 = load i32, ptr %6, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %6, align 4, !tbaa !5
  br label %57, !llvm.loop !13

126:                                              ; preds = %64
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %4, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %4, align 4, !tbaa !5
  br label %51, !llvm.loop !14

130:                                              ; preds = %55
  %131 = load i32, ptr @n, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [310 x i32], ptr getelementptr inbounds ([310 x [310 x i32]], ptr @f, i64 0, i64 1), i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %134)
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %135, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@n = external dso_local global i32, align 4
@sum = external dso_local global [310 x i32], align 16
@f = external dso_local global [310 x [310 x i32]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %.not44 = icmp slt i32 %3, 1
  br i1 %.not44, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %0
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(384400) @f, i8 63, i64 384400, i1 false)
  br label %.preheader42.._crit_edge59_crit_edge

._crit_edge:                                      ; preds = %.lr.ph
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(384400) @f, i8 63, i64 384400, i1 false)
  %.not3746 = icmp slt i32 %13, 1
  br i1 %.not3746, label %.preheader42.._crit_edge59_crit_edge, label %.lr.ph49.preheader

.lr.ph49.preheader:                               ; preds = %._crit_edge
  %4 = zext nneg i32 %13 to i64
  %xtraiter = and i64 %4, 3
  %5 = icmp ult i32 %13, 4
  br i1 %5, label %.preheader42.unr-lcssa, label %.lr.ph49.preheader.new

.lr.ph49.preheader.new:                           ; preds = %.lr.ph49.preheader
  %unroll_iter = and i64 %4, 2147483644
  br label %.lr.ph49

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %6 = getelementptr inbounds [310 x i32], ptr @sum, i64 0, i64 %indvars.iv
  %7 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %8 = add nsw i64 %indvars.iv, -1
  %9 = getelementptr inbounds [310 x i32], ptr @sum, i64 0, i64 %8
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = load i32, ptr %6, align 4, !tbaa !5
  %12 = add nsw i32 %11, %10
  store i32 %12, ptr %6, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %.not.not = icmp slt i64 %indvars.iv, %14
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader42.unr-lcssa:                           ; preds = %.lr.ph49, %.lr.ph49.preheader
  %indvars.iv64.unr = phi i64 [ 1, %.lr.ph49.preheader ], [ %indvars.iv.next65.3, %.lr.ph49 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader42, label %.lr.ph49.epil

.lr.ph49.epil:                                    ; preds = %.preheader42.unr-lcssa, %.lr.ph49.epil
  %indvars.iv64.epil = phi i64 [ %indvars.iv.next65.epil, %.lr.ph49.epil ], [ %indvars.iv64.unr, %.preheader42.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph49.epil ], [ 0, %.preheader42.unr-lcssa ]
  %15 = getelementptr inbounds [310 x [310 x i32]], ptr @f, i64 0, i64 %indvars.iv64.epil, i64 %indvars.iv64.epil
  store i32 0, ptr %15, align 4, !tbaa !5
  %indvars.iv.next65.epil = add nuw nsw i64 %indvars.iv64.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader42, label %.lr.ph49.epil, !llvm.loop !11

.preheader42:                                     ; preds = %.lr.ph49.epil, %.preheader42.unr-lcssa
  br i1 %.not3746, label %.preheader42.._crit_edge59_crit_edge, label %.preheader41

.preheader42.._crit_edge59_crit_edge:             ; preds = %._crit_edge, %._crit_edge.thread, %.preheader42
  %16 = phi i32 [ %13, %.preheader42 ], [ %13, %._crit_edge ], [ %3, %._crit_edge.thread ]
  %.pre81 = sext i32 %16 to i64
  br label %._crit_edge59

.lr.ph49:                                         ; preds = %.lr.ph49, %.lr.ph49.preheader.new
  %indvars.iv64 = phi i64 [ 1, %.lr.ph49.preheader.new ], [ %indvars.iv.next65.3, %.lr.ph49 ]
  %niter = phi i64 [ 0, %.lr.ph49.preheader.new ], [ %niter.next.3, %.lr.ph49 ]
  %17 = getelementptr inbounds [310 x [310 x i32]], ptr @f, i64 0, i64 %indvars.iv64, i64 %indvars.iv64
  store i32 0, ptr %17, align 4, !tbaa !5
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %18 = getelementptr inbounds [310 x [310 x i32]], ptr @f, i64 0, i64 %indvars.iv.next65, i64 %indvars.iv.next65
  store i32 0, ptr %18, align 4, !tbaa !5
  %indvars.iv.next65.1 = add nuw nsw i64 %indvars.iv64, 2
  %19 = getelementptr inbounds [310 x [310 x i32]], ptr @f, i64 0, i64 %indvars.iv.next65.1, i64 %indvars.iv.next65.1
  store i32 0, ptr %19, align 4, !tbaa !5
  %indvars.iv.next65.2 = add nuw nsw i64 %indvars.iv64, 3
  %20 = getelementptr inbounds [310 x [310 x i32]], ptr @f, i64 0, i64 %indvars.iv.next65.2, i64 %indvars.iv.next65.2
  store i32 0, ptr %20, align 4, !tbaa !5
  %indvars.iv.next65.3 = add nuw nsw i64 %indvars.iv64, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader42.unr-lcssa, label %.lr.ph49, !llvm.loop !13

.preheader41:                                     ; preds = %.preheader42, %._crit_edge56
  %21 = phi i32 [ %35, %._crit_edge56 ], [ %13, %.preheader42 ]
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %._crit_edge56 ], [ 1, %.preheader42 ]
  %22 = sext i32 %21 to i64
  %.not3954 = icmp sgt i64 %indvars.iv77, %22
  br i1 %.not3954, label %._crit_edge56, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader41
  %23 = trunc nuw nsw i64 %indvars.iv77 to i32
  br label %.preheader

._crit_edge59:                                    ; preds = %._crit_edge56, %.preheader42.._crit_edge59_crit_edge
  %.pre-phi82 = phi i64 [ %.pre81, %.preheader42.._crit_edge59_crit_edge ], [ %.pre-phi, %._crit_edge56 ]
  %24 = getelementptr inbounds [310 x i32], ptr getelementptr inbounds (i8, ptr @f, i64 1240), i64 0, i64 %.pre-phi82
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %25)
  %27 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge53
  %28 = phi i32 [ %21, %.preheader.preheader ], [ %36, %._crit_edge53 ]
  %29 = phi i32 [ %21, %.preheader.preheader ], [ %37, %._crit_edge53 ]
  %indvars.iv72 = phi i32 [ %23, %.preheader.preheader ], [ %indvars.iv.next73, %._crit_edge53 ]
  %indvars.iv67 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next68, %._crit_edge53 ]
  %30 = sext i32 %indvars.iv72 to i64
  %.not40.not50 = icmp slt i64 %indvars.iv67, %30
  br i1 %.not40.not50, label %.lr.ph52, label %._crit_edge53

.lr.ph52:                                         ; preds = %.preheader
  %31 = getelementptr inbounds [310 x [310 x i32]], ptr @f, i64 0, i64 %indvars.iv67, i64 %30
  %32 = getelementptr inbounds [310 x i32], ptr @sum, i64 0, i64 %30
  %33 = add nsw i64 %indvars.iv67, -1
  %34 = getelementptr inbounds [310 x i32], ptr @sum, i64 0, i64 %33
  %wide.trip.count74 = zext i32 %indvars.iv72 to i64
  br label %40

._crit_edge56.loopexit:                           ; preds = %._crit_edge53
  %.pre80 = sext i32 %36 to i64
  br label %._crit_edge56

._crit_edge56:                                    ; preds = %._crit_edge56.loopexit, %.preheader41
  %.pre-phi = phi i64 [ %.pre80, %._crit_edge56.loopexit ], [ %22, %.preheader41 ]
  %35 = phi i32 [ %36, %._crit_edge56.loopexit ], [ %21, %.preheader41 ]
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %.not38.not = icmp slt i64 %indvars.iv77, %.pre-phi
  br i1 %.not38.not, label %.preheader41, label %._crit_edge59, !llvm.loop !14

._crit_edge53.loopexit:                           ; preds = %40
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge53

._crit_edge53:                                    ; preds = %._crit_edge53.loopexit, %.preheader
  %36 = phi i32 [ %.pre, %._crit_edge53.loopexit ], [ %28, %.preheader ]
  %37 = phi i32 [ %.pre, %._crit_edge53.loopexit ], [ %29, %.preheader ]
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %38 = add nuw i64 %indvars.iv77, %indvars.iv67
  %39 = trunc nuw i64 %38 to i32
  %.not39 = icmp slt i32 %37, %39
  %indvars.iv.next73 = add i32 %indvars.iv72, 1
  br i1 %.not39, label %._crit_edge56.loopexit, label %.preheader, !llvm.loop !15

40:                                               ; preds = %.lr.ph52, %40
  %indvars.iv69 = phi i64 [ %indvars.iv67, %.lr.ph52 ], [ %indvars.iv.next70, %40 ]
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %41 = getelementptr inbounds [310 x [310 x i32]], ptr @f, i64 0, i64 %indvars.iv67, i64 %indvars.iv69
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = getelementptr inbounds [310 x [310 x i32]], ptr @f, i64 0, i64 %indvars.iv.next70, i64 %30
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = add nsw i32 %44, %42
  %46 = load i32, ptr %32, align 4, !tbaa !5
  %47 = add nsw i32 %45, %46
  %48 = load i32, ptr %34, align 4, !tbaa !5
  %49 = sub i32 %47, %48
  store i32 %49, ptr %1, align 4, !tbaa !5
  %50 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %31, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %51 = load i32, ptr %50, align 4, !tbaa !5
  store i32 %51, ptr %31, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %exitcond75.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count74
  br i1 %exitcond75.not, label %._crit_edge53.loopexit, label %40, !llvm.loop !16
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass