; LLVM IR from tangjz/acm-icpc :: hdu (5683)

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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [20000 x i32], align 16
@b = external dso_local global [20000 x i32], align 16
@qx = external dso_local global [20000 x i32], align 16
@qy = external dso_local global [20000 x i32], align 16
@ans = external dso_local global [20000 x i32], align 16
@tot = external dso_local global i32, align 4
@seq = external dso_local global [40002 x i32], align 16
@seg = external dso_local global [80004 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6updateiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %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 i32, align 4
  %12 = alloca i32, 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
  store i32 0, ptr %1, align 4
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %21

21:                                               ; preds = %491, %0
  %22 = load i32, ptr @t, align 4, !tbaa !5
  %23 = add nsw i32 %22, -1
  store i32 %23, ptr @t, align 4, !tbaa !5
  %24 = icmp ne i32 %22, 0
  br i1 %24, label %25, label %492

25:                                               ; preds = %21
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %58, %25
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %61

32:                                               ; preds = %27
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds i32, ptr @a, i64 %34
  %36 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %35)
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [20000 x i32], ptr @a, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = load i32, ptr @tot, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr @tot, align 4, !tbaa !5
  %43 = sext i32 %41 to i64
  %44 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %43
  store i32 %40, ptr %44, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %54, %32
  %46 = load i32, ptr %2, align 4, !tbaa !5
  %47 = shl i32 1, %46
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [20000 x i32], ptr @a, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = icmp sle i32 %47, %51
  br i1 %52, label %53, label %57

53:                                               ; preds = %45
  br label %54

54:                                               ; preds = %53
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %2, align 4, !tbaa !5
  br label %45, !llvm.loop !9

57:                                               ; preds = %45
  br label %58

58:                                               ; preds = %57
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %3, align 4, !tbaa !5
  br label %27, !llvm.loop !11

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

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

66:                                               ; preds = %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %104

67:                                               ; preds = %62
  %68 = load i32, ptr %4, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds i32, ptr @qx, i64 %69
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds i32, ptr @qy, i64 %72
  %74 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %70, ptr noundef %73)
  %75 = load i32, ptr %4, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [20000 x i32], ptr @qx, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = add nsw i32 %78, -1
  store i32 %79, ptr %77, align 4, !tbaa !5
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [20000 x i32], ptr @qy, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = load i32, ptr @tot, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr @tot, align 4, !tbaa !5
  %86 = sext i32 %84 to i64
  %87 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %86
  store i32 %83, ptr %87, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %97, %67
  %89 = load i32, ptr %2, align 4, !tbaa !5
  %90 = shl i32 1, %89
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [20000 x i32], ptr @qy, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = icmp sle i32 %90, %94
  br i1 %95, label %96, label %100

96:                                               ; preds = %88
  br label %97

97:                                               ; preds = %96
  %98 = load i32, ptr %2, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %2, align 4, !tbaa !5
  br label %88, !llvm.loop !12

100:                                              ; preds = %88
  br label %101

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

