; LLVM IR from tangjz/acm-icpc :: codeforces/complete (1030G)

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

@tot = external dso_local global i32, align 4
@pr = external dso_local global [2000001 x i32], align 16
@d = external dso_local global [2000001 x i32], align 16
@n = external dso_local global i32, align 4
@a = external dso_local global [200001 x i32], align 16
@mx = external dso_local global [2000001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #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 %"struct.std::pair", align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::pair", align 4
  %14 = alloca i32, align 4
  %15 = alloca i8, align 1
  %16 = alloca i32, align 4
  %17 = alloca i8, align 1
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i32 1, ptr getelementptr inbounds ([2000001 x i32], ptr @d, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %76, %0
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = icmp slt i32 %24, 2000001
  br i1 %25, label %27, label %26

26:                                               ; preds = %23
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %79

27:                                               ; preds = %23
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [2000001 x i32], ptr @d, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %42, label %33

33:                                               ; preds = %27
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [2000001 x i32], ptr @d, i64 0, i64 %36
  store i32 %34, ptr %37, align 4, !tbaa !5
  %38 = load i32, ptr @tot, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr @tot, align 4, !tbaa !5
  %40 = sext i32 %38 to i64
  %41 = getelementptr inbounds [2000001 x i32], ptr @pr, i64 0, i64 %40
  store i32 %34, ptr %41, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %33, %27
  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
  br label %43

43:                                               ; preds = %71, %42
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [2000001 x i32], ptr @pr, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = mul nsw i32 %44, %48
  store i32 %49, ptr %5, align 4, !tbaa !5
  %50 = icmp slt i32 %49, 2000001
  br i1 %50, label %52, label %51

51:                                               ; preds = %43
  store i32 5, ptr %3, align 4
  br label %74

52:                                               ; preds = %43
  %53 = load i32, ptr %4, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [2000001 x i32], ptr @pr, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [2000001 x i32], ptr @d, i64 0, i64 %58
  store i32 %56, ptr %59, align 4, !tbaa !5
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [2000001 x i32], ptr @d, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = load i32, ptr %4, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [2000001 x i32], ptr @pr, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = icmp eq i32 %63, %67
  br i1 %68, label %69, label %70

69:                                               ; preds = %52
  store i32 5, ptr %3, align 4
  br label %74

70:                                               ; preds = %52
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %4, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %4, align 4, !tbaa !5
  br label %43, !llvm.loop !9

74:                                               ; preds = %69, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %75

75:                                               ; preds = %74
  br label %76

76:                                               ; preds = %75
  %77 = load i32, ptr %2, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %2, align 4, !tbaa !5
  br label %23, !llvm.loop !11

79:                                               ; preds = %26
  %80 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %81

81:                                               ; preds = %91, %79
  %82 = load i32, ptr %6, align 4, !tbaa !5
  %83 = load i32, ptr @n, align 4, !tbaa !5
  %84 = icmp slt i32 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %81
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %94

86:                                               ; preds = %81
  %87 = load i32, ptr %6, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds i32, ptr @a, i64 %88
  %90 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %89)
  br label %91

91:                                               ; preds = %86
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %6, align 4, !tbaa !5
  br label %81, !llvm.loop !12

94:                                               ; preds = %85
  %95 = load i32, ptr @n, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds i32, ptr @a, i64 %96
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @a, ptr noundef %97)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %98 = load i32, ptr @n, align 4, !tbaa !5
  %99 = sub nsw i32 %98, 1
  store i32 %99, ptr %7, align 4, !tbaa !5
  br label %100

100:                                              ; preds = %193, %94
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = icmp sge i32 %101, 0
  br i1 %102, label %104, label %103

103:                                              ; preds = %100
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %196

104:                                              ; preds = %100
  %105 = load i32, ptr %7, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %109
  %111 = getelementptr inbounds %"struct.std::pair", ptr %110, i32 0, i32 0
  %112 = load i32, ptr %111, align 8, !tbaa !13
  %113 = icmp ne i32 %112, 0
  br i1 %113, label %126, label %114

114:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %115 = load i32, ptr %7, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %116
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 1, ptr %9, align 4, !tbaa !5
  %118 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %117, ptr noundef nonnull align 4 dereferenceable(4) %9)
  store i64 %118, ptr %8, align 4
  %119 = load i32, ptr %7, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %123
  %125 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %124, ptr noundef nonnull align 4 dereferenceable(8) %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %192

