; LLVM IR from ritikbanger/Hacktoberfest2022-DSA :: 20. Dynamic Programming (Knapsack_Problem_DP)

; 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_ostream" = type { ptr, %"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 }

@__const.main.P = external hidden unnamed_addr constant [4 x i32], align 16
@__const.main.Wt = external hidden unnamed_addr constant [4 x i32], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca [4 x i32], align 16
  %3 = alloca [4 x i32], align 16
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca [4 x [6 x i32]], align 16
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr %2) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %2, ptr align 16 @__const.main.P, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %3, ptr align 16 @__const.main.Wt, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 5, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 3, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 96, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %99, %0
  %14 = load i32, ptr %7, align 4, !tbaa !5
  %15 = load i32, ptr %5, align 4, !tbaa !5
  %16 = icmp sle i32 %14, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %102

18:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %95, %18
  %20 = load i32, ptr %9, align 4, !tbaa !5
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = icmp sle i32 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %98

24:                                               ; preds = %19
  %25 = load i32, ptr %7, align 4, !tbaa !5
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %30, label %27

27:                                               ; preds = %24
  %28 = load i32, ptr %9, align 4, !tbaa !5
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %30, label %37

30:                                               ; preds = %27, %24
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [4 x [6 x i32]], ptr %6, i64 0, i64 %32
  %34 = load i32, ptr %9, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [6 x i32], ptr %33, i64 0, i64 %35
  store i32 0, ptr %36, align 4, !tbaa !5
  br label %94

37:                                               ; preds = %27
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = load i32, ptr %9, align 4, !tbaa !5
  %43 = icmp sle i32 %41, %42
  br i1 %43, label %44, label %78

44:                                               ; preds = %37
  %45 = load i32, ptr %7, align 4, !tbaa !5
  %46 = sub nsw i32 %45, 1
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [4 x [6 x i32]], ptr %6, i64 0, i64 %47
  %49 = load i32, ptr %9, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [6 x i32], ptr %48, i64 0, i64 %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %52 = load i32, ptr %7, align 4, !tbaa !5
  %53 = sub nsw i32 %52, 1
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [4 x [6 x i32]], ptr %6, i64 0, i64 %54
  %56 = load i32, ptr %9, align 4, !tbaa !5
  %57 = load i32, ptr %7, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = sub nsw i32 %56, %60
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [6 x i32], ptr %55, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = load i32, ptr %7, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [4 x i32], ptr %2, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = add nsw i32 %64, %68
  store i32 %69, ptr %10, align 4, !tbaa !5
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %51, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = load i32, ptr %7, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [4 x [6 x i32]], ptr %6, i64 0, i64 %73
  %75 = load i32, ptr %9, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [6 x i32], ptr %74, i64 0, i64 %76
  store i32 %71, ptr %77, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %93

78:                                               ; preds = %37
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = sub nsw i32 %79, 1
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [4 x [6 x i32]], ptr %6, i64 0, i64 %81
  %83 = load i32, ptr %9, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [6 x i32], ptr %82, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = load i32, ptr %7, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [4 x [6 x i32]], ptr %6, i64 0, i64 %88
  %90 = load i32, ptr %9, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [6 x i32], ptr %89, i64 0, i64 %91
  store i32 %86, ptr %92, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %78, %44
  br label %94

94:                                               ; preds = %93, %30
  br label %95

95:                                               ; preds = %94
  %96 = load i32, ptr %9, align 4, !tbaa !5
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %9, align 4, !tbaa !5
  br label %19, !llvm.loop !9

98:                                               ; preds = %23
  br label %99

99:                                               ; preds = %98
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %7, align 4, !tbaa !5
  br label %13, !llvm.loop !11

102:                                              ; preds = %17
  %103 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %116, %102
  %105 = load i32, ptr %11, align 4, !tbaa !5
  %106 = load i32, ptr %5, align 4, !tbaa !5
  %107 = icmp sle i32 %105, %106
  br i1 %107, label %109, label %108

108:                                              ; preds = %104
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %119

