; LLVM IR from tangjz/acm-icpc :: codeforces/gym/104023G.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 { i64, i64 }
%class.anon = type { ptr }

@_ZZ5solvevE3seg = external hidden global [100001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [76 x i8], align 1
@__PRETTY_FUNCTION__._Z5solvev = external hidden unnamed_addr constant [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [128 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@_ZZ5solvevE1s = external hidden global [1048577 x i32], align 16
@.str.6 = external hidden unnamed_addr constant [6 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 i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca %class.anon, align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %1)
  %13 = icmp eq i32 %12, 2
  br i1 %13, label %14, label %26

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

17:                                               ; preds = %14
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = icmp sle i32 %18, 100000
  br i1 %19, label %20, label %26

20:                                               ; preds = %17
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = icmp sle i32 1, %21
  br i1 %22, label %23, label %26

23:                                               ; preds = %20
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = icmp sle i32 %24, 1000000
  br label %26

26:                                               ; preds = %23, %20, %17, %14, %0
  %27 = phi i1 [ false, %20 ], [ false, %17 ], [ false, %14 ], [ false, %0 ], [ %25, %23 ]
  br i1 %27, label %28, label %29

28:                                               ; preds = %26
  br label %31

29:                                               ; preds = %26
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 15, ptr noundef @__PRETTY_FUNCTION__._Z5solvev) #7
  unreachable

30:                                               ; No predecessors!
  br label %31

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

32:                                               ; preds = %80, %31
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = load i32, ptr %1, align 4, !tbaa !5
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %83

37:                                               ; preds = %32
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @_ZZ5solvevE3seg, i64 0, i64 %39
  %41 = getelementptr inbounds %"struct.std::pair", ptr %40, i32 0, i32 0
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @_ZZ5solvevE3seg, i64 0, i64 %43
  %45 = getelementptr inbounds %"struct.std::pair", ptr %44, i32 0, i32 1
  %46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %41, ptr noundef %45)
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %74

48:                                               ; preds = %37
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @_ZZ5solvevE3seg, i64 0, i64 %50
  %52 = getelementptr inbounds %"struct.std::pair", ptr %51, i32 0, i32 0
  %53 = load i64, ptr %52, align 16, !tbaa !9
  %54 = icmp sle i64 1, %53
  br i1 %54, label %55, label %74

55:                                               ; preds = %48
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @_ZZ5solvevE3seg, i64 0, i64 %57
  %59 = getelementptr inbounds %"struct.std::pair", ptr %58, i32 0, i32 0
  %60 = load i64, ptr %59, align 16, !tbaa !9
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @_ZZ5solvevE3seg, i64 0, i64 %62
  %64 = getelementptr inbounds %"struct.std::pair", ptr %63, i32 0, i32 1
  %65 = load i64, ptr %64, align 8, !tbaa !12
  %66 = icmp sle i64 %60, %65
  br i1 %66, label %67, label %74

67:                                               ; preds = %55
  %68 = load i32, ptr %3, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @_ZZ5solvevE3seg, i64 0, i64 %69
  %71 = getelementptr inbounds %"struct.std::pair", ptr %70, i32 0, i32 1
  %72 = load i64, ptr %71, align 8, !tbaa !12
  %73 = icmp sle i64 %72, 1000000000000
  br label %74

74:                                               ; preds = %67, %55, %48, %37
  %75 = phi i1 [ false, %55 ], [ false, %48 ], [ false, %37 ], [ %73, %67 ]
  br i1 %75, label %76, label %77

76:                                               ; preds = %74
  br label %79

77:                                               ; preds = %74
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.2, i32 noundef 20, ptr noundef @__PRETTY_FUNCTION__._Z5solvev) #7
  unreachable

78:                                               ; No predecessors!
  br label %79

79:                                               ; preds = %78, %76
  br label %80

80:                                               ; preds = %79
  %81 = load i32, ptr %3, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %3, align 4, !tbaa !5
  br label %32, !llvm.loop !13

83:                                               ; preds = %36
  %84 = load i32, ptr %2, align 4, !tbaa !5
  %85 = and i32 %84, 1
  %86 = icmp ne i32 %85, 0
  br i1 %86, label %99, label %87

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

88:                                               ; preds = %95, %87
  %89 = load i32, ptr %4, align 4, !tbaa !5
  %90 = load i32, ptr %1, align 4, !tbaa !5
  %91 = icmp slt i32 %89, %90
  br i1 %91, label %93, label %92

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