126:                                              ; preds = %104
  %127 = load i32, ptr %7, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = add nsw i32 %130, -1
  store i32 %131, ptr %129, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %132 = load i32, ptr %7, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  store i32 %135, ptr %10, align 4, !tbaa !5
  br label %136

136:                                              ; preds = %190, %126
  %137 = load i32, ptr %10, align 4, !tbaa !5
  %138 = icmp sgt i32 %137, 1
  br i1 %138, label %140, label %139

139:                                              ; preds = %136
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %191

140:                                              ; preds = %136
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %141 = load i32, ptr %10, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [2000001 x i32], ptr @d, i64 0, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  store i32 %144, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %145

145:                                              ; preds = %153, %140
  %146 = load i32, ptr %10, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [2000001 x i32], ptr @d, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = load i32, ptr %11, align 4, !tbaa !5
  %151 = icmp eq i32 %149, %150
  br i1 %151, label %152, label %160

152:                                              ; preds = %145
  br label %153

153:                                              ; preds = %152
  %154 = load i32, ptr %11, align 4, !tbaa !5
  %155 = load i32, ptr %10, align 4, !tbaa !5
  %156 = sdiv i32 %155, %154
  store i32 %156, ptr %10, align 4, !tbaa !5
  %157 = load i32, ptr %11, align 4, !tbaa !5
  %158 = load i32, ptr %12, align 4, !tbaa !5
  %159 = mul nsw i32 %158, %157
  store i32 %159, ptr %12, align 4, !tbaa !5
  br label %145, !llvm.loop !15

160:                                              ; preds = %145
  %161 = load i32, ptr %11, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %162
  %164 = getelementptr inbounds %"struct.std::pair", ptr %163, i32 0, i32 0
  %165 = load i32, ptr %164, align 8, !tbaa !13
  %166 = load i32, ptr %12, align 4, !tbaa !5
  %167 = icmp slt i32 %165, %166
  br i1 %167, label %168, label %174

168:                                              ; preds = %160
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 1, ptr %14, align 4, !tbaa !5
  %169 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %14)
  store i64 %169, ptr %13, align 4
  %170 = load i32, ptr %11, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %171
  %173 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %172, ptr noundef nonnull align 4 dereferenceable(8) %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %190

174:                                              ; preds = %160
  %175 = load i32, ptr %11, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %176
  %178 = getelementptr inbounds %"struct.std::pair", ptr %177, i32 0, i32 0
  %179 = load i32, ptr %178, align 8, !tbaa !13
  %180 = load i32, ptr %12, align 4, !tbaa !5
  %181 = icmp eq i32 %179, %180
  br i1 %181, label %182, label %189

182:                                              ; preds = %174
  %183 = load i32, ptr %11, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %184
  %186 = getelementptr inbounds %"struct.std::pair", ptr %185, i32 0, i32 1
  %187 = load i32, ptr %186, align 4, !tbaa !16
  %188 = add nsw i32 %187, 1
  store i32 %188, ptr %186, align 4, !tbaa !16
  br label %189

189:                                              ; preds = %182, %174
  br label %190

190:                                              ; preds = %189, %168
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %136, !llvm.loop !17

191:                                              ; preds = %139
  br label %192

192:                                              ; preds = %191, %114
  br label %193

193:                                              ; preds = %192
  %194 = load i32, ptr %7, align 4, !tbaa !5
  %195 = add nsw i32 %194, -1
  store i32 %195, ptr %7, align 4, !tbaa !5
  br label %100, !llvm.loop !18

196:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #6
  store i8 0, ptr %15, align 1, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %197

197:                                              ; preds = %276, %196
  %198 = load i8, ptr %15, align 1, !tbaa !19, !range !21, !noundef !22
  %199 = trunc i8 %198 to i1
  br i1 %199, label %204, label %200

200:                                              ; preds = %197
  %201 = load i32, ptr %16, align 4, !tbaa !5
  %202 = load i32, ptr @n, align 4, !tbaa !5
  %203 = icmp slt i32 %201, %202
  br label %204

