; LLVM IR from Tunghohin/Competitive_Coding :: Daimayuan (164)

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

@cost = external dso_local global [2010 x i32], align 16
@val = external dso_local global [2010 x i32], align 16
@limit = external dso_local global [2010 x i32], align 16
@dp = external dso_local global [2010 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %13 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %14 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %15 = getelementptr i8, ptr %14, i64 -24
  %16 = load i64, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %16
  %18 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %17, ptr noundef null)
  %19 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %20 = getelementptr i8, ptr %19, i64 -24
  %21 = load i64, ptr %20, align 8
  %22 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %21
  %23 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %22, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %24 = 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)
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !8
  br label %26

26:                                               ; preds = %44, %0
  %27 = load i32, ptr %4, align 4, !tbaa !8
  %28 = load i32, ptr %2, align 4, !tbaa !8
  %29 = icmp sle i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %47

31:                                               ; preds = %26
  %32 = load i32, ptr %4, align 4, !tbaa !8
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [2010 x i32], ptr @cost, i64 0, i64 %33
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %34)
  %36 = load i32, ptr %4, align 4, !tbaa !8
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [2010 x i32], ptr @val, i64 0, i64 %37
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 4 dereferenceable(4) %38)
  %40 = load i32, ptr %4, align 4, !tbaa !8
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [2010 x i32], ptr @limit, i64 0, i64 %41
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %39, ptr noundef nonnull align 4 dereferenceable(4) %42)
  br label %44

44:                                               ; preds = %31
  %45 = load i32, ptr %4, align 4, !tbaa !8
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %4, align 4, !tbaa !8
  br label %26, !llvm.loop !11

47:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !8
  br label %48

48:                                               ; preds = %155, %47
  %49 = load i32, ptr %5, align 4, !tbaa !8
  %50 = load i32, ptr %2, align 4, !tbaa !8
  %51 = icmp sle i32 %49, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %48
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %158

53:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %54 = load i32, ptr %5, align 4, !tbaa !8
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [2010 x i32], ptr @limit, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !8
  store i32 %57, ptr %7, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !8
  br label %58

58:                                               ; preds = %106, %53
  %59 = load i32, ptr %8, align 4, !tbaa !8
  %60 = load i32, ptr %7, align 4, !tbaa !8
  %61 = icmp sle i32 %59, %60
  br i1 %61, label %63, label %62

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

63:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %64 = load i32, ptr %3, align 4, !tbaa !8
  store i32 %64, ptr %9, align 4, !tbaa !8
  br label %65

65:                                               ; preds = %102, %63
  %66 = load i32, ptr %9, align 4, !tbaa !8
  %67 = load i32, ptr %5, align 4, !tbaa !8
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [2010 x i32], ptr @cost, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !8
  %71 = load i32, ptr %8, align 4, !tbaa !8
  %72 = mul nsw i32 %70, %71
  %73 = icmp sge i32 %66, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %65
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %105

75:                                               ; preds = %65
  %76 = load i32, ptr %9, align 4, !tbaa !8
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [2010 x i32], ptr @dp, i64 0, i64 %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %79 = load i32, ptr %9, align 4, !tbaa !8
  %80 = load i32, ptr %5, align 4, !tbaa !8
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [2010 x i32], ptr @cost, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !8
  %84 = load i32, ptr %8, align 4, !tbaa !8
  %85 = mul nsw i32 %83, %84
  %86 = sub nsw i32 %79, %85
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [2010 x i32], ptr @dp, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !8
  %90 = load i32, ptr %5, align 4, !tbaa !8
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [2010 x i32], ptr @val, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !8
  %94 = load i32, ptr %8, align 4, !tbaa !8
  %95 = mul nsw i32 %93, %94
  %96 = add nsw i32 %89, %95
  store i32 %96, ptr %10, align 4, !tbaa !8
  %97 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %78, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %98 = load i32, ptr %97, align 4, !tbaa !8
  %99 = load i32, ptr %9, align 4, !tbaa !8
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [2010 x i32], ptr @dp, i64 0, i64 %100
  store i32 %98, ptr %101, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %102

