; LLVM IR from AdarshGaur/Competitive-Programming :: CSES/Dynamic Programming (Book Shop)

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

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; 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 ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = zext i32 %17 to i64
  %19 = call ptr @llvm.stacksave.p0()
  store ptr %19, ptr %4, align 8
  %20 = alloca i32, i64 %18, align 16
  store i64 %18, ptr %5, align 8
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = zext i32 %21 to i64
  %23 = alloca i32, i64 %22, align 16
  store i64 %22, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %34, %0
  %25 = load i32, ptr %7, align 4, !tbaa !5
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %37

29:                                               ; preds = %24
  %30 = load i32, ptr %7, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i32, ptr %20, i64 %31
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %32)
  br label %34

34:                                               ; preds = %29
  %35 = load i32, ptr %7, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %7, align 4, !tbaa !5
  br label %24, !llvm.loop !9

37:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %48, %37
  %39 = load i32, ptr %8, align 4, !tbaa !5
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %51

43:                                               ; preds = %38
  %44 = load i32, ptr %8, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds i32, ptr %23, i64 %45
  %47 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %46)
  br label %48

48:                                               ; preds = %43
  %49 = load i32, ptr %8, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %8, align 4, !tbaa !5
  br label %38, !llvm.loop !11

51:                                               ; preds = %42
  %52 = load i32, ptr %2, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  %54 = zext i32 %53 to i64
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  %57 = zext i32 %56 to i64
  %58 = mul nuw i64 %54, %57
  %59 = alloca i32, i64 %58, align 16
  store i64 %54, ptr %9, align 8
  store i64 %57, ptr %10, align 8
  %60 = mul nuw i64 %54, %57
  %61 = mul nuw i64 4, %60
  call void @llvm.memset.p0.i64(ptr align 16 %59, i8 0, i64 %61, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %142, %51
  %63 = load i32, ptr %11, align 4, !tbaa !5
  %64 = load i32, ptr %2, align 4, !tbaa !5
  %65 = icmp sle i32 %63, %64
  br i1 %65, label %67, label %66

66:                                               ; preds = %62
  store i32 8, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %145

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

68:                                               ; preds = %138, %67
  %69 = load i32, ptr %13, align 4, !tbaa !5
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = icmp sle i32 %69, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %68
  store i32 11, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %141

73:                                               ; preds = %68
  %74 = load i32, ptr %11, align 4, !tbaa !5
  %75 = sub nsw i32 %74, 1
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i32, ptr %20, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = load i32, ptr %13, align 4, !tbaa !5
  %80 = icmp sle i32 %78, %79
  br i1 %80, label %81, label %120

81:                                               ; preds = %73
  %82 = load i32, ptr %11, align 4, !tbaa !5
  %83 = sub nsw i32 %82, 1
  %84 = sext i32 %83 to i64
  %85 = mul nsw i64 %84, %57
  %86 = getelementptr inbounds i32, ptr %59, i64 %85
  %87 = load i32, ptr %13, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds i32, ptr %86, i64 %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %90 = load i32, ptr %11, align 4, !tbaa !5
  %91 = sub nsw i32 %90, 1
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds i32, ptr %23, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = load i32, ptr %11, align 4, !tbaa !5
  %96 = sub nsw i32 %95, 1
  %97 = sext i32 %96 to i64
  %98 = mul nsw i64 %97, %57
  %99 = getelementptr inbounds i32, ptr %59, i64 %98
  %100 = load i32, ptr %13, align 4, !tbaa !5
  %101 = load i32, ptr %11, align 4, !tbaa !5
  %102 = sub nsw i32 %101, 1
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds i32, ptr %20, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = sub nsw i32 %100, %105
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds i32, ptr %99, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = add nsw i32 %94, %109
  store i32 %110, ptr %14, align 4, !tbaa !5
  %111 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %89, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = load i32, ptr %11, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = mul nsw i64 %114, %57
  %116 = getelementptr inbounds i32, ptr %59, i64 %115
  %117 = load i32, ptr %13, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds i32, ptr %116, i64 %118
  store i32 %112, ptr %119, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %137

120:                                              ; preds = %73
  %121 = load i32, ptr %11, align 4, !tbaa !5
  %122 = sub nsw i32 %121, 1
  %123 = sext i32 %122 to i64
  %124 = mul nsw i64 %123, %57
  %125 = getelementptr inbounds i32, ptr %59, i64 %124
  %126 = load i32, ptr %13, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds i32, ptr %125, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = load i32, ptr %11, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = mul nsw i64 %131, %57
  %133 = getelementptr inbounds i32, ptr %59, i64 %132
  %134 = load i32, ptr %13, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds i32, ptr %133, i64 %135
  store i32 %129, ptr %136, align 4, !tbaa !5
  br label %137

137:                                              ; preds = %120, %81
  br label %138

138:                                              ; preds = %137
  %139 = load i32, ptr %13, align 4, !tbaa !5
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %13, align 4, !tbaa !5
  br label %68, !llvm.loop !12

141:                                              ; preds = %72
  br label %142

142:                                              ; preds = %141
  %143 = load i32, ptr %11, align 4, !tbaa !5
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %11, align 4, !tbaa !5
  br label %62, !llvm.loop !13

145:                                              ; preds = %66
  %146 = load i32, ptr %2, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = mul nsw i64 %147, %57
  %149 = getelementptr inbounds i32, ptr %59, i64 %148
  %150 = load i32, ptr %3, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds i32, ptr %149, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %153)
  %155 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %154, ptr noundef @.str)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %12, align 4
  %156 = load ptr, ptr %4, align 8
  call void @llvm.stackrestore.p0(ptr %156)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %157 = load i32, ptr %1, align 4
  ret i32 %157
}

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 #3 = { nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #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}


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

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %4 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %5 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %6 = load i32, ptr %1, align 4, !tbaa !5
  %7 = zext i32 %6 to i64
  %8 = call ptr @llvm.stacksave.p0()
  %9 = alloca i32, i64 %7, align 16
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = zext i32 %10 to i64
  %12 = alloca i32, i64 %11, align 16
  %13 = icmp sgt i32 %10, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