204:                                              ; preds = %200, %197
  %205 = phi i1 [ false, %197 ], [ %203, %200 ]
  br i1 %205, label %207, label %206

206:                                              ; preds = %204
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %279

207:                                              ; preds = %204
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #6
  store i8 0, ptr %17, align 1, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %208 = load i32, ptr %16, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %209
  %211 = load i32, ptr %210, align 4, !tbaa !5
  store i32 %211, ptr %18, align 4, !tbaa !5
  br label %212

212:                                              ; preds = %256, %207
  %213 = load i8, ptr %17, align 1, !tbaa !19, !range !21, !noundef !22
  %214 = trunc i8 %213 to i1
  br i1 %214, label %218, label %215

215:                                              ; preds = %212
  %216 = load i32, ptr %18, align 4, !tbaa !5
  %217 = icmp sgt i32 %216, 1
  br label %218

218:                                              ; preds = %215, %212
  %219 = phi i1 [ false, %212 ], [ %217, %215 ]
  br i1 %219, label %221, label %220

220:                                              ; preds = %218
  store i32 22, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %265

221:                                              ; preds = %218
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %222 = load i32, ptr %18, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [2000001 x i32], ptr @d, i64 0, i64 %223
  %225 = load i32, ptr %224, align 4, !tbaa !5
  store i32 %225, ptr %19, 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 %226

226:                                              ; preds = %234, %221
  %227 = load i32, ptr %18, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [2000001 x i32], ptr @d, i64 0, i64 %228
  %230 = load i32, ptr %229, align 4, !tbaa !5
  %231 = load i32, ptr %19, align 4, !tbaa !5
  %232 = icmp eq i32 %230, %231
  br i1 %232, label %233, label %241

233:                                              ; preds = %226
  br label %234

234:                                              ; preds = %233
  %235 = load i32, ptr %19, align 4, !tbaa !5
  %236 = load i32, ptr %18, align 4, !tbaa !5
  %237 = sdiv i32 %236, %235
  store i32 %237, ptr %18, align 4, !tbaa !5
  %238 = load i32, ptr %19, align 4, !tbaa !5
  %239 = load i32, ptr %20, align 4, !tbaa !5
  %240 = mul nsw i32 %239, %238
  store i32 %240, ptr %20, align 4, !tbaa !5
  br label %226, !llvm.loop !23

241:                                              ; preds = %226
  %242 = load i32, ptr %19, align 4, !tbaa !5
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %243
  %245 = getelementptr inbounds %"struct.std::pair", ptr %244, i32 0, i32 0
  %246 = load i32, ptr %245, align 8, !tbaa !13
  %247 = load i32, ptr %20, align 4, !tbaa !5
  %248 = icmp eq i32 %246, %247
  br i1 %248, label %249, label %256

249:                                              ; preds = %241
  %250 = load i32, ptr %19, align 4, !tbaa !5
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %251
  %253 = getelementptr inbounds %"struct.std::pair", ptr %252, i32 0, i32 1
  %254 = load i32, ptr %253, align 4, !tbaa !16
  %255 = icmp eq i32 %254, 1
  br label %256

256:                                              ; preds = %249, %241
  %257 = phi i1 [ false, %241 ], [ %255, %249 ]
  %258 = zext i1 %257 to i32
  %259 = load i8, ptr %17, align 1, !tbaa !19, !range !21, !noundef !22
  %260 = trunc i8 %259 to i1
  %261 = zext i1 %260 to i32
  %262 = or i32 %261, %258
  %263 = icmp ne i32 %262, 0
  %264 = zext i1 %263 to i8
  store i8 %264, ptr %17, align 1, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %212, !llvm.loop !24

265:                                              ; preds = %220
  %266 = load i8, ptr %17, align 1, !tbaa !19, !range !21, !noundef !22
  %267 = trunc i8 %266 to i1
  %268 = xor i1 %267, true
  %269 = zext i1 %268 to i32
  %270 = load i8, ptr %15, align 1, !tbaa !19, !range !21, !noundef !22
  %271 = trunc i8 %270 to i1
  %272 = zext i1 %271 to i32
  %273 = or i32 %272, %269
  %274 = icmp ne i32 %273, 0
  %275 = zext i1 %274 to i8
  store i8 %275, ptr %15, align 1, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #6
  br label %276

