; LLVM IR from tangjz/acm-icpc :: codeforces/1408D.ll (Z5solvev)

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

%"struct.std::pair" = type { i32, i32 }

@_ZZ5solvevE1a = external hidden global [2001 x %"struct.std::pair"], align 16
@_ZZ5solvevE1b = external hidden global [2001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZZ5solvevE3upp = external hidden global [1000009 x i32], align 16
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #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
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %1, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %31, %0
  %17 = load i32, ptr %3, align 4, !tbaa !5
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %34

21:                                               ; preds = %16
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [2001 x %"struct.std::pair"], ptr @_ZZ5solvevE1a, i64 0, i64 %23
  %25 = getelementptr inbounds %"struct.std::pair", ptr %24, i32 0, i32 0
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [2001 x %"struct.std::pair"], ptr @_ZZ5solvevE1a, i64 0, i64 %27
  %29 = getelementptr inbounds %"struct.std::pair", ptr %28, i32 0, i32 1
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %25, ptr noundef %29)
  br label %31

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

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

35:                                               ; preds = %50, %34
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %40, label %39

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

40:                                               ; preds = %35
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [2001 x %"struct.std::pair"], ptr @_ZZ5solvevE1b, i64 0, i64 %42
  %44 = getelementptr inbounds %"struct.std::pair", ptr %43, i32 0, i32 0
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [2001 x %"struct.std::pair"], ptr @_ZZ5solvevE1b, i64 0, i64 %46
  %48 = getelementptr inbounds %"struct.std::pair", ptr %47, i32 0, i32 1
  %49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %44, ptr noundef %48)
  br label %50

50:                                               ; preds = %40
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %4, align 4, !tbaa !5
  br label %35, !llvm.loop !11

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

54:                                               ; preds = %138, %53
  %55 = load i32, ptr %6, align 4, !tbaa !5
  %56 = load i32, ptr %1, align 4, !tbaa !5
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %59, label %58

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

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

60:                                               ; preds = %134, %59
  %61 = load i32, ptr %8, align 4, !tbaa !5
  %62 = load i32, ptr %2, align 4, !tbaa !5
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %65, label %64

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

65:                                               ; preds = %60
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [2001 x %"struct.std::pair"], ptr @_ZZ5solvevE1a, i64 0, i64 %67
  %69 = getelementptr inbounds %"struct.std::pair", ptr %68, i32 0, i32 0
  %70 = load i32, ptr %69, align 8, !tbaa !12
  %71 = load i32, ptr %8, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [2001 x %"struct.std::pair"], ptr @_ZZ5solvevE1b, i64 0, i64 %72
  %74 = getelementptr inbounds %"struct.std::pair", ptr %73, i32 0, i32 0
  %75 = load i32, ptr %74, align 8, !tbaa !12
  %76 = icmp sle i32 %70, %75
  br i1 %76, label %77, label %133

77:                                               ; preds = %65
  %78 = load i32, ptr %6, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [2001 x %"struct.std::pair"], ptr @_ZZ5solvevE1a, i64 0, i64 %79
  %81 = getelementptr inbounds %"struct.std::pair", ptr %80, i32 0, i32 1
  %82 = load i32, ptr %81, align 4, !tbaa !14
  %83 = load i32, ptr %8, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [2001 x %"struct.std::pair"], ptr @_ZZ5solvevE1b, i64 0, i64 %84
  %86 = getelementptr inbounds %"struct.std::pair", ptr %85, i32 0, i32 1
  %87 = load i32, ptr %86, align 4, !tbaa !14
  %88 = icmp sle i32 %82, %87
  br i1 %88, label %89, label %133

89:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %90 = load i32, ptr %8, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [2001 x %"struct.std::pair"], ptr @_ZZ5solvevE1b, i64 0, i64 %91
  %93 = getelementptr inbounds %"struct.std::pair", ptr %92, i32 0, i32 0
  %94 = load i32, ptr %93, align 8, !tbaa !12
  %95 = load i32, ptr %6, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [2001 x %"struct.std::pair"], ptr @_ZZ5solvevE1a, i64 0, i64 %96
  %98 = getelementptr inbounds %"struct.std::pair", ptr %97, i32 0, i32 0
  %99 = load i32, ptr %98, align 8, !tbaa !12
  %100 = sub nsw i32 %94, %99
  store i32 %100, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %101 = load i32, ptr %8, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [2001 x %"struct.std::pair"], ptr @_ZZ5solvevE1b, i64 0, i64 %102
  %104 = getelementptr inbounds %"struct.std::pair", ptr %103, i32 0, i32 1
  %105 = load i32, ptr %104, align 4, !tbaa !14
  %106 = load i32, ptr %6, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [2001 x %"struct.std::pair"], ptr @_ZZ5solvevE1a, i64 0, i64 %107
  %109 = getelementptr inbounds %"struct.std::pair", ptr %108, i32 0, i32 1
  %110 = load i32, ptr %109, align 4, !tbaa !14
  %111 = sub nsw i32 %105, %110
  store i32 %111, ptr %10, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %117, %89
  %113 = load i32, ptr %5, align 4, !tbaa !5
  %114 = load i32, ptr %9, align 4, !tbaa !5
  %115 = icmp sle i32 %113, %114
  br i1 %115, label %116, label %122

