; LLVM IR from tangjz/acm-icpc :: poj/1925.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 }

@_ZZ5solvevE3tim = external hidden global i32, align 4
@_ZZ5solvevE1p = external hidden global [5001 x %"struct.std::pair"], align 16
@_ZZ5solvevE2dp = external hidden global [1000001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = 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 ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca %"struct.std::pair", align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %42, %0
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = load i32, ptr %1, align 4, !tbaa !5
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %45

30:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [5001 x %"struct.std::pair"], ptr @_ZZ5solvevE1p, i64 0, i64 %32
  %34 = getelementptr inbounds %"struct.std::pair", ptr %33, i32 0, i32 0
  store ptr %34, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [5001 x %"struct.std::pair"], ptr @_ZZ5solvevE1p, i64 0, i64 %36
  %38 = getelementptr inbounds %"struct.std::pair", ptr %37, i32 0, i32 1
  store ptr %38, ptr %4, align 8, !tbaa !9
  %39 = load ptr, ptr %3, align 8, !tbaa !9
  %40 = load ptr, ptr %4, align 8, !tbaa !9
  %41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %39, ptr noundef %40)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %42

42:                                               ; preds = %30
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %2, align 4, !tbaa !5
  br label %25, !llvm.loop !11

45:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store ptr @_ZZ5solvevE1p, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store ptr getelementptr (i8, ptr @_ZZ5solvevE1p, i64 4), ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %46 = load i32, ptr %1, align 4, !tbaa !5
  %47 = sub nsw i32 %46, 1
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [5001 x %"struct.std::pair"], ptr @_ZZ5solvevE1p, i64 0, i64 %48
  %50 = getelementptr inbounds %"struct.std::pair", ptr %49, i32 0, i32 0
  store ptr %50, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %51 = load i32, ptr %1, align 4, !tbaa !5
  %52 = sub nsw i32 %51, 1
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [5001 x %"struct.std::pair"], ptr @_ZZ5solvevE1p, i64 0, i64 %53
  %55 = getelementptr inbounds %"struct.std::pair", ptr %54, i32 0, i32 1
  store ptr %55, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  %56 = load i32, ptr @_ZZ5solvevE3tim, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr @_ZZ5solvevE3tim, align 4, !tbaa !5
  %58 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) @_ZZ5solvevE3tim)
  store i64 %58, ptr %9, align 4
  %59 = load i32, ptr @_ZZ5solvevE1p, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE2dp, i64 0, i64 %60
  %62 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %61, 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %189, %45
  %64 = load i32, ptr %11, align 4, !tbaa !5
  %65 = load i32, ptr %1, align 4, !tbaa !5
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %68, label %67

67:                                               ; preds = %63
  store i32 5, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %192

68:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %69 = load i32, ptr %11, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [5001 x %"struct.std::pair"], ptr @_ZZ5solvevE1p, i64 0, i64 %70
  %72 = getelementptr inbounds %"struct.std::pair", ptr %71, i32 0, i32 0
  store ptr %72, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %73 = load i32, ptr %11, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [5001 x %"struct.std::pair"], ptr @_ZZ5solvevE1p, i64 0, i64 %74
  %76 = getelementptr inbounds %"struct.std::pair", ptr %75, i32 0, i32 1
  store ptr %76, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %77 = load ptr, ptr %14, align 8, !tbaa !9
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = load ptr, ptr %14, align 8, !tbaa !9
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = mul nsw i64 %79, %82
  %84 = load ptr, ptr %14, align 8, !tbaa !9
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = load i32, ptr getelementptr (i8, ptr @_ZZ5solvevE1p, i64 4), align 4, !tbaa !5
  %87 = sub nsw i32 %85, %86
  %88 = sext i32 %87 to i64
  %89 = load ptr, ptr %14, align 8, !tbaa !9
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = load i32, ptr getelementptr (i8, ptr @_ZZ5solvevE1p, i64 4), align 4, !tbaa !5
  %92 = sub nsw i32 %90, %91
  %93 = sext i32 %92 to i64
  %94 = mul nsw i64 %88, %93
  %95 = sub nsw i64 %83, %94
  store i64 %95, ptr %15, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %96 = load i64, ptr %15, align 8, !tbaa !13
  %97 = sitofp i64 %96 to x86_fp80
  %98 = call x86_fp80 @sqrtl(x86_fp80 noundef %97) #6
  %99 = fptosi x86_fp80 %98 to i32
  store i32 %99, ptr %16, align 4, !tbaa !5
  br label %100