104:                                              ; preds = %66
  %105 = load i32, ptr @tot, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr @tot, align 4, !tbaa !5
  %107 = sext i32 %105 to i64
  %108 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %107
  store i32 0, ptr %108, align 4, !tbaa !5
  %109 = load i32, ptr %2, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  %111 = shl i32 1, %110
  %112 = sub i32 %111, 1
  %113 = load i32, ptr @tot, align 4, !tbaa !5
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr @tot, align 4, !tbaa !5
  %115 = sext i32 %113 to i64
  %116 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %115
  store i32 %112, ptr %116, align 4, !tbaa !5
  %117 = load i32, ptr @m, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = mul i64 %118, 4
  call void @llvm.memset.p0.i64(ptr align 16 @ans, i8 0, i64 %119, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %120 = load i32, ptr %2, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  %122 = shl i32 1, %121
  %123 = sub i32 %122, 1
  store i32 %123, ptr %5, align 4, !tbaa !5
  br label %124

124:                                              ; preds = %471, %104
  %125 = load i32, ptr %2, align 4, !tbaa !5
  %126 = icmp sge i32 %125, 0
  br i1 %126, label %128, label %127

127:                                              ; preds = %124
  store i32 16, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %476

128:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %129

129:                                              ; preds = %144, %128
  %130 = load i32, ptr %7, align 4, !tbaa !5
  %131 = load i32, ptr @n, align 4, !tbaa !5
  %132 = icmp slt i32 %130, %131
  br i1 %132, label %134, label %133

133:                                              ; preds = %129
  store i32 19, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %147

134:                                              ; preds = %129
  %135 = load i32, ptr %7, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [20000 x i32], ptr @a, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = load i32, ptr %5, align 4, !tbaa !5
  %140 = and i32 %138, %139
  %141 = load i32, ptr %7, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %142
  store i32 %140, ptr %143, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %134
  %145 = load i32, ptr %7, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %7, align 4, !tbaa !5
  br label %129, !llvm.loop !14

147:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %148

148:                                              ; preds = %163, %147
  %149 = load i32, ptr %8, align 4, !tbaa !5
  %150 = load i32, ptr @m, align 4, !tbaa !5
  %151 = icmp slt i32 %149, %150
  br i1 %151, label %153, label %152

152:                                              ; preds = %148
  store i32 22, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %166

153:                                              ; preds = %148
  %154 = load i32, ptr %8, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [20000 x i32], ptr @qy, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !5
  %158 = load i32, ptr %5, align 4, !tbaa !5
  %159 = and i32 %157, %158
  %160 = load i32, ptr %8, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [20000 x i32], ptr @qy, i64 0, i64 %161
  store i32 %159, ptr %162, align 4, !tbaa !5
  br label %163

163:                                              ; preds = %153
  %164 = load i32, ptr %8, align 4, !tbaa !5
  %165 = add nsw i32 %164, 1
  store i32 %165, ptr %8, align 4, !tbaa !5
  br label %148, !llvm.loop !15

166:                                              ; preds = %152
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %167

167:                                              ; preds = %182, %166
  %168 = load i32, ptr %9, align 4, !tbaa !5
  %169 = load i32, ptr @tot, align 4, !tbaa !5
  %170 = icmp slt i32 %168, %169
  br i1 %170, label %172, label %171

171:                                              ; preds = %167
  store i32 25, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %185

172:                                              ; preds = %167
  %173 = load i32, ptr %9, align 4, !tbaa !5
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %174
  %176 = load i32, ptr %175, align 4, !tbaa !5
  %177 = load i32, ptr %5, align 4, !tbaa !5
  %178 = and i32 %176, %177
  %179 = load i32, ptr %9, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %180
  store i32 %178, ptr %181, align 4, !tbaa !5
  br label %182

182:                                              ; preds = %172
  %183 = load i32, ptr %9, align 4, !tbaa !5
  %184 = add nsw i32 %183, 1
  store i32 %184, ptr %9, align 4, !tbaa !5
  br label %167, !llvm.loop !16

185:                                              ; preds = %171
  %186 = load i32, ptr @tot, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds i32, ptr @seq, i64 %187
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @seq, ptr noundef %188)
  %189 = load i32, ptr @tot, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds i32, ptr @seq, i64 %190
  %192 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef @seq, ptr noundef %191)
  %193 = ptrtoint ptr %192 to i64
  %194 = sub i64 %193, ptrtoint (ptr @seq to i64)
  %195 = sdiv exact i64 %194, 4
  %196 = trunc i64 %195 to i32
  store i32 %196, ptr @tot, align 4, !tbaa !5
  %197 = load i32, ptr @tot, align 4, !tbaa !5
  %198 = shl i32 %197, 1
  %199 = sext i32 %198 to i64
  %200 = mul i64 %199, 4
  call void @llvm.memset.p0.i64(ptr align 16 @seg, i8 0, i64 %200, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %201

201:                                              ; preds = %273, %185
  %202 = load i32, ptr %11, align 4, !tbaa !5
  %203 = load i32, ptr @n, align 4, !tbaa !5
  %204 = icmp slt i32 %202, %203
  br i1 %204, label %206, label %205

205:                                              ; preds = %201
  store i32 28, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %276

206:                                              ; preds = %201
  %207 = load i32, ptr @tot, align 4, !tbaa !5
  %208 = sub nsw i32 %207, 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %209 = load i32, ptr %2, align 4, !tbaa !5
  %210 = shl i32 1, %209
  %211 = load i32, ptr %11, align 4, !tbaa !5
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %212
  %214 = load i32, ptr %213, align 4, !tbaa !5
  %215 = sub nsw i32 %210, %214
  store i32 %215, ptr %13, align 4, !tbaa !5
  %216 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %217 = load i32, ptr %216, align 4, !tbaa !5
  %218 = load i32, ptr %5, align 4, !tbaa !5
  %219 = load i32, ptr %11, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %220
  %222 = load i32, ptr %221, align 4, !tbaa !5
  %223 = sub nsw i32 %218, %222
  %224 = call noundef i32 @_Z5queryiiii(i32 noundef 0, i32 noundef %208, i32 noundef %217, i32 noundef %223)
  %225 = load i32, ptr %10, align 4, !tbaa !5
  %226 = add nsw i32 %225, %224
  store i32 %226, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  %227 = load i32, ptr %2, align 4, !tbaa !5
  %228 = add nsw i32 %227, 1
  %229 = shl i32 1, %228
  %230 = load i32, ptr %11, align 4, !tbaa !5
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %231
  %233 = load i32, ptr %232, align 4, !tbaa !5
  %234 = sub i32 %229, %233
  %235 = load i32, ptr %2, align 4, !tbaa !5
  %236 = shl i32 1, %235
  %237 = add i32 %234, %236
  %238 = load i32, ptr @tot, align 4, !tbaa !5
  %239 = sub nsw i32 %238, 1
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %240
  %242 = load i32, ptr %241, align 4, !tbaa !5
  %243 = icmp ule i32 %237, %242
  br i1 %243, label %244, label %266

244:                                              ; preds = %206
  %245 = load i32, ptr @tot, align 4, !tbaa !5
  %246 = sub nsw i32 %245, 1
  %247 = load i32, ptr %2, align 4, !tbaa !5
  %248 = add nsw i32 %247, 1
  %249 = shl i32 1, %248
  %250 = load i32, ptr %11, align 4, !tbaa !5
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %251
  %253 = load i32, ptr %252, align 4, !tbaa !5
  %254 = sub i32 %249, %253
  %255 = load i32, ptr %2, align 4, !tbaa !5
  %256 = shl i32 1, %255
  %257 = add i32 %254, %256
  %258 = load i32, ptr @tot, align 4, !tbaa !5
  %259 = sub nsw i32 %258, 1
  %260 = sext i32 %259 to i64
  %261 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %260
  %262 = load i32, ptr %261, align 4, !tbaa !5
  %263 = call noundef i32 @_Z5queryiiii(i32 noundef 0, i32 noundef %246, i32 noundef %257, i32 noundef %262)
  %264 = load i32, ptr %10, align 4, !tbaa !5
  %265 = add nsw i32 %264, %263
  store i32 %265, ptr %10, align 4, !tbaa !5
  br label %266

266:                                              ; preds = %244, %206
  %267 = load i32, ptr @tot, align 4, !tbaa !5
  %268 = sub nsw i32 %267, 1
  %269 = load i32, ptr %11, align 4, !tbaa !5
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %270
  %272 = load i32, ptr %271, align 4, !tbaa !5
  call void @_Z6updateiiii(i32 noundef 0, i32 noundef %268, i32 noundef %272, i32 noundef 1)
  br label %273

273:                                              ; preds = %266
  %274 = load i32, ptr %11, align 4, !tbaa !5
  %275 = add nsw i32 %274, 1
  store i32 %275, ptr %11, align 4, !tbaa !5
  br label %201, !llvm.loop !17

276:                                              ; preds = %205
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %277

277:                                              ; preds = %467, %276
  %278 = load i32, ptr %14, align 4, !tbaa !5
  %279 = load i32, ptr @m, align 4, !tbaa !5
  %280 = icmp slt i32 %278, %279
  br i1 %280, label %282, label %281

281:                                              ; preds = %277
  store i32 31, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %470

282:                                              ; preds = %277
  %283 = load i32, ptr @tot, align 4, !tbaa !5
  %284 = sub nsw i32 %283, 1
  %285 = load i32, ptr %14, align 4, !tbaa !5
  %286 = sext i32 %285 to i64
  %287 = getelementptr inbounds [20000 x i32], ptr @qx, i64 0, i64 %286
  %288 = load i32, ptr %287, align 4, !tbaa !5
  %289 = sext i32 %288 to i64
  %290 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %289
  %291 = load i32, ptr %290, align 4, !tbaa !5
  call void @_Z6updateiiii(i32 noundef 0, i32 noundef %284, i32 noundef %291, i32 noundef -1)
  %292 = load i32, ptr @tot, align 4, !tbaa !5
  %293 = sub nsw i32 %292, 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %294 = load i32, ptr %2, align 4, !tbaa !5
  %295 = shl i32 1, %294
  %296 = load i32, ptr %14, align 4, !tbaa !5
  %297 = sext i32 %296 to i64
  %298 = getelementptr inbounds [20000 x i32], ptr @qx, i64 0, i64 %297
  %299 = load i32, ptr %298, align 4, !tbaa !5
  %300 = sext i32 %299 to i64
  %301 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %300
  %302 = load i32, ptr %301, align 4, !tbaa !5
  %303 = sub nsw i32 %295, %302
  store i32 %303, ptr %16, align 4, !tbaa !5
  %304 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %305 = load i32, ptr %304, align 4, !tbaa !5
  %306 = load i32, ptr %5, align 4, !tbaa !5
  %307 = load i32, ptr %14, align 4, !tbaa !5
  %308 = sext i32 %307 to i64
  %309 = getelementptr inbounds [20000 x i32], ptr @qx, i64 0, i64 %308
  %310 = load i32, ptr %309, align 4, !tbaa !5
  %311 = sext i32 %310 to i64
  %312 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %311
  %313 = load i32, ptr %312, align 4, !tbaa !5
  %314 = sub nsw i32 %306, %313
  %315 = call noundef i32 @_Z5queryiiii(i32 noundef 0, i32 noundef %293, i32 noundef %305, i32 noundef %314)
  %316 = load i32, ptr %10, align 4, !tbaa !5
  %317 = sub nsw i32 %316, %315
  store i32 %317, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  %318 = load i32, ptr %2, align 4, !tbaa !5
  %319 = add nsw i32 %318, 1
  %320 = shl i32 1, %319
  %321 = load i32, ptr %14, align 4, !tbaa !5
  %322 = sext i32 %321 to i64
  %323 = getelementptr inbounds [20000 x i32], ptr @qx, i64 0, i64 %322
  %324 = load i32, ptr %323, align 4, !tbaa !5
  %325 = sext i32 %324 to i64
  %326 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %325
  %327 = load i32, ptr %326, align 4, !tbaa !5
  %328 = sub i32 %320, %327
  %329 = load i32, ptr %2, align 4, !tbaa !5
  %330 = shl i32 1, %329
  %331 = add i32 %328, %330
  %332 = load i32, ptr @tot, align 4, !tbaa !5
  %333 = sub nsw i32 %332, 1
  %334 = sext i32 %333 to i64
  %335 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %334
  %336 = load i32, ptr %335, align 4, !tbaa !5
  %337 = icmp ule i32 %331, %336
  br i1 %337, label %338, label %363

338:                                              ; preds = %282
  %339 = load i32, ptr @tot, align 4, !tbaa !5
  %340 = sub nsw i32 %339, 1
  %341 = load i32, ptr %2, align 4, !tbaa !5
  %342 = add nsw i32 %341, 1
  %343 = shl i32 1, %342
  %344 = load i32, ptr %14, align 4, !tbaa !5
  %345 = sext i32 %344 to i64
  %346 = getelementptr inbounds [20000 x i32], ptr @qx, i64 0, i64 %345
  %347 = load i32, ptr %346, align 4, !tbaa !5
  %348 = sext i32 %347 to i64
  %349 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %348
  %350 = load i32, ptr %349, align 4, !tbaa !5
  %351 = sub i32 %343, %350
  %352 = load i32, ptr %2, align 4, !tbaa !5
  %353 = shl i32 1, %352
  %354 = add i32 %351, %353
  %355 = load i32, ptr @tot, align 4, !tbaa !5
  %356 = sub nsw i32 %355, 1
  %357 = sext i32 %356 to i64
  %358 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %357
  %359 = load i32, ptr %358, align 4, !tbaa !5
  %360 = call noundef i32 @_Z5queryiiii(i32 noundef 0, i32 noundef %340, i32 noundef %354, i32 noundef %359)
  %361 = load i32, ptr %10, align 4, !tbaa !5
  %362 = sub nsw i32 %361, %360
  store i32 %362, ptr %10, align 4, !tbaa !5
  br label %363

363:                                              ; preds = %338, %282
  %364 = load i32, ptr %14, align 4, !tbaa !5
  %365 = sext i32 %364 to i64
  %366 = getelementptr inbounds [20000 x i32], ptr @qy, i64 0, i64 %365
  %367 = load i32, ptr %366, align 4, !tbaa !5
  %368 = load i32, ptr %14, align 4, !tbaa !5
  %369 = sext i32 %368 to i64
  %370 = getelementptr inbounds [20000 x i32], ptr @qx, i64 0, i64 %369
  %371 = load i32, ptr %370, align 4, !tbaa !5
  %372 = sext i32 %371 to i64
  %373 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %372
  store i32 %367, ptr %373, align 4, !tbaa !5
  %374 = load i32, ptr @tot, align 4, !tbaa !5
  %375 = sub nsw i32 %374, 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %376 = load i32, ptr %2, align 4, !tbaa !5
  %377 = shl i32 1, %376
  %378 = load i32, ptr %14, align 4, !tbaa !5
  %379 = sext i32 %378 to i64
  %380 = getelementptr inbounds [20000 x i32], ptr @qx, i64 0, i64 %379
  %381 = load i32, ptr %380, align 4, !tbaa !5
  %382 = sext i32 %381 to i64
  %383 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %382
  %384 = load i32, ptr %383, align 4, !tbaa !5
  %385 = sub nsw i32 %377, %384
  store i32 %385, ptr %18, align 4, !tbaa !5
  %386 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %17, ptr noundef nonnull align 4 dereferenceable(4) %18)
  %387 = load i32, ptr %386, align 4, !tbaa !5
  %388 = load i32, ptr %5, align 4, !tbaa !5
  %389 = load i32, ptr %14, align 4, !tbaa !5
  %390 = sext i32 %389 to i64
  %391 = getelementptr inbounds [20000 x i32], ptr @qx, i64 0, i64 %390
  %392 = load i32, ptr %391, align 4, !tbaa !5
  %393 = sext i32 %392 to i64
  %394 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %393
  %395 = load i32, ptr %394, align 4, !tbaa !5
  %396 = sub nsw i32 %388, %395
  %397 = call noundef i32 @_Z5queryiiii(i32 noundef 0, i32 noundef %375, i32 noundef %387, i32 noundef %396)
  %398 = load i32, ptr %10, align 4, !tbaa !5
  %399 = add nsw i32 %398, %397
  store i32 %399, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  %400 = load i32, ptr %2, align 4, !tbaa !5
  %401 = add nsw i32 %400, 1
  %402 = shl i32 1, %401
  %403 = load i32, ptr %14, align 4, !tbaa !5
  %404 = sext i32 %403 to i64
  %405 = getelementptr inbounds [20000 x i32], ptr @qx, i64 0, i64 %404
  %406 = load i32, ptr %405, align 4, !tbaa !5
  %407 = sext i32 %406 to i64
  %408 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %407
  %409 = load i32, ptr %408, align 4, !tbaa !5
  %410 = sub i32 %402, %409
  %411 = load i32, ptr %2, align 4, !tbaa !5
  %412 = shl i32 1, %411
  %413 = add i32 %410, %412
  %414 = load i32, ptr @tot, align 4, !tbaa !5
  %415 = sub nsw i32 %414, 1
  %416 = sext i32 %415 to i64
  %417 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %416
  %418 = load i32, ptr %417, align 4, !tbaa !5
  %419 = icmp ule i32 %413, %418
  br i1 %419, label %420, label %445

420:                                              ; preds = %363
  %421 = load i32, ptr @tot, align 4, !tbaa !5
  %422 = sub nsw i32 %421, 1
  %423 = load i32, ptr %2, align 4, !tbaa !5
  %424 = add nsw i32 %423, 1
  %425 = shl i32 1, %424
  %426 = load i32, ptr %14, align 4, !tbaa !5
  %427 = sext i32 %426 to i64
  %428 = getelementptr inbounds [20000 x i32], ptr @qx, i64 0, i64 %427
  %429 = load i32, ptr %428, align 4, !tbaa !5
  %430 = sext i32 %429 to i64
  %431 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %430
  %432 = load i32, ptr %431, align 4, !tbaa !5
  %433 = sub i32 %425, %432
  %434 = load i32, ptr %2, align 4, !tbaa !5
  %435 = shl i32 1, %434
  %436 = add i32 %433, %435
  %437 = load i32, ptr @tot, align 4, !tbaa !5
  %438 = sub nsw i32 %437, 1
  %439 = sext i32 %438 to i64
  %440 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %439
  %441 = load i32, ptr %440, align 4, !tbaa !5
  %442 = call noundef i32 @_Z5queryiiii(i32 noundef 0, i32 noundef %422, i32 noundef %436, i32 noundef %441)
  %443 = load i32, ptr %10, align 4, !tbaa !5
  %444 = add nsw i32 %443, %442
  store i32 %444, ptr %10, align 4, !tbaa !5
  br label %445

445:                                              ; preds = %420, %363
  %446 = load i32, ptr @tot, align 4, !tbaa !5
  %447 = sub nsw i32 %446, 1
  %448 = load i32, ptr %14, align 4, !tbaa !5
  %449 = sext i32 %448 to i64
  %450 = getelementptr inbounds [20000 x i32], ptr @qx, i64 0, i64 %449
  %451 = load i32, ptr %450, align 4, !tbaa !5
  %452 = sext i32 %451 to i64
  %453 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %452
  %454 = load i32, ptr %453, align 4, !tbaa !5
  call void @_Z6updateiiii(i32 noundef 0, i32 noundef %447, i32 noundef %454, i32 noundef 1)
  %455 = load i32, ptr %10, align 4, !tbaa !5
  %456 = and i32 %455, 1
  %457 = icmp ne i32 %456, 0
  br i1 %457, label %458, label %466

458:                                              ; preds = %445
  %459 = load i32, ptr %2, align 4, !tbaa !5
  %460 = shl i32 1, %459
  %461 = load i32, ptr %14, align 4, !tbaa !5
  %462 = sext i32 %461 to i64
  %463 = getelementptr inbounds [20000 x i32], ptr @ans, i64 0, i64 %462
  %464 = load i32, ptr %463, align 4, !tbaa !5
  %465 = or i32 %464, %460
  store i32 %465, ptr %463, align 4, !tbaa !5
  br label %466

466:                                              ; preds = %458, %445
  br label %467

467:                                              ; preds = %466
  %468 = load i32, ptr %14, align 4, !tbaa !5
  %469 = add nsw i32 %468, 1
  store i32 %469, ptr %14, align 4, !tbaa !5
  br label %277, !llvm.loop !18

470:                                              ; preds = %281
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %471

471:                                              ; preds = %470
  %472 = load i32, ptr %2, align 4, !tbaa !5
  %473 = add nsw i32 %472, -1
  store i32 %473, ptr %2, align 4, !tbaa !5
  %474 = load i32, ptr %5, align 4, !tbaa !5
  %475 = ashr i32 %474, 1
  store i32 %475, ptr %5, align 4, !tbaa !5
  br label %124, !llvm.loop !19

476:                                              ; preds = %127
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %477

477:                                              ; preds = %488, %476
  %478 = load i32, ptr %19, align 4, !tbaa !5
  %479 = load i32, ptr @m, align 4, !tbaa !5
  %480 = icmp slt i32 %478, %479
  br i1 %480, label %482, label %481

481:                                              ; preds = %477
  store i32 34, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %491

482:                                              ; preds = %477
  %483 = load i32, ptr %19, align 4, !tbaa !5
  %484 = sext i32 %483 to i64
  %485 = getelementptr inbounds [20000 x i32], ptr @ans, i64 0, i64 %484
  %486 = load i32, ptr %485, align 4, !tbaa !5
  %487 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %486)
  br label %488

488:                                              ; preds = %482
  %489 = load i32, ptr %19, align 4, !tbaa !5
  %490 = add nsw i32 %489, 1
  store i32 %490, ptr %19, align 4, !tbaa !5
  br label %477, !llvm.loop !20

491:                                              ; preds = %481
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %21, !llvm.loop !21

492:                                              ; preds = %21
  ret i32 0
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z5queryiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #5

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { 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 #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}


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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [20000 x i32], align 16
@b = external dso_local local_unnamed_addr global [20000 x i32], align 16
@qx = external dso_local global [20000 x i32], align 16
@qy = external dso_local global [20000 x i32], align 16
@ans = external dso_local local_unnamed_addr global [20000 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@seq = external dso_local global [40002 x i32], align 16
@seg = external dso_local local_unnamed_addr global [80004 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6updateiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %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 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %8 = load i32, ptr @t, align 4, !tbaa !5
  %9 = add nsw i32 %8, -1
  store i32 %9, ptr @t, align 4, !tbaa !5
  %.not148 = icmp eq i32 %8, 0
  br i1 %.not148, label %._crit_edge151, label %.lr.ph150

.loopexit:                                        ; preds = %.lr.ph147, %.preheader117
  %10 = load i32, ptr @t, align 4, !tbaa !5
  %11 = add nsw i32 %10, -1
  store i32 %11, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %._crit_edge151, label %.lr.ph150, !llvm.loop !9

.lr.ph150:                                        ; preds = %0, %.loopexit
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  store i32 0, ptr @tot, align 4, !tbaa !5
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph, label %.preheader118

.preheader118:                                    ; preds = %28, %.lr.ph150
  %15 = phi i32 [ 0, %.lr.ph150 ], [ %22, %28 ]
  %.096.lcssa = phi i32 [ 0, %.lr.ph150 ], [ %.197, %28 ]
  %16 = load i32, ptr @m, align 4, !tbaa !5
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph124, label %.preheader118.._crit_edge_crit_edge

.preheader118.._crit_edge_crit_edge:              ; preds = %.preheader118
  %.pre194 = add nsw i32 %.096.lcssa, 1
  %.pre196 = sext i32 %16 to i64
  br label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph150, %28
  %indvars.iv = phi i64 [ %indvars.iv.next, %28 ], [ 0, %.lr.ph150 ]
  %.096120 = phi i32 [ %.197, %28 ], [ 0, %.lr.ph150 ]
  %18 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %18)
  %20 = load i32, ptr %18, align 4, !tbaa !5
  %21 = load i32, ptr @tot, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr @tot, align 4, !tbaa !5
  %23 = sext i32 %21 to i64
  %24 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %23
  store i32 %20, ptr %24, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %25, %.lr.ph
  %.197 = phi i32 [ %.096120, %.lr.ph ], [ %27, %25 ]
  %26 = shl nuw i32 1, %.197
  %.not113 = icmp sgt i32 %26, %20
  %27 = add nsw i32 %.197, 1
  br i1 %.not113, label %28, label %25, !llvm.loop !11

28:                                               ; preds = %25
  %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
  %31 = icmp slt i64 %indvars.iv.next, %30
  br i1 %31, label %.lr.ph, label %.preheader118, !llvm.loop !12

._crit_edge:                                      ; preds = %55, %.preheader118.._crit_edge_crit_edge
  %.pre-phi197 = phi i64 [ %.pre196, %.preheader118.._crit_edge_crit_edge ], [ %57, %55 ]
  %.pre-phi195 = phi i32 [ %.pre194, %.preheader118.._crit_edge_crit_edge ], [ %54, %55 ]
  %32 = phi i32 [ %15, %.preheader118.._crit_edge_crit_edge ], [ %49, %55 ]
  %.298.lcssa = phi i32 [ %.096.lcssa, %.preheader118.._crit_edge_crit_edge ], [ %.399, %55 ]
  %.lcssa = phi i32 [ %16, %.preheader118.._crit_edge_crit_edge ], [ %56, %55 ]
  %33 = add nsw i32 %32, 1
  %34 = sext i32 %32 to i64
  %35 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %34
  store i32 0, ptr %35, align 4, !tbaa !5
  %notmask = shl nsw i32 -1, %.pre-phi195
  %36 = xor i32 %notmask, -1
  %37 = add nsw i32 %32, 2
  store i32 %37, ptr @tot, align 4, !tbaa !5
  %38 = sext i32 %33 to i64
  %39 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %38
  store i32 %36, ptr %39, align 4, !tbaa !5
  %40 = shl nsw i64 %.pre-phi197, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @ans, i8 0, i64 %40, i1 false)
  %41 = icmp sgt i32 %.298.lcssa, -1
  br i1 %41, label %.preheader116, label %.preheader117

.lr.ph124:                                        ; preds = %.preheader118, %55
  %indvars.iv154 = phi i64 [ %indvars.iv.next155, %55 ], [ 0, %.preheader118 ]
  %.298122 = phi i32 [ %.399, %55 ], [ %.096.lcssa, %.preheader118 ]
  %42 = getelementptr inbounds i32, ptr @qx, i64 %indvars.iv154
  %43 = getelementptr inbounds i32, ptr @qy, i64 %indvars.iv154
  %44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %42, ptr noundef nonnull %43)
  %45 = load i32, ptr %42, align 4, !tbaa !5
  %46 = add nsw i32 %45, -1
  store i32 %46, ptr %42, align 4, !tbaa !5
  %47 = load i32, ptr %43, align 4, !tbaa !5
  %48 = load i32, ptr @tot, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr @tot, align 4, !tbaa !5
  %50 = sext i32 %48 to i64
  %51 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %50
  store i32 %47, ptr %51, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %52, %.lr.ph124
  %.399 = phi i32 [ %.298122, %.lr.ph124 ], [ %54, %52 ]
  %53 = shl nuw i32 1, %.399
  %.not112 = icmp sgt i32 %53, %47
  %54 = add nsw i32 %.399, 1
  br i1 %.not112, label %55, label %52, !llvm.loop !13

55:                                               ; preds = %52
  %indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
  %56 = load i32, ptr @m, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = icmp slt i64 %indvars.iv.next155, %57
  br i1 %58, label %.lr.ph124, label %._crit_edge, !llvm.loop !14

.preheader117:                                    ; preds = %._crit_edge143, %._crit_edge
  %59 = phi i32 [ %.lcssa, %._crit_edge ], [ %143, %._crit_edge143 ]
  %60 = icmp sgt i32 %59, 0
  br i1 %60, label %.lr.ph147, label %.loopexit

.preheader116:                                    ; preds = %._crit_edge, %._crit_edge143
  %61 = phi i32 [ %143, %._crit_edge143 ], [ %.lcssa, %._crit_edge ]
  %.093145 = phi i32 [ %145, %._crit_edge143 ], [ %36, %._crit_edge ]
  %.4100144 = phi i32 [ %144, %._crit_edge143 ], [ %.298.lcssa, %._crit_edge ]
  %62 = load i32, ptr @n, align 4, !tbaa !5
  %63 = icmp sgt i32 %62, 0
  br i1 %63, label %.lr.ph128.preheader, label %.preheader115

.lr.ph128.preheader:                              ; preds = %.preheader116
  %wide.trip.count = zext nneg i32 %62 to i64
  %min.iters.check230 = icmp ult i32 %62, 8
  br i1 %min.iters.check230, label %.lr.ph128.preheader245, label %vector.ph231

.lr.ph128.preheader245:                           ; preds = %middle.block228, %.lr.ph128.preheader
  %indvars.iv157.ph = phi i64 [ 0, %.lr.ph128.preheader ], [ %n.vec233, %middle.block228 ]
  br label %.lr.ph128

vector.ph231:                                     ; preds = %.lr.ph128.preheader
  %n.vec233 = and i64 %wide.trip.count, 2147483640
  %broadcast.splatinsert239 = insertelement <4 x i32> poison, i32 %.093145, i64 0
  %broadcast.splat240 = shufflevector <4 x i32> %broadcast.splatinsert239, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body235

vector.body235:                                   ; preds = %vector.body235, %vector.ph231
  %index236 = phi i64 [ 0, %vector.ph231 ], [ %index.next241, %vector.body235 ]
  %64 = getelementptr inbounds [20000 x i32], ptr @a, i64 0, i64 %index236
  %65 = getelementptr inbounds i8, ptr %64, i64 16
  %wide.load237 = load <4 x i32>, ptr %64, align 16, !tbaa !5
  %wide.load238 = load <4 x i32>, ptr %65, align 16, !tbaa !5
  %66 = and <4 x i32> %wide.load237, %broadcast.splat240
  %67 = and <4 x i32> %wide.load238, %broadcast.splat240
  %68 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %index236
  %69 = getelementptr inbounds i8, ptr %68, i64 16
  store <4 x i32> %66, ptr %68, align 16, !tbaa !5
  store <4 x i32> %67, ptr %69, align 16, !tbaa !5
  %index.next241 = add nuw i64 %index236, 8
  %70 = icmp eq i64 %index.next241, %n.vec233
  br i1 %70, label %middle.block228, label %vector.body235, !llvm.loop !15

middle.block228:                                  ; preds = %vector.body235
  %cmp.n242 = icmp eq i64 %n.vec233, %wide.trip.count
  br i1 %cmp.n242, label %.preheader115, label %.lr.ph128.preheader245

.preheader115:                                    ; preds = %.lr.ph128, %middle.block228, %.preheader116
  %71 = icmp sgt i32 %61, 0
  br i1 %71, label %.lr.ph130.preheader, label %.preheader114

.lr.ph130.preheader:                              ; preds = %.preheader115
  %wide.trip.count163 = zext nneg i32 %61 to i64
  %min.iters.check215 = icmp ult i32 %61, 8
  br i1 %min.iters.check215, label %.lr.ph130.preheader244, label %vector.ph216

.lr.ph130.preheader244:                           ; preds = %middle.block213, %.lr.ph130.preheader
  %indvars.iv160.ph = phi i64 [ 0, %.lr.ph130.preheader ], [ %n.vec218, %middle.block213 ]
  br label %.lr.ph130

vector.ph216:                                     ; preds = %.lr.ph130.preheader
  %n.vec218 = and i64 %wide.trip.count163, 2147483640
  %broadcast.splatinsert224 = insertelement <4 x i32> poison, i32 %.093145, i64 0
  %broadcast.splat225 = shufflevector <4 x i32> %broadcast.splatinsert224, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body220

vector.body220:                                   ; preds = %vector.body220, %vector.ph216
  %index221 = phi i64 [ 0, %vector.ph216 ], [ %index.next226, %vector.body220 ]
  %72 = getelementptr inbounds [20000 x i32], ptr @qy, i64 0, i64 %index221
  %73 = getelementptr inbounds i8, ptr %72, i64 16
  %wide.load222 = load <4 x i32>, ptr %72, align 16, !tbaa !5
  %wide.load223 = load <4 x i32>, ptr %73, align 16, !tbaa !5
  %74 = and <4 x i32> %wide.load222, %broadcast.splat225
  %75 = and <4 x i32> %wide.load223, %broadcast.splat225
  store <4 x i32> %74, ptr %72, align 16, !tbaa !5
  store <4 x i32> %75, ptr %73, align 16, !tbaa !5
  %index.next226 = add nuw i64 %index221, 8
  %76 = icmp eq i64 %index.next226, %n.vec218
  br i1 %76, label %middle.block213, label %vector.body220, !llvm.loop !18

middle.block213:                                  ; preds = %vector.body220
  %cmp.n227 = icmp eq i64 %n.vec218, %wide.trip.count163
  br i1 %cmp.n227, label %.preheader114, label %.lr.ph130.preheader244

.lr.ph128:                                        ; preds = %.lr.ph128.preheader245, %.lr.ph128
  %indvars.iv157 = phi i64 [ %indvars.iv.next158, %.lr.ph128 ], [ %indvars.iv157.ph, %.lr.ph128.preheader245 ]
  %77 = getelementptr inbounds [20000 x i32], ptr @a, i64 0, i64 %indvars.iv157
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = and i32 %78, %.093145
  %80 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %indvars.iv157
  store i32 %79, ptr %80, align 4, !tbaa !5
  %indvars.iv.next158 = add nuw nsw i64 %indvars.iv157, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next158, %wide.trip.count
  br i1 %exitcond.not, label %.preheader115, label %.lr.ph128, !llvm.loop !19

.preheader114:                                    ; preds = %.lr.ph130, %middle.block213, %.preheader115
  %81 = load i32, ptr @tot, align 4, !tbaa !5
  %82 = icmp sgt i32 %81, 0
  br i1 %82, label %.lr.ph132.preheader, label %._crit_edge133

.lr.ph132.preheader:                              ; preds = %.preheader114
  %wide.trip.count168 = zext nneg i32 %81 to i64
  %min.iters.check = icmp ult i32 %81, 8
  br i1 %min.iters.check, label %.lr.ph132.preheader243, label %vector.ph