93:                                               ; preds = %88
  %94 = call i32 @puts(ptr noundef @.str.5)
  br label %95

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

98:                                               ; preds = %92
  store i32 1, ptr %5, align 4
  br label %168

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

100:                                              ; preds = %105, %99
  %101 = load i32, ptr %6, align 4, !tbaa !5
  %102 = load i32, ptr %2, align 4, !tbaa !5
  %103 = icmp sle i32 %101, %102
  br i1 %103, label %104, label %108

104:                                              ; preds = %100
  br label %105

105:                                              ; preds = %104
  %106 = load i32, ptr %6, align 4, !tbaa !5
  %107 = shl i32 %106, 1
  store i32 %107, ptr %6, align 4, !tbaa !5
  br label %100, !llvm.loop !16

108:                                              ; preds = %100
  store i32 0, ptr @_ZZ5solvevE1s, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store i64 0, ptr %7, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %109

109:                                              ; preds = %133, %108
  %110 = load i32, ptr %8, align 4, !tbaa !5
  %111 = load i32, ptr %6, align 4, !tbaa !5
  %112 = icmp sle i32 %110, %111
  br i1 %112, label %114, label %113

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

114:                                              ; preds = %109
  %115 = load i32, ptr %8, align 4, !tbaa !5
  %116 = sub nsw i32 %115, 1
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [1048577 x i32], ptr @_ZZ5solvevE1s, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = load i64, ptr %7, align 8, !tbaa !17
  %121 = load i32, ptr %2, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = xor i64 %120, %122
  %124 = load i32, ptr %2, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = call noundef i64 @_ZSt3gcdIxxENSt11common_typeIJT_T0_EE4typeES1_S2_(i64 noundef %123, i64 noundef %125) #6
  %127 = icmp eq i64 %126, 1
  %128 = zext i1 %127 to i32
  %129 = add nsw i32 %119, %128
  %130 = load i32, ptr %8, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1048577 x i32], ptr @_ZZ5solvevE1s, i64 0, i64 %131
  store i32 %129, ptr %132, align 4, !tbaa !5
  br label %133

133:                                              ; preds = %114
  %134 = load i32, ptr %8, align 4, !tbaa !5
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %8, align 4, !tbaa !5
  %136 = load i32, ptr %2, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = load i64, ptr %7, align 8, !tbaa !17
  %139 = add nsw i64 %138, %137
  store i64 %139, ptr %7, align 8, !tbaa !17
  br label %109, !llvm.loop !18

140:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %141 = getelementptr inbounds %class.anon, ptr %9, i32 0, i32 0
  store ptr %6, ptr %141, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %142

142:                                              ; preds = %164, %140
  %143 = load i32, ptr %10, align 4, !tbaa !5
  %144 = load i32, ptr %1, align 4, !tbaa !5
  %145 = icmp slt i32 %143, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %142
  store i32 14, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %167

147:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %148 = load i32, ptr %10, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @_ZZ5solvevE3seg, i64 0, i64 %149
  %151 = getelementptr inbounds %"struct.std::pair", ptr %150, i32 0, i32 1
  %152 = load i64, ptr %151, align 8, !tbaa !12
  %153 = add nsw i64 %152, 1
  %154 = call noundef i64 @"_ZZ5solvevENK3$_0clEx"(ptr noundef nonnull align 8 dereferenceable(8) %9, i64 noundef %153)
  %155 = load i32, ptr %10, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @_ZZ5solvevE3seg, i64 0, i64 %156
  %158 = getelementptr inbounds %"struct.std::pair", ptr %157, i32 0, i32 0
  %159 = load i64, ptr %158, align 16, !tbaa !9
  %160 = call noundef i64 @"_ZZ5solvevENK3$_0clEx"(ptr noundef nonnull align 8 dereferenceable(8) %9, i64 noundef %159)
  %161 = sub nsw i64 %154, %160
  store i64 %161, ptr %11, align 8, !tbaa !17
  %162 = load i64, ptr %11, align 8, !tbaa !17
  %163 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i64 noundef %162)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %164

164:                                              ; preds = %147
  %165 = load i32, ptr %10, align 4, !tbaa !5
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %10, align 4, !tbaa !5
  br label %142, !llvm.loop !21

167:                                              ; preds = %146
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  store i32 0, ptr %5, align 4
  br label %168

168:                                              ; preds = %167, %98
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  %169 = load i32, ptr %5, align 4
  switch i32 %169, label %171 [
    i32 0, label %170
    i32 1, label %170
  ]

