; LLVM IR from tangjz/acm-icpc :: codeforces/gym (101471H)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@qtot = external dso_local global i32, align 4
@que = external dso_local global [10001 x i32], align 16
@stot = external dso_local global i32, align 4
@b = external dso_local global [10001 x i32], align 16
@nxt = external dso_local global [10001 x i32], align 16
@a = external dso_local global [10001 x %"struct.std::pair"], align 16
@seg = external dso_local global [10001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = 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 i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair", align 4
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %38, %0
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = icmp slt i32 %15, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %41

19:                                               ; preds = %14
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @a, i64 0, i64 %21
  %23 = getelementptr inbounds %"struct.std::pair", ptr %22, i32 0, i32 0
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @a, i64 0, i64 %25
  %27 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 1
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %23, ptr noundef %27)
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @a, i64 0, i64 %30
  %32 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 1
  %33 = load i32, ptr %32, align 4, !tbaa !9
  %34 = load i32, ptr @qtot, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr @qtot, align 4, !tbaa !5
  %36 = sext i32 %34 to i64
  %37 = getelementptr inbounds [10001 x i32], ptr @que, i64 0, i64 %36
  store i32 %33, ptr %37, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %19
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %2, align 4, !tbaa !5
  br label %14, !llvm.loop !11

41:                                               ; preds = %18
  %42 = load i32, ptr @n, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds %"struct.std::pair", ptr @a, i64 %43
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef @a, ptr noundef %44)
  %45 = load i32, ptr @qtot, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i32, ptr @que, i64 %46
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @que, ptr noundef %47)
  %48 = load i32, ptr @qtot, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i32, ptr @que, i64 %49
  %51 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef @que, ptr noundef %50)
  %52 = ptrtoint ptr %51 to i64
  %53 = sub i64 %52, ptrtoint (ptr @que to i64)
  %54 = sdiv exact i64 %53, 4
  %55 = trunc i64 %54 to i32
  store i32 %55, ptr @qtot, align 4, !tbaa !5
  %56 = load i32, ptr @qtot, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = mul i64 %57, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 @b, ptr align 16 @que, i64 %58, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  %59 = load i32, ptr @qtot, align 4, !tbaa !5
  store i32 %59, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 1061109567, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 1061109567, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = sub nsw i32 %60, 1
  store i32 %61, ptr %7, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %277, %41
  %63 = load i32, ptr %7, align 4, !tbaa !5
  %64 = icmp sge i32 %63, 0
  br i1 %64, label %66, label %65

65:                                               ; preds = %62
  store i32 5, ptr %8, align 4
  br label %279

66:                                               ; preds = %62
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @a, i64 0, i64 %68
  %70 = getelementptr inbounds %"struct.std::pair", ptr %69, i32 0, i32 0
  %71 = load i32, ptr %70, align 8, !tbaa !13
  store i32 %71, ptr %3, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %120, %66
  %73 = load i32, ptr %4, align 4, !tbaa !5
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %75, label %85

75:                                               ; preds = %72
  %76 = load i32, ptr %3, align 4, !tbaa !5
  %77 = load i32, ptr @m, align 4, !tbaa !5
  %78 = add nsw i32 %76, %77
  %79 = load i32, ptr %4, align 4, !tbaa !5
  %80 = sub nsw i32 %79, 1
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [10001 x i32], ptr @que, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = icmp sle i32 %78, %83
  br label %85

85:                                               ; preds = %75, %72
  %86 = phi i1 [ false, %72 ], [ %84, %75 ]
  br i1 %86, label %87, label %121

87:                                               ; preds = %85
  %88 = load i32, ptr %4, align 4, !tbaa !5
  %89 = add nsw i32 %88, -1
  store i32 %89, ptr %4, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %114, %87
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [10001 x i32], ptr @nxt, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = load i32, ptr @stot, align 4, !tbaa !5
  %96 = icmp slt i32 %94, %95
  br i1 %96, label %97, label %111

