; LLVM IR from lzyrapx/Competitive-Programming :: 百度之星/2020/第一场 (D)

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

@a = external dso_local global [1234 x [1234 x i32]], align 16
@cost = external dso_local global [4 x [25 x [25 x [25 x i32]]]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z9get_valueiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5solveiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #2

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #4 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %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
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %91, %2
  %22 = load i32, ptr %6, align 4, !tbaa !5
  %23 = icmp sle i32 %22, 3
  br i1 %23, label %25, label %24

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

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

26:                                               ; preds = %87, %25
  %27 = load i32, ptr %8, align 4, !tbaa !5
  %28 = icmp sle i32 %27, 24
  br i1 %28, label %30, label %29

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

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %83, %30
  %32 = load i32, ptr %9, align 4, !tbaa !5
  %33 = icmp sle i32 %32, 24
  br i1 %33, label %35, label %34

34:                                               ; preds = %31
  store i32 8, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %86

35:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %79, %35
  %37 = load i32, ptr %10, align 4, !tbaa !5
  %38 = icmp sle i32 %37, 24
  br i1 %38, label %40, label %39

39:                                               ; preds = %36
  store i32 11, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %82

40:                                               ; preds = %36
  %41 = load i32, ptr %8, align 4, !tbaa !5
  %42 = load i32, ptr %9, align 4, !tbaa !5
  %43 = add nsw i32 %41, %42
  %44 = load i32, ptr %10, align 4, !tbaa !5
  %45 = add nsw i32 %43, %44
  %46 = icmp sle i32 %45, 24
  br i1 %46, label %47, label %65

47:                                               ; preds = %40
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = load i32, ptr %8, align 4, !tbaa !5
  %50 = load i32, ptr %9, align 4, !tbaa !5
  %51 = load i32, ptr %10, align 4, !tbaa !5
  %52 = call noundef i32 @_Z9get_valueiiii(i32 noundef %48, i32 noundef %49, i32 noundef %50, i32 noundef %51)
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [4 x [25 x [25 x [25 x i32]]]], ptr @cost, i64 0, i64 %54
  %56 = load i32, ptr %8, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [25 x [25 x [25 x i32]]], ptr %55, i64 0, i64 %57
  %59 = load i32, ptr %9, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [25 x [25 x i32]], ptr %58, i64 0, i64 %60
  %62 = load i32, ptr %10, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [25 x i32], ptr %61, i64 0, i64 %63
  store i32 %52, ptr %64, align 4, !tbaa !5
  br label %78

65:                                               ; preds = %40
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [4 x [25 x [25 x [25 x i32]]]], ptr @cost, i64 0, i64 %67
  %69 = load i32, ptr %8, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [25 x [25 x [25 x i32]]], ptr %68, i64 0, i64 %70
  %72 = load i32, ptr %9, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [25 x [25 x i32]], ptr %71, i64 0, i64 %73
  %75 = load i32, ptr %10, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [25 x i32], ptr %74, i64 0, i64 %76
  store i32 1000000000, ptr %77, align 4, !tbaa !5
  br label %78

78:                                               ; preds = %65, %47
  br label %79

79:                                               ; preds = %78
  %80 = load i32, ptr %10, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %10, align 4, !tbaa !5
  br label %36, !llvm.loop !11

82:                                               ; preds = %39
  br label %83

83:                                               ; preds = %82
  %84 = load i32, ptr %9, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %9, align 4, !tbaa !5
  br label %31, !llvm.loop !13

86:                                               ; preds = %34
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %8, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %8, align 4, !tbaa !5
  br label %26, !llvm.loop !14

90:                                               ; preds = %29
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %6, align 4, !tbaa !5
  br label %21, !llvm.loop !15

94:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  %95 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %11)
  br label %96

96:                                               ; preds = %158, %94
  %97 = load i32, ptr %11, align 4, !tbaa !5
  %98 = add nsw i32 %97, -1
  store i32 %98, ptr %11, align 4, !tbaa !5
  %99 = icmp ne i32 %97, 0
  br i1 %99, label %100, label %162

100:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 1000000000, ptr %15, align 4, !tbaa !5
  %101 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %102 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %101, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %103 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %102, ptr noundef nonnull align 4 dereferenceable(4) %14)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 1, ptr %16, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %127, %100
  %105 = load i32, ptr %16, align 4, !tbaa !5
  %106 = load i32, ptr %12, align 4, !tbaa !5
  %107 = icmp sle i32 %105, %106
  br i1 %107, label %109, label %108

108:                                              ; preds = %104
  store i32 16, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %130

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

110:                                              ; preds = %123, %109
  %111 = load i32, ptr %17, align 4, !tbaa !5
  %112 = load i32, ptr %12, align 4, !tbaa !5
  %113 = icmp sle i32 %111, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %110
  store i32 19, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %126

115:                                              ; preds = %110
  %116 = load i32, ptr %16, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [1234 x [1234 x i32]], ptr @a, i64 0, i64 %117
  %119 = load i32, ptr %17, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [1234 x i32], ptr %118, i64 0, i64 %120
  %122 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %121)
  br label %123

123:                                              ; preds = %115
  %124 = load i32, ptr %17, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %17, align 4, !tbaa !5
  br label %110, !llvm.loop !16

126:                                              ; preds = %114
  br label %127

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

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

131:                                              ; preds = %155, %130
  %132 = load i32, ptr %18, align 4, !tbaa !5
  %133 = load i32, ptr %12, align 4, !tbaa !5
  %134 = icmp sle i32 %132, %133
  br i1 %134, label %136, label %135

135:                                              ; preds = %131
  store i32 22, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %158

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

137:                                              ; preds = %151, %136
  %138 = load i32, ptr %19, align 4, !tbaa !5
  %139 = load i32, ptr %12, align 4, !tbaa !5
  %140 = icmp sle i32 %138, %139
  br i1 %140, label %142, label %141

141:                                              ; preds = %137
  store i32 25, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %154

142:                                              ; preds = %137
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %143 = load i32, ptr %18, align 4, !tbaa !5
  %144 = load i32, ptr %19, align 4, !tbaa !5
  %145 = load i32, ptr %12, align 4, !tbaa !5
  %146 = load i32, ptr %13, align 4, !tbaa !5
  %147 = load i32, ptr %14, align 4, !tbaa !5
  %148 = call noundef i32 @_Z5solveiiiii(i32 noundef %143, i32 noundef %144, i32 noundef %145, i32 noundef %146, i32 noundef %147)
  store i32 %148, ptr %20, align 4, !tbaa !5
  %149 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %20)
  %150 = load i32, ptr %149, align 4, !tbaa !5
  store i32 %150, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %151

151:                                              ; preds = %142
  %152 = load i32, ptr %19, align 4, !tbaa !5
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %19, align 4, !tbaa !5
  br label %137, !llvm.loop !18

154:                                              ; preds = %141
  br label %155

155:                                              ; preds = %154
  %156 = load i32, ptr %18, align 4, !tbaa !5
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %18, align 4, !tbaa !5
  br label %131, !llvm.loop !19

158:                                              ; preds = %135
  %159 = load i32, ptr %15, align 4, !tbaa !5
  %160 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %159)
  %161 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %160, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %96, !llvm.loop !20

162:                                              ; preds = %96
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  %163 = load i32, ptr %3, align 4
  ret i32 %163
}

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #2 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = { 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 #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 = { 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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}


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

