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

@.str = external hidden unnamed_addr constant [9 x i8], align 1
@_ZZ5solvevE3pos = external hidden global [1000001 x %"struct.std::pair"], align 16
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5exgcdiiRiS_(i32 noundef, i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %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 i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %1, ptr noundef %2, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %22 = load i32, ptr %1, align 4, !tbaa !5
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = call noundef i32 @_Z5exgcdiiRiS_(i32 noundef %22, i32 noundef %23, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i32 %24, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = sdiv i32 %25, %26
  %28 = sext i32 %27 to i64
  %29 = load i32, ptr %1, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = mul nsw i64 %28, %30
  store i64 %31, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %32 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = mul nsw i32 %33, 2
  store i32 %34, ptr %8, align 4, !tbaa !5
  %35 = load i32, ptr %8, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = mul i64 %36, 8
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (%"struct.std::pair", ptr @_ZZ5solvevE3pos, i64 1), i8 0, i64 %37, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %65, %0
  %39 = load i32, ptr %9, align 4, !tbaa !5
  %40 = load i32, ptr %1, align 4, !tbaa !5
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = add nsw i32 %40, %41
  %43 = icmp sle i32 %39, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %68

45:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %10)
  %47 = load i32, ptr %9, align 4, !tbaa !5
  %48 = load i32, ptr %1, align 4, !tbaa !5
  %49 = icmp sle i32 %47, %48
  br i1 %49, label %50, label %56

50:                                               ; preds = %45
  %51 = load i32, ptr %9, align 4, !tbaa !5
  %52 = load i32, ptr %10, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE3pos, i64 0, i64 %53
  %55 = getelementptr inbounds %"struct.std::pair", ptr %54, i32 0, i32 0
  store i32 %51, ptr %55, align 8, !tbaa !11
  br label %64

56:                                               ; preds = %45
  %57 = load i32, ptr %9, align 4, !tbaa !5
  %58 = load i32, ptr %1, align 4, !tbaa !5
  %59 = sub nsw i32 %57, %58
  %60 = load i32, ptr %10, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE3pos, i64 0, i64 %61
  %63 = getelementptr inbounds %"struct.std::pair", ptr %62, i32 0, i32 1
  store i32 %59, ptr %63, align 4, !tbaa !13
  br label %64

64:                                               ; preds = %56, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %65

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

68:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 1, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %69 = load i64, ptr %3, align 8, !tbaa !9
  %70 = load i32, ptr %8, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = mul nsw i64 %69, %71
  store i64 %72, ptr %12, align 8, !tbaa !9
  br label %73

73:                                               ; preds = %174, %68
  %74 = load i64, ptr %11, align 8, !tbaa !9
  %75 = load i64, ptr %12, align 8, !tbaa !9
  %76 = icmp slt i64 %74, %75
  br i1 %76, label %77, label %175

77:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %78 = load i64, ptr %11, align 8, !tbaa !9
  %79 = load i64, ptr %12, align 8, !tbaa !9
  %80 = add nsw i64 %78, %79
  %81 = ashr i64 %80, 1
  store i64 %81, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %82 = load i64, ptr %13, align 8, !tbaa !9
  store i64 %82, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 1, ptr %15, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %162, %77
  %84 = load i32, ptr %15, align 4, !tbaa !5
  %85 = load i32, ptr %8, align 4, !tbaa !5
  %86 = icmp sle i32 %84, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %83
  store i32 7, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %165

88:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %89 = load i32, ptr %15, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE3pos, i64 0, i64 %90
  %92 = getelementptr inbounds %"struct.std::pair", ptr %91, i32 0, i32 0
  store ptr %92, ptr %17, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %93 = load i32, ptr %15, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE3pos, i64 0, i64 %94
  %96 = getelementptr inbounds %"struct.std::pair", ptr %95, i32 0, i32 1
  store ptr %96, ptr %18, align 8, !tbaa !16
  %97 = load ptr, ptr %17, align 8, !tbaa !16
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %100, label %113

100:                                              ; preds = %88
  %101 = load ptr, ptr %18, align 8, !tbaa !16
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = icmp ne i32 %102, 0
  br i1 %103, label %104, label %113

104:                                              ; preds = %100
  %105 = load ptr, ptr %18, align 8, !tbaa !16
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = load ptr, ptr %17, align 8, !tbaa !16
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = sub nsw i32 %106, %108
  %110 = load i32, ptr %6, align 4, !tbaa !5
  %111 = srem i32 %109, %110
  %112 = icmp ne i32 %111, 0
  br i1 %112, label %113, label %114

113:                                              ; preds = %104, %100, %88
  store i32 9, ptr %16, align 4
  br label %159

114:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %115 = load ptr, ptr %18, align 8, !tbaa !16
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = load ptr, ptr %17, align 8, !tbaa !16
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sub nsw i32 %116, %118
  %120 = sext i32 %119 to i64
  %121 = load i32, ptr %4, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = mul nsw i64 %120, %122
  %124 = load i32, ptr %2, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = srem i64 %123, %125
  %127 = trunc i64 %126 to i32
  store i32 %127, ptr %19, align 4, !tbaa !5
  %128 = load i32, ptr %19, align 4, !tbaa !5
  %129 = icmp slt i32 %128, 0
  br i1 %129, label %130, label %134

130:                                              ; preds = %114
  %131 = load i32, ptr %2, align 4, !tbaa !5
  %132 = load i32, ptr %19, align 4, !tbaa !5
  %133 = add nsw i32 %132, %131
  store i32 %133, ptr %19, align 4, !tbaa !5
  br label %134

134:                                              ; preds = %130, %114
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %135 = load i32, ptr %19, align 4, !tbaa !5
  %136 = load i32, ptr %6, align 4, !tbaa !5
  %137 = sdiv i32 %135, %136
  %138 = sext i32 %137 to i64
  %139 = load i32, ptr %1, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = mul nsw i64 %138, %140
  %142 = load ptr, ptr %17, align 8, !tbaa !16
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = add nsw i64 %141, %144
  store i64 %145, ptr %20, align 8, !tbaa !9
  %146 = load i64, ptr %13, align 8, !tbaa !9
  %147 = load i64, ptr %20, align 8, !tbaa !9
  %148 = icmp sge i64 %146, %147
  br i1 %148, label %149, label %158

149:                                              ; preds = %134
  %150 = load i64, ptr %13, align 8, !tbaa !9
  %151 = load i64, ptr %20, align 8, !tbaa !9
  %152 = sub nsw i64 %150, %151
  %153 = load i64, ptr %7, align 8, !tbaa !9
  %154 = sdiv i64 %152, %153
  %155 = add nsw i64 %154, 1
  %156 = load i64, ptr %14, align 8, !tbaa !9
  %157 = sub nsw i64 %156, %155
  store i64 %157, ptr %14, align 8, !tbaa !9
  br label %158

158:                                              ; preds = %149, %134
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  store i32 0, ptr %16, align 4
  br label %159

159:                                              ; preds = %158, %113
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  %160 = load i32, ptr %16, align 4
  switch i32 %160, label %178 [
    i32 0, label %161
    i32 9, label %162
  ]

161:                                              ; preds = %159
  br label %162

162:                                              ; preds = %161, %159
  %163 = load i32, ptr %15, align 4, !tbaa !5
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %15, align 4, !tbaa !5
  br label %83, !llvm.loop !18

165:                                              ; preds = %87
  %166 = load i64, ptr %14, align 8, !tbaa !9
  %167 = load i64, ptr %3, align 8, !tbaa !9
  %168 = icmp slt i64 %166, %167
  br i1 %168, label %169, label %172

169:                                              ; preds = %165
  %170 = load i64, ptr %13, align 8, !tbaa !9
  %171 = add nsw i64 %170, 1
  store i64 %171, ptr %11, align 8, !tbaa !9
  br label %174

172:                                              ; preds = %165
  %173 = load i64, ptr %13, align 8, !tbaa !9
  store i64 %173, ptr %12, align 8, !tbaa !9
  br label %174

174:                                              ; preds = %172, %169
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %73, !llvm.loop !19

175:                                              ; preds = %73
  %176 = load i64, ptr %11, align 8, !tbaa !9
  %177 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %176)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  ret void