97:                                               ; preds = %90
  %98 = load i32, ptr %4, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [10001 x i32], ptr @b, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = load i32, ptr %4, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [10001 x i32], ptr @nxt, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %106
  %108 = getelementptr inbounds %"struct.std::pair", ptr %107, i32 0, i32 0
  %109 = load i32, ptr %108, align 8, !tbaa !13
  %110 = icmp sle i32 %101, %109
  br label %111

111:                                              ; preds = %97, %90
  %112 = phi i1 [ false, %90 ], [ %110, %97 ]
  br i1 %112, label %113, label %120

113:                                              ; preds = %111
  br label %114

114:                                              ; preds = %113
  %115 = load i32, ptr %4, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [10001 x i32], ptr @nxt, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %117, align 4, !tbaa !5
  br label %90, !llvm.loop !14

120:                                              ; preds = %111
  br label %72, !llvm.loop !15

121:                                              ; preds = %85
  br label %122

122:                                              ; preds = %231, %121
  %123 = load i32, ptr %7, align 4, !tbaa !5
  %124 = icmp sge i32 %123, 0
  br i1 %124, label %125, label %133

125:                                              ; preds = %122
  %126 = load i32, ptr %7, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @a, i64 0, i64 %127
  %129 = getelementptr inbounds %"struct.std::pair", ptr %128, i32 0, i32 0
  %130 = load i32, ptr %129, align 8, !tbaa !13
  %131 = load i32, ptr %3, align 4, !tbaa !5
  %132 = icmp eq i32 %130, %131
  br label %133

133:                                              ; preds = %125, %122
  %134 = phi i1 [ false, %122 ], [ %132, %125 ]
  br i1 %134, label %135, label %234

135:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %136 = load i32, ptr %4, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds i32, ptr @que, i64 %137
  %139 = load i32, ptr @qtot, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds i32, ptr @que, i64 %140
  %142 = load i32, ptr %7, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @a, i64 0, i64 %143
  %145 = getelementptr inbounds %"struct.std::pair", ptr %144, i32 0, i32 1
  %146 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef %138, ptr noundef %141, ptr noundef nonnull align 4 dereferenceable(4) %145)
  %147 = ptrtoint ptr %146 to i64
  %148 = sub i64 %147, ptrtoint (ptr @que to i64)
  %149 = sdiv exact i64 %148, 4
  %150 = trunc i64 %149 to i32
  store i32 %150, ptr %9, align 4, !tbaa !5
  br label %151

151:                                              ; preds = %227, %135
  %152 = load i32, ptr %9, align 4, !tbaa !5
  %153 = load i32, ptr @qtot, align 4, !tbaa !5
  %154 = icmp slt i32 %152, %153
  br i1 %154, label %156, label %155

155:                                              ; preds = %151
  store i32 16, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %230

156:                                              ; preds = %151
  %157 = load i32, ptr @m, align 4, !tbaa !5
  %158 = load i32, ptr %9, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [10001 x i32], ptr @b, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = sub nsw i32 %161, %157
  store i32 %162, ptr %160, align 4, !tbaa !5
  br label %163

163:                                              ; preds = %187, %156
  %164 = load i32, ptr %9, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [10001 x i32], ptr @nxt, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = load i32, ptr @stot, align 4, !tbaa !5
  %169 = icmp slt i32 %167, %168
  br i1 %169, label %170, label %184

170:                                              ; preds = %163
  %171 = load i32, ptr %9, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [10001 x i32], ptr @b, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  %175 = load i32, ptr %9, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [10001 x i32], ptr @nxt, i64 0, i64 %176
  %178 = load i32, ptr %177, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %179
  %181 = getelementptr inbounds %"struct.std::pair", ptr %180, i32 0, i32 0
  %182 = load i32, ptr %181, align 8, !tbaa !13
  %183 = icmp sle i32 %174, %182
  br label %184

184:                                              ; preds = %170, %163
  %185 = phi i1 [ false, %163 ], [ %183, %170 ]
  br i1 %185, label %186, label %193

186:                                              ; preds = %184
  br label %187

187:                                              ; preds = %186
  %188 = load i32, ptr %9, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [10001 x i32], ptr @nxt, i64 0, i64 %189
  %191 = load i32, ptr %190, align 4, !tbaa !5
  %192 = add nsw i32 %191, 1
  store i32 %192, ptr %190, align 4, !tbaa !5
  br label %163, !llvm.loop !16

193:                                              ; preds = %184
  %194 = load i32, ptr %9, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [10001 x i32], ptr @nxt, i64 0, i64 %195
  %197 = load i32, ptr %196, align 4, !tbaa !5
  %198 = load i32, ptr @stot, align 4, !tbaa !5
  %199 = icmp slt i32 %197, %198
  br i1 %199, label %200, label %226

200:                                              ; preds = %193
  %201 = load i32, ptr %9, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [10001 x i32], ptr @b, i64 0, i64 %202
  %204 = load i32, ptr %203, align 4, !tbaa !5
  %205 = load i32, ptr %9, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [10001 x i32], ptr @nxt, i64 0, i64 %206
  %208 = load i32, ptr %207, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %209
  %211 = getelementptr inbounds %"struct.std::pair", ptr %210, i32 0, i32 1
  %212 = load i32, ptr %211, align 4, !tbaa !9
  %213 = icmp slt i32 %204, %212
  br i1 %213, label %214, label %226

214:                                              ; preds = %200
  %215 = load i32, ptr %9, align 4, !tbaa !5
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [10001 x i32], ptr @nxt, i64 0, i64 %216
  %218 = load i32, ptr %217, align 4, !tbaa !5
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %219
  %221 = getelementptr inbounds %"struct.std::pair", ptr %220, i32 0, i32 0
  %222 = load i32, ptr %221, align 8, !tbaa !13
  %223 = load i32, ptr %9, align 4, !tbaa !5
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds [10001 x i32], ptr @b, i64 0, i64 %224
  store i32 %222, ptr %225, align 4, !tbaa !5
  br label %226

226:                                              ; preds = %214, %200, %193
  br label %227

227:                                              ; preds = %226
  %228 = load i32, ptr %9, align 4, !tbaa !5
  %229 = add nsw i32 %228, 1
  store i32 %229, ptr %9, align 4, !tbaa !5
  br label %151, !llvm.loop !17

230:                                              ; preds = %155
  br label %231

231:                                              ; preds = %230
  %232 = load i32, ptr %7, align 4, !tbaa !5
  %233 = add nsw i32 %232, -1
  store i32 %233, ptr %7, align 4, !tbaa !5
  br label %122, !llvm.loop !18

234:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  %235 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %235, ptr %10, align 4, !tbaa !5
  br label %236

236:                                              ; preds = %247, %234
  %237 = load i32, ptr %10, align 4, !tbaa !5
  %238 = load i32, ptr @qtot, align 4, !tbaa !5
  %239 = icmp slt i32 %237, %238
  br i1 %239, label %241, label %240

240:                                              ; preds = %236
  store i32 22, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %250

241:                                              ; preds = %236
  %242 = load i32, ptr %10, align 4, !tbaa !5
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds [10001 x i32], ptr @b, i64 0, i64 %243
  %245 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %244)
  %246 = load i32, ptr %245, align 4, !tbaa !5
  store i32 %246, ptr %6, align 4, !tbaa !5
  br label %247

247:                                              ; preds = %241
  %248 = load i32, ptr %10, align 4, !tbaa !5
  %249 = add nsw i32 %248, 1
  store i32 %249, ptr %10, align 4, !tbaa !5
  br label %236, !llvm.loop !19

250:                                              ; preds = %240
  %251 = load i32, ptr %6, align 4, !tbaa !5
  %252 = load i32, ptr %3, align 4, !tbaa !5
  %253 = icmp slt i32 %251, %252
  br i1 %253, label %254, label %256

254:                                              ; preds = %250
  %255 = call i32 @puts(ptr noundef @.str.1)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %279

256:                                              ; preds = %250
  %257 = load i32, ptr %6, align 4, !tbaa !5
  %258 = load i32, ptr %5, align 4, !tbaa !5
  %259 = icmp slt i32 %257, %258
  br i1 %259, label %260, label %276

260:                                              ; preds = %256
  %261 = load i32, ptr %6, align 4, !tbaa !5
  %262 = load i32, ptr @m, align 4, !tbaa !5
  %263 = sub nsw i32 %261, %262
  %264 = load i32, ptr %3, align 4, !tbaa !5
  %265 = icmp slt i32 %263, %264
  br i1 %265, label %266, label %276

266:                                              ; preds = %260
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %267 = load i32, ptr %6, align 4, !tbaa !5
  %268 = load i32, ptr @m, align 4, !tbaa !5
  %269 = sub nsw i32 %267, %268
  store i32 %269, ptr %12, align 4, !tbaa !5
  %270 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__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) %3)
  store i64 %270, ptr %11, align 4
  %271 = load i32, ptr @stot, align 4, !tbaa !5
  %272 = add nsw i32 %271, 1
  store i32 %272, ptr @stot, align 4, !tbaa !5
  %273 = sext i32 %271 to i64
  %274 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %273
  %275 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %274, ptr noundef nonnull align 4 dereferenceable(8) %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %276

276:                                              ; preds = %266, %260, %256
  br label %277

277:                                              ; preds = %276
  %278 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %278, ptr %5, align 4, !tbaa !5
  br label %62, !llvm.loop !20

279:                                              ; preds = %254, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  %280 = load i32, ptr %8, align 4
  switch i32 %280, label %283 [
    i32 5, label %281
  ]

281:                                              ; preds = %279
  %282 = call i32 @puts(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %283

283:                                              ; preds = %281, %279
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  %284 = load i32, ptr %1, align 4
  ret i32 %284
}

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

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

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #3

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

; 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)) #7 align 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 = { "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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #7 = { 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 #8 = { 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, !6, i64 4}
!10 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!10, !6, i64 0}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!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 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@qtot = external dso_local local_unnamed_addr global i32, align 4
@que = external dso_local global [10001 x i32], align 16
@stot = external dso_local local_unnamed_addr global i32, align 4
@b = external dso_local global [10001 x i32], align 16
@nxt = external dso_local local_unnamed_addr global [10001 x i32], align 16
@a = external dso_local global [10001 x %"struct.std::pair"], align 16
@seg = external dso_local global [10001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = 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 i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca i32, align 4
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre118 = sext i32 %6 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre118, %.._crit_edge_crit_edge ], [ %34, %.lr.ph ]
  %8 = getelementptr inbounds %"struct.std::pair", ptr @a, i64 %.pre-phi
  tail call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef nonnull @a, ptr noundef nonnull %8)
  %9 = load i32, ptr @qtot, align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds i32, ptr @que, i64 %10
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @que, ptr noundef nonnull %11)
  %12 = load i32, ptr @qtot, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds i32, ptr @que, i64 %13
  %15 = tail call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef nonnull @que, ptr noundef nonnull %14)
  %16 = ptrtoint ptr %15 to i64
  %17 = sub i64 %16, ptrtoint (ptr @que to i64)
  %18 = lshr exact i64 %17, 2
  %19 = trunc i64 %18 to i32
  store i32 %19, ptr @qtot, align 4, !tbaa !5
  %sext = shl i64 %17, 30
  %20 = ashr exact i64 %sext, 30
  %21 = and i64 %20, -4
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @b, ptr nonnull align 16 @que, i64 %21, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  store i32 1061109567, ptr %2, align 4, !tbaa !5
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %23 = icmp slt i32 %22, 1
  br i1 %23, label %.critedge63, label %.lr.ph94.preheader

