; LLVM IR from tangjz/acm-icpc :: codeforces/1427B.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 }

@_ZZ5solvevE3buf = external hidden global [300001 x i8], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@_ZZ5solvevE3arr = external hidden global [300001 x %"struct.std::pair"], align 16
@.str.2 = 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 %"struct.std::pair", 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %1, ptr noundef %2, ptr noundef @_ZZ5solvevE3buf)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  br label %18

18:                                               ; preds = %68, %46, %0
  %19 = load i32, ptr %5, align 4, !tbaa !5
  %20 = load i32, ptr %1, align 4, !tbaa !5
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %88

23:                                               ; preds = %18
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [300001 x i8], ptr @_ZZ5solvevE3buf, i64 0, i64 %25
  %27 = load i8, ptr %26, align 1, !tbaa !9
  %28 = sext i8 %27 to i32
  %29 = icmp eq i32 %28, 87
  br i1 %29, label %30, label %49

30:                                               ; preds = %23
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %3, align 4, !tbaa !5
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %35, label %46

35:                                               ; preds = %30
  %36 = load i32, ptr %5, align 4, !tbaa !5
  %37 = sub nsw i32 %36, 1
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [300001 x i8], ptr @_ZZ5solvevE3buf, i64 0, i64 %38
  %40 = load i8, ptr %39, align 1, !tbaa !9
  %41 = sext i8 %40 to i32
  %42 = icmp eq i32 %41, 87
  br i1 %42, label %43, label %46

43:                                               ; preds = %35
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %3, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %43, %35, %30
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %5, align 4, !tbaa !5
  br label %18, !llvm.loop !10

49:                                               ; preds = %23
  %50 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %50, ptr %6, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %65, %49
  %52 = load i32, ptr %6, align 4, !tbaa !5
  %53 = load i32, ptr %1, align 4, !tbaa !5
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %55, label %62

55:                                               ; preds = %51
  %56 = load i32, ptr %6, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [300001 x i8], ptr @_ZZ5solvevE3buf, i64 0, i64 %57
  %59 = load i8, ptr %58, align 1, !tbaa !9
  %60 = sext i8 %59 to i32
  %61 = icmp ne i32 %60, 87
  br label %62

62:                                               ; preds = %55, %51
  %63 = phi i1 [ false, %51 ], [ %61, %55 ]
  br i1 %63, label %64, label %68

64:                                               ; preds = %62
  br label %65

65:                                               ; preds = %64
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %6, align 4, !tbaa !5
  br label %51, !llvm.loop !12

68:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %69 = load i32, ptr %5, align 4, !tbaa !5
  %70 = icmp sgt i32 %69, 0
  %71 = zext i1 %70 to i32
  %72 = load i32, ptr %6, align 4, !tbaa !5
  %73 = load i32, ptr %1, align 4, !tbaa !5
  %74 = icmp slt i32 %72, %73
  %75 = zext i1 %74 to i32
  %76 = add nsw i32 %71, %75
  store i32 %76, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %77 = load i32, ptr %6, align 4, !tbaa !5
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = sub nsw i32 %77, %78
  store i32 %79, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %80 = load i32, ptr %7, align 4, !tbaa !5
  %81 = sub nsw i32 0, %80
  store i32 %81, ptr %10, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %82 = load i32, ptr %4, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %4, align 4, !tbaa !5
  %84 = sext i32 %82 to i64
  %85 = getelementptr inbounds [300001 x %"struct.std::pair"], ptr @_ZZ5solvevE3arr, i64 0, i64 %84
  %86 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %85, ptr noundef nonnull align 4 dereferenceable(8) %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  %87 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %87, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %18, !llvm.loop !10

88:                                               ; preds = %22
  %89 = load i32, ptr %4, align 4, !tbaa !5
  %90 = icmp eq i32 %89, 1
  br i1 %90, label %91, label %107

91:                                               ; preds = %88
  %92 = load i32, ptr @_ZZ5solvevE3arr, align 16, !tbaa !13
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %107, label %94

94:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %95 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (%"struct.std::pair", ptr @_ZZ5solvevE3arr, i32 0, i32 1), ptr noundef nonnull align 4 dereferenceable(4) %2)
  %96 = load i32, ptr %95, align 4, !tbaa !5
  store i32 %96, ptr %11, align 4, !tbaa !5
  %97 = load i32, ptr %11, align 4, !tbaa !5
  %98 = icmp sgt i32 %97, 0
  br i1 %98, label %99, label %106

99:                                               ; preds = %94
  %100 = load i32, ptr %11, align 4, !tbaa !5
  %101 = load i32, ptr %11, align 4, !tbaa !5
  %102 = add nsw i32 %100, %101
  %103 = sub nsw i32 %102, 1
  %104 = load i32, ptr %3, align 4, !tbaa !5
  %105 = add nsw i32 %104, %103
  store i32 %105, ptr %3, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %99, %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %163