@a = external dso_local global [1234 x [1234 x i32]], align 16
@cost = external dso_local local_unnamed_addr global [4 x [25 x [25 x [25 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z9get_valueiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5solveiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #4 {
.preheader51:
  %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
  br label %.preheader50

.preheader50:                                     ; preds = %.preheader51, %41
  %indvars.iv78 = phi i64 [ 0, %.preheader51 ], [ %indvars.iv.next79, %41 ]
  %8 = trunc nuw nsw i64 %indvars.iv78 to i32
  br label %.preheader49

.preheader50.1:                                   ; preds = %41, %21
  %indvars.iv78.1 = phi i64 [ %indvars.iv.next79.1, %21 ], [ 0, %41 ]
  %9 = trunc nuw nsw i64 %indvars.iv78.1 to i32
  br label %.preheader49.1

.preheader49.1:                                   ; preds = %20, %.preheader50.1
  %indvars.iv74.1 = phi i64 [ 0, %.preheader50.1 ], [ %indvars.iv.next75.1, %20 ]
  %10 = add nuw nsw i64 %indvars.iv74.1, %indvars.iv78.1
  %11 = trunc nuw nsw i64 %indvars.iv74.1 to i32
  br label %12

12:                                               ; preds = %18, %.preheader49.1
  %indvars.iv.1 = phi i64 [ 0, %.preheader49.1 ], [ %indvars.iv.next.1, %18 ]
  %13 = add nuw nsw i64 %10, %indvars.iv.1
  %14 = icmp ult i64 %13, 25
  br i1 %14, label %15, label %18

15:                                               ; preds = %12
  %16 = trunc nuw nsw i64 %indvars.iv.1 to i32
  %17 = tail call noundef i32 @_Z9get_valueiiii(i32 noundef 2, i32 noundef %9, i32 noundef %11, i32 noundef %16)
  br label %18

18:                                               ; preds = %12, %15
  %.sink = phi i32 [ %17, %15 ], [ 1000000000, %12 ]
  %19 = getelementptr inbounds [4 x [25 x [25 x [25 x i32]]]], ptr @cost, i64 0, i64 2, i64 %indvars.iv78.1, i64 %indvars.iv74.1, i64 %indvars.iv.1
  store i32 %.sink, ptr %19, align 4
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.1, 1
  %exitcond.1.not = icmp eq i64 %indvars.iv.next.1, 25
  br i1 %exitcond.1.not, label %20, label %12, !llvm.loop !5

20:                                               ; preds = %18
  %indvars.iv.next75.1 = add nuw nsw i64 %indvars.iv74.1, 1
  %exitcond77.1.not = icmp eq i64 %indvars.iv.next75.1, 25
  br i1 %exitcond77.1.not, label %21, label %.preheader49.1, !llvm.loop !7

21:                                               ; preds = %20
  %indvars.iv.next79.1 = add nuw nsw i64 %indvars.iv78.1, 1
  %exitcond81.1.not = icmp eq i64 %indvars.iv.next79.1, 25
  br i1 %exitcond81.1.not, label %.preheader50.2, label %.preheader50.1, !llvm.loop !8

.preheader50.2:                                   ; preds = %21, %34
  %indvars.iv78.2 = phi i64 [ %indvars.iv.next79.2, %34 ], [ 0, %21 ]
  %22 = trunc nuw nsw i64 %indvars.iv78.2 to i32
  br label %.preheader49.2

.preheader49.2:                                   ; preds = %33, %.preheader50.2
  %indvars.iv74.2 = phi i64 [ 0, %.preheader50.2 ], [ %indvars.iv.next75.2, %33 ]
  %23 = add nuw nsw i64 %indvars.iv74.2, %indvars.iv78.2
  %24 = trunc nuw nsw i64 %indvars.iv74.2 to i32
  br label %25

25:                                               ; preds = %31, %.preheader49.2
  %indvars.iv.2 = phi i64 [ 0, %.preheader49.2 ], [ %indvars.iv.next.2, %31 ]
  %26 = add nuw nsw i64 %23, %indvars.iv.2
  %27 = icmp ult i64 %26, 25
  br i1 %27, label %28, label %31

28:                                               ; preds = %25
  %29 = trunc nuw nsw i64 %indvars.iv.2 to i32
  %30 = tail call noundef i32 @_Z9get_valueiiii(i32 noundef 3, i32 noundef %22, i32 noundef %24, i32 noundef %29)
  br label %31

31:                                               ; preds = %25, %28
  %.sink92 = phi i32 [ %30, %28 ], [ 1000000000, %25 ]
  %32 = getelementptr inbounds [4 x [25 x [25 x [25 x i32]]]], ptr @cost, i64 0, i64 3, i64 %indvars.iv78.2, i64 %indvars.iv74.2, i64 %indvars.iv.2
  store i32 %.sink92, ptr %32, align 4
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv.2, 1
  %exitcond.2.not = icmp eq i64 %indvars.iv.next.2, 25
  br i1 %exitcond.2.not, label %33, label %25, !llvm.loop !5

33:                                               ; preds = %31
  %indvars.iv.next75.2 = add nuw nsw i64 %indvars.iv74.2, 1
  %exitcond77.2.not = icmp eq i64 %indvars.iv.next75.2, 25
  br i1 %exitcond77.2.not, label %34, label %.preheader49.2, !llvm.loop !7

34:                                               ; preds = %33
  %indvars.iv.next79.2 = add nuw nsw i64 %indvars.iv78.2, 1
  %exitcond81.2.not = icmp eq i64 %indvars.iv.next79.2, 25
  br i1 %exitcond81.2.not, label %35, label %.preheader50.2, !llvm.loop !8

35:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  store i32 0, ptr %2, align 4, !tbaa !9
  %36 = 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)
  %37 = load i32, ptr %2, align 4, !tbaa !9
  %38 = add nsw i32 %37, -1
  store i32 %38, ptr %2, align 4, !tbaa !9
  %.not67 = icmp eq i32 %37, 0
  br i1 %.not67, label %._crit_edge70, label %.lr.ph69

.preheader49:                                     ; preds = %.preheader50, %42
  %indvars.iv74 = phi i64 [ 0, %.preheader50 ], [ %indvars.iv.next75, %42 ]
  %39 = add nuw nsw i64 %indvars.iv74, %indvars.iv78
  %40 = trunc nuw nsw i64 %indvars.iv74 to i32
  br label %43

41:                                               ; preds = %42
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %exitcond81.not = icmp eq i64 %indvars.iv.next79, 25
  br i1 %exitcond81.not, label %.preheader50.1, label %.preheader50, !llvm.loop !8

42:                                               ; preds = %49
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %exitcond77.not = icmp eq i64 %indvars.iv.next75, 25
  br i1 %exitcond77.not, label %41, label %.preheader49, !llvm.loop !7

43:                                               ; preds = %.preheader49, %49
  %indvars.iv = phi i64 [ 0, %.preheader49 ], [ %indvars.iv.next, %49 ]
  %44 = add nuw nsw i64 %39, %indvars.iv
  %45 = icmp ult i64 %44, 25
  br i1 %45, label %46, label %49

46:                                               ; preds = %43
  %47 = trunc nuw nsw i64 %indvars.iv to i32
  %48 = tail call noundef i32 @_Z9get_valueiiii(i32 noundef 1, i32 noundef %8, i32 noundef %40, i32 noundef %47)
  br label %49

49:                                               ; preds = %43, %46
  %.sink93 = phi i32 [ %48, %46 ], [ 1000000000, %43 ]
  %50 = getelementptr inbounds [4 x [25 x [25 x [25 x i32]]]], ptr @cost, i64 0, i64 1, i64 %indvars.iv78, i64 %indvars.iv74, i64 %indvars.iv
  store i32 %.sink93, ptr %50, align 4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 25
  br i1 %exitcond.not, label %42, label %43, !llvm.loop !5

.lr.ph69:                                         ; preds = %35, %._crit_edge66
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  store i32 1000000000, ptr %6, align 4, !tbaa !9
  %51 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %52 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %51, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %53 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %52, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %54 = load i32, ptr %3, align 4, !tbaa !9
  %.not4358 = icmp slt i32 %54, 1
  br i1 %.not4358, label %._crit_edge66, label %.preheader47

.preheader48:                                     ; preds = %._crit_edge
  %.not4464 = icmp slt i32 %56, 1
  br i1 %.not4464, label %._crit_edge66, label %.preheader

.preheader47:                                     ; preds = %.lr.ph69, %._crit_edge
  %55 = phi i32 [ %56, %._crit_edge ], [ %54, %.lr.ph69 ]
  %indvars.iv89 = phi i64 [ %indvars.iv.next90, %._crit_edge ], [ 1, %.lr.ph69 ]
  %.not4656 = icmp slt i32 %55, 1
  br i1 %.not4656, label %.preheader47.._crit_edge_crit_edge, label %.lr.ph

.preheader47.._crit_edge_crit_edge:               ; preds = %.preheader47
  %.pre = sext i32 %55 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.preheader47.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader47.._crit_edge_crit_edge ], [ %60, %.lr.ph ]
  %56 = phi i32 [ %55, %.preheader47.._crit_edge_crit_edge ], [ %59, %.lr.ph ]
  %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
  %.not43.not = icmp slt i64 %indvars.iv89, %.pre-phi
  br i1 %.not43.not, label %.preheader47, label %.preheader48, !llvm.loop !13

.lr.ph:                                           ; preds = %.preheader47, %.lr.ph
  %indvars.iv86 = phi i64 [ %indvars.iv.next87, %.lr.ph ], [ 1, %.preheader47 ]
  %57 = getelementptr inbounds [1234 x [1234 x i32]], ptr @a, i64 0, i64 %indvars.iv89, i64 %indvars.iv86
  %58 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %57)
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %59 = load i32, ptr %3, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %.not46.not = icmp slt i64 %indvars.iv86, %60
  br i1 %.not46.not, label %.lr.ph, label %._crit_edge, !llvm.loop !15

.preheader:                                       ; preds = %.preheader48, %._crit_edge63
  %61 = phi i32 [ %67, %._crit_edge63 ], [ %56, %.preheader48 ]
  %.03665 = phi i32 [ %68, %._crit_edge63 ], [ 1, %.preheader48 ]
  %.not4560 = icmp slt i32 %61, 1
  br i1 %.not4560, label %._crit_edge63, label %.lr.ph62

._crit_edge66:                                    ; preds = %._crit_edge63, %.lr.ph69, %.preheader48
  %62 = load i32, ptr %6, align 4, !tbaa !9
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %62)
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %63, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %65 = load i32, ptr %2, align 4, !tbaa !9
  %66 = add nsw i32 %65, -1
  store i32 %66, ptr %2, align 4, !tbaa !9
  %.not = icmp eq i32 %65, 0
  br i1 %.not, label %._crit_edge70, label %.lr.ph69, !llvm.loop !16