.lr.ph94.preheader:                               ; preds = %._crit_edge
  %24 = add nsw i32 %22, -1
  br label %.lr.ph94

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %25 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @a, i64 0, i64 %indvars.iv
  %26 = getelementptr inbounds i8, ptr %25, i64 4
  %27 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %25, ptr noundef nonnull %26)
  %28 = load i32, ptr %26, align 4, !tbaa !9
  %29 = load i32, ptr @qtot, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr @qtot, align 4, !tbaa !5
  %31 = sext i32 %29 to i64
  %32 = getelementptr inbounds [10001 x i32], ptr @que, i64 0, i64 %31
  store i32 %28, ptr %32, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %33 = load i32, ptr @n, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = icmp slt i64 %indvars.iv.next, %34
  br i1 %35, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.lr.ph94:                                         ; preds = %.lr.ph94.preheader, %127
  %.04692 = phi i32 [ %.1.lcssa, %127 ], [ %24, %.lr.ph94.preheader ]
  %.04791 = phi i32 [ %128, %127 ], [ 1061109567, %.lr.ph94.preheader ]
  %.04890 = phi i32 [ %.149.lcssa123, %127 ], [ %19, %.lr.ph94.preheader ]
  %36 = zext nneg i32 %.04692 to i64
  %37 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @a, i64 0, i64 %36
  %38 = load i32, ptr %37, align 8, !tbaa !13
  store i32 %38, ptr %1, align 4, !tbaa !5
  %.not68 = icmp eq i32 %.04890, 0
  br i1 %.not68, label %.lr.ph83, label %.lr.ph71

.lr.ph71:                                         ; preds = %.lr.ph94
  %39 = load i32, ptr @m, align 4, !tbaa !5
  %40 = add nsw i32 %39, %38
  %41 = load i32, ptr @stot, align 4
  %42 = sext i32 %.04890 to i64
  br label %43

43:                                               ; preds = %.lr.ph71, %.critedge2
  %indvars.iv102 = phi i64 [ %42, %.lr.ph71 ], [ %indvars.iv.next103, %.critedge2 ]
  %indvars.iv.next103 = add nsw i64 %indvars.iv102, -1
  %44 = getelementptr inbounds [10001 x i32], ptr @que, i64 0, i64 %indvars.iv.next103
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %.not59 = icmp sgt i32 %40, %45
  br i1 %.not59, label %.critedge.split.loop.exit, label %.preheader

.preheader:                                       ; preds = %43
  %46 = getelementptr inbounds [10001 x i32], ptr @nxt, i64 0, i64 %indvars.iv.next103
  %.promoted = load i32, ptr %46, align 4, !tbaa !5
  %47 = icmp slt i32 %.promoted, %41
  br i1 %47, label %.lr.ph66, label %.critedge2

.lr.ph66:                                         ; preds = %.preheader
  %48 = getelementptr inbounds [10001 x i32], ptr @b, i64 0, i64 %indvars.iv.next103
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = sext i32 %.promoted to i64
  br label %51

51:                                               ; preds = %.lr.ph66, %54
  %indvars.iv99 = phi i64 [ %50, %.lr.ph66 ], [ %indvars.iv.next100, %54 ]
  %52 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %indvars.iv99
  %53 = load i32, ptr %52, align 8, !tbaa !13
  %.not61 = icmp sgt i32 %49, %53
  br i1 %.not61, label %.critedge2, label %54

54:                                               ; preds = %51
  %indvars.iv.next100 = add nsw i64 %indvars.iv99, 1
  %55 = trunc i64 %indvars.iv.next100 to i32
  store i32 %55, ptr %46, align 4, !tbaa !5
  %exitcond.not = icmp eq i32 %41, %55
  br i1 %exitcond.not, label %.critedge2, label %51, !llvm.loop !14

.critedge2:                                       ; preds = %51, %54, %.preheader
  %.not = icmp eq i64 %indvars.iv.next103, 0
  br i1 %.not, label %.critedge, label %43, !llvm.loop !15

.critedge.split.loop.exit:                        ; preds = %43
  %56 = trunc nsw i64 %indvars.iv102 to i32
  br label %.critedge

.critedge:                                        ; preds = %.critedge2, %.critedge.split.loop.exit
  %.149.lcssa = phi i32 [ %56, %.critedge.split.loop.exit ], [ 0, %.critedge2 ]
  %57 = icmp sgt i32 %.04692, -1
  br i1 %57, label %.lr.ph83, label %.critedge4

.lr.ph83:                                         ; preds = %.lr.ph94, %.critedge
  %.149.lcssa122 = phi i32 [ %.149.lcssa, %.critedge ], [ 0, %.lr.ph94 ]
  %58 = sext i32 %.149.lcssa122 to i64
  %59 = getelementptr inbounds i32, ptr @que, i64 %58
  br label %60