102:                                              ; preds = %75
  %103 = load i32, ptr %9, align 4, !tbaa !8
  %104 = add nsw i32 %103, -1
  store i32 %104, ptr %9, align 4, !tbaa !8
  br label %65, !llvm.loop !13

105:                                              ; preds = %74
  br label %106

106:                                              ; preds = %105
  %107 = load i32, ptr %8, align 4, !tbaa !8
  %108 = load i32, ptr %7, align 4, !tbaa !8
  %109 = sub nsw i32 %108, %107
  store i32 %109, ptr %7, align 4, !tbaa !8
  %110 = load i32, ptr %8, align 4, !tbaa !8
  %111 = mul nsw i32 %110, 2
  store i32 %111, ptr %8, align 4, !tbaa !8
  br label %58, !llvm.loop !14

112:                                              ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %113 = load i32, ptr %3, align 4, !tbaa !8
  store i32 %113, ptr %11, align 4, !tbaa !8
  br label %114

114:                                              ; preds = %151, %112
  %115 = load i32, ptr %11, align 4, !tbaa !8
  %116 = load i32, ptr %5, align 4, !tbaa !8
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [2010 x i32], ptr @cost, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !8
  %120 = load i32, ptr %7, align 4, !tbaa !8
  %121 = mul nsw i32 %119, %120
  %122 = icmp sge i32 %115, %121
  br i1 %122, label %124, label %123

123:                                              ; preds = %114
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %154

124:                                              ; preds = %114
  %125 = load i32, ptr %11, align 4, !tbaa !8
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [2010 x i32], ptr @dp, i64 0, i64 %126
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %128 = load i32, ptr %11, align 4, !tbaa !8
  %129 = load i32, ptr %5, align 4, !tbaa !8
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [2010 x i32], ptr @cost, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !8
  %133 = load i32, ptr %7, align 4, !tbaa !8
  %134 = mul nsw i32 %132, %133
  %135 = sub nsw i32 %128, %134
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [2010 x i32], ptr @dp, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !8
  %139 = load i32, ptr %5, align 4, !tbaa !8
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [2010 x i32], ptr @val, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !8
  %143 = load i32, ptr %7, align 4, !tbaa !8
  %144 = mul nsw i32 %142, %143
  %145 = add nsw i32 %138, %144
  store i32 %145, ptr %12, align 4, !tbaa !8
  %146 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %127, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %147 = load i32, ptr %146, align 4, !tbaa !8
  %148 = load i32, ptr %11, align 4, !tbaa !8
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [2010 x i32], ptr @dp, i64 0, i64 %149
  store i32 %147, ptr %150, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %151

151:                                              ; preds = %124
  %152 = load i32, ptr %11, align 4, !tbaa !8
  %153 = add nsw i32 %152, -1
  store i32 %153, ptr %11, align 4, !tbaa !8
  br label %114, !llvm.loop !15

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

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

158:                                              ; preds = %52
  %159 = load i32, ptr %3, align 4, !tbaa !8
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [2010 x i32], ptr @dp, i64 0, i64 %160
  %162 = load i32, ptr %161, align 4, !tbaa !8
  %163 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %162)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %164 = load i32, ptr %1, align 4
  ret i32 %164
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 2

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

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

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

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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !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}


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