170:                                              ; preds = %168, %168
  ret void

171:                                              ; preds = %168
  unreachable
}

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

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

declare i32 @puts(ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt3gcdIxxENSt11common_typeIJT_T0_EE4typeES1_S2_(i64 noundef, i64 noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @"_ZZ5solvevENK3$_0clEx"(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #5 align 2

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 = { noreturn 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 #4 = { 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 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 #6 = { nounwind }
attributes #7 = { noreturn 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, !11, i64 0}
!10 = !{!"_ZTSSt4pairIxxE", !11, i64 0, !11, i64 8}
!11 = !{!"long long", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = !{!11, !11, i64 0}
!18 = distinct !{!18, !14}
!19 = !{!20, !20, i64 0}
!20 = !{!"any pointer", !7, i64 0}
!21 = distinct !{!21, !14}


; 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 { i64, i64 }
%class.anon = type { ptr }

@_ZZ5solvevE3seg = external hidden global [100001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [76 x i8], align 1
@__PRETTY_FUNCTION__._Z5solvev = external hidden unnamed_addr constant [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [128 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@_ZZ5solvevE1s = external hidden local_unnamed_addr global [1048577 x i32], align 16
@.str.6 = external hidden unnamed_addr constant [6 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 %class.anon, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2, ptr noundef nonnull %1)
  %6 = icmp eq i32 %5, 2
  %7 = load i32, ptr %1, align 4
  %8 = add i32 %7, -1
  %9 = icmp ult i32 %8, 100000
  %or.cond3 = select i1 %6, i1 %9, i1 false
  %10 = load i32, ptr %2, align 4
  %11 = add i32 %10, -1
  %12 = icmp ult i32 %11, 1000000
  %or.cond9 = select i1 %or.cond3, i1 %12, i1 false
  br i1 %or.cond9, label %.lr.ph, label %.critedge

.critedge:                                        ; preds = %0
  call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 15, ptr noundef nonnull @__PRETTY_FUNCTION__._Z5solvev) #6
  unreachable

13:                                               ; preds = %25
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = load i32, ptr %1, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = icmp slt i64 %indvars.iv.next, %15
  br i1 %16, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %13
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  %17 = and i32 %.pre, 1
  %.not = icmp eq i32 %17, 0
  br i1 %.not, label %.preheader, label %32

.preheader:                                       ; preds = %._crit_edge
  %18 = icmp sgt i32 %14, 0
  br i1 %18, label %.lr.ph54, label %.loopexit

.lr.ph:                                           ; preds = %0, %13
  %indvars.iv = phi i64 [ %indvars.iv.next, %13 ], [ 0, %0 ]
  %19 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @_ZZ5solvevE3seg, i64 0, i64 %indvars.iv
  %20 = getelementptr inbounds i8, ptr %19, i64 8
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %19, ptr noundef nonnull %20)
  %.not39 = icmp eq i32 %21, 0
  br i1 %.not39, label %.critedge7, label %22

22:                                               ; preds = %.lr.ph
  %23 = load i64, ptr %19, align 16, !tbaa !11
  %24 = icmp sgt i64 %23, 0
  br i1 %24, label %25, label %.critedge7

25:                                               ; preds = %22
  %26 = load i64, ptr %20, align 8, !tbaa !14
  %.not40 = icmp sle i64 %23, %26
  %27 = icmp slt i64 %26, 1000000000001
  %or.cond = and i1 %.not40, %27
  br i1 %or.cond, label %13, label %.critedge7

.critedge7:                                       ; preds = %25, %22, %.lr.ph
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.2, i32 noundef 20, ptr noundef nonnull @__PRETTY_FUNCTION__._Z5solvev) #6
  unreachable

.lr.ph54:                                         ; preds = %.preheader, %.lr.ph54
  %.03353 = phi i32 [ %29, %.lr.ph54 ], [ 0, %.preheader ]
  %28 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.5)
  %29 = add nuw nsw i32 %.03353, 1
  %30 = load i32, ptr %1, align 4, !tbaa !5
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %.lr.ph54, label %.loopexit, !llvm.loop !15

32:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  br label %33

33:                                               ; preds = %33, %32
  %34 = phi i32 [ 1, %32 ], [ %35, %33 ]
  %.not37 = icmp sgt i32 %34, %.pre
  %35 = shl i32 %34, 1
  br i1 %.not37, label %36, label %33, !llvm.loop !16

36:                                               ; preds = %33
  store i32 %34, ptr %3, align 4, !tbaa !5
  store i32 0, ptr @_ZZ5solvevE1s, align 16, !tbaa !5
  %.not3843 = icmp slt i32 %34, 1
  br i1 %.not3843, label %._crit_edge48, label %.lr.ph47.preheader

.lr.ph47.preheader:                               ; preds = %36
  %37 = zext nneg i32 %34 to i64
  br label %.lr.ph47

._crit_edge48.loopexit:                           ; preds = %.lr.ph47
  %.pre62 = load i32, ptr %1, align 4, !tbaa !5
  br label %._crit_edge48

._crit_edge48:                                    ; preds = %._crit_edge48.loopexit, %36
  %38 = phi i32 [ %.pre62, %._crit_edge48.loopexit ], [ %14, %36 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  store ptr %3, ptr %4, align 8, !tbaa !17
  %39 = icmp sgt i32 %38, 0
  br i1 %39, label %.lr.ph51, label %._crit_edge52

.lr.ph47:                                         ; preds = %.lr.ph47.preheader, %.lr.ph47
  %40 = phi i32 [ %.pre, %.lr.ph47.preheader ], [ %49, %.lr.ph47 ]
  %41 = phi i32 [ 0, %.lr.ph47.preheader ], [ %47, %.lr.ph47 ]
  %indvars.iv56 = phi i64 [ 1, %.lr.ph47.preheader ], [ %indvars.iv.next57, %.lr.ph47 ]
  %.03244 = phi i64 [ 0, %.lr.ph47.preheader ], [ %51, %.lr.ph47 ]
  %42 = sext i32 %40 to i64
  %43 = xor i64 %.03244, %42
  %44 = call noundef i64 @_ZSt3gcdIxxENSt11common_typeIJT_T0_EE4typeES1_S2_(i64 noundef %43, i64 noundef %42) #5
  %45 = icmp eq i64 %44, 1
  %46 = zext i1 %45 to i32
  %47 = add nuw nsw i32 %41, %46
  %48 = getelementptr inbounds [1048577 x i32], ptr @_ZZ5solvevE1s, i64 0, i64 %indvars.iv56
  store i32 %47, ptr %48, align 4, !tbaa !5
  %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = add nsw i64 %.03244, %50
  %.not38.not = icmp ult i64 %indvars.iv56, %37
  br i1 %.not38.not, label %.lr.ph47, label %._crit_edge48.loopexit, !llvm.loop !19

._crit_edge52:                                    ; preds = %.lr.ph51, %._crit_edge48
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  br label %.loopexit

.lr.ph51:                                         ; preds = %._crit_edge48, %.lr.ph51
  %indvars.iv59 = phi i64 [ %indvars.iv.next60, %.lr.ph51 ], [ 0, %._crit_edge48 ]
  %52 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @_ZZ5solvevE3seg, i64 0, i64 %indvars.iv59
  %53 = getelementptr inbounds i8, ptr %52, i64 8
  %54 = load i64, ptr %53, align 8, !tbaa !14
  %55 = add nsw i64 %54, 1
  %56 = call noundef i64 @"_ZZ5solvevENK3$_0clEx"(ptr noundef nonnull align 8 dereferenceable(8) %4, i64 noundef %55)
  %57 = load i64, ptr %52, align 16, !tbaa !11
  %58 = call noundef i64 @"_ZZ5solvevENK3$_0clEx"(ptr noundef nonnull align 8 dereferenceable(8) %4, i64 noundef %57)
  %59 = sub nsw i64 %56, %58
  %60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i64 noundef %59)
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %61 = load i32, ptr %1, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = icmp slt i64 %indvars.iv.next60, %62
  br i1 %63, label %.lr.ph51, label %._crit_edge52, !llvm.loop !20

.loopexit:                                        ; preds = %.lr.ph54, %.preheader, %._crit_edge52
  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
}

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt3gcdIxxENSt11common_typeIJT_T0_EE4typeES1_S2_(i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @"_ZZ5solvevENK3$_0clEx"(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #4 align 2

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

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 = { noreturn 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 #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 }
attributes #6 = { noreturn 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 = !{!12, !13, i64 0}
!12 = !{!"_ZTSSt4pairIxxE", !13, i64 0, !13, i64 8}
!13 = !{!"long long", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!18, !18, i64 0}
!18 = !{!"any pointer", !7, i64 0}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}


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