109:                                              ; preds = %104
  %110 = load i32, ptr %11, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %113)
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %114, ptr noundef @.str.1)
  br label %116

116:                                              ; preds = %109
  %117 = load i32, ptr %11, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %11, align 4, !tbaa !5
  br label %104, !llvm.loop !12

119:                                              ; preds = %108
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %133, %119
  %122 = load i32, ptr %12, align 4, !tbaa !5
  %123 = load i32, ptr %5, align 4, !tbaa !5
  %124 = icmp sle i32 %122, %123
  br i1 %124, label %126, label %125

125:                                              ; preds = %121
  store i32 11, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %136

126:                                              ; preds = %121
  %127 = load i32, ptr %12, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [4 x i32], ptr %2, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %130)
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %131, ptr noundef @.str.1)
  br label %133

133:                                              ; preds = %126
  %134 = load i32, ptr %12, align 4, !tbaa !5
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %12, align 4, !tbaa !5
  br label %121, !llvm.loop !13

136:                                              ; preds = %125
  %137 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
  %138 = load i32, ptr %5, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [4 x [6 x i32]], ptr %6, i64 0, i64 %139
  %141 = load i32, ptr %4, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [6 x i32], ptr %140, i64 0, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %137, i32 noundef %144)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 96, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %2) #6
  %146 = load i32, ptr %1, align 4
  ret i32 %146
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; 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)) #3

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

; 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) #4

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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { "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 = { 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_ostream" = type { ptr, %"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 }

@__const.main.P = external hidden unnamed_addr constant [4 x i32], align 16
@__const.main.Wt = external hidden unnamed_addr constant [4 x i32], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
.preheader.peel.begin:
  %0 = alloca [4 x [6 x i32]], align 16
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %0) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(24) %0, i8 0, i64 24, i1 false), !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader.peel.begin, %.split.us
  %indvar = phi i64 [ 1, %.preheader.peel.begin ], [ %indvar.next, %.split.us ]
  %2 = getelementptr inbounds [4 x i32], ptr @__const.main.Wt, i64 0, i64 %indvar
  %3 = add nsw i64 %indvar, -1
  %4 = getelementptr inbounds [4 x i32], ptr @__const.main.P, i64 0, i64 %indvar
  %5 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %indvar, i64 0
  store i32 0, ptr %5, align 8, !tbaa !5
  %6 = load i32, ptr %2, align 4, !tbaa !5
  %.not.1 = icmp sgt i32 %6, 1
  %7 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %3, i64 1
  br i1 %.not.1, label %42, label %32

.loopexit:                                        ; preds = %.split.us
  %8 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %9 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.Wt, i64 4), align 4, !tbaa !5
  %10 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %9)
  %11 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull @.str.1)
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.Wt, i64 8), align 8, !tbaa !5
  %13 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %12)
  %14 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull @.str.1)
  %15 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.Wt, i64 12), align 4, !tbaa !5
  %16 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %15)
  %17 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull @.str.1)
  %18 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.2)
  %19 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.P, i64 4), align 4, !tbaa !5
  %20 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %19)
  %21 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull @.str.1)
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.P, i64 8), align 8, !tbaa !5
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %22)
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull @.str.1)
  %25 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.P, i64 12), 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 @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef nonnull @.str.1)
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.3)
  %29 = getelementptr inbounds i8, ptr %0, i64 92
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %28, i32 noundef %30)
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %0) #6
  ret i32 0

.split.us:                                        ; preds = %92, %102
  %indvar.next = add nuw nsw i64 %indvar, 1
  %exitcond.not = icmp eq i64 %indvar.next, 4
  br i1 %exitcond.not, label %.loopexit, label %.preheader, !llvm.loop !9

32:                                               ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %33 = sub nsw i32 1, %6
  %34 = zext nneg i32 %33 to i64
  %35 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %3, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = add nsw i32 %37, %36
  store i32 %38, ptr %1, align 4, !tbaa !5
  %39 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %indvar, i64 1
  store i32 %40, ptr %41, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  br label %.preheader.split.2