@cost = external dso_local global [2010 x i32], align 16
@val = external dso_local global [2010 x i32], align 16
@limit = external dso_local global [2010 x i32], align 16
@dp = external dso_local global [2010 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %6 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %7 = getelementptr i8, ptr %6, i64 -24
  %8 = load i64, ptr %7, align 8
  %9 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %8
  %10 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %9, ptr noundef null)
  %11 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %13
  %15 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %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) %1)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %18 = load i32, ptr %1, align 4, !tbaa !8
  %.not45 = icmp slt i32 %18, 1
  br i1 %.not45, label %._crit_edge64, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph
  %19 = icmp slt i32 %26, 1
  br i1 %19, label %._crit_edge64, label %.lr.ph63

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %20 = getelementptr inbounds [2010 x i32], ptr @cost, i64 0, i64 %indvars.iv
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %20)
  %22 = getelementptr inbounds [2010 x i32], ptr @val, i64 0, i64 %indvars.iv
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 4 dereferenceable(4) %22)
  %24 = getelementptr inbounds [2010 x i32], ptr @limit, i64 0, i64 %indvars.iv
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 4 dereferenceable(4) %24)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %26 = load i32, ptr %1, align 4, !tbaa !8
  %27 = sext i32 %26 to i64
  %.not.not = icmp slt i64 %indvars.iv, %27
  br i1 %.not.not, label %.lr.ph, label %.preheader, !llvm.loop !11

._crit_edge64:                                    ; preds = %._crit_edge60, %0, %.preheader
  %28 = load i32, ptr %2, align 4, !tbaa !8
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [2010 x i32], ptr @dp, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !8
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %31)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0

.lr.ph63:                                         ; preds = %.preheader, %._crit_edge60
  %indvars.iv72 = phi i64 [ %indvars.iv.next73, %._crit_edge60 ], [ 1, %.preheader ]
  %33 = getelementptr inbounds [2010 x i32], ptr @limit, i64 0, i64 %indvars.iv72
  %34 = load i32, ptr %33, align 4, !tbaa !8
  %.not4250 = icmp slt i32 %34, 1
  %.phi.trans.insert = getelementptr inbounds [2010 x i32], ptr @cost, i64 0, i64 %indvars.iv72
  br i1 %.not4250, label %.lr.ph63.._crit_edge55_crit_edge, label %.lr.ph54

.lr.ph63.._crit_edge55_crit_edge:                 ; preds = %.lr.ph63
  %.pre75 = load i32, ptr %.phi.trans.insert, align 4, !tbaa !8
  br label %._crit_edge55

.lr.ph54:                                         ; preds = %.lr.ph63
  %35 = getelementptr inbounds [2010 x i32], ptr @val, i64 0, i64 %indvars.iv72
  %.pre = load i32, ptr %.phi.trans.insert, align 4, !tbaa !8
  br label %42

._crit_edge55:                                    ; preds = %._crit_edge, %.lr.ph63.._crit_edge55_crit_edge
  %36 = phi i32 [ %.pre75, %.lr.ph63.._crit_edge55_crit_edge ], [ %47, %._crit_edge ]
  %.038.lcssa = phi i32 [ %34, %.lr.ph63.._crit_edge55_crit_edge ], [ %48, %._crit_edge ]
  %37 = load i32, ptr %2, align 4, !tbaa !8
  %38 = getelementptr inbounds [2010 x i32], ptr @cost, i64 0, i64 %indvars.iv72
  %39 = mul nsw i32 %36, %.038.lcssa
  %.not4356 = icmp slt i32 %37, %39
  br i1 %.not4356, label %._crit_edge60, label %.lr.ph59

.lr.ph59:                                         ; preds = %._crit_edge55
  %40 = getelementptr inbounds [2010 x i32], ptr @val, i64 0, i64 %indvars.iv72
  %41 = sext i32 %37 to i64
  br label %66

42:                                               ; preds = %.lr.ph54, %._crit_edge
  %43 = phi i32 [ %.pre, %.lr.ph54 ], [ %47, %._crit_edge ]
  %.03752 = phi i32 [ 1, %.lr.ph54 ], [ %49, %._crit_edge ]
  %.03851 = phi i32 [ %34, %.lr.ph54 ], [ %48, %._crit_edge ]
  %44 = load i32, ptr %2, align 4, !tbaa !8
  %45 = mul nsw i32 %43, %.03752
  %.not4447 = icmp slt i32 %44, %45
  br i1 %.not4447, label %._crit_edge, label %.lr.ph49.preheader