100:                                              ; preds = %109, %68
  %101 = load i32, ptr %16, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = load i32, ptr %16, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = mul nsw i64 %102, %104
  %106 = load i64, ptr %15, align 8, !tbaa !13
  %107 = icmp sle i64 %105, %106
  br i1 %107, label %108, label %112

108:                                              ; preds = %100
  br label %109

109:                                              ; preds = %108
  %110 = load i32, ptr %16, align 4, !tbaa !5
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %16, align 4, !tbaa !5
  br label %100, !llvm.loop !15

112:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %113 = load ptr, ptr %13, align 8, !tbaa !9
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = sub nsw i32 %114, 1
  store i32 %115, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %116 = load ptr, ptr %13, align 8, !tbaa !9
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %19, align 4, !tbaa !5
  %119 = load ptr, ptr %7, align 8, !tbaa !9
  %120 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %119)
  %121 = load i32, ptr %120, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  store i32 %121, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 1, ptr %20, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %184, %112
  %123 = load i32, ptr %17, align 4, !tbaa !5
  %124 = load i32, ptr @_ZZ5solvevE1p, align 4, !tbaa !5
  %125 = icmp sge i32 %123, %124
  br i1 %125, label %126, label %130

126:                                              ; preds = %122
  %127 = load i32, ptr %20, align 4, !tbaa !5
  %128 = load i32, ptr %16, align 4, !tbaa !5
  %129 = icmp slt i32 %127, %128
  br label %130

130:                                              ; preds = %126, %122
  %131 = phi i1 [ false, %122 ], [ %129, %126 ]
  br i1 %131, label %133, label %132

132:                                              ; preds = %130
  store i32 11, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %188

133:                                              ; preds = %130
  %134 = load i32, ptr %17, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE2dp, i64 0, i64 %135
  %137 = getelementptr inbounds %"struct.std::pair", ptr %136, i32 0, i32 1
  %138 = load i32, ptr %137, align 4, !tbaa !16
  %139 = load i32, ptr @_ZZ5solvevE3tim, align 4, !tbaa !5
  %140 = icmp ne i32 %138, %139
  br i1 %140, label %141, label %142

141:                                              ; preds = %133
  br label %173

142:                                              ; preds = %133
  %143 = load i32, ptr %18, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE2dp, i64 0, i64 %144
  %146 = getelementptr inbounds %"struct.std::pair", ptr %145, i32 0, i32 1
  %147 = load i32, ptr %146, align 4, !tbaa !16
  %148 = load i32, ptr @_ZZ5solvevE3tim, align 4, !tbaa !5
  %149 = icmp ne i32 %147, %148
  br i1 %149, label %150, label %156

150:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 2147483647, ptr %22, align 4, !tbaa !5
  %151 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %22, ptr noundef nonnull align 4 dereferenceable(4) @_ZZ5solvevE3tim)
  store i64 %151, ptr %21, align 4
  %152 = load i32, ptr %18, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE2dp, i64 0, i64 %153
  %155 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %154, ptr noundef nonnull align 4 dereferenceable(8) %21) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %156