107:                                              ; preds = %91, %88
  %108 = load i32, ptr %4, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds %"struct.std::pair", ptr @_ZZ5solvevE3arr, i64 %109
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef @_ZZ5solvevE3arr, ptr noundef %110)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %148, %107
  %112 = load i32, ptr %13, align 4, !tbaa !5
  %113 = load i32, ptr %4, align 4, !tbaa !5
  %114 = icmp slt i32 %112, %113
  br i1 %114, label %116, label %115

115:                                              ; preds = %111
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %151

116:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %117 = load i32, ptr %13, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [300001 x %"struct.std::pair"], ptr @_ZZ5solvevE3arr, i64 0, i64 %118
  %120 = getelementptr inbounds %"struct.std::pair", ptr %119, i32 0, i32 0
  %121 = load i32, ptr %120, align 8, !tbaa !13
  %122 = sub nsw i32 0, %121
  store i32 %122, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %123 = load i32, ptr %13, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [300001 x %"struct.std::pair"], ptr @_ZZ5solvevE3arr, i64 0, i64 %124
  %126 = getelementptr inbounds %"struct.std::pair", ptr %125, i32 0, i32 1
  %127 = load i32, ptr %126, align 4, !tbaa !15
  store i32 %127, ptr %15, align 4, !tbaa !5
  %128 = load i32, ptr %2, align 4, !tbaa !5
  %129 = load i32, ptr %15, align 4, !tbaa !5
  %130 = icmp sge i32 %128, %129
  br i1 %130, label %131, label %143

131:                                              ; preds = %116
  %132 = load i32, ptr %15, align 4, !tbaa !5
  %133 = load i32, ptr %15, align 4, !tbaa !5
  %134 = add nsw i32 %132, %133
  %135 = sub nsw i32 %134, 1
  %136 = load i32, ptr %14, align 4, !tbaa !5
  %137 = add nsw i32 %135, %136
  %138 = load i32, ptr %3, align 4, !tbaa !5
  %139 = add nsw i32 %138, %137
  store i32 %139, ptr %3, align 4, !tbaa !5
  %140 = load i32, ptr %15, align 4, !tbaa !5
  %141 = load i32, ptr %2, align 4, !tbaa !5
  %142 = sub nsw i32 %141, %140
  store i32 %142, ptr %2, align 4, !tbaa !5
  br label %147

143:                                              ; preds = %116
  %144 = load i32, ptr %15, align 4, !tbaa !5
  %145 = load i32, ptr %12, align 4, !tbaa !5
  %146 = add nsw i32 %145, %144
  store i32 %146, ptr %12, align 4, !tbaa !5
  br label %147

147:                                              ; preds = %143, %131
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %148

148:                                              ; preds = %147
  %149 = load i32, ptr %13, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %13, align 4, !tbaa !5
  br label %111, !llvm.loop !16

151:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %152 = 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) %2)
  %153 = load i32, ptr %152, align 4, !tbaa !5
  store i32 %153, ptr %16, align 4, !tbaa !5
  %154 = load i32, ptr %16, align 4, !tbaa !5
  %155 = icmp sgt i32 %154, 0
  br i1 %155, label %156, label %162

156:                                              ; preds = %151
  %157 = load i32, ptr %16, align 4, !tbaa !5
  %158 = load i32, ptr %16, align 4, !tbaa !5
  %159 = add nsw i32 %157, %158
  %160 = load i32, ptr %3, align 4, !tbaa !5
  %161 = add nsw i32 %160, %159
  store i32 %161, ptr %3, align 4, !tbaa !5
  br label %162

162:                                              ; preds = %156, %151
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %163

163:                                              ; preds = %162, %106
  %164 = load i32, ptr %3, align 4, !tbaa !5
  %165 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %164)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  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: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #3 align 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 @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef, ptr noundef) #5

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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress 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 = { 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 #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!15 = !{!14, !6, i64 4}
!16 = distinct !{!16, !11}


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

@_ZZ5solvevE3buf = external hidden global [300001 x i8], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@_ZZ5solvevE3arr = external hidden global [300001 x %"struct.std::pair"], align 16
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress 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 %"struct.std::pair", align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull @_ZZ5solvevE3buf)
  %8 = load i32, ptr %1, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph, label %.outer._crit_edge.thread