.preheader32:                                     ; preds = %.lr.ph
  %14 = icmp sgt i32 %17, 0
  br i1 %14, label %.lr.ph36, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %15 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = icmp slt i64 %indvars.iv.next, %18
  br i1 %19, label %.lr.ph, label %.preheader32, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph36, %0, %.preheader32
  %20 = phi i32 [ %17, %.preheader32 ], [ %10, %0 ], [ %32, %.lr.ph36 ]
  %21 = add nsw i32 %20, 1
  %22 = zext i32 %21 to i64
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  %25 = zext i32 %24 to i64
  %26 = mul nuw i64 %25, %22
  %27 = alloca i32, i64 %26, align 16
  %28 = shl nuw i64 %26, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %27, i8 0, i64 %28, i1 false)
  %.not41 = icmp slt i32 %20, 1
  %29 = icmp slt i32 %23, 1
  %or.cond = select i1 %.not41, i1 true, i1 %29
  br i1 %or.cond, label %._crit_edge43, label %.preheader

.lr.ph36:                                         ; preds = %.preheader32, %.lr.ph36
  %indvars.iv49 = phi i64 [ %indvars.iv.next50, %.lr.ph36 ], [ 0, %.preheader32 ]
  %30 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv49
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %30)
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %32 = load i32, ptr %1, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = icmp slt i64 %indvars.iv.next50, %33
  br i1 %34, label %.lr.ph36, label %._crit_edge, !llvm.loop !11

.preheader:                                       ; preds = %._crit_edge, %._crit_edge40
  %35 = phi i32 [ %54, %._crit_edge40 ], [ %20, %._crit_edge ]
  %36 = phi i32 [ %55, %._crit_edge40 ], [ %23, %._crit_edge ]
  %37 = phi i32 [ %56, %._crit_edge40 ], [ %23, %._crit_edge ]
  %indvars.iv55 = phi i64 [ %indvars.iv.next56, %._crit_edge40 ], [ 1, %._crit_edge ]
  %.not3037 = icmp slt i32 %37, 1
  br i1 %.not3037, label %._crit_edge40, label %.lr.ph39