60:                                               ; preds = %.lr.ph83, %._crit_edge81
  %.182 = phi i32 [ %.04692, %.lr.ph83 ], [ %81, %._crit_edge81 ]
  %61 = zext nneg i32 %.182 to i64
  %62 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @a, i64 0, i64 %61
  %63 = load i32, ptr %62, align 8, !tbaa !13
  %64 = load i32, ptr %1, align 4, !tbaa !5
  %65 = icmp eq i32 %63, %64
  br i1 %65, label %66, label %.critedge4

66:                                               ; preds = %60
  %67 = load i32, ptr @qtot, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds i32, ptr @que, i64 %68
  %70 = getelementptr inbounds i8, ptr %62, i64 4
  %71 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull %59, ptr noundef nonnull %69, ptr noundef nonnull align 4 dereferenceable(4) %70)
  %72 = ptrtoint ptr %71 to i64
  %73 = sub i64 %72, ptrtoint (ptr @que to i64)
  %74 = lshr exact i64 %73, 2
  %75 = trunc i64 %74 to i32
  %76 = load i32, ptr @qtot, align 4, !tbaa !5
  %77 = icmp sgt i32 %76, %75
  br i1 %77, label %.lr.ph80, label %._crit_edge81

.lr.ph80:                                         ; preds = %66
  %78 = load i32, ptr @m, align 4, !tbaa !5
  %79 = load i32, ptr @stot, align 4, !tbaa !5
  %sext119 = shl i64 %73, 30
  %80 = ashr i64 %sext119, 32
  %wide.trip.count = sext i32 %76 to i64
  br label %83

._crit_edge81:                                    ; preds = %.critedge6, %66
  %81 = add nsw i32 %.182, -1
  %82 = icmp sgt i32 %.182, 0
  br i1 %82, label %60, label %.critedge4, !llvm.loop !16

83:                                               ; preds = %.lr.ph80, %.critedge6
  %indvars.iv110 = phi i64 [ %80, %.lr.ph80 ], [ %indvars.iv.next111, %.critedge6 ]
  %84 = getelementptr inbounds [10001 x i32], ptr @b, i64 0, i64 %indvars.iv110
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = sub nsw i32 %85, %78
  store i32 %86, ptr %84, align 4, !tbaa !5
  %87 = getelementptr inbounds [10001 x i32], ptr @nxt, i64 0, i64 %indvars.iv110
  %.promoted75 = load i32, ptr %87, align 4, !tbaa !5
  %88 = icmp slt i32 %.promoted75, %79
  br i1 %88, label %.lr.ph77.preheader, label %.critedge6

.lr.ph77.preheader:                               ; preds = %83
  %89 = sext i32 %.promoted75 to i64
  br label %.lr.ph77

.lr.ph77:                                         ; preds = %.lr.ph77.preheader, %92
  %indvars.iv105 = phi i64 [ %89, %.lr.ph77.preheader ], [ %indvars.iv.next106, %92 ]
  %90 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %indvars.iv105
  %91 = load i32, ptr %90, align 8, !tbaa !13
  %.not60 = icmp sgt i32 %86, %91
  br i1 %.not60, label %94, label %92

92:                                               ; preds = %.lr.ph77
  %indvars.iv.next106 = add nsw i64 %indvars.iv105, 1
  %93 = trunc i64 %indvars.iv.next106 to i32
  store i32 %93, ptr %87, align 4, !tbaa !5
  %exitcond109.not = icmp eq i32 %79, %93
  br i1 %exitcond109.not, label %.critedge6, label %.lr.ph77, !llvm.loop !17

94:                                               ; preds = %.lr.ph77
  %sext120 = shl i64 %indvars.iv105, 32
  %95 = ashr exact i64 %sext120, 32
  %96 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %95
  %97 = getelementptr inbounds i8, ptr %96, i64 4
  %98 = load i32, ptr %97, align 4, !tbaa !9
  %99 = icmp slt i32 %86, %98
  br i1 %99, label %100, label %.critedge6

100:                                              ; preds = %94
  %101 = load i32, ptr %96, align 8, !tbaa !13
  store i32 %101, ptr %84, align 4, !tbaa !5
  br label %.critedge6