178:                                              ; preds = %159
  unreachable
}

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

; 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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


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

@.str = external hidden unnamed_addr constant [9 x i8], align 1
@_ZZ5solvevE3pos = external hidden local_unnamed_addr global [1000001 x %"struct.std::pair"], align 16
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5exgcdiiRiS_(i32 noundef, i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 i64, align 8
  %4 = alloca i32, 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
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %8 = load i32, ptr %1, align 4, !tbaa !5
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = call noundef i32 @_Z5exgcdiiRiS_(i32 noundef %8, i32 noundef %9, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = sdiv i32 %11, %10
  %13 = sext i32 %12 to i64
  %14 = load i32, ptr %1, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = mul nsw i64 %15, %13
  %17 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = shl i32 %18, 1
  %20 = sext i32 %19 to i64
  %21 = shl nsw i64 %20, 3
  call void @llvm.memset.p0.i64(ptr nonnull align 8 getelementptr inbounds (i8, ptr @_ZZ5solvevE3pos, i64 8), i8 0, i64 %21, i1 false)
  %22 = load i32, ptr %1, align 4, !tbaa !5
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = add nsw i32 %23, %22
  %.not60 = icmp slt i32 %24, 1
  br i1 %.not60, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %49, %0
  %.lcssa59 = phi i32 [ %22, %0 ], [ %39, %49 ]
  %.lcssa = phi i32 [ %23, %0 ], [ %51, %49 ]
  %25 = load i64, ptr %3, align 8, !tbaa !9
  %26 = mul nsw i64 %25, %20
  %27 = icmp sgt i64 %26, 1
  br i1 %27, label %.lr.ph73, label %._crit_edge74

.lr.ph73:                                         ; preds = %._crit_edge
  %.not5363 = icmp slt i32 %18, 1
  %28 = load i32, ptr %4, align 4
  %29 = sext i32 %28 to i64
  %30 = sext i32 %.lcssa to i64
  %31 = sext i32 %.lcssa59 to i64
  br i1 %.not5363, label %.lr.ph73.split.us, label %.lr.ph67.preheader

.lr.ph67.preheader:                               ; preds = %.lr.ph73
  %smax = call i32 @llvm.smax.i32(i32 %19, i32 1)
  %32 = add nuw nsw i32 %smax, 1
  %wide.trip.count = zext nneg i32 %32 to i64
  br label %.lr.ph67

.lr.ph73.split.us:                                ; preds = %.lr.ph73, %.lr.ph73.split.us
  %.04071.us = phi i64 [ %.1.us, %.lr.ph73.split.us ], [ 1, %.lr.ph73 ]
  %.04170.us = phi i64 [ %.142.us, %.lr.ph73.split.us ], [ %26, %.lr.ph73 ]
  %33 = add nuw nsw i64 %.04071.us, %.04170.us
  %34 = lshr i64 %33, 1
  %35 = icmp slt i64 %34, %25
  %36 = add nuw nsw i64 %34, 1
  %.142.us = select i1 %35, i64 %.04170.us, i64 %34
  %.1.us = select i1 %35, i64 %36, i64 %.04071.us
  %37 = icmp slt i64 %.1.us, %.142.us
  br i1 %37, label %.lr.ph73.split.us, label %._crit_edge74, !llvm.loop !11

.lr.ph:                                           ; preds = %0, %49
  %.061 = phi i32 [ %50, %49 ], [ 1, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  %38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %6)
  %39 = load i32, ptr %1, align 4, !tbaa !5
  %.not58 = icmp sgt i32 %.061, %39
  br i1 %.not58, label %44, label %40

40:                                               ; preds = %.lr.ph
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE3pos, i64 0, i64 %42
  store i32 %.061, ptr %43, align 8, !tbaa !13
  br label %49

44:                                               ; preds = %.lr.ph
  %45 = sub nsw i32 %.061, %39
  %46 = load i32, ptr %6, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE3pos, i64 0, i64 %47, i32 1
  store i32 %45, ptr %48, align 4, !tbaa !15
  br label %49

49:                                               ; preds = %44, %40
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  %50 = add nuw nsw i32 %.061, 1
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = add nsw i32 %51, %39
  %.not.not = icmp slt i32 %.061, %52
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !16

.lr.ph67:                                         ; preds = %.lr.ph67.preheader, %._crit_edge68
  %.04071 = phi i64 [ %.1, %._crit_edge68 ], [ 1, %.lr.ph67.preheader ]
  %.04170 = phi i64 [ %.142, %._crit_edge68 ], [ %26, %.lr.ph67.preheader ]
  %53 = add nuw nsw i64 %.04071, %.04170
  %54 = lshr i64 %53, 1
  br label %58

._crit_edge68:                                    ; preds = %83
  %55 = icmp slt i64 %.2, %25
  %56 = add nuw nsw i64 %54, 1
  %.142 = select i1 %55, i64 %.04170, i64 %54
  %.1 = select i1 %55, i64 %56, i64 %.04071
  %57 = icmp slt i64 %.1, %.142
  br i1 %57, label %.lr.ph67, label %._crit_edge74, !llvm.loop !11

58:                                               ; preds = %.lr.ph67, %83
  %indvars.iv = phi i64 [ 1, %.lr.ph67 ], [ %indvars.iv.next, %83 ]
  %.04464 = phi i64 [ %54, %.lr.ph67 ], [ %.2, %83 ]
  %59 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE3pos, i64 0, i64 %indvars.iv
  %60 = load i32, ptr %59, align 8, !tbaa !5
  %.not54 = icmp eq i32 %60, 0
  br i1 %.not54, label %83, label %61

61:                                               ; preds = %58
  %62 = getelementptr inbounds i8, ptr %59, i64 4
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %.not55 = icmp eq i32 %63, 0
  br i1 %.not55, label %83, label %64

64:                                               ; preds = %61
  %65 = sub nsw i32 %63, %60
  %66 = srem i32 %65, %10
  %.not56 = icmp eq i32 %66, 0
  br i1 %.not56, label %67, label %83

67:                                               ; preds = %64
  %68 = sext i32 %65 to i64
  %69 = mul nsw i64 %29, %68
  %70 = srem i64 %69, %30
  %71 = trunc nsw i64 %70 to i32
  %72 = icmp slt i64 %70, 0
  %73 = select i1 %72, i32 %.lcssa, i32 0
  %spec.select = add nsw i32 %73, %71
  %74 = sdiv i32 %spec.select, %10
  %75 = sext i32 %74 to i64
  %76 = mul nsw i64 %75, %31
  %77 = sext i32 %60 to i64
  %78 = add nsw i64 %76, %77
  %.not57 = icmp slt i64 %54, %78
  br i1 %.not57, label %83, label %79

79:                                               ; preds = %67
  %80 = sub nsw i64 %54, %78
  %81 = sdiv i64 %80, %16
  %.neg = xor i64 %81, -1
  %82 = add i64 %.04464, %.neg
  br label %83

83:                                               ; preds = %67, %79, %58, %61, %64
  %.2 = phi i64 [ %.04464, %64 ], [ %.04464, %61 ], [ %.04464, %58 ], [ %82, %79 ], [ %.04464, %67 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge68, label %58, !llvm.loop !17

._crit_edge74:                                    ; preds = %._crit_edge68, %.lr.ph73.split.us, %._crit_edge
  %.040.lcssa = phi i64 [ 1, %._crit_edge ], [ %.1.us, %.lr.ph73.split.us ], [ %.1, %._crit_edge68 ]
  %84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %.040.lcssa)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5

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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!15 = !{!14, !6, i64 4}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


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