.lr.ph49.preheader:                               ; preds = %42
  %46 = sext i32 %44 to i64
  br label %.lr.ph49

._crit_edge:                                      ; preds = %.lr.ph49, %42
  %47 = phi i32 [ %43, %42 ], [ %61, %.lr.ph49 ]
  %48 = sub nsw i32 %.03851, %.03752
  %49 = shl nsw i32 %.03752, 1
  %.not42 = icmp sgt i32 %49, %48
  br i1 %.not42, label %._crit_edge55, label %42, !llvm.loop !13

.lr.ph49:                                         ; preds = %.lr.ph49.preheader, %.lr.ph49
  %indvars.iv66 = phi i64 [ %46, %.lr.ph49.preheader ], [ %indvars.iv.next67, %.lr.ph49 ]
  %50 = phi i32 [ %45, %.lr.ph49.preheader ], [ %62, %.lr.ph49 ]
  %51 = getelementptr inbounds [2010 x i32], ptr @dp, i64 0, i64 %indvars.iv66
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %52 = sext i32 %50 to i64
  %53 = sub nsw i64 %indvars.iv66, %52
  %54 = getelementptr inbounds [2010 x i32], ptr @dp, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !8
  %56 = load i32, ptr %35, align 4, !tbaa !8
  %57 = mul nsw i32 %56, %.03752
  %58 = add nsw i32 %57, %55
  store i32 %58, ptr %3, align 4, !tbaa !8
  %59 = 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) %3)
  %60 = load i32, ptr %59, align 4, !tbaa !8
  store i32 %60, ptr %51, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  %indvars.iv.next67 = add nsw i64 %indvars.iv66, -1
  %61 = load i32, ptr %.phi.trans.insert, align 4, !tbaa !8
  %62 = mul nsw i32 %61, %.03752
  %63 = sext i32 %62 to i64
  %.not44.not = icmp sgt i64 %indvars.iv66, %63
  br i1 %.not44.not, label %.lr.ph49, label %._crit_edge, !llvm.loop !14

._crit_edge60:                                    ; preds = %66, %._crit_edge55
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %64 = load i32, ptr %1, align 4, !tbaa !8
  %65 = sext i32 %64 to i64
  %.not41.not = icmp slt i64 %indvars.iv72, %65
  br i1 %.not41.not, label %.lr.ph63, label %._crit_edge64, !llvm.loop !15

66:                                               ; preds = %.lr.ph59, %66
  %indvars.iv69 = phi i64 [ %41, %.lr.ph59 ], [ %indvars.iv.next70, %66 ]
  %67 = phi i32 [ %39, %.lr.ph59 ], [ %79, %66 ]
  %68 = getelementptr inbounds [2010 x i32], ptr @dp, i64 0, i64 %indvars.iv69
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %69 = sext i32 %67 to i64
  %70 = sub nsw i64 %indvars.iv69, %69
  %71 = getelementptr inbounds [2010 x i32], ptr @dp, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !8
  %73 = load i32, ptr %40, align 4, !tbaa !8
  %74 = mul nsw i32 %73, %.038.lcssa
  %75 = add nsw i32 %74, %72
  store i32 %75, ptr %4, align 4, !tbaa !8
  %76 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %68, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %77 = load i32, ptr %76, align 4, !tbaa !8
  store i32 %77, ptr %68, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  %indvars.iv.next70 = add nsw i64 %indvars.iv69, -1
  %78 = load i32, ptr %38, align 4, !tbaa !8
  %79 = mul nsw i32 %78, %.038.lcssa
  %80 = sext i32 %79 to i64
  %.not43.not = icmp sgt i64 %indvars.iv69, %80
  br i1 %.not43.not, label %66, label %._crit_edge60, !llvm.loop !16
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #1

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

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

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

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

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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !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}


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