.lr.ph132.preheader243:                           ; preds = %middle.block, %.lr.ph132.preheader
  %indvars.iv165.ph = phi i64 [ 0, %.lr.ph132.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph132

vector.ph:                                        ; preds = %.lr.ph132.preheader
  %n.vec = and i64 %wide.trip.count168, 2147483640
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %.093145, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %83 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %index
  %84 = getelementptr inbounds i8, ptr %83, i64 16
  %wide.load = load <4 x i32>, ptr %83, align 16, !tbaa !5
  %wide.load212 = load <4 x i32>, ptr %84, align 16, !tbaa !5
  %85 = and <4 x i32> %wide.load, %broadcast.splat
  %86 = and <4 x i32> %wide.load212, %broadcast.splat
  store <4 x i32> %85, ptr %83, align 16, !tbaa !5
  store <4 x i32> %86, ptr %84, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %87 = icmp eq i64 %index.next, %n.vec
  br i1 %87, label %middle.block, label %vector.body, !llvm.loop !20

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count168
  br i1 %cmp.n, label %._crit_edge133, label %.lr.ph132.preheader243

.lr.ph130:                                        ; preds = %.lr.ph130.preheader244, %.lr.ph130
  %indvars.iv160 = phi i64 [ %indvars.iv.next161, %.lr.ph130 ], [ %indvars.iv160.ph, %.lr.ph130.preheader244 ]
  %88 = getelementptr inbounds [20000 x i32], ptr @qy, i64 0, i64 %indvars.iv160
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = and i32 %89, %.093145
  store i32 %90, ptr %88, align 4, !tbaa !5
  %indvars.iv.next161 = add nuw nsw i64 %indvars.iv160, 1
  %exitcond164.not = icmp eq i64 %indvars.iv.next161, %wide.trip.count163
  br i1 %exitcond164.not, label %.preheader114, label %.lr.ph130, !llvm.loop !21

._crit_edge133:                                   ; preds = %.lr.ph132, %middle.block, %.preheader114
  %91 = sext i32 %81 to i64
  %92 = getelementptr inbounds i32, ptr @seq, i64 %91
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @seq, ptr noundef nonnull %92)
  %93 = load i32, ptr @tot, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds i32, ptr @seq, i64 %94
  %96 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef nonnull @seq, ptr noundef nonnull %95)
  %97 = ptrtoint ptr %96 to i64
  %98 = sub i64 %97, ptrtoint (ptr @seq to i64)
  %99 = lshr exact i64 %98, 2
  %100 = trunc i64 %99 to i32
  store i32 %100, ptr @tot, align 4, !tbaa !5
  %101 = shl i32 %100, 1
  %102 = sext i32 %101 to i64
  %103 = shl nsw i64 %102, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @seg, i8 0, i64 %103, i1 false)
  %104 = load i32, ptr @n, align 4, !tbaa !5
  %105 = icmp sgt i32 %104, 0
  br i1 %105, label %.lr.ph138, label %.preheader

.lr.ph138:                                        ; preds = %._crit_edge133
  %106 = shl nuw i32 1, %.4100144
  %107 = shl nuw i32 2, %.4100144
  br label %115

.lr.ph132:                                        ; preds = %.lr.ph132.preheader243, %.lr.ph132
  %indvars.iv165 = phi i64 [ %indvars.iv.next166, %.lr.ph132 ], [ %indvars.iv165.ph, %.lr.ph132.preheader243 ]
  %108 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %indvars.iv165
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = and i32 %109, %.093145
  store i32 %110, ptr %108, align 4, !tbaa !5
  %indvars.iv.next166 = add nuw nsw i64 %indvars.iv165, 1
  %exitcond169.not = icmp eq i64 %indvars.iv.next166, %wide.trip.count168
  br i1 %exitcond169.not, label %._crit_edge133, label %.lr.ph132, !llvm.loop !22

.preheader:                                       ; preds = %138, %._crit_edge133
  %.089.lcssa = phi i32 [ 0, %._crit_edge133 ], [ %.1, %138 ]
  %111 = load i32, ptr @m, align 4, !tbaa !5
  %112 = icmp sgt i32 %111, 0
  br i1 %112, label %.lr.ph142, label %._crit_edge143

.lr.ph142:                                        ; preds = %.preheader
  %113 = shl nuw i32 1, %.4100144
  %114 = shl nuw i32 2, %.4100144
  br label %147

115:                                              ; preds = %.lr.ph138, %138
  %indvars.iv170 = phi i64 [ 0, %.lr.ph138 ], [ %indvars.iv.next171, %138 ]
  %.089135 = phi i32 [ 0, %.lr.ph138 ], [ %.1, %138 ]
  %116 = load i32, ptr @tot, align 4, !tbaa !5
  %117 = add nsw i32 %116, -1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %118 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %indvars.iv170
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = sub nsw i32 %106, %119
  store i32 %120, ptr %2, align 4, !tbaa !5
  %121 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = load i32, ptr %118, align 4, !tbaa !5
  %124 = sub nsw i32 %.093145, %123
  %125 = call noundef i32 @_Z5queryiiii(i32 noundef 0, i32 noundef %117, i32 noundef %122, i32 noundef %124)
  %126 = add nsw i32 %125, %.089135
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %127 = load i32, ptr %118, align 4, !tbaa !5
  %128 = sub i32 %107, %127
  %129 = add i32 %128, %106
  %130 = load i32, ptr @tot, align 4, !tbaa !5
  %131 = add nsw i32 %130, -1
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %.not111 = icmp ugt i32 %129, %134
  br i1 %.not111, label %138, label %135

135:                                              ; preds = %115
  %136 = call noundef i32 @_Z5queryiiii(i32 noundef 0, i32 noundef %131, i32 noundef %129, i32 noundef %134)
  %137 = add nsw i32 %136, %126
  %.pre = load i32, ptr @tot, align 4, !tbaa !5
  %.pre179 = load i32, ptr %118, align 4, !tbaa !5
  %.pre186 = add nsw i32 %.pre, -1
  br label %138

138:                                              ; preds = %135, %115
  %.pre-phi = phi i32 [ %.pre186, %135 ], [ %131, %115 ]
  %139 = phi i32 [ %.pre179, %135 ], [ %127, %115 ]
  %.1 = phi i32 [ %137, %135 ], [ %126, %115 ]
  call void @_Z6updateiiii(i32 noundef 0, i32 noundef %.pre-phi, i32 noundef %139, i32 noundef 1)
  %indvars.iv.next171 = add nuw nsw i64 %indvars.iv170, 1
  %140 = load i32, ptr @n, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = icmp slt i64 %indvars.iv.next171, %141
  br i1 %142, label %115, label %.preheader, !llvm.loop !23

._crit_edge143:                                   ; preds = %220, %.preheader
  %143 = phi i32 [ %111, %.preheader ], [ %221, %220 ]
  %144 = add nsw i32 %.4100144, -1
  %145 = lshr i32 %.093145, 1
  %146 = icmp sgt i32 %.4100144, 0
  br i1 %146, label %.preheader116, label %.preheader117, !llvm.loop !24