156:                                              ; preds = %150, %142
  %157 = load i32, ptr %18, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE2dp, i64 0, i64 %158
  %160 = getelementptr inbounds %"struct.std::pair", ptr %159, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  %161 = load i32, ptr %17, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE2dp, i64 0, i64 %162
  %164 = getelementptr inbounds %"struct.std::pair", ptr %163, i32 0, i32 0
  %165 = load i32, ptr %164, align 8, !tbaa !18
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %23, align 4, !tbaa !5
  %167 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %160, ptr noundef nonnull align 4 dereferenceable(4) %23)
  %168 = load i32, ptr %167, align 4, !tbaa !5
  %169 = load i32, ptr %18, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE2dp, i64 0, i64 %170
  %172 = getelementptr inbounds %"struct.std::pair", ptr %171, i32 0, i32 0
  store i32 %168, ptr %172, align 8, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %173

173:                                              ; preds = %156, %141
  %174 = load i32, ptr %17, align 4, !tbaa !5
  %175 = add nsw i32 %174, -1
  store i32 %175, ptr %17, align 4, !tbaa !5
  %176 = load i32, ptr %18, align 4, !tbaa !5
  %177 = load ptr, ptr %7, align 8, !tbaa !9
  %178 = load i32, ptr %177, align 4, !tbaa !5
  %179 = icmp slt i32 %176, %178
  br i1 %179, label %180, label %184

180:                                              ; preds = %173
  %181 = load i32, ptr %18, align 4, !tbaa !5
  %182 = add nsw i32 %181, 1
  store i32 %182, ptr %18, align 4, !tbaa !5
  %183 = icmp ne i32 %182, 0
  br label %184

184:                                              ; preds = %180, %173
  %185 = phi i1 [ false, %173 ], [ %183, %180 ]
  %186 = load i32, ptr %20, align 4, !tbaa !5
  %187 = add nsw i32 %186, 1
  store i32 %187, ptr %20, align 4, !tbaa !5
  br label %122, !llvm.loop !19

188:                                              ; preds = %132
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %189

189:                                              ; preds = %188
  %190 = load i32, ptr %11, align 4, !tbaa !5
  %191 = add nsw i32 %190, 1
  store i32 %191, ptr %11, align 4, !tbaa !5
  br label %63, !llvm.loop !20

192:                                              ; preds = %67
  %193 = load ptr, ptr %7, align 8, !tbaa !9
  %194 = load i32, ptr %193, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE2dp, i64 0, i64 %195
  %197 = getelementptr inbounds %"struct.std::pair", ptr %196, i32 0, i32 1
  %198 = load i32, ptr %197, align 4, !tbaa !16
  %199 = load i32, ptr @_ZZ5solvevE3tim, align 4, !tbaa !5
  %200 = icmp ne i32 %198, %199
  br i1 %200, label %201, label %203

201:                                              ; preds = %192
  %202 = call i32 @puts(ptr noundef @.str.2)
  br label %211

203:                                              ; preds = %192
  %204 = load ptr, ptr %7, align 8, !tbaa !9
  %205 = load i32, ptr %204, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE2dp, i64 0, i64 %206
  %208 = getelementptr inbounds %"struct.std::pair", ptr %207, i32 0, i32 0
  %209 = load i32, ptr %208, align 8, !tbaa !18
  %210 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %209)
  br label %211

211:                                              ; preds = %203, %201
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

; 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: nounwind
declare x86_fp80 @sqrtl(x86_fp80 noundef) #4

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

declare i32 @puts(ptr noundef) #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 = { 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 "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 }

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