276:                                              ; preds = %265
  %277 = load i32, ptr %16, align 4, !tbaa !5
  %278 = add nsw i32 %277, 1
  store i32 %278, ptr %16, align 4, !tbaa !5
  br label %197, !llvm.loop !25

279:                                              ; preds = %206
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 1, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 0, ptr %22, align 4, !tbaa !5
  br label %280

280:                                              ; preds = %311, %279
  %281 = load i32, ptr %22, align 4, !tbaa !5
  %282 = load i32, ptr @tot, align 4, !tbaa !5
  %283 = icmp slt i32 %281, %282
  br i1 %283, label %285, label %284

284:                                              ; preds = %280
  store i32 27, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  br label %314

285:                                              ; preds = %280
  %286 = load i32, ptr %22, align 4, !tbaa !5
  %287 = sext i32 %286 to i64
  %288 = getelementptr inbounds [2000001 x i32], ptr @pr, i64 0, i64 %287
  %289 = load i32, ptr %288, align 4, !tbaa !5
  %290 = sext i32 %289 to i64
  %291 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %290
  %292 = getelementptr inbounds %"struct.std::pair", ptr %291, i32 0, i32 0
  %293 = load i32, ptr %292, align 8, !tbaa !13
  %294 = icmp ne i32 %293, 0
  br i1 %294, label %295, label %310

295:                                              ; preds = %285
  %296 = load i32, ptr %21, align 4, !tbaa !5
  %297 = sext i32 %296 to i64
  %298 = load i32, ptr %22, align 4, !tbaa !5
  %299 = sext i32 %298 to i64
  %300 = getelementptr inbounds [2000001 x i32], ptr @pr, i64 0, i64 %299
  %301 = load i32, ptr %300, align 4, !tbaa !5
  %302 = sext i32 %301 to i64
  %303 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %302
  %304 = getelementptr inbounds %"struct.std::pair", ptr %303, i32 0, i32 0
  %305 = load i32, ptr %304, align 8, !tbaa !13
  %306 = sext i32 %305 to i64
  %307 = mul nsw i64 %297, %306
  %308 = srem i64 %307, 1000000007
  %309 = trunc i64 %308 to i32
  store i32 %309, ptr %21, align 4, !tbaa !5
  br label %310

310:                                              ; preds = %295, %285
  br label %311

311:                                              ; preds = %310
  %312 = load i32, ptr %22, align 4, !tbaa !5
  %313 = add nsw i32 %312, 1
  store i32 %313, ptr %22, align 4, !tbaa !5
  br label %280, !llvm.loop !26

314:                                              ; preds = %284
  %315 = load i8, ptr %15, align 1, !tbaa !19, !range !21, !noundef !22
  %316 = trunc i8 %315 to i1
  br i1 %316, label %317, label %327

317:                                              ; preds = %314
  %318 = load i32, ptr %21, align 4, !tbaa !5
  %319 = add nsw i32 %318, 1
  store i32 %319, ptr %21, align 4, !tbaa !5
  %320 = icmp sge i32 %319, 1000000007
  br i1 %320, label %321, label %325

321:                                              ; preds = %317
  %322 = load i32, ptr %21, align 4, !tbaa !5
  %323 = sub nsw i32 %322, 1000000007
  store i32 %323, ptr %21, align 4, !tbaa !5
  %324 = icmp ne i32 %323, 0
  br label %325

325:                                              ; preds = %321, %317
  %326 = phi i1 [ false, %317 ], [ %324, %321 ]
  br label %327

327:                                              ; preds = %325, %314
  %328 = load i32, ptr %21, align 4, !tbaa !5
  %329 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %328)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #6
  %330 = load i32, ptr %1, align 4
  ret i32 %330
}

; 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

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

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

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

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

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

attributes #0 = { mustprogress norecurse 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 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 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 = { 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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!15 = distinct !{!15, !10}
!16 = !{!14, !6, i64 4}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = !{!20, !20, i64 0}
!20 = !{!"bool", !7, i64 0}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}


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

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