116:                                              ; preds = %112
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %5, align 4, !tbaa !5
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %5, align 4, !tbaa !5
  %120 = sext i32 %118 to i64
  %121 = getelementptr inbounds [1000009 x i32], ptr @_ZZ5solvevE3upp, i64 0, i64 %120
  store i32 0, ptr %121, align 4, !tbaa !5
  br label %112, !llvm.loop !15

122:                                              ; preds = %112
  %123 = load i32, ptr %9, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [1000009 x i32], ptr @_ZZ5solvevE3upp, i64 0, i64 %124
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %126 = load i32, ptr %10, align 4, !tbaa !5
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %11, align 4, !tbaa !5
  %128 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %125, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = load i32, ptr %9, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1000009 x i32], ptr @_ZZ5solvevE3upp, i64 0, i64 %131
  store i32 %129, ptr %132, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %133

133:                                              ; preds = %122, %77, %65
  br label %134

134:                                              ; preds = %133
  %135 = load i32, ptr %8, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %8, align 4, !tbaa !5
  br label %60, !llvm.loop !16

137:                                              ; preds = %64
  br label %138

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

141:                                              ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 2000018, ptr %12, align 4, !tbaa !5
  %142 = load i32, ptr %5, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [1000009 x i32], ptr @_ZZ5solvevE3upp, i64 0, i64 %143
  store i32 0, ptr %144, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %145 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %145, ptr %13, align 4, !tbaa !5
  br label %146

146:                                              ; preds = %176, %141
  %147 = load i32, ptr %13, align 4, !tbaa !5
  %148 = icmp sge i32 %147, 0
  br i1 %148, label %150, label %149

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

150:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %151 = load i32, ptr %13, align 4, !tbaa !5
  %152 = load i32, ptr %13, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [1000009 x i32], ptr @_ZZ5solvevE3upp, i64 0, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !5
  %156 = add nsw i32 %151, %155
  store i32 %156, ptr %14, align 4, !tbaa !5
  %157 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %158 = load i32, ptr %157, align 4, !tbaa !5
  store i32 %158, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  %159 = load i32, ptr %13, align 4, !tbaa !5
  %160 = icmp sgt i32 %159, 0
  br i1 %160, label %161, label %175

161:                                              ; preds = %150
  %162 = load i32, ptr %13, align 4, !tbaa !5
  %163 = sub nsw i32 %162, 1
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [1000009 x i32], ptr @_ZZ5solvevE3upp, i64 0, i64 %164
  %166 = load i32, ptr %13, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [1000009 x i32], ptr @_ZZ5solvevE3upp, i64 0, i64 %167
  %169 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %165, ptr noundef nonnull align 4 dereferenceable(4) %168)
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = load i32, ptr %13, align 4, !tbaa !5
  %172 = sub nsw i32 %171, 1
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [1000009 x i32], ptr @_ZZ5solvevE3upp, i64 0, i64 %173
  store i32 %170, ptr %174, align 4, !tbaa !5
  br label %175

175:                                              ; preds = %161, %150
  br label %176

176:                                              ; preds = %175
  %177 = load i32, ptr %13, align 4, !tbaa !5
  %178 = add nsw i32 %177, -1
  store i32 %178, ptr %13, align 4, !tbaa !5
  br label %146, !llvm.loop !18

179:                                              ; preds = %149
  %180 = load i32, ptr %12, align 4, !tbaa !5
  %181 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %180)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret void
}

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

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

; 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 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: 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

declare i32 @printf(ptr noundef, ...) #2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { 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 = !{!13, !6, i64 0}
!13 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!14 = !{!13, !6, i64 4}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !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"

%"struct.std::pair" = type { i32, i32 }

@_ZZ5solvevE1a = external hidden global [2001 x %"struct.std::pair"], align 16
@_ZZ5solvevE1b = external hidden global [2001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZZ5solvevE3upp = external hidden global [1000009 x i32], align 16
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z5solvev() 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 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %7 = load i32, ptr %1, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %.preheader50

.preheader50:                                     ; preds = %.lr.ph, %0
  %9 = phi i32 [ %7, %0 ], [ %15, %.lr.ph ]
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph53, label %.preheader49

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %12 = getelementptr inbounds [2001 x %"struct.std::pair"], ptr @_ZZ5solvevE1a, i64 0, i64 %indvars.iv
  %13 = getelementptr inbounds i8, ptr %12, i64 4
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %12, ptr noundef nonnull %13)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = load i32, ptr %1, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = icmp slt i64 %indvars.iv.next, %16
  br i1 %17, label %.lr.ph, label %.preheader50, !llvm.loop !9