@_ZZ5solvevE3tim = external hidden global i32, align 4
@_ZZ5solvevE1p = external hidden global [5001 x %"struct.std::pair"], align 16
@_ZZ5solvevE2dp = external hidden global [1000001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = 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 %"struct.std::pair", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %9 = load i32, ptr %1, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %.lcssa = phi i32 [ %9, %0 ], [ %26, %.lr.ph ]
  %11 = add nsw i32 %.lcssa, -1
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [5001 x %"struct.std::pair"], ptr @_ZZ5solvevE1p, i64 0, i64 %12
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  %14 = load i32, ptr @_ZZ5solvevE3tim, align 4, !tbaa !5
  %15 = add nsw i32 %14, 1
  store i32 %15, ptr @_ZZ5solvevE3tim, align 4, !tbaa !5
  %16 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) @_ZZ5solvevE3tim)
  store i64 %16, ptr %2, align 8
  %17 = load i32, ptr @_ZZ5solvevE1p, align 16, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE2dp, i64 0, i64 %18
  %20 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %19, ptr noundef nonnull align 4 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %21 = load i32, ptr %1, align 4, !tbaa !5
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph57, label %._crit_edge58

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %23 = getelementptr inbounds [5001 x %"struct.std::pair"], ptr @_ZZ5solvevE1p, i64 0, i64 %indvars.iv
  %24 = getelementptr inbounds i8, ptr %23, i64 4
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %23, ptr noundef nonnull %24)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %26 = load i32, ptr %1, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = icmp slt i64 %indvars.iv.next, %27
  br i1 %28, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge58:                                    ; preds = %._crit_edge54, %._crit_edge
  %29 = load i32, ptr %13, align 8, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE2dp, i64 0, i64 %30
  %32 = getelementptr inbounds i8, ptr %31, i64 4
  %33 = load i32, ptr %32, align 4, !tbaa !11
  %34 = load i32, ptr @_ZZ5solvevE3tim, align 4, !tbaa !5
  %.not = icmp eq i32 %33, %34
  br i1 %.not, label %94, label %92

.lr.ph57:                                         ; preds = %._crit_edge, %._crit_edge54
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %._crit_edge54 ], [ 0, %._crit_edge ]
  %35 = getelementptr inbounds [5001 x %"struct.std::pair"], ptr @_ZZ5solvevE1p, i64 0, i64 %indvars.iv67
  %36 = getelementptr inbounds i8, ptr %35, i64 4
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = load i32, ptr getelementptr inbounds (i8, ptr @_ZZ5solvevE1p, i64 4), align 4, !tbaa !5
  %40 = sub nsw i32 %37, %39
  %41 = sext i32 %40 to i64
  %add = add nsw i64 %41, %38
  %sub = sub nsw i64 %38, %41
  %42 = mul nsw i64 %add, %sub
  %43 = sitofp i64 %42 to x86_fp80
  %44 = call x86_fp80 @sqrtl(x86_fp80 noundef %43) #6
  %45 = fptosi x86_fp80 %44 to i32
  %46 = sext i32 %45 to i64
  br label %47

47:                                               ; preds = %47, %.lr.ph57
  %indvars.iv61 = phi i64 [ %indvars.iv.next62, %47 ], [ %46, %.lr.ph57 ]
  %48 = mul nsw i64 %indvars.iv61, %indvars.iv61
  %.not44 = icmp sgt i64 %48, %42
  %indvars.iv.next62 = add nsw i64 %indvars.iv61, 1
  br i1 %.not44, label %49, label %47, !llvm.loop !13

49:                                               ; preds = %47
  %50 = trunc nsw i64 %indvars.iv61 to i32
  %51 = load i32, ptr %35, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %4, align 4, !tbaa !5
  %53 = 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) %13)
  %54 = load i32, ptr %53, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %55 = load i32, ptr @_ZZ5solvevE1p, align 16, !tbaa !5
  %56 = icmp sgt i32 %51, %55
  %57 = icmp sgt i64 %indvars.iv61, 1
  %58 = and i1 %56, %57
  br i1 %58, label %.lr.ph53.preheader, label %._crit_edge54

.lr.ph53.preheader:                               ; preds = %49
  %59 = sext i32 %51 to i64
  %.pre70 = load i32, ptr @_ZZ5solvevE3tim, align 4, !tbaa !5
  br label %.lr.ph53