@tot = external dso_local local_unnamed_addr global i32, align 4
@pr = external dso_local local_unnamed_addr global [2000001 x i32], align 16
@d = external dso_local local_unnamed_addr global [2000001 x i32], align 16
@n = external dso_local global i32, align 4
@a = external dso_local global [200001 x i32], align 16
@mx = external dso_local global [2000001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %"struct.std::pair", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca i32, align 4
  store i32 1, ptr getelementptr inbounds (i8, ptr @d, i64 4), align 4, !tbaa !5
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !5
  br label %10

6:                                                ; preds = %._crit_edge
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph97, label %.._crit_edge98_crit_edge

.._crit_edge98_crit_edge:                         ; preds = %6
  %.pre162 = sext i32 %8 to i64
  br label %._crit_edge98

10:                                               ; preds = %0, %._crit_edge
  %indvars.iv145 = phi i64 [ 2, %0 ], [ %indvars.iv.next146, %._crit_edge ]
  %11 = phi i32 [ %tot.promoted, %0 ], [ %19, %._crit_edge ]
  %12 = getelementptr inbounds [2000001 x i32], ptr @d, i64 0, i64 %indvars.iv145
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %.not90 = icmp eq i32 %13, 0
  %14 = trunc nuw nsw i64 %indvars.iv145 to i32
  br i1 %.not90, label %15, label %._crit_edge160

15:                                               ; preds = %10
  store i32 %14, ptr %12, align 4, !tbaa !5
  %16 = add nsw i32 %11, 1
  store i32 %16, ptr @tot, align 4, !tbaa !5
  %17 = sext i32 %11 to i64
  %18 = getelementptr inbounds [2000001 x i32], ptr @pr, i64 0, i64 %17
  store i32 %14, ptr %18, align 4, !tbaa !5
  br label %._crit_edge160

._crit_edge160:                                   ; preds = %10, %15
  %19 = phi i32 [ %16, %15 ], [ %11, %10 ]
  %20 = load i32, ptr @pr, align 16, !tbaa !5
  %21 = mul nsw i32 %20, %14
  %22 = icmp slt i32 %21, 2000001
  br i1 %22, label %.lr.ph, label %._crit_edge

23:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = getelementptr inbounds [2000001 x i32], ptr @pr, i64 0, i64 %indvars.iv.next
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = mul nsw i32 %25, %14
  %27 = icmp slt i32 %26, 2000001
  br i1 %27, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.lr.ph:                                           ; preds = %._crit_edge160, %23
  %indvars.iv = phi i64 [ %indvars.iv.next, %23 ], [ 0, %._crit_edge160 ]
  %28 = phi i32 [ %26, %23 ], [ %21, %._crit_edge160 ]
  %29 = phi i32 [ %25, %23 ], [ %20, %._crit_edge160 ]
  %30 = sext i32 %28 to i64
  %31 = getelementptr inbounds [2000001 x i32], ptr @d, i64 0, i64 %30
  store i32 %29, ptr %31, align 4, !tbaa !5
  %32 = load i32, ptr %12, align 4, !tbaa !5
  %33 = icmp eq i32 %32, %29
  br i1 %33, label %._crit_edge, label %23

._crit_edge:                                      ; preds = %23, %.lr.ph, %._crit_edge160
  %indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next146, 2000001
  br i1 %exitcond.not, label %6, label %10, !llvm.loop !11

._crit_edge98:                                    ; preds = %.lr.ph97, %.._crit_edge98_crit_edge
  %.pre-phi163 = phi i64 [ %.pre162, %.._crit_edge98_crit_edge ], [ %41, %.lr.ph97 ]
  %34 = getelementptr inbounds i32, ptr @a, i64 %.pre-phi163
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @a, ptr noundef nonnull %34)
  %35 = load i32, ptr @n, align 4
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.lr.ph114.preheader, label %.preheader

.lr.ph114.preheader:                              ; preds = %._crit_edge98
  %37 = zext nneg i32 %35 to i64
  br label %.lr.ph114

.lr.ph97:                                         ; preds = %6, %.lr.ph97
  %indvars.iv148 = phi i64 [ %indvars.iv.next149, %.lr.ph97 ], [ 0, %6 ]
  %38 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv148
  %39 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %38)
  %indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = icmp slt i64 %indvars.iv.next149, %41
  br i1 %42, label %.lr.ph97, label %._crit_edge98, !llvm.loop !12