42:                                               ; preds = %.preheader
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %indvar, i64 1
  store i32 %43, ptr %44, align 4, !tbaa !5
  br label %.preheader.split.2

.preheader.split.2:                               ; preds = %32, %42
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %.not.2 = icmp sgt i32 %45, 2
  %46 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %3, i64 2
  br i1 %.not.2, label %57, label %47

47:                                               ; preds = %.preheader.split.2
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %48 = sub nsw i32 2, %45
  %49 = zext nneg i32 %48 to i64
  %50 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %3, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = add nsw i32 %52, %51
  store i32 %53, ptr %1, align 4, !tbaa !5
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %46, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %indvar, i64 2
  store i32 %55, ptr %56, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  br label %.preheader.split.3

57:                                               ; preds = %.preheader.split.2
  %58 = load i32, ptr %46, align 8, !tbaa !5
  %59 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %indvar, i64 2
  store i32 %58, ptr %59, align 8, !tbaa !5
  br label %.preheader.split.3

.preheader.split.3:                               ; preds = %47, %57
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %.not.3 = icmp sgt i32 %60, 3
  %61 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %3, i64 3
  br i1 %.not.3, label %72, label %62

62:                                               ; preds = %.preheader.split.3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %63 = sub nsw i32 3, %60
  %64 = zext nneg i32 %63 to i64
  %65 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %3, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = add nsw i32 %67, %66
  store i32 %68, ptr %1, align 4, !tbaa !5
  %69 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %61, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %indvar, i64 3
  store i32 %70, ptr %71, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  br label %.preheader.split.4

72:                                               ; preds = %.preheader.split.3
  %73 = load i32, ptr %61, align 4, !tbaa !5
  %74 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %indvar, i64 3
  store i32 %73, ptr %74, align 4, !tbaa !5
  br label %.preheader.split.4

.preheader.split.4:                               ; preds = %62, %72
  %75 = load i32, ptr %2, align 4, !tbaa !5
  %.not.4 = icmp sgt i32 %75, 4
  %76 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %3, i64 4
  br i1 %.not.4, label %87, label %77

77:                                               ; preds = %.preheader.split.4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %78 = sub nsw i32 4, %75
  %79 = zext nneg i32 %78 to i64
  %80 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %3, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = load i32, ptr %4, align 4, !tbaa !5
  %83 = add nsw i32 %82, %81
  store i32 %83, ptr %1, align 4, !tbaa !5
  %84 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %76, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %indvar, i64 4
  store i32 %85, ptr %86, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  br label %.preheader.split.5

87:                                               ; preds = %.preheader.split.4
  %88 = load i32, ptr %76, align 8, !tbaa !5
  %89 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %indvar, i64 4
  store i32 %88, ptr %89, align 8, !tbaa !5
  br label %.preheader.split.5

.preheader.split.5:                               ; preds = %77, %87
  %90 = load i32, ptr %2, align 4, !tbaa !5
  %.not.5 = icmp sgt i32 %90, 5
  %91 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %3, i64 5
  br i1 %.not.5, label %102, label %92

92:                                               ; preds = %.preheader.split.5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %93 = sub nsw i32 5, %90
  %94 = zext nneg i32 %93 to i64
  %95 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %3, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = load i32, ptr %4, align 4, !tbaa !5
  %98 = add nsw i32 %97, %96
  store i32 %98, ptr %1, align 4, !tbaa !5
  %99 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %91, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %indvar, i64 5
  store i32 %100, ptr %101, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  br label %.split.us

102:                                              ; preds = %.preheader.split.5
  %103 = load i32, ptr %91, align 4, !tbaa !5
  %104 = getelementptr inbounds [4 x [6 x i32]], ptr %0, i64 0, i64 %indvar, i64 5
  store i32 %103, ptr %104, align 4, !tbaa !5
  br label %.split.us
}

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

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

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

; 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 #3

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

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

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 = { 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 #3 = { 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 #4 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopIdiomRecognizePass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass