; LLVM IR from tangjz/acm-icpc :: uvalive (7216)

; 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 }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@b = external dso_local global [100001 x i32], align 16
@tot = external dso_local global i32, align 4
@que = external dso_local global [100001 x i32], align 16
@fir = external dso_local global [100001 x i32], align 16
@sz = external dso_local global [100001 x i32], align 16
@a = external dso_local global [100001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [66 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %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 %"class.std::map", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair", align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  %23 = icmp eq i32 %22, 1
  br i1 %23, label %24, label %30

24:                                               ; preds = %0
  %25 = load i32, ptr @t, align 4, !tbaa !5
  %26 = icmp sle i32 1, %25
  br i1 %26, label %27, label %30

27:                                               ; preds = %24
  %28 = load i32, ptr @t, align 4, !tbaa !5
  %29 = icmp sle i32 %28, 20
  br label %30

30:                                               ; preds = %27, %24, %0
  %31 = phi i1 [ false, %24 ], [ false, %0 ], [ %29, %27 ]
  br i1 %31, label %32, label %33

32:                                               ; preds = %30
  br label %35

33:                                               ; preds = %30
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 11, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

34:                                               ; No predecessors!
  br label %35

35:                                               ; preds = %34, %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %461, %35
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = load i32, ptr @t, align 4, !tbaa !5
  %39 = icmp sle i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %465

41:                                               ; preds = %36
  %42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef @n, ptr noundef @q)
  %43 = icmp eq i32 %42, 2
  br i1 %43, label %44, label %56

44:                                               ; preds = %41
  %45 = load i32, ptr @n, align 4, !tbaa !5
  %46 = icmp sle i32 1, %45
  br i1 %46, label %47, label %56

47:                                               ; preds = %44
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = icmp slt i32 %48, 100001
  br i1 %49, label %50, label %56

50:                                               ; preds = %47
  %51 = load i32, ptr @q, align 4, !tbaa !5
  %52 = icmp sle i32 1, %51
  br i1 %52, label %53, label %56

53:                                               ; preds = %50
  %54 = load i32, ptr @q, align 4, !tbaa !5
  %55 = icmp slt i32 %54, 100001
  br label %56

56:                                               ; preds = %53, %50, %47, %44, %41
  %57 = phi i1 [ false, %50 ], [ false, %47 ], [ false, %44 ], [ false, %41 ], [ %55, %53 ]
  br i1 %57, label %58, label %59

58:                                               ; preds = %56
  br label %61

59:                                               ; preds = %56
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.2, i32 noundef 14, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

60:                                               ; No predecessors!
  br label %61

61:                                               ; preds = %60, %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %99, %61
  %63 = load i32, ptr %4, align 4, !tbaa !5
  %64 = load i32, ptr @n, align 4, !tbaa !5
  %65 = icmp sle i32 %63, %64
  br i1 %65, label %67, label %66

66:                                               ; preds = %62
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %102

67:                                               ; preds = %62
  %68 = load i32, ptr %4, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %69
  %71 = getelementptr inbounds %"struct.std::pair", ptr %70, i32 0, i32 0
  %72 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %71)
  %73 = icmp eq i32 %72, 1
  br i1 %73, label %74, label %88

74:                                               ; preds = %67
  %75 = load i32, ptr %4, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %76
  %78 = getelementptr inbounds %"struct.std::pair", ptr %77, i32 0, i32 0
  %79 = load i32, ptr %78, align 8, !tbaa !9
  %80 = icmp sle i32 1, %79
  br i1 %80, label %81, label %88

81:                                               ; preds = %74
  %82 = load i32, ptr %4, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %83
  %85 = getelementptr inbounds %"struct.std::pair", ptr %84, i32 0, i32 0
  %86 = load i32, ptr %85, align 8, !tbaa !9
  %87 = icmp sle i32 %86, 1000000000
  br label %88

88:                                               ; preds = %81, %74, %67
  %89 = phi i1 [ false, %74 ], [ false, %67 ], [ %87, %81 ]
  br i1 %89, label %90, label %91

90:                                               ; preds = %88
  br label %93

91:                                               ; preds = %88
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.2, i32 noundef 17, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

92:                                               ; No predecessors!
  br label %93

93:                                               ; preds = %92, %90
  %94 = load i32, ptr %4, align 4, !tbaa !5
  %95 = load i32, ptr %4, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %96
  %98 = getelementptr inbounds %"struct.std::pair", ptr %97, i32 0, i32 1
  store i32 %94, ptr %98, align 4, !tbaa !11
  br label %99

99:                                               ; preds = %93
  %100 = load i32, ptr %4, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %4, align 4, !tbaa !5
  br label %62, !llvm.loop !12

102:                                              ; preds = %66
  %103 = load i32, ptr @n, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds %"struct.std::pair", ptr @a, i64 %104
  %106 = getelementptr inbounds %"struct.std::pair", ptr %105, i64 1
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef getelementptr inbounds (%"struct.std::pair", ptr @a, i64 1), ptr noundef %106)
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %107

107:                                              ; preds = %148, %102
  %108 = load i32, ptr %5, align 4, !tbaa !5
  %109 = load i32, ptr @n, align 4, !tbaa !5
  %110 = icmp sle i32 %108, %109
  br i1 %110, label %112, label %111

111:                                              ; preds = %107
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %151

112:                                              ; preds = %107
  %113 = load i32, ptr %5, align 4, !tbaa !5
  %114 = sub nsw i32 %113, 1
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %115
  %117 = getelementptr inbounds %"struct.std::pair", ptr %116, i32 0, i32 0
  %118 = load i32, ptr %117, align 8, !tbaa !9
  %119 = load i32, ptr %5, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %120
  %122 = getelementptr inbounds %"struct.std::pair", ptr %121, i32 0, i32 0
  %123 = load i32, ptr %122, align 8, !tbaa !9
  %124 = icmp ne i32 %118, %123
  br i1 %124, label %125, label %142

125:                                              ; preds = %112
  %126 = load i32, ptr %5, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [100001 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 !9
  %131 = load i32, ptr @tot, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr @tot, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [100001 x i32], ptr @que, i64 0, i64 %133
  store i32 %130, ptr %134, align 4, !tbaa !5
  %135 = load i32, ptr %5, align 4, !tbaa !5
  %136 = load i32, ptr @tot, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %137
  store i32 %135, ptr %138, align 4, !tbaa !5
  %139 = load i32, ptr @tot, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %140
  store i32 0, ptr %141, align 4, !tbaa !5
  br label %142

142:                                              ; preds = %125, %112
  %143 = load i32, ptr @tot, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %145, align 4, !tbaa !5
  br label %148

148:                                              ; preds = %142
  %149 = load i32, ptr %5, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %5, align 4, !tbaa !5
  br label %107, !llvm.loop !14

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

152:                                              ; preds = %182, %151
  %153 = load i32, ptr %6, align 4, !tbaa !5
  %154 = load i32, ptr @n, align 4, !tbaa !5
  %155 = icmp sle i32 %153, %154
  br i1 %155, label %157, label %156

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

157:                                              ; preds = %152
  %158 = load i32, ptr %6, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds i32, ptr @b, i64 %159
  %161 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %160)
  %162 = icmp eq i32 %161, 1
  br i1 %162, label %163, label %176

163:                                              ; preds = %157
  %164 = load i32, ptr %6, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = icmp sle i32 1, %167
  br i1 %168, label %169, label %176

169:                                              ; preds = %163
  %170 = load i32, ptr %6, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !5
  %174 = load i32, ptr @n, align 4, !tbaa !5
  %175 = icmp sle i32 %173, %174
  br label %176

176:                                              ; preds = %169, %163, %157
  %177 = phi i1 [ false, %163 ], [ false, %157 ], [ %175, %169 ]
  br i1 %177, label %178, label %179

178:                                              ; preds = %176
  br label %181

179:                                              ; preds = %176
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.2, i32 noundef 33, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

180:                                              ; No predecessors!
  br label %181

181:                                              ; preds = %180, %178
  br label %182

182:                                              ; preds = %181
  %183 = load i32, ptr %6, align 4, !tbaa !5
  %184 = add nsw i32 %183, 1
  store i32 %184, ptr %6, align 4, !tbaa !5
  br label %152, !llvm.loop !15

185:                                              ; preds = %156
  call void @llvm.lifetime.start.p0(i64 48, ptr %7) #8
  call void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #8
  %186 = load i32, ptr %2, align 4, !tbaa !5
  %187 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %186)
          to label %188 unwind label %214

188:                                              ; preds = %185
  br label %189

189:                                              ; preds = %452, %450, %188
  %190 = load i32, ptr @q, align 4, !tbaa !5
  %191 = add nsw i32 %190, -1
  store i32 %191, ptr @q, align 4, !tbaa !5
  %192 = icmp ne i32 %190, 0
  br i1 %192, label %193, label %460

193:                                              ; preds = %189
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %194 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %10, ptr noundef %11)
          to label %195 unwind label %218

195:                                              ; preds = %193
  %196 = icmp eq i32 %194, 2
  br i1 %196, label %197, label %210

197:                                              ; preds = %195
  %198 = load i32, ptr %10, align 4, !tbaa !5
  %199 = icmp sle i32 1, %198
  br i1 %199, label %200, label %210

200:                                              ; preds = %197
  %201 = load i32, ptr %10, align 4, !tbaa !5
  %202 = icmp sle i32 %201, 1000000000
  br i1 %202, label %203, label %210

203:                                              ; preds = %200
  %204 = load i32, ptr %11, align 4, !tbaa !5
  %205 = icmp sle i32 1, %204
  br i1 %205, label %206, label %210

206:                                              ; preds = %203
  %207 = load i32, ptr %11, align 4, !tbaa !5
  %208 = load i32, ptr @n, align 4, !tbaa !5
  %209 = icmp sle i32 %207, %208
  br label %210

210:                                              ; preds = %206, %203, %200, %197, %195
  %211 = phi i1 [ false, %203 ], [ false, %200 ], [ false, %197 ], [ false, %195 ], [ %209, %206 ]
  br i1 %211, label %212, label %213

212:                                              ; preds = %210
  br label %223

213:                                              ; preds = %210
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.2, i32 noundef 39, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

214:                                              ; preds = %185
  %215 = landingpad { ptr, i32 }
          cleanup
  %216 = extractvalue { ptr, i32 } %215, 0
  store ptr %216, ptr %8, align 8
  %217 = extractvalue { ptr, i32 } %215, 1
  store i32 %217, ptr %9, align 4
  br label %464

218:                                              ; preds = %193
  %219 = landingpad { ptr, i32 }
          cleanup
  %220 = extractvalue { ptr, i32 } %219, 0
  store ptr %220, ptr %8, align 8
  %221 = extractvalue { ptr, i32 } %219, 1
  store i32 %221, ptr %9, align 4
  br label %459

222:                                              ; No predecessors!
  br label %223

223:                                              ; preds = %222, %212
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %224 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %225 unwind label %235

225:                                              ; preds = %223
  store i64 %224, ptr %12, align 4
  %226 = invoke noundef i64 @_ZNKSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(8) %12)
          to label %227 unwind label %235

227:                                              ; preds = %225
  %228 = icmp ne i64 %226, 0
  br i1 %228, label %229, label %239

229:                                              ; preds = %227
  %230 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(8) %12)
          to label %231 unwind label %235

231:                                              ; preds = %229
  %232 = load i32, ptr %230, align 4, !tbaa !5
  %233 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.9, i32 noundef %232)
          to label %234 unwind label %235

234:                                              ; preds = %231
  store i32 14, ptr %3, align 4
  br label %450, !llvm.loop !16

235:                                              ; preds = %231, %229, %225, %223
  %236 = landingpad { ptr, i32 }
          cleanup
  %237 = extractvalue { ptr, i32 } %236, 0
  store ptr %237, ptr %8, align 8
  %238 = extractvalue { ptr, i32 } %236, 1
  store i32 %238, ptr %9, align 4
  br label %458

239:                                              ; preds = %227
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %240 = load i32, ptr @tot, align 4, !tbaa !5
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds i32, ptr @que, i64 %241
  %243 = getelementptr inbounds i32, ptr %242, i64 1
  %244 = invoke noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef getelementptr inbounds (i32, ptr @que, i64 1), ptr noundef %243, ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %245 unwind label %351

245:                                              ; preds = %239
  %246 = ptrtoint ptr %244 to i64
  %247 = sub i64 %246, ptrtoint (ptr @que to i64)
  %248 = sdiv exact i64 %247, 4
  %249 = trunc i64 %248 to i32
  store i32 %249, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 0, ptr %14, align 4, !tbaa !5
  %250 = load i32, ptr %13, align 4, !tbaa !5
  %251 = load i32, ptr @tot, align 4, !tbaa !5
  %252 = icmp sle i32 %250, %251
  br i1 %252, label %253, label %441

253:                                              ; preds = %245
  %254 = load i32, ptr %13, align 4, !tbaa !5
  %255 = sext i32 %254 to i64
  %256 = getelementptr inbounds [100001 x i32], ptr @que, i64 0, i64 %255
  %257 = load i32, ptr %256, align 4, !tbaa !5
  %258 = load i32, ptr %10, align 4, !tbaa !5
  %259 = icmp eq i32 %257, %258
  br i1 %259, label %260, label %441

260:                                              ; preds = %253
  %261 = load i32, ptr %11, align 4, !tbaa !5
  %262 = load i32, ptr %13, align 4, !tbaa !5
  %263 = sext i32 %262 to i64
  %264 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %263
  %265 = load i32, ptr %264, align 4, !tbaa !5
  %266 = icmp sle i32 %261, %265
  br i1 %266, label %267, label %441

267:                                              ; preds = %260
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %268

268:                                              ; preds = %439, %267
  br label %269

269:                                              ; preds = %268
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %270 = load i32, ptr %16, align 4, !tbaa !5
  %271 = load i32, ptr %11, align 4, !tbaa !5
  %272 = add nsw i32 %270, %271
  %273 = load i32, ptr %13, align 4, !tbaa !5
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %274
  %276 = load i32, ptr %275, align 4, !tbaa !5
  %277 = icmp sle i32 %272, %276
  br i1 %277, label %278, label %292

278:                                              ; preds = %269
  %279 = load i32, ptr %13, align 4, !tbaa !5
  %280 = sext i32 %279 to i64
  %281 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %280
  %282 = load i32, ptr %281, align 4, !tbaa !5
  %283 = load i32, ptr %16, align 4, !tbaa !5
  %284 = add nsw i32 %282, %283
  %285 = load i32, ptr %11, align 4, !tbaa !5
  %286 = add nsw i32 %284, %285
  %287 = sub nsw i32 %286, 1
  %288 = sext i32 %287 to i64
  %289 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %288
  %290 = getelementptr inbounds %"struct.std::pair", ptr %289, i32 0, i32 1
  %291 = load i32, ptr %290, align 4, !tbaa !11
  br label %295

292:                                              ; preds = %269
  %293 = load i32, ptr @n, align 4, !tbaa !5
  %294 = add nsw i32 %293, 1
  br label %295

295:                                              ; preds = %292, %278
  %296 = phi i32 [ %291, %278 ], [ %294, %292 ]
  store i32 %296, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  %297 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %297, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  %298 = load i32, ptr %16, align 4, !tbaa !5
  %299 = load i32, ptr %11, align 4, !tbaa !5
  %300 = add nsw i32 %298, %299
  store i32 %300, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  %301 = load i32, ptr %13, align 4, !tbaa !5
  %302 = sext i32 %301 to i64
  %303 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %302
  %304 = load i32, ptr %303, align 4, !tbaa !5
  store i32 %304, ptr %20, align 4, !tbaa !5
  br label %305

305:                                              ; preds = %357, %295
  %306 = load i32, ptr %19, align 4, !tbaa !5
  %307 = load i32, ptr %20, align 4, !tbaa !5
  %308 = icmp slt i32 %306, %307
  br i1 %308, label %309, label %358

309:                                              ; preds = %305
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  %310 = load i32, ptr %19, align 4, !tbaa !5
  %311 = load i32, ptr %20, align 4, !tbaa !5
  %312 = add nsw i32 %310, %311
  %313 = ashr i32 %312, 1
  store i32 %313, ptr %21, align 4, !tbaa !5
  %314 = load i32, ptr %13, align 4, !tbaa !5
  %315 = sext i32 %314 to i64
  %316 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %315
  %317 = load i32, ptr %316, align 4, !tbaa !5
  %318 = load i32, ptr %21, align 4, !tbaa !5
  %319 = add nsw i32 %317, %318
  %320 = sub nsw i32 %319, 1
  %321 = sext i32 %320 to i64
  %322 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %321
  %323 = getelementptr inbounds %"struct.std::pair", ptr %322, i32 0, i32 1
  %324 = load i32, ptr %323, align 4, !tbaa !11
  %325 = load i32, ptr %16, align 4, !tbaa !5
  %326 = icmp ne i32 %325, 0
  br i1 %326, label %327, label %339

327:                                              ; preds = %309
  %328 = load i32, ptr %13, align 4, !tbaa !5
  %329 = sext i32 %328 to i64
  %330 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %329
  %331 = load i32, ptr %330, align 4, !tbaa !5
  %332 = load i32, ptr %16, align 4, !tbaa !5
  %333 = add nsw i32 %331, %332
  %334 = sub nsw i32 %333, 1
  %335 = sext i32 %334 to i64
  %336 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %335
  %337 = getelementptr inbounds %"struct.std::pair", ptr %336, i32 0, i32 1
  %338 = load i32, ptr %337, align 4, !tbaa !11
  br label %340

339:                                              ; preds = %309
  br label %340

340:                                              ; preds = %339, %327
  %341 = phi i32 [ %338, %327 ], [ 0, %339 ]
  %342 = sub nsw i32 %324, %341
  %343 = load i32, ptr %11, align 4, !tbaa !5
  %344 = sext i32 %343 to i64
  %345 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %344
  %346 = load i32, ptr %345, align 4, !tbaa !5
  %347 = icmp slt i32 %342, %346
  br i1 %347, label %348, label %355

348:                                              ; preds = %340
  %349 = load i32, ptr %21, align 4, !tbaa !5
  %350 = add nsw i32 %349, 1
  store i32 %350, ptr %19, align 4, !tbaa !5
  br label %357

351:                                              ; preds = %239
  %352 = landingpad { ptr, i32 }
          cleanup
  %353 = extractvalue { ptr, i32 } %352, 0
  store ptr %353, ptr %8, align 8
  %354 = extractvalue { ptr, i32 } %352, 1
  store i32 %354, ptr %9, align 4
  br label %457

355:                                              ; preds = %340
  %356 = load i32, ptr %21, align 4, !tbaa !5
  store i32 %356, ptr %20, align 4, !tbaa !5
  br label %357

357:                                              ; preds = %355, %348
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  br label %305, !llvm.loop !17

358:                                              ; preds = %305
  %359 = load i32, ptr %19, align 4, !tbaa !5
  %360 = load i32, ptr %13, align 4, !tbaa !5
  %361 = sext i32 %360 to i64
  %362 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %361
  %363 = load i32, ptr %362, align 4, !tbaa !5
  %364 = icmp sle i32 %359, %363
  br i1 %364, label %365, label %415

365:                                              ; preds = %358
  %366 = load i32, ptr %13, align 4, !tbaa !5
  %367 = sext i32 %366 to i64
  %368 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %367
  %369 = load i32, ptr %368, align 4, !tbaa !5
  %370 = load i32, ptr %19, align 4, !tbaa !5
  %371 = add nsw i32 %369, %370
  %372 = sub nsw i32 %371, 1
  %373 = sext i32 %372 to i64
  %374 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %373
  %375 = getelementptr inbounds %"struct.std::pair", ptr %374, i32 0, i32 1
  %376 = load i32, ptr %375, align 4, !tbaa !11
  %377 = load i32, ptr %16, align 4, !tbaa !5
  %378 = icmp ne i32 %377, 0
  br i1 %378, label %379, label %391

379:                                              ; preds = %365
  %380 = load i32, ptr %13, align 4, !tbaa !5
  %381 = sext i32 %380 to i64
  %382 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %381
  %383 = load i32, ptr %382, align 4, !tbaa !5
  %384 = load i32, ptr %16, align 4, !tbaa !5
  %385 = add nsw i32 %383, %384
  %386 = sub nsw i32 %385, 1
  %387 = sext i32 %386 to i64
  %388 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %387
  %389 = getelementptr inbounds %"struct.std::pair", ptr %388, i32 0, i32 1
  %390 = load i32, ptr %389, align 4, !tbaa !11
  br label %392

391:                                              ; preds = %365
  br label %392

392:                                              ; preds = %391, %379
  %393 = phi i32 [ %390, %379 ], [ 0, %391 ]
  %394 = sub nsw i32 %376, %393
  %395 = load i32, ptr %11, align 4, !tbaa !5
  %396 = sext i32 %395 to i64
  %397 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %396
  %398 = load i32, ptr %397, align 4, !tbaa !5
  %399 = icmp sge i32 %394, %398
  br i1 %399, label %400, label %415

400:                                              ; preds = %392
  %401 = load i32, ptr %13, align 4, !tbaa !5
  %402 = sext i32 %401 to i64
  %403 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %402
  %404 = load i32, ptr %403, align 4, !tbaa !5
  %405 = load i32, ptr %19, align 4, !tbaa !5
  %406 = add nsw i32 %404, %405
  %407 = sub nsw i32 %406, 1
  %408 = sext i32 %407 to i64
  %409 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %408
  %410 = getelementptr inbounds %"struct.std::pair", ptr %409, i32 0, i32 1
  %411 = load i32, ptr %410, align 4, !tbaa !11
  store i32 %411, ptr %17, align 4, !tbaa !5
  %412 = load i32, ptr %19, align 4, !tbaa !5
  %413 = load i32, ptr %16, align 4, !tbaa !5
  %414 = sub nsw i32 %412, %413
  store i32 %414, ptr %18, align 4, !tbaa !5
  br label %418

415:                                              ; preds = %392, %358
  %416 = load i32, ptr @n, align 4, !tbaa !5
  %417 = add nsw i32 %416, 1
  store i32 %417, ptr %17, align 4, !tbaa !5
  br label %418

418:                                              ; preds = %415, %400
  %419 = load i32, ptr %17, align 4, !tbaa !5
  %420 = load i32, ptr @n, align 4, !tbaa !5
  %421 = icmp sgt i32 %419, %420
  br i1 %421, label %422, label %430

422:                                              ; preds = %418
  %423 = load i32, ptr %15, align 4, !tbaa !5
  %424 = load i32, ptr @n, align 4, !tbaa !5
  %425 = icmp slt i32 %423, %424
  br i1 %425, label %426, label %429

426:                                              ; preds = %422
  %427 = load i32, ptr %14, align 4, !tbaa !5
  %428 = add nsw i32 %427, 1
  store i32 %428, ptr %14, align 4, !tbaa !5
  br label %429

429:                                              ; preds = %426, %422
  store i32 17, ptr %3, align 4
  br label %437

430:                                              ; preds = %418
  %431 = load i32, ptr %17, align 4, !tbaa !5
  store i32 %431, ptr %15, align 4, !tbaa !5
  %432 = load i32, ptr %18, align 4, !tbaa !5
  %433 = load i32, ptr %16, align 4, !tbaa !5
  %434 = add nsw i32 %433, %432
  store i32 %434, ptr %16, align 4, !tbaa !5
  %435 = load i32, ptr %14, align 4, !tbaa !5
  %436 = add nsw i32 %435, 1
  store i32 %436, ptr %14, align 4, !tbaa !5
  store i32 0, ptr %3, align 4
  br label %437

437:                                              ; preds = %430, %429
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  %438 = load i32, ptr %3, align 4
  switch i32 %438, label %471 [
    i32 0, label %439
    i32 17, label %440
  ]

439:                                              ; preds = %437
  br label %268, !llvm.loop !18

440:                                              ; preds = %437
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %444

441:                                              ; preds = %260, %253, %245
  %442 = load i32, ptr %14, align 4, !tbaa !5
  %443 = add nsw i32 %442, 1
  store i32 %443, ptr %14, align 4, !tbaa !5
  br label %444

444:                                              ; preds = %441, %440
  %445 = load i32, ptr %14, align 4, !tbaa !5
  %446 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(8) %12)
          to label %447 unwind label %453

447:                                              ; preds = %444
  store i32 %445, ptr %446, align 4, !tbaa !5
  %448 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.9, i32 noundef %445)
          to label %449 unwind label %453

449:                                              ; preds = %447
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  store i32 0, ptr %3, align 4
  br label %450

450:                                              ; preds = %449, %234
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  %451 = load i32, ptr %3, align 4
  switch i32 %451, label %471 [
    i32 0, label %452
    i32 14, label %189
  ]

452:                                              ; preds = %450
  br label %189, !llvm.loop !16

453:                                              ; preds = %447, %444
  %454 = landingpad { ptr, i32 }
          cleanup
  %455 = extractvalue { ptr, i32 } %454, 0
  store ptr %455, ptr %8, align 8
  %456 = extractvalue { ptr, i32 } %454, 1
  store i32 %456, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %457

457:                                              ; preds = %453, %351
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %458

458:                                              ; preds = %457, %235
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %459

459:                                              ; preds = %458, %218
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %464

460:                                              ; preds = %189
  call void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %7) #8
  br label %461

461:                                              ; preds = %460
  %462 = load i32, ptr %2, align 4, !tbaa !5
  %463 = add nsw i32 %462, 1
  store i32 %463, ptr %2, align 4, !tbaa !5
  br label %36, !llvm.loop !19

464:                                              ; preds = %459, %214
  call void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %466

465:                                              ; preds = %40
  ret i32 0

466:                                              ; preds = %464
  %467 = load ptr, ptr %8, align 8
  %468 = load i32, ptr %9, align 4
  %469 = insertvalue { ptr, i32 } poison, ptr %467, 0
  %470 = insertvalue { ptr, i32 } %469, i32 %468, 1
  resume { ptr, i32 } %470

471:                                              ; preds = %450, %437
  unreachable
}

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #5 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__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 uwtable
declare dso_local noundef i64 @_ZNKSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) #6 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #5 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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = { 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 = { noreturn nounwind }
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 0}
!10 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}


; 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 }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@b = external dso_local global [100001 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@que = external dso_local global [100001 x i32], align 16
@fir = external dso_local local_unnamed_addr global [100001 x i32], align 16
@sz = external dso_local local_unnamed_addr global [100001 x i32], align 16
@a = external dso_local global [100001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [66 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.9 = 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 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::map", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %6 = icmp eq i32 %5, 1
  %7 = load i32, ptr @t, align 4
  %8 = add i32 %7, -1
  %9 = icmp ult i32 %8, 20
  %or.cond23 = select i1 %6, i1 %9, i1 false
  br i1 %or.cond23, label %.lr.ph172, label %.critedge

.critedge:                                        ; preds = %0
  tail call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 11, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

._crit_edge173:                                   ; preds = %._crit_edge168
  ret i32 0

.lr.ph172:                                        ; preds = %0, %._crit_edge168
  %.0171 = phi i32 [ %170, %._crit_edge168 ], [ 1, %0 ]
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @n, ptr noundef nonnull @q)
  %11 = icmp eq i32 %10, 2
  %12 = load i32, ptr @n, align 4
  %13 = add i32 %12, -1
  %14 = icmp ult i32 %13, 100000
  %or.cond5 = select i1 %11, i1 %14, i1 false
  %15 = load i32, ptr @q, align 4
  %16 = add i32 %15, -1
  %17 = icmp ult i32 %16, 100000
  %or.cond25 = select i1 %or.cond5, i1 %17, i1 false
  br i1 %or.cond25, label %.lr.ph, label %.critedge9

.critedge9:                                       ; preds = %.lr.ph172
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.2, i32 noundef 14, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

._crit_edge:                                      ; preds = %26
  %gep169 = getelementptr %"struct.std::pair", ptr getelementptr inbounds (i8, ptr @a, i64 8), i64 %30
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 8), ptr noundef nonnull %gep169)
  store i32 0, ptr @tot, align 4, !tbaa !5
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %.not115151 = icmp slt i32 %18, 1
  br i1 %.not115151, label %._crit_edge158, label %.lr.ph154.preheader

.lr.ph154.preheader:                              ; preds = %._crit_edge
  %19 = add nuw i32 %18, 1
  %wide.trip.count = zext i32 %19 to i64
  %.pre = load i32, ptr @a, align 16, !tbaa !9
  br label %.lr.ph154

.lr.ph:                                           ; preds = %.lr.ph172, %26
  %indvars.iv = phi i64 [ %indvars.iv.next, %26 ], [ 1, %.lr.ph172 ]
  %20 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %indvars.iv
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %20)
  %22 = icmp eq i32 %21, 1
  br i1 %22, label %23, label %.critedge11

23:                                               ; preds = %.lr.ph
  %24 = load i32, ptr %20, align 8, !tbaa !9
  %25 = add i32 %24, -1
  %or.cond = icmp ult i32 %25, 1000000000
  br i1 %or.cond, label %26, label %.critedge11

.critedge11:                                      ; preds = %23, %.lr.ph
  call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.2, i32 noundef 17, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

26:                                               ; preds = %23
  %27 = getelementptr inbounds i8, ptr %20, i64 4
  %28 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %28, ptr %27, align 4, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %.not114.not = icmp slt i64 %indvars.iv, %30
  br i1 %.not114.not, label %.lr.ph, label %._crit_edge, !llvm.loop !12

.preheader144:                                    ; preds = %42
  br i1 %.not115151, label %._crit_edge158, label %.lr.ph157

.lr.ph154:                                        ; preds = %.lr.ph154.preheader, %42
  %31 = phi i32 [ %.pre, %.lr.ph154.preheader ], [ %34, %42 ]
  %indvars.iv179 = phi i64 [ 1, %.lr.ph154.preheader ], [ %indvars.iv.next180, %42 ]
  %32 = phi i32 [ 0, %.lr.ph154.preheader ], [ %44, %42 ]
  %33 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %indvars.iv179
  %34 = load i32, ptr %33, align 8, !tbaa !9
  %.not131 = icmp eq i32 %31, %34
  br i1 %.not131, label %.lr.ph154._crit_edge, label %35

.lr.ph154._crit_edge:                             ; preds = %.lr.ph154
  %.phi.trans.insert = sext i32 %32 to i64
  %.phi.trans.insert185 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %.phi.trans.insert
  %.pre186 = load i32, ptr %.phi.trans.insert185, align 4, !tbaa !5
  br label %42

35:                                               ; preds = %.lr.ph154
  %36 = add nsw i32 %32, 1
  store i32 %36, ptr @tot, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [100001 x i32], ptr @que, i64 0, i64 %37
  store i32 %34, ptr %38, align 4, !tbaa !5
  %39 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %37
  %40 = trunc nuw nsw i64 %indvars.iv179 to i32
  store i32 %40, ptr %39, align 4, !tbaa !5
  %41 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %37
  store i32 0, ptr %41, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %.lr.ph154._crit_edge, %35
  %.pre-phi = phi i64 [ %.phi.trans.insert, %.lr.ph154._crit_edge ], [ %37, %35 ]
  %43 = phi i32 [ %.pre186, %.lr.ph154._crit_edge ], [ 0, %35 ]
  %44 = phi i32 [ %32, %.lr.ph154._crit_edge ], [ %36, %35 ]
  %45 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %.pre-phi
  %46 = add nsw i32 %43, 1
  store i32 %46, ptr %45, align 4, !tbaa !5
  %indvars.iv.next180 = add nuw nsw i64 %indvars.iv179, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next180, %wide.trip.count
  br i1 %exitcond.not, label %.preheader144, label %.lr.ph154, !llvm.loop !14

47:                                               ; preds = %55
  %indvars.iv.next183 = add nuw nsw i64 %indvars.iv182, 1
  %48 = sext i32 %58 to i64
  %.not116.not = icmp slt i64 %indvars.iv182, %48
  br i1 %.not116.not, label %.lr.ph157, label %._crit_edge158, !llvm.loop !15

._crit_edge158:                                   ; preds = %47, %._crit_edge, %.preheader144
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %1) #8
  call void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #8
  %49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %.0171)
  %50 = load i32, ptr @q, align 4, !tbaa !5
  %51 = add nsw i32 %50, -1
  store i32 %51, ptr @q, align 4, !tbaa !5
  %.not117165 = icmp eq i32 %50, 0
  br i1 %.not117165, label %._crit_edge168, label %.lr.ph167

.lr.ph157:                                        ; preds = %.preheader144, %47
  %indvars.iv182 = phi i64 [ %indvars.iv.next183, %47 ], [ 1, %.preheader144 ]
  %52 = getelementptr inbounds i32, ptr @b, i64 %indvars.iv182
  %53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %52)
  %54 = icmp eq i32 %53, 1
  br i1 %54, label %55, label %.critedge13

55:                                               ; preds = %.lr.ph157
  %56 = load i32, ptr %52, align 4, !tbaa !5
  %57 = icmp slt i32 %56, 1
  %58 = load i32, ptr @n, align 4
  %.not130 = icmp sgt i32 %56, %58
  %or.cond132 = select i1 %57, i1 true, i1 %.not130
  br i1 %or.cond132, label %.critedge13, label %47

.critedge13:                                      ; preds = %55, %.lr.ph157
  call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2, i32 noundef 33, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

.lr.ph167:                                        ; preds = %._crit_edge158, %163
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %59 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %60 = icmp ne i32 %59, 2
  %61 = load i32, ptr %2, align 4
  %62 = add i32 %61, -1000000001
  %63 = icmp ult i32 %62, -1000000000
  %or.cond17.not143 = select i1 %60, i1 true, i1 %63
  %64 = load i32, ptr %3, align 4
  %65 = icmp slt i32 %64, 1
  %or.cond19.not140 = select i1 %or.cond17.not143, i1 true, i1 %65
  %66 = load i32, ptr @n, align 4
  %.not118 = icmp sgt i32 %64, %66
  %or.cond133 = select i1 %or.cond19.not140, i1 true, i1 %.not118
  br i1 %or.cond133, label %.critedge21, label %67

.critedge21:                                      ; preds = %.lr.ph167
  call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.2, i32 noundef 39, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

67:                                               ; preds = %.lr.ph167
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %68 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %69 unwind label %76

69:                                               ; preds = %67
  store i64 %68, ptr %4, align 8
  %70 = invoke noundef i64 @_ZNKSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 4 dereferenceable(8) %4)
          to label %71 unwind label %76

71:                                               ; preds = %69
  %.not119 = icmp eq i64 %70, 0
  br i1 %.not119, label %78, label %72

72:                                               ; preds = %71
  %73 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 4 dereferenceable(8) %4)
          to label %74 unwind label %76

74:                                               ; preds = %72
  %75 = load i32, ptr %73, align 4, !tbaa !5
  br label %163, !llvm.loop !16

76:                                               ; preds = %72, %69, %67
  %77 = landingpad { ptr, i32 }
          cleanup
  br label %169

78:                                               ; preds = %71
  %79 = load i32, ptr @tot, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %gep = getelementptr i32, ptr getelementptr inbounds (i8, ptr @que, i64 4), i64 %80
  %81 = invoke noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @que, i64 4), ptr noundef nonnull %gep, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %82 unwind label %134

82:                                               ; preds = %78
  %83 = ptrtoint ptr %81 to i64
  %84 = sub i64 %83, ptrtoint (ptr @que to i64)
  %85 = lshr exact i64 %84, 2
  %86 = trunc i64 %85 to i32
  %87 = load i32, ptr @tot, align 4, !tbaa !5
  %.not120 = icmp slt i32 %87, %86
  br i1 %.not120, label %160, label %88

88:                                               ; preds = %82
  %sext = shl i64 %84, 30
  %89 = ashr i64 %sext, 32
  %90 = getelementptr inbounds [100001 x i32], ptr @que, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = load i32, ptr %2, align 4, !tbaa !5
  %93 = icmp eq i32 %91, %92
  br i1 %93, label %94, label %160

94:                                               ; preds = %88
  %95 = load i32, ptr %3, align 4, !tbaa !5
  %96 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %89
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %.not121 = icmp sgt i32 %95, %97
  br i1 %.not121, label %160, label %.preheader

.preheader:                                       ; preds = %94
  %98 = load i32, ptr @n, align 4
  %99 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %89
  %100 = sext i32 %95 to i64
  %101 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %100
  %102 = add nsw i32 %98, 1
  br label %103

103:                                              ; preds = %.preheader, %156
  %.097 = phi i32 [ %159, %156 ], [ 0, %.preheader ]
  %.095 = phi i32 [ %spec.select174, %156 ], [ 0, %.preheader ]
  %.093 = phi i32 [ %158, %156 ], [ 0, %.preheader ]
  %104 = add nsw i32 %.093, %95
  %105 = icmp slt i32 %104, %97
  br i1 %105, label %.lr.ph162, label %._crit_edge163

.lr.ph162:                                        ; preds = %103
  %106 = load i32, ptr %99, align 4, !tbaa !5
  %107 = add i32 %106, -1
  %.not127 = icmp eq i32 %.093, 0
  %108 = load i32, ptr %101, align 4, !tbaa !5
  br i1 %.not127, label %.lr.ph162.split.us, label %.lr.ph162.split

.lr.ph162.split.us:                               ; preds = %.lr.ph162, %.lr.ph162.split.us
  %.088160.us = phi i32 [ %.1.us, %.lr.ph162.split.us ], [ %97, %.lr.ph162 ]
  %.089159.us = phi i32 [ %.190.us, %.lr.ph162.split.us ], [ %104, %.lr.ph162 ]
  %109 = add nsw i32 %.088160.us, %.089159.us
  %110 = ashr i32 %109, 1
  %111 = add i32 %107, %110
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %112, i32 1
  %114 = load i32, ptr %113, align 4, !tbaa !11
  %115 = icmp slt i32 %114, %108
  %116 = add nsw i32 %110, 1
  %.190.us = select i1 %115, i32 %116, i32 %.089159.us
  %.1.us = select i1 %115, i32 %.088160.us, i32 %110
  %117 = icmp slt i32 %.190.us, %.1.us
  br i1 %117, label %.lr.ph162.split.us, label %._crit_edge163, !llvm.loop !17

.lr.ph162.split:                                  ; preds = %.lr.ph162
  %118 = add i32 %.093, -1
  %119 = add i32 %118, %106
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %120, i32 1
  %122 = load i32, ptr %121, align 4, !tbaa !11
  br label %123

123:                                              ; preds = %.lr.ph162.split, %123
  %.088160 = phi i32 [ %97, %.lr.ph162.split ], [ %.1, %123 ]
  %.089159 = phi i32 [ %104, %.lr.ph162.split ], [ %.190, %123 ]
  %124 = add nsw i32 %.088160, %.089159
  %125 = ashr i32 %124, 1
  %126 = add i32 %107, %125
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %127, i32 1
  %129 = load i32, ptr %128, align 4, !tbaa !11
  %130 = sub nsw i32 %129, %122
  %131 = icmp slt i32 %130, %108
  %132 = add nsw i32 %125, 1
  %.190 = select i1 %131, i32 %132, i32 %.089159
  %.1 = select i1 %131, i32 %.088160, i32 %125
  %133 = icmp slt i32 %.190, %.1
  br i1 %133, label %123, label %._crit_edge163, !llvm.loop !17

134:                                              ; preds = %78
  %135 = landingpad { ptr, i32 }
          cleanup
  br label %169

._crit_edge163:                                   ; preds = %123, %.lr.ph162.split.us, %103
  %.089.lcssa = phi i32 [ %104, %103 ], [ %.190.us, %.lr.ph162.split.us ], [ %.190, %123 ]
  %.not123 = icmp sgt i32 %.089.lcssa, %97
  br i1 %.not123, label %.thread, label %136

136:                                              ; preds = %._crit_edge163
  %137 = load i32, ptr %99, align 4, !tbaa !5
  %138 = add i32 %.089.lcssa, -1
  %139 = add i32 %138, %137
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %140, i32 1
  %142 = load i32, ptr %141, align 4, !tbaa !11
  %.not124 = icmp eq i32 %.093, 0
  br i1 %.not124, label %149, label %143

143:                                              ; preds = %136
  %144 = add i32 %.093, -1
  %145 = add i32 %144, %137
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %146, i32 1
  %148 = load i32, ptr %147, align 4, !tbaa !11
  br label %149

149:                                              ; preds = %143, %136
  %150 = phi i32 [ %148, %143 ], [ 0, %136 ]
  %151 = sub nsw i32 %142, %150
  %152 = load i32, ptr %101, align 4, !tbaa !5
  %.not125 = icmp slt i32 %151, %152
  %spec.select174 = select i1 %.not125, i32 %102, i32 %142
  %153 = icmp sgt i32 %spec.select174, %98
  br i1 %153, label %.thread, label %156

.thread:                                          ; preds = %._crit_edge163, %149
  %154 = icmp slt i32 %.095, %98
  %155 = zext i1 %154 to i32
  %spec.select = add nuw nsw i32 %.097, %155
  br label %160

156:                                              ; preds = %149
  %157 = sub nsw i32 %.089.lcssa, %.093
  %spec.select175 = select i1 %.not125, i32 %95, i32 %157
  %158 = add nsw i32 %spec.select175, %.093
  %159 = add nuw nsw i32 %.097, 1
  br label %103

160:                                              ; preds = %.thread, %82, %88, %94
  %.3 = phi i32 [ 1, %94 ], [ 1, %88 ], [ 1, %82 ], [ %spec.select, %.thread ]
  %161 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 4 dereferenceable(8) %4)
          to label %162 unwind label %167

162:                                              ; preds = %160
  store i32 %.3, ptr %161, align 4, !tbaa !5
  br label %163

163:                                              ; preds = %162, %74
  %.3.sink = phi i32 [ %.3, %162 ], [ %75, %74 ]
  %164 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef %.3.sink)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  %165 = load i32, ptr @q, align 4, !tbaa !5
  %166 = add nsw i32 %165, -1
  store i32 %166, ptr @q, align 4, !tbaa !5
  %.not117 = icmp eq i32 %165, 0
  br i1 %.not117, label %._crit_edge168, label %.lr.ph167

167:                                              ; preds = %160
  %168 = landingpad { ptr, i32 }
          cleanup
  br label %169

169:                                              ; preds = %134, %167, %76
  %.pn128 = phi { ptr, i32 } [ %77, %76 ], [ %168, %167 ], [ %135, %134 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #8
  resume { ptr, i32 } %.pn128

._crit_edge168:                                   ; preds = %163, %._crit_edge158
  call void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #8
  %170 = add nuw nsw i32 %.0171, 1
  %171 = load i32, ptr @t, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.0171, %171
  br i1 %.not.not, label %.lr.ph172, label %._crit_edge173, !llvm.loop !18
}

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #5 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__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 uwtable
declare dso_local noundef i64 @_ZNKSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #6 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #5 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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = { 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 = { noreturn nounwind }
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 0}
!10 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}


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