.lr.ph:                                           ; preds = %0, %.critedge
  %indvars.iv93 = phi i64 [ %indvars.iv.next94, %.critedge ], [ 0, %0 ]
  %10 = phi i32 [ %43, %.critedge ], [ %8, %0 ]
  %.0.ph71 = phi i32 [ %.058, %.critedge ], [ 0, %0 ]
  %.043.ph69 = phi i32 [ %.045.lcssa, %.critedge ], [ 0, %0 ]
  %11 = sext i32 %.043.ph69 to i64
  %12 = sext i32 %10 to i64
  br label %17

.outer._crit_edge:                                ; preds = %.critedge, %32
  %indvars.iv.next94.lcssa.sink = phi i64 [ %indvars.iv93, %32 ], [ %indvars.iv.next94, %.critedge ]
  %.0.lcssa = phi i32 [ %.1, %32 ], [ %.058, %.critedge ]
  %13 = trunc nuw i64 %indvars.iv.next94.lcssa.sink to i32
  %14 = icmp ne i64 %indvars.iv.next94.lcssa.sink, 1
  %15 = load i32, ptr @_ZZ5solvevE3arr, align 16
  %16 = icmp ne i32 %15, 0
  %or.cond = select i1 %14, i1 true, i1 %16
  br i1 %or.cond, label %.outer._crit_edge.thread, label %45

17:                                               ; preds = %.lr.ph, %32
  %indvars.iv = phi i64 [ %11, %.lr.ph ], [ %indvars.iv.next, %32 ]
  %.058 = phi i32 [ %.0.ph71, %.lr.ph ], [ %.1, %32 ]
  %18 = getelementptr inbounds [300001 x i8], ptr @_ZZ5solvevE3buf, i64 0, i64 %indvars.iv
  %19 = load i8, ptr %18, align 1, !tbaa !9
  %20 = icmp eq i8 %19, 87
  br i1 %20, label %23, label %.preheader

.preheader:                                       ; preds = %17
  %21 = trunc nsw i64 %indvars.iv to i32
  %22 = icmp sgt i32 %10, %21
  br i1 %22, label %.lr.ph63, label %.critedge

23:                                               ; preds = %17
  %24 = add nsw i32 %.058, 1
  %25 = icmp sgt i64 %indvars.iv, 0
  br i1 %25, label %26, label %32

26:                                               ; preds = %23
  %27 = add nsw i64 %indvars.iv, -1
  %28 = getelementptr inbounds [300001 x i8], ptr @_ZZ5solvevE3buf, i64 0, i64 %27
  %29 = load i8, ptr %28, align 1, !tbaa !9
  %30 = icmp eq i8 %29, 87
  %31 = add nsw i32 %.058, 2
  %spec.select = select i1 %30, i32 %31, i32 %24
  br label %32

32:                                               ; preds = %26, %23
  %.1 = phi i32 [ %24, %23 ], [ %spec.select, %26 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %33 = icmp slt i64 %indvars.iv.next, %12
  br i1 %33, label %17, label %.outer._crit_edge, !llvm.loop !10

.lr.ph63:                                         ; preds = %.preheader, %36
  %indvars.iv91 = phi i64 [ %indvars.iv.next92, %36 ], [ %indvars.iv, %.preheader ]
  %34 = getelementptr inbounds [300001 x i8], ptr @_ZZ5solvevE3buf, i64 0, i64 %indvars.iv91
  %35 = load i8, ptr %34, align 1, !tbaa !9
  %.not51 = icmp eq i8 %35, 87
  br i1 %.not51, label %.critedge.loopexit.split.loop.exit108, label %36

36:                                               ; preds = %.lr.ph63
  %indvars.iv.next92 = add nsw i64 %indvars.iv91, 1
  %37 = icmp slt i64 %indvars.iv.next92, %12
  br i1 %37, label %.lr.ph63, label %.critedge, !llvm.loop !12

.critedge.loopexit.split.loop.exit108:            ; preds = %.lr.ph63
  %38 = trunc nsw i64 %indvars.iv91 to i32
  br label %.critedge

.critedge:                                        ; preds = %36, %.critedge.loopexit.split.loop.exit108, %.preheader
  %.045.lcssa = phi i32 [ %21, %.preheader ], [ %38, %.critedge.loopexit.split.loop.exit108 ], [ %10, %36 ]
  %.lcssa = phi i32 [ 0, %.preheader ], [ -1, %.critedge.loopexit.split.loop.exit108 ], [ 0, %36 ]
  %39 = icmp sgt i64 %indvars.iv, 0
  %.neg = sext i1 %39 to i32
  %.neg53 = add nsw i32 %.lcssa, %.neg
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %40 = sub nsw i32 %.045.lcssa, %21
  store i32 %40, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  store i32 %.neg53, ptr %5, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
  %41 = getelementptr inbounds [300001 x %"struct.std::pair"], ptr @_ZZ5solvevE3arr, i64 0, i64 %indvars.iv93
  %42 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %41, ptr noundef nonnull align 4 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %43 = load i32, ptr %1, align 4, !tbaa !5
  %44 = icmp slt i32 %.045.lcssa, %43
  br i1 %44, label %.lr.ph, label %.outer._crit_edge, !llvm.loop !10

45:                                               ; preds = %.outer._crit_edge
  %46 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @_ZZ5solvevE3arr, i64 4), ptr noundef nonnull align 4 dereferenceable(4) %2)
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = icmp sgt i32 %47, 0
  %49 = shl nuw nsw i32 %47, 1
  %50 = add nsw i32 %49, -1
  %51 = select i1 %48, i32 %50, i32 0
  %.2 = add nsw i32 %51, %.0.lcssa
  br label %77