._crit_edge63:                                    ; preds = %.lr.ph62, %.preheader
  %67 = phi i32 [ %61, %.preheader ], [ %76, %.lr.ph62 ]
  %68 = add nuw nsw i32 %.03665, 1
  %.not44.not = icmp slt i32 %.03665, %67
  br i1 %.not44.not, label %.preheader, label %._crit_edge66, !llvm.loop !17

.lr.ph62:                                         ; preds = %.preheader, %.lr.ph62
  %69 = phi i32 [ %76, %.lr.ph62 ], [ %61, %.preheader ]
  %.061 = phi i32 [ %75, %.lr.ph62 ], [ 1, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  %70 = load i32, ptr %4, align 4, !tbaa !9
  %71 = load i32, ptr %5, align 4, !tbaa !9
  %72 = call noundef i32 @_Z5solveiiiii(i32 noundef %.03665, i32 noundef %.061, i32 noundef %69, i32 noundef %70, i32 noundef %71)
  store i32 %72, ptr %7, align 4, !tbaa !9
  %73 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %74 = load i32, ptr %73, align 4, !tbaa !9
  store i32 %74, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  %75 = add nuw nsw i32 %.061, 1
  %76 = load i32, ptr %3, align 4, !tbaa !9
  %.not45.not = icmp slt i32 %.061, %76
  br i1 %.not45.not, label %.lr.ph62, label %._crit_edge63, !llvm.loop !18

._crit_edge70:                                    ; preds = %._crit_edge66, %35
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  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)) local_unnamed_addr #5

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

; 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 #2 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = { 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 #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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = distinct !{!13, !6, !14}
!14 = !{!"llvm.loop.unswitch.partial.disable"}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6, !14}
!18 = distinct !{!18, !6}


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