147:                                              ; preds = %.lr.ph142, %220
  %indvars.iv173 = phi i64 [ 0, %.lr.ph142 ], [ %indvars.iv.next174, %220 ]
  %.2140 = phi i32 [ %.089.lcssa, %.lr.ph142 ], [ %.4, %220 ]
  %148 = load i32, ptr @tot, align 4, !tbaa !5
  %149 = add nsw i32 %148, -1
  %150 = getelementptr inbounds [20000 x i32], ptr @qx, i64 0, i64 %indvars.iv173
  %151 = load i32, ptr %150, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !5
  call void @_Z6updateiiii(i32 noundef 0, i32 noundef %149, i32 noundef %154, i32 noundef -1)
  %155 = load i32, ptr @tot, align 4, !tbaa !5
  %156 = add nsw i32 %155, -1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %157 = load i32, ptr %150, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !5
  %161 = sub nsw i32 %113, %160
  store i32 %161, ptr %4, align 4, !tbaa !5
  %162 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = load i32, ptr %150, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = sub nsw i32 %.093145, %167
  %169 = call noundef i32 @_Z5queryiiii(i32 noundef 0, i32 noundef %156, i32 noundef %163, i32 noundef %168)
  %170 = sub nsw i32 %.2140, %169
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %171 = load i32, ptr %150, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  %175 = sub i32 %114, %174
  %176 = add i32 %175, %113
  %177 = load i32, ptr @tot, align 4, !tbaa !5
  %178 = add nsw i32 %177, -1
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !5
  %.not108 = icmp ugt i32 %176, %181
  br i1 %.not108, label %185, label %182

182:                                              ; preds = %147
  %183 = call noundef i32 @_Z5queryiiii(i32 noundef 0, i32 noundef %178, i32 noundef %176, i32 noundef %181)
  %184 = sub nsw i32 %170, %183
  %.pre180 = load i32, ptr %150, align 4, !tbaa !5
  %.pre181 = load i32, ptr @tot, align 4, !tbaa !5
  %.pre187 = sext i32 %.pre180 to i64
  %.pre189 = add nsw i32 %.pre181, -1
  br label %185

185:                                              ; preds = %182, %147
  %.pre-phi190 = phi i32 [ %.pre189, %182 ], [ %178, %147 ]
  %.pre-phi188 = phi i64 [ %.pre187, %182 ], [ %172, %147 ]
  %.3 = phi i32 [ %184, %182 ], [ %170, %147 ]
  %186 = getelementptr inbounds [20000 x i32], ptr @qy, i64 0, i64 %indvars.iv173
  %187 = load i32, ptr %186, align 4, !tbaa !5
  %188 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %.pre-phi188
  store i32 %187, ptr %188, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %189 = sub nsw i32 %113, %187
  store i32 %189, ptr %6, align 4, !tbaa !5
  %190 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %191 = load i32, ptr %190, align 4, !tbaa !5
  %192 = load i32, ptr %150, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %193
  %195 = load i32, ptr %194, align 4, !tbaa !5
  %196 = sub nsw i32 %.093145, %195
  %197 = call noundef i32 @_Z5queryiiii(i32 noundef 0, i32 noundef %.pre-phi190, i32 noundef %191, i32 noundef %196)
  %198 = add nsw i32 %197, %.3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  %199 = load i32, ptr %150, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %200
  %202 = load i32, ptr %201, align 4, !tbaa !5
  %203 = sub i32 %114, %202
  %204 = add i32 %203, %113
  %205 = load i32, ptr @tot, align 4, !tbaa !5
  %206 = add nsw i32 %205, -1
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [40002 x i32], ptr @seq, i64 0, i64 %207
  %209 = load i32, ptr %208, align 4, !tbaa !5
  %.not109 = icmp ugt i32 %204, %209
  br i1 %.not109, label %213, label %210

210:                                              ; preds = %185
  %211 = call noundef i32 @_Z5queryiiii(i32 noundef 0, i32 noundef %206, i32 noundef %204, i32 noundef %209)
  %212 = add nsw i32 %211, %198
  %.pre182 = load i32, ptr @tot, align 4, !tbaa !5
  %.pre183 = load i32, ptr %150, align 4, !tbaa !5
  %.phi.trans.insert = sext i32 %.pre183 to i64
  %.phi.trans.insert184 = getelementptr inbounds [20000 x i32], ptr @b, i64 0, i64 %.phi.trans.insert
  %.pre185 = load i32, ptr %.phi.trans.insert184, align 4, !tbaa !5
  %.pre191 = add nsw i32 %.pre182, -1
  br label %213

213:                                              ; preds = %210, %185
  %.pre-phi192 = phi i32 [ %.pre191, %210 ], [ %206, %185 ]
  %214 = phi i32 [ %.pre185, %210 ], [ %202, %185 ]
  %.4 = phi i32 [ %212, %210 ], [ %198, %185 ]
  call void @_Z6updateiiii(i32 noundef 0, i32 noundef %.pre-phi192, i32 noundef %214, i32 noundef 1)
  %215 = and i32 %.4, 1
  %.not110 = icmp eq i32 %215, 0
  br i1 %.not110, label %220, label %216

216:                                              ; preds = %213
  %217 = getelementptr inbounds [20000 x i32], ptr @ans, i64 0, i64 %indvars.iv173
  %218 = load i32, ptr %217, align 4, !tbaa !5
  %219 = or i32 %218, %113
  store i32 %219, ptr %217, align 4, !tbaa !5
  br label %220

220:                                              ; preds = %213, %216
  %indvars.iv.next174 = add nuw nsw i64 %indvars.iv173, 1
  %221 = load i32, ptr @m, align 4, !tbaa !5
  %222 = sext i32 %221 to i64
  %223 = icmp slt i64 %indvars.iv.next174, %222
  br i1 %223, label %147, label %._crit_edge143, !llvm.loop !25

.lr.ph147:                                        ; preds = %.preheader117, %.lr.ph147
  %indvars.iv176 = phi i64 [ %indvars.iv.next177, %.lr.ph147 ], [ 0, %.preheader117 ]
  %224 = getelementptr inbounds [20000 x i32], ptr @ans, i64 0, i64 %indvars.iv176
  %225 = load i32, ptr %224, align 4, !tbaa !5
  %226 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %225)
  %indvars.iv.next177 = add nuw nsw i64 %indvars.iv176, 1
  %227 = load i32, ptr @m, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = icmp slt i64 %indvars.iv.next177, %228
  br i1 %229, label %.lr.ph147, label %.loopexit, !llvm.loop !26

._crit_edge151:                                   ; preds = %.loopexit, %0
  ret i32 0
}

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z5queryiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #5

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { 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 #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !10, !16, !17}
!19 = distinct !{!19, !10, !17, !16}
!20 = distinct !{!20, !10, !16, !17}
!21 = distinct !{!21, !10, !17, !16}
!22 = distinct !{!22, !10, !17, !16}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}


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