.preheader91:                                     ; preds = %.loopexit
  %.pre = load i32, ptr @n, align 4
  %43 = icmp slt i32 %.pre, 1
  br i1 %43, label %.preheader, label %.lr.ph130.preheader

.lr.ph130.preheader:                              ; preds = %.preheader91
  %44 = zext nneg i32 %.pre to i64
  br label %.lr.ph130

.lr.ph114:                                        ; preds = %.lr.ph114.preheader, %.loopexit
  %indvars.iv151 = phi i64 [ %37, %.lr.ph114.preheader ], [ %indvars.iv.next152, %.loopexit ]
  %indvars.iv.next152 = add nsw i64 %indvars.iv151, -1
  %45 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %indvars.iv.next152
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %47
  %49 = load i32, ptr %48, align 8, !tbaa !13
  %.not89 = icmp eq i32 %49, 0
  br i1 %.not89, label %50, label %56

50:                                               ; preds = %.lr.ph114
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  %51 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %45, ptr noundef nonnull align 4 dereferenceable(4) %2)
  store i64 %51, ptr %1, align 8
  %52 = load i32, ptr %45, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %53
  %55 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %54, ptr noundef nonnull align 4 dereferenceable(8) %1) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  br label %.loopexit

56:                                               ; preds = %.lr.ph114
  %57 = add nsw i32 %46, -1
  store i32 %57, ptr %45, align 4, !tbaa !5
  %58 = icmp sgt i32 %46, 2
  br i1 %58, label %.lr.ph103.preheader, label %.loopexit

.lr.ph103.preheader:                              ; preds = %56, %81
  %.070108 = phi i32 [ %62, %81 ], [ %57, %56 ]
  %59 = zext nneg i32 %.070108 to i64
  %60 = getelementptr inbounds [2000001 x i32], ptr @d, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  br label %.lr.ph103

.lr.ph103:                                        ; preds = %.lr.ph103.preheader, %.lr.ph103
  %.171101 = phi i32 [ %62, %.lr.ph103 ], [ %.070108, %.lr.ph103.preheader ]
  %storemerge100 = phi i32 [ %63, %.lr.ph103 ], [ 1, %.lr.ph103.preheader ]
  %62 = sdiv i32 %.171101, %61
  %63 = mul nsw i32 %storemerge100, %61
  %64 = sext i32 %62 to i64
  %65 = getelementptr inbounds [2000001 x i32], ptr @d, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = icmp eq i32 %66, %61
  br i1 %67, label %.lr.ph103, label %._crit_edge104, !llvm.loop !15

._crit_edge104:                                   ; preds = %.lr.ph103
  store i32 %63, ptr %3, align 4, !tbaa !5
  %68 = sext i32 %61 to i64
  %69 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %68
  %70 = load i32, ptr %69, align 8, !tbaa !13
  %71 = icmp slt i32 %70, %63
  br i1 %71, label %72, label %75

72:                                               ; preds = %._crit_edge104
  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 1, ptr %5, align 4, !tbaa !5
  %73 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__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) %5)
  store i64 %73, ptr %4, align 8
  %74 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %69, 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
  br label %81

75:                                               ; preds = %._crit_edge104
  %76 = icmp eq i32 %70, %63
  br i1 %76, label %77, label %81

77:                                               ; preds = %75
  %78 = getelementptr inbounds i8, ptr %69, i64 4
  %79 = load i32, ptr %78, align 4, !tbaa !16
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %78, align 4, !tbaa !16
  br label %81

81:                                               ; preds = %75, %77, %72
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %82 = icmp sgt i32 %62, 1
  br i1 %82, label %.lr.ph103.preheader, label %.loopexit, !llvm.loop !17

.loopexit:                                        ; preds = %81, %56, %50
  %83 = icmp sgt i64 %indvars.iv151, 1
  br i1 %83, label %.lr.ph114, label %.preheader91, !llvm.loop !18

.preheader.loopexit:                              ; preds = %.lr.ph130, %._crit_edge126
  %.066.lcssa168 = phi i1 [ %110, %._crit_edge126 ], [ false, %.lr.ph130 ]
  %84 = xor i1 %.066.lcssa168, true
  br label %.preheader