.preheader49.loopexit:                            ; preds = %.lr.ph53
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %.preheader49

.preheader49:                                     ; preds = %.preheader49.loopexit, %.preheader50
  %18 = phi i32 [ %25, %.preheader49.loopexit ], [ %10, %.preheader50 ]
  %19 = phi i32 [ %.pre, %.preheader49.loopexit ], [ %9, %.preheader50 ]
  %20 = icmp sgt i32 %19, 0
  %21 = icmp sgt i32 %18, 0
  %or.cond = and i1 %20, %21
  br i1 %or.cond, label %.preheader, label %._crit_edge64.thread

.lr.ph53:                                         ; preds = %.preheader50, %.lr.ph53
  %indvars.iv72 = phi i64 [ %indvars.iv.next73, %.lr.ph53 ], [ 0, %.preheader50 ]
  %22 = getelementptr inbounds [2001 x %"struct.std::pair"], ptr @_ZZ5solvevE1b, i64 0, i64 %indvars.iv72
  %23 = getelementptr inbounds i8, ptr %22, i64 4
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %22, ptr noundef nonnull %23)
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = icmp slt i64 %indvars.iv.next73, %26
  br i1 %27, label %.lr.ph53, label %.preheader49.loopexit, !llvm.loop !11

.preheader:                                       ; preds = %.preheader49, %._crit_edge60
  %28 = phi i32 [ %38, %._crit_edge60 ], [ %19, %.preheader49 ]
  %29 = phi i32 [ %39, %._crit_edge60 ], [ %18, %.preheader49 ]
  %30 = phi i32 [ %40, %._crit_edge60 ], [ %18, %.preheader49 ]
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %._crit_edge60 ], [ 0, %.preheader49 ]
  %.04062 = phi i32 [ %.1.lcssa, %._crit_edge60 ], [ 1, %.preheader49 ]
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.lr.ph59, label %._crit_edge60

.lr.ph59:                                         ; preds = %.preheader
  %32 = getelementptr inbounds [2001 x %"struct.std::pair"], ptr @_ZZ5solvevE1a, i64 0, i64 %indvars.iv81
  %33 = getelementptr inbounds i8, ptr %32, i64 4
  br label %43

._crit_edge64.thread:                             ; preds = %.preheader49
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 2000018, ptr %4, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @_ZZ5solvevE3upp, i64 4), align 4, !tbaa !5
  br label %.lr.ph68.preheader

._crit_edge64:                                    ; preds = %._crit_edge60
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 2000018, ptr %4, align 4, !tbaa !5
  %34 = sext i32 %.1.lcssa to i64
  %35 = getelementptr inbounds [1000009 x i32], ptr @_ZZ5solvevE3upp, i64 0, i64 %34
  store i32 0, ptr %35, align 4, !tbaa !5
  %36 = icmp sgt i32 %.1.lcssa, -1
  br i1 %36, label %.lr.ph68.preheader, label %._crit_edge69

.lr.ph68.preheader:                               ; preds = %._crit_edge64.thread, %._crit_edge64
  %.040.lcssa92 = phi i32 [ 1, %._crit_edge64.thread ], [ %.1.lcssa, %._crit_edge64 ]
  %37 = zext nneg i32 %.040.lcssa92 to i64
  br label %.lr.ph68

._crit_edge60.loopexit:                           ; preds = %68
  %.pre88 = load i32, ptr %1, align 4, !tbaa !5
  br label %._crit_edge60

._crit_edge60:                                    ; preds = %._crit_edge60.loopexit, %.preheader
  %38 = phi i32 [ %28, %.preheader ], [ %.pre88, %._crit_edge60.loopexit ]
  %39 = phi i32 [ %29, %.preheader ], [ %69, %._crit_edge60.loopexit ]
  %40 = phi i32 [ %30, %.preheader ], [ %69, %._crit_edge60.loopexit ]
  %.1.lcssa = phi i32 [ %.04062, %.preheader ], [ %.3, %._crit_edge60.loopexit ]
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %41 = sext i32 %38 to i64
  %42 = icmp slt i64 %indvars.iv.next82, %41
  br i1 %42, label %.preheader, label %._crit_edge64, !llvm.loop !12