.outer._crit_edge.thread:                         ; preds = %0, %.outer._crit_edge
  %.0.lcssa103 = phi i32 [ %.0.lcssa, %.outer._crit_edge ], [ 0, %0 ]
  %.042.ph.lcssa102 = phi i32 [ %13, %.outer._crit_edge ], [ 0, %0 ]
  %52 = sext i32 %.042.ph.lcssa102 to i64
  %53 = getelementptr inbounds %"struct.std::pair", ptr @_ZZ5solvevE3arr, i64 %52
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef nonnull @_ZZ5solvevE3arr, ptr noundef nonnull %53)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  %54 = icmp sgt i32 %.042.ph.lcssa102, 0
  br i1 %54, label %.lr.ph79.preheader, label %._crit_edge80

.lr.ph79.preheader:                               ; preds = %.outer._crit_edge.thread
  %.promoted = load i32, ptr %2, align 4, !tbaa !5
  %wide.trip.count = zext nneg i32 %.042.ph.lcssa102 to i64
  br label %.lr.ph79

._crit_edge80:                                    ; preds = %74, %.outer._crit_edge.thread
  %.lcssa75 = phi i32 [ 0, %.outer._crit_edge.thread ], [ %75, %74 ]
  %.3.lcssa = phi i32 [ %.0.lcssa103, %.outer._crit_edge.thread ], [ %.4, %74 ]
  store i32 %.lcssa75, ptr %6, align 4, !tbaa !5
  %55 = 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) %2)
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = icmp sgt i32 %56, 0
  %58 = shl nuw nsw i32 %56, 1
  %59 = select i1 %57, i32 %58, i32 0
  %.5 = add nsw i32 %59, %.3.lcssa
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  br label %77

.lr.ph79:                                         ; preds = %.lr.ph79.preheader, %74
  %indvars.iv96 = phi i64 [ 0, %.lr.ph79.preheader ], [ %indvars.iv.next97, %74 ]
  %.377 = phi i32 [ %.0.lcssa103, %.lr.ph79.preheader ], [ %.4, %74 ]
  %60 = phi i32 [ %.promoted, %.lr.ph79.preheader ], [ %76, %74 ]
  %61 = phi i32 [ 0, %.lr.ph79.preheader ], [ %75, %74 ]
  %62 = getelementptr inbounds [300001 x %"struct.std::pair"], ptr @_ZZ5solvevE3arr, i64 0, i64 %indvars.iv96
  %63 = getelementptr inbounds i8, ptr %62, i64 4
  %64 = load i32, ptr %63, align 4, !tbaa !13
  %.not = icmp slt i32 %60, %64
  br i1 %.not, label %72, label %65

65:                                               ; preds = %.lr.ph79
  %66 = load i32, ptr %62, align 8, !tbaa !15
  %67 = shl nsw i32 %64, 1
  %68 = xor i32 %66, -1
  %69 = add i32 %67, %.377
  %70 = add i32 %69, %68
  %71 = sub nsw i32 %60, %64
  store i32 %71, ptr %2, align 4, !tbaa !5
  br label %74

72:                                               ; preds = %.lr.ph79
  %73 = add nsw i32 %61, %64
  br label %74

74:                                               ; preds = %72, %65
  %75 = phi i32 [ %61, %65 ], [ %73, %72 ]
  %76 = phi i32 [ %71, %65 ], [ %60, %72 ]
  %.4 = phi i32 [ %70, %65 ], [ %.377, %72 ]
  %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next97, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge80, label %.lr.ph79, !llvm.loop !16

77:                                               ; preds = %._crit_edge80, %45
  %.6 = phi i32 [ %.5, %._crit_edge80 ], [ %.2, %45 ]
  %78 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret void
}

; 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 nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #3 align 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 @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 = { 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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress 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 = { 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 #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = !{!14, !6, i64 4}
!14 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!15 = !{!14, !6, i64 0}
!16 = distinct !{!16, !11}


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