.preheader:                                       ; preds = %._crit_edge98, %.preheader.loopexit, %.preheader91
  %.068.lcssa = phi i1 [ false, %.preheader91 ], [ %84, %.preheader.loopexit ], [ false, %._crit_edge98 ]
  %85 = load i32, ptr @tot, align 4, !tbaa !5
  %86 = icmp sgt i32 %85, 0
  br i1 %86, label %.lr.ph134.preheader, label %._crit_edge135.thread

.lr.ph134.preheader:                              ; preds = %.preheader
  %wide.trip.count = zext nneg i32 %85 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %87 = icmp eq i32 %85, 1
  br i1 %87, label %._crit_edge135.unr-lcssa, label %.lr.ph134.preheader.new

.lr.ph134.preheader.new:                          ; preds = %.lr.ph134.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph134

.lr.ph130:                                        ; preds = %.lr.ph130.preheader, %._crit_edge126
  %indvars.iv154 = phi i64 [ 0, %.lr.ph130.preheader ], [ %indvars.iv.next155, %._crit_edge126 ]
  %88 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %indvars.iv154
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = icmp slt i32 %89, 2
  br i1 %90, label %.preheader.loopexit, label %.lr.ph118.preheader

._crit_edge126:                                   ; preds = %109
  %indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
  %91 = icmp ult i64 %indvars.iv.next155, %44
  %.not86.not = select i1 %110, i1 %91, i1 false
  br i1 %.not86.not, label %.lr.ph130, label %.preheader.loopexit, !llvm.loop !19

.lr.ph118.preheader:                              ; preds = %.lr.ph130, %109
  %.064123 = phi i32 [ %95, %109 ], [ %89, %.lr.ph130 ]
  %92 = zext nneg i32 %.064123 to i64
  %93 = getelementptr inbounds [2000001 x i32], ptr @d, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  br label %.lr.ph118

.lr.ph118:                                        ; preds = %.lr.ph118.preheader, %.lr.ph118
  %.063116 = phi i32 [ %96, %.lr.ph118 ], [ 1, %.lr.ph118.preheader ]
  %.165115 = phi i32 [ %95, %.lr.ph118 ], [ %.064123, %.lr.ph118.preheader ]
  %95 = sdiv i32 %.165115, %94
  %96 = mul nsw i32 %.063116, %94
  %97 = sext i32 %95 to i64
  %98 = getelementptr inbounds [2000001 x i32], ptr @d, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = icmp eq i32 %99, %94
  br i1 %100, label %.lr.ph118, label %._crit_edge119, !llvm.loop !20

._crit_edge119:                                   ; preds = %.lr.ph118
  %101 = sext i32 %94 to i64
  %102 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %101
  %103 = load i32, ptr %102, align 8, !tbaa !13
  %104 = icmp eq i32 %103, %96
  br i1 %104, label %105, label %109

105:                                              ; preds = %._crit_edge119
  %106 = getelementptr inbounds i8, ptr %102, i64 4
  %107 = load i32, ptr %106, align 4, !tbaa !16
  %108 = icmp eq i32 %107, 1
  br label %109

109:                                              ; preds = %105, %._crit_edge119
  %110 = phi i1 [ false, %._crit_edge119 ], [ %108, %105 ]
  %111 = icmp slt i32 %95, 2
  %.not88 = or i1 %110, %111
  br i1 %.not88, label %._crit_edge126, label %.lr.ph118.preheader, !llvm.loop !21