._crit_edge54:                                    ; preds = %81, %49
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %60 = load i32, ptr %1, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = icmp slt i64 %indvars.iv.next68, %61
  br i1 %62, label %.lr.ph57, label %._crit_edge58, !llvm.loop !14

.lr.ph53:                                         ; preds = %.lr.ph53.preheader, %81
  %63 = phi i32 [ %55, %.lr.ph53.preheader ], [ %82, %81 ]
  %64 = phi i32 [ %.pre70, %.lr.ph53.preheader ], [ %83, %81 ]
  %indvars.iv64 = phi i64 [ %59, %.lr.ph53.preheader ], [ %indvars.iv.next65, %81 ]
  %.050 = phi i32 [ 1, %.lr.ph53.preheader ], [ %87, %81 ]
  %.03749 = phi i32 [ %54, %.lr.ph53.preheader ], [ %spec.select, %81 ]
  %indvars.iv.next65 = add nsw i64 %indvars.iv64, -1
  %65 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE2dp, i64 0, i64 %indvars.iv.next65
  %66 = getelementptr inbounds i8, ptr %65, i64 4
  %67 = load i32, ptr %66, align 4, !tbaa !11
  %.not45 = icmp eq i32 %67, %64
  br i1 %.not45, label %68, label %81

68:                                               ; preds = %.lr.ph53
  %69 = sext i32 %.03749 to i64
  %70 = getelementptr inbounds [1000001 x %"struct.std::pair"], ptr @_ZZ5solvevE2dp, i64 0, i64 %69
  %71 = getelementptr inbounds i8, ptr %70, i64 4
  %72 = load i32, ptr %71, align 4, !tbaa !11
  %.not46 = icmp eq i32 %72, %64
  br i1 %.not46, label %76, label %73

73:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  store i32 2147483647, ptr %6, align 4, !tbaa !5
  %74 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) @_ZZ5solvevE3tim)
  store i64 %74, ptr %5, align 8
  %75 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %70, ptr noundef nonnull align 4 dereferenceable(8) %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %76

76:                                               ; preds = %73, %68
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  %77 = load i32, ptr %65, align 8, !tbaa !15
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %7, align 4, !tbaa !5
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %70, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %80 = load i32, ptr %79, align 4, !tbaa !5
  store i32 %80, ptr %70, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  %.pre = load i32, ptr @_ZZ5solvevE3tim, align 4, !tbaa !5
  %.pre71 = load i32, ptr @_ZZ5solvevE1p, align 16, !tbaa !5
  br label %81

81:                                               ; preds = %.lr.ph53, %76
  %82 = phi i32 [ %63, %.lr.ph53 ], [ %.pre71, %76 ]
  %83 = phi i32 [ %64, %.lr.ph53 ], [ %.pre, %76 ]
  %84 = load i32, ptr %13, align 8, !tbaa !5
  %85 = icmp slt i32 %.03749, %84
  %86 = zext i1 %85 to i32
  %spec.select = add nsw i32 %.03749, %86
  %87 = add nuw nsw i32 %.050, 1
  %88 = sext i32 %82 to i64
  %89 = icmp sgt i64 %indvars.iv.next65, %88
  %90 = icmp slt i32 %87, %50
  %91 = select i1 %89, i1 %90, i1 false
  br i1 %91, label %.lr.ph53, label %._crit_edge54, !llvm.loop !16

92:                                               ; preds = %._crit_edge58
  %93 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %97

94:                                               ; preds = %._crit_edge58
  %95 = load i32, ptr %31, align 8, !tbaa !15
  %96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %95)
  br label %97

97:                                               ; preds = %94, %92
  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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

; 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 nofree nounwind willreturn memory(write)
declare x86_fp80 @sqrtl(x86_fp80 noundef) local_unnamed_addr #4

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

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

; 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 = { mustprogress nofree nounwind willreturn memory(write) "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 }

!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, !6, i64 4}
!12 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = !{!12, !6, i64 0}
!16 = distinct !{!16, !10}


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