.critedge6:                                       ; preds = %92, %83, %94, %100
  %indvars.iv.next111 = add nsw i64 %indvars.iv110, 1
  %exitcond113.not = icmp eq i64 %indvars.iv.next111, %wide.trip.count
  br i1 %exitcond113.not, label %._crit_edge81, label %83, !llvm.loop !18

.critedge4:                                       ; preds = %60, %._crit_edge81, %.critedge
  %.149.lcssa123 = phi i32 [ %.149.lcssa, %.critedge ], [ %.149.lcssa122, %._crit_edge81 ], [ %.149.lcssa122, %60 ]
  %.1.lcssa = phi i32 [ %.04692, %.critedge ], [ %.182, %60 ], [ -1, %._crit_edge81 ]
  %102 = load i32, ptr @qtot, align 4, !tbaa !5
  %103 = icmp slt i32 %.149.lcssa123, %102
  br i1 %103, label %.lr.ph88.preheader, label %.critedge4.._crit_edge89_crit_edge

.critedge4.._crit_edge89_crit_edge:               ; preds = %.critedge4
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  br label %._crit_edge89

.lr.ph88.preheader:                               ; preds = %.critedge4
  %104 = sext i32 %.149.lcssa123 to i64
  br label %.lr.ph88

._crit_edge89:                                    ; preds = %.lr.ph88, %.critedge4.._crit_edge89_crit_edge
  %105 = phi i32 [ %.pre, %.critedge4.._crit_edge89_crit_edge ], [ %110, %.lr.ph88 ]
  %106 = load i32, ptr %1, align 4, !tbaa !5
  %107 = icmp slt i32 %105, %106
  br i1 %107, label %.critedge63, label %114

.lr.ph88:                                         ; preds = %.lr.ph88.preheader, %.lr.ph88
  %indvars.iv114 = phi i64 [ %104, %.lr.ph88.preheader ], [ %indvars.iv.next115, %.lr.ph88 ]
  %108 = getelementptr inbounds [10001 x i32], ptr @b, i64 0, i64 %indvars.iv114
  %109 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %108)
  %110 = load i32, ptr %109, align 4, !tbaa !5
  store i32 %110, ptr %2, align 4, !tbaa !5
  %indvars.iv.next115 = add nsw i64 %indvars.iv114, 1
  %111 = load i32, ptr @qtot, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = icmp slt i64 %indvars.iv.next115, %112
  br i1 %113, label %.lr.ph88, label %._crit_edge89, !llvm.loop !19

114:                                              ; preds = %._crit_edge89
  %115 = icmp slt i32 %105, %.04791
  br i1 %115, label %116, label %127

116:                                              ; preds = %114
  %117 = load i32, ptr @m, align 4, !tbaa !5
  %118 = sub nsw i32 %105, %117
  %119 = icmp slt i32 %118, %106
  br i1 %119, label %120, label %127

120:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  store i32 %118, ptr %4, align 4, !tbaa !5
  %121 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %1)
  store i64 %121, ptr %3, align 8
  %122 = load i32, ptr @stot, align 4, !tbaa !5
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr @stot, align 4, !tbaa !5
  %124 = sext i32 %122 to i64
  %125 = getelementptr inbounds [10001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %124
  %126 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %125, ptr noundef nonnull align 4 dereferenceable(8) %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  %.pre117 = load i32, ptr %2, align 4, !tbaa !5
  br label %127

127:                                              ; preds = %114, %116, %120
  %128 = phi i32 [ %105, %114 ], [ %105, %116 ], [ %.pre117, %120 ]
  %129 = icmp slt i32 %.1.lcssa, 0
  br i1 %129, label %.critedge63, label %.lr.ph94, !llvm.loop !20

.critedge63:                                      ; preds = %127, %._crit_edge89, %._crit_edge
  %.str.1.sink = phi ptr [ @.str.2, %._crit_edge ], [ @.str.1, %._crit_edge89 ], [ @.str.2, %127 ]
  %130 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0
}

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

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

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

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

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

; 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 #7 align 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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #7 = { 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 #8 = { 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, !6, i64 4}
!10 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!10, !6, i64 0}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}


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