43:                                               ; preds = %.lr.ph59, %68
  %44 = phi i32 [ %29, %.lr.ph59 ], [ %69, %68 ]
  %indvars.iv78 = phi i64 [ 0, %.lr.ph59 ], [ %indvars.iv.next79, %68 ]
  %.157 = phi i32 [ %.04062, %.lr.ph59 ], [ %.3, %68 ]
  %45 = load i32, ptr %32, align 8, !tbaa !14
  %46 = getelementptr inbounds [2001 x %"struct.std::pair"], ptr @_ZZ5solvevE1b, i64 0, i64 %indvars.iv78
  %47 = load i32, ptr %46, align 8, !tbaa !14
  %.not46 = icmp sgt i32 %45, %47
  br i1 %.not46, label %68, label %48

48:                                               ; preds = %43
  %49 = load i32, ptr %33, align 4, !tbaa !16
  %50 = getelementptr inbounds i8, ptr %46, i64 4
  %51 = load i32, ptr %50, align 4, !tbaa !16
  %.not47 = icmp sgt i32 %49, %51
  br i1 %.not47, label %68, label %52

52:                                               ; preds = %48
  %53 = sub nsw i32 %47, %45
  %.not4854 = icmp sgt i32 %.157, %53
  br i1 %.not4854, label %._crit_edge, label %.lr.ph56.preheader

.lr.ph56.preheader:                               ; preds = %52
  %54 = sext i32 %.157 to i64
  %55 = shl nsw i64 %54, 2
  %scevgep = getelementptr i8, ptr @_ZZ5solvevE3upp, i64 %55
  %56 = add i32 %.157, %45
  %57 = sub i32 %47, %56
  %58 = zext i32 %57 to i64
  %59 = shl nuw nsw i64 %58, 2
  %60 = add nuw nsw i64 %59, 4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i8 0, i64 %60, i1 false), !tbaa !5
  %61 = add i32 %47, 1
  %62 = sub i32 %61, %45
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph56.preheader, %52
  %.2.lcssa = phi i32 [ %.157, %52 ], [ %62, %.lr.ph56.preheader ]
  %63 = sext i32 %53 to i64
  %64 = getelementptr inbounds [1000009 x i32], ptr @_ZZ5solvevE3upp, i64 0, i64 %63
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %reass.sub = sub i32 %51, %49
  %65 = add i32 %reass.sub, 1
  store i32 %65, ptr %3, align 4, !tbaa !5
  %66 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %64, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %67 = load i32, ptr %66, align 4, !tbaa !5
  store i32 %67, ptr %64, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  %.pre87 = load i32, ptr %2, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %43, %48, %._crit_edge
  %69 = phi i32 [ %.pre87, %._crit_edge ], [ %44, %48 ], [ %44, %43 ]
  %.3 = phi i32 [ %.2.lcssa, %._crit_edge ], [ %.157, %48 ], [ %.157, %43 ]
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %70 = sext i32 %69 to i64
  %71 = icmp slt i64 %indvars.iv.next79, %70
  br i1 %71, label %43, label %._crit_edge60.loopexit, !llvm.loop !17

._crit_edge69.loopexit:                           ; preds = %.lr.ph68, %.lr.ph68._crit_edge
  %.pre89 = load i32, ptr %4, align 4, !tbaa !5
  br label %._crit_edge69

._crit_edge69:                                    ; preds = %._crit_edge69.loopexit, %._crit_edge64
  %72 = phi i32 [ %.pre89, %._crit_edge69.loopexit ], [ 2000018, %._crit_edge64 ]
  %73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %72)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  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 void

.lr.ph68:                                         ; preds = %.lr.ph68.preheader, %.lr.ph68._crit_edge
  %indvars.iv84 = phi i64 [ %37, %.lr.ph68.preheader ], [ %80, %.lr.ph68._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %74 = getelementptr inbounds [1000009 x i32], ptr @_ZZ5solvevE3upp, i64 0, i64 %indvars.iv84
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = trunc nuw nsw i64 %indvars.iv84 to i32
  %77 = add nsw i32 %75, %76
  store i32 %77, ptr %5, align 4, !tbaa !5
  %78 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %79 = load i32, ptr %78, align 4, !tbaa !5
  store i32 %79, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  %.not = icmp eq i64 %indvars.iv84, 0
  br i1 %.not, label %._crit_edge69.loopexit, label %.lr.ph68._crit_edge

.lr.ph68._crit_edge:                              ; preds = %.lr.ph68
  %80 = add nsw i64 %indvars.iv84, -1
  %81 = getelementptr inbounds [1000009 x i32], ptr @_ZZ5solvevE3upp, i64 0, i64 %80
  %82 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %81, ptr noundef nonnull align 4 dereferenceable(4) %74)
  %83 = load i32, ptr %82, align 4, !tbaa !5
  store i32 %83, ptr %81, align 4, !tbaa !5
  %84 = icmp sgt i64 %indvars.iv84, 0
  br i1 %84, label %.lr.ph68, label %._crit_edge69.loopexit, !llvm.loop !18
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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 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 #3

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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


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