._crit_edge135.unr-lcssa:                         ; preds = %149, %.lr.ph134.preheader
  %.1.fr.lcssa.ph = phi i32 [ poison, %.lr.ph134.preheader ], [ %.1.fr.1, %149 ]
  %indvars.iv156.unr = phi i64 [ 0, %.lr.ph134.preheader ], [ %indvars.iv.next157.1, %149 ]
  %.062132.unr = phi i32 [ 1, %.lr.ph134.preheader ], [ %.1.fr.1, %149 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge135, label %.lr.ph134.epil

.lr.ph134.epil:                                   ; preds = %._crit_edge135.unr-lcssa
  %112 = getelementptr inbounds [2000001 x i32], ptr @pr, i64 0, i64 %indvars.iv156.unr
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %114
  %116 = load i32, ptr %115, align 8, !tbaa !13
  %.fr189 = freeze i32 %116
  %.not.epil = icmp eq i32 %.fr189, 0
  br i1 %.not.epil, label %._crit_edge135, label %117

117:                                              ; preds = %.lr.ph134.epil
  %118 = sext i32 %.062132.unr to i64
  %119 = sext i32 %.fr189 to i64
  %120 = mul nsw i64 %119, %118
  %121 = srem i64 %120, 1000000007
  %122 = trunc nsw i64 %121 to i32
  br label %._crit_edge135

._crit_edge135:                                   ; preds = %.lr.ph134.epil, %117, %._crit_edge135.unr-lcssa
  %.1.fr.lcssa = phi i32 [ %.1.fr.lcssa.ph, %._crit_edge135.unr-lcssa ], [ %122, %117 ], [ %.062132.unr, %.lr.ph134.epil ]
  %123 = add nsw i32 %.1.fr.lcssa, 1
  %124 = icmp sgt i32 %.1.fr.lcssa, 1000000005
  %spec.select = select i1 %124, i32 0, i32 %123
  br label %._crit_edge135.thread

._crit_edge135.thread:                            ; preds = %._crit_edge135, %.preheader
  %.062.lcssa171 = phi i32 [ 1, %.preheader ], [ %.1.fr.lcssa, %._crit_edge135 ]
  %125 = phi i32 [ 2, %.preheader ], [ %spec.select, %._crit_edge135 ]
  %.2 = select i1 %.068.lcssa, i32 %125, i32 %.062.lcssa171
  %126 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.2)
  ret i32 0

.lr.ph134:                                        ; preds = %149, %.lr.ph134.preheader.new
  %indvars.iv156 = phi i64 [ 0, %.lr.ph134.preheader.new ], [ %indvars.iv.next157.1, %149 ]
  %.062132 = phi i32 [ 1, %.lr.ph134.preheader.new ], [ %.1.fr.1, %149 ]
  %niter = phi i64 [ 0, %.lr.ph134.preheader.new ], [ %niter.next.1, %149 ]
  %127 = getelementptr inbounds [2000001 x i32], ptr @pr, i64 0, i64 %indvars.iv156
  %128 = load i32, ptr %127, align 8, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %129
  %131 = load i32, ptr %130, align 8, !tbaa !13
  %.not = icmp eq i32 %131, 0
  br i1 %.not, label %.lr.ph134.1, label %132

132:                                              ; preds = %.lr.ph134
  %133 = sext i32 %.062132 to i64
  %134 = sext i32 %131 to i64
  %135 = mul nsw i64 %134, %133
  %136 = srem i64 %135, 1000000007
  %137 = trunc nsw i64 %136 to i32
  br label %.lr.ph134.1

.lr.ph134.1:                                      ; preds = %.lr.ph134, %132
  %.1 = phi i32 [ %137, %132 ], [ %.062132, %.lr.ph134 ]
  %.1.fr = freeze i32 %.1
  %indvars.iv.next157 = or disjoint i64 %indvars.iv156, 1
  %138 = getelementptr inbounds [2000001 x i32], ptr @pr, i64 0, i64 %indvars.iv.next157
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [2000001 x %"struct.std::pair"], ptr @mx, i64 0, i64 %140
  %142 = load i32, ptr %141, align 8, !tbaa !13
  %.not.1 = icmp eq i32 %142, 0
  br i1 %.not.1, label %149, label %143

143:                                              ; preds = %.lr.ph134.1
  %144 = sext i32 %.1.fr to i64
  %145 = sext i32 %142 to i64
  %146 = mul nsw i64 %145, %144
  %147 = srem i64 %146, 1000000007
  %148 = trunc nsw i64 %147 to i32
  br label %149

149:                                              ; preds = %143, %.lr.ph134.1
  %.1.1 = phi i32 [ %148, %143 ], [ %.1.fr, %.lr.ph134.1 ]
  %.1.fr.1 = freeze i32 %.1.1
  %indvars.iv.next157.1 = add nuw nsw i64 %indvars.iv156, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge135.unr-lcssa, label %.lr.ph134, !llvm.loop !22
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiiESt4pairINSt25__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 #4

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

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

attributes #0 = { mustprogress norecurse 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 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 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 = { 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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!15 = distinct !{!15, !10}
!16 = !{!14, !6, i64 4}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}


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