.lr.ph39:                                         ; preds = %.preheader
  %38 = add nsw i64 %indvars.iv55, -1
  %39 = getelementptr inbounds i32, ptr %9, i64 %38
  %40 = mul nuw nsw i64 %38, %25
  %41 = getelementptr inbounds i32, ptr %27, i64 %40
  %42 = getelementptr inbounds i32, ptr %12, i64 %38
  %43 = mul nuw nsw i64 %indvars.iv55, %25
  %44 = getelementptr inbounds i32, ptr %27, i64 %43
  br label %58

._crit_edge43:                                    ; preds = %._crit_edge40, %._crit_edge
  %45 = phi i32 [ %23, %._crit_edge ], [ %55, %._crit_edge40 ]
  %.lcssa = phi i32 [ %20, %._crit_edge ], [ %54, %._crit_edge40 ]
  %46 = sext i32 %.lcssa to i64
  %47 = mul nsw i64 %46, %25
  %48 = getelementptr inbounds i32, ptr %27, i64 %47
  %49 = sext i32 %45 to i64
  %50 = getelementptr inbounds i32, ptr %48, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %51)
  %53 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef nonnull @.str)
  call void @llvm.stackrestore.p0(ptr %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0

._crit_edge40.loopexit:                           ; preds = %77
  %.pre58 = load i32, ptr %1, align 4, !tbaa !5
  br label %._crit_edge40

._crit_edge40:                                    ; preds = %._crit_edge40.loopexit, %.preheader
  %54 = phi i32 [ %.pre58, %._crit_edge40.loopexit ], [ %35, %.preheader ]
  %55 = phi i32 [ %78, %._crit_edge40.loopexit ], [ %36, %.preheader ]
  %56 = phi i32 [ %78, %._crit_edge40.loopexit ], [ %37, %.preheader ]
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %57 = sext i32 %54 to i64
  %.not.not = icmp slt i64 %indvars.iv55, %57
  br i1 %.not.not, label %.preheader, label %._crit_edge43, !llvm.loop !12

58:                                               ; preds = %.lr.ph39, %77
  %59 = phi i32 [ %36, %.lr.ph39 ], [ %78, %77 ]
  %indvars.iv52 = phi i64 [ 1, %.lr.ph39 ], [ %indvars.iv.next53, %77 ]
  %60 = load i32, ptr %39, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %.not31 = icmp slt i64 %indvars.iv52, %61
  %62 = getelementptr inbounds i32, ptr %41, i64 %indvars.iv52
  br i1 %.not31, label %74, label %63

63:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %64 = load i32, ptr %42, align 4, !tbaa !5
  %65 = trunc nuw nsw i64 %indvars.iv52 to i32
  %66 = sub nsw i32 %65, %60
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds i32, ptr %41, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = add nsw i32 %69, %64
  store i32 %70, ptr %3, align 4, !tbaa !5
  %71 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %62, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = getelementptr inbounds i32, ptr %44, i64 %indvars.iv52
  store i32 %72, ptr %73, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  br label %77

74:                                               ; preds = %58
  %75 = load i32, ptr %62, align 4, !tbaa !5
  %76 = getelementptr inbounds i32, ptr %44, i64 %indvars.iv52
  store i32 %75, ptr %76, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %63, %74
  %78 = phi i32 [ %.pre, %63 ], [ %59, %74 ]
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  %79 = sext i32 %78 to i64
  %.not30.not = icmp slt i64 %indvars.iv52, %79
  br i1 %.not30.not, label %58, label %._crit_edge40.loopexit, !llvm.loop !14
}

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

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 #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

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

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

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #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}
!13 = !{!"llvm.loop.unswitch.partial.disable"}
!14 = distinct !{!14, !10}


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