; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ (5808)

; 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.A = type { i32, i32, i32 }
%struct.Q = type { i32, i32, i32, i32, i32 }

@a = external dso_local global [20010 x %struct.A], align 16
@q = external dso_local global [100010 x %struct.Q], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@C = external dso_local global [20010 x [110 x i32]], align 16
@ans = external dso_local global [100010 x i32], align 16
@b = external dso_local global [3010 x i32], align 16
@f = external dso_local global [110 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 [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3cmp1AS_(i64, i32, i64, i32) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4cmp21QS_(ptr noundef byval(%struct.Q) align 8, ptr noundef byval(%struct.Q) align 8) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3addii(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 nounwind uwtable
declare dso_local noundef i32 @_Z5queryii(i32 noundef, i32 noundef) #0

; 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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  br label %18

18:                                               ; preds = %325, %0
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = add nsw i32 %19, -1
  store i32 %20, ptr %2, align 4, !tbaa !5
  %21 = icmp ne i32 %19, 0
  br i1 %21, label %22, label %327

22:                                               ; preds = %18
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %35, %22
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = icmp sle i32 %25, %26
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %24
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [20010 x %struct.A], ptr @a, i64 0, i64 %31
  %33 = getelementptr inbounds %struct.A, ptr %32, i32 0, i32 0
  %34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %33)
  br label %35

35:                                               ; preds = %29
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %3, align 4, !tbaa !5
  br label %24, !llvm.loop !9

38:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %55, %38
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = load i32, ptr @n, align 4, !tbaa !5
  %42 = icmp sle i32 %40, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %58

44:                                               ; preds = %39
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [20010 x %struct.A], ptr @a, i64 0, i64 %46
  %48 = getelementptr inbounds %struct.A, ptr %47, i32 0, i32 1
  %49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %48)
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [20010 x %struct.A], ptr @a, i64 0, i64 %52
  %54 = getelementptr inbounds %struct.A, ptr %53, i32 0, i32 2
  store i32 %50, ptr %54, align 4, !tbaa !11
  br label %55

55:                                               ; preds = %44
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %4, align 4, !tbaa !5
  br label %39, !llvm.loop !13

58:                                               ; preds = %43
  %59 = load i32, ptr @n, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds %struct.A, ptr @a, i64 %60
  %62 = getelementptr inbounds %struct.A, ptr %61, i64 1
  call void @_ZSt4sortIP1APFiS0_S0_EEvT_S4_T0_(ptr noundef getelementptr inbounds (%struct.A, ptr @a, i64 1), ptr noundef %62, ptr noundef @_Z3cmp1AS_)
  call void @llvm.memset.p0.i64(ptr align 16 @C, i8 0, i64 8804400, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %91, %58
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = load i32, ptr @m, align 4, !tbaa !5
  %66 = icmp sle i32 %64, %65
  br i1 %66, label %68, label %67

67:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %94

68:                                               ; preds = %63
  %69 = load i32, ptr %5, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %70
  %72 = getelementptr inbounds %struct.Q, ptr %71, i32 0, i32 0
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %74
  %76 = getelementptr inbounds %struct.Q, ptr %75, i32 0, i32 1
  %77 = load i32, ptr %5, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %78
  %80 = getelementptr inbounds %struct.Q, ptr %79, i32 0, i32 2
  %81 = load i32, ptr %5, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %82
  %84 = getelementptr inbounds %struct.Q, ptr %83, i32 0, i32 3
  %85 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %72, ptr noundef %76, ptr noundef %80, ptr noundef %84)
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = load i32, ptr %5, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %88
  %90 = getelementptr inbounds %struct.Q, ptr %89, i32 0, i32 4
  store i32 %86, ptr %90, align 4, !tbaa !14
  br label %91

91:                                               ; preds = %68
  %92 = load i32, ptr %5, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %5, align 4, !tbaa !5
  br label %63, !llvm.loop !16

94:                                               ; preds = %67
  %95 = load i32, ptr @m, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds %struct.Q, ptr @q, i64 %96
  %98 = getelementptr inbounds %struct.Q, ptr %97, i64 1
  call void @_ZSt4sortIP1QPFiS0_S0_EEvT_S4_T0_(ptr noundef getelementptr inbounds (%struct.Q, ptr @q, i64 1), ptr noundef %98, ptr noundef @_Z4cmp21QS_)
  %99 = load i32, ptr @n, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [20010 x %struct.A], ptr @a, i64 0, i64 %101
  %103 = getelementptr inbounds %struct.A, ptr %102, i32 0, i32 1
  store i32 1000000010, ptr %103, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %307, %94
  %105 = load i32, ptr %7, align 4, !tbaa !5
  %106 = load i32, ptr @m, align 4, !tbaa !5
  %107 = icmp sle i32 %105, %106
  br i1 %107, label %109, label %108

108:                                              ; preds = %104
  store i32 13, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %310

109:                                              ; preds = %104
  br label %110

110:                                              ; preds = %128, %109
  %111 = load i32, ptr %6, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [20010 x %struct.A], ptr @a, i64 0, i64 %112
  %114 = getelementptr inbounds %struct.A, ptr %113, i32 0, i32 1
  %115 = load i32, ptr %114, align 4, !tbaa !17
  %116 = load i32, ptr %7, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %117
  %119 = getelementptr inbounds %struct.Q, ptr %118, i32 0, i32 2
  %120 = load i32, ptr %119, align 4, !tbaa !18
  %121 = icmp sle i32 %115, %120
  br i1 %121, label %122, label %126

122:                                              ; preds = %110
  %123 = load i32, ptr %6, align 4, !tbaa !5
  %124 = load i32, ptr @n, align 4, !tbaa !5
  %125 = icmp sle i32 %123, %124
  br label %126

126:                                              ; preds = %122, %110
  %127 = phi i1 [ false, %110 ], [ %125, %122 ]
  br i1 %127, label %128, label %141

128:                                              ; preds = %126
  %129 = load i32, ptr %6, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [20010 x %struct.A], ptr @a, i64 0, i64 %130
  %132 = getelementptr inbounds %struct.A, ptr %131, i32 0, i32 2
  %133 = load i32, ptr %132, align 4, !tbaa !11
  %134 = load i32, ptr %6, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [20010 x %struct.A], ptr @a, i64 0, i64 %135
  %137 = getelementptr inbounds %struct.A, ptr %136, i32 0, i32 0
  %138 = load i32, ptr %137, align 4, !tbaa !19
  call void @_Z3addii(i32 noundef %133, i32 noundef %138)
  %139 = load i32, ptr %6, align 4, !tbaa !5
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %6, align 4, !tbaa !5
  br label %110, !llvm.loop !20

141:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %142 = load i32, ptr %7, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %143
  %145 = getelementptr inbounds %struct.Q, ptr %144, i32 0, i32 1
  %146 = load i32, ptr %145, align 4, !tbaa !21
  %147 = load i32, ptr %7, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %148
  %150 = getelementptr inbounds %struct.Q, ptr %149, i32 0, i32 3
  %151 = load i32, ptr %150, align 4, !tbaa !22
  %152 = call noundef i32 @_Z5queryii(i32 noundef %146, i32 noundef %151)
  %153 = load i32, ptr %7, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %154
  %156 = getelementptr inbounds %struct.Q, ptr %155, i32 0, i32 0
  %157 = load i32, ptr %156, align 4, !tbaa !23
  %158 = sub nsw i32 %157, 1
  %159 = load i32, ptr %7, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %160
  %162 = getelementptr inbounds %struct.Q, ptr %161, i32 0, i32 3
  %163 = load i32, ptr %162, align 4, !tbaa !22
  %164 = call noundef i32 @_Z5queryii(i32 noundef %158, i32 noundef %163)
  %165 = sub nsw i32 %152, %164
  store i32 %165, ptr %9, align 4, !tbaa !5
  %166 = load i32, ptr %9, align 4, !tbaa !5
  %167 = icmp ne i32 %166, 0
  br i1 %167, label %168, label %176

168:                                              ; preds = %141
  %169 = load i32, ptr %7, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %170
  %172 = getelementptr inbounds %struct.Q, ptr %171, i32 0, i32 4
  %173 = load i32, ptr %172, align 4, !tbaa !14
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %174
  store i32 0, ptr %175, align 4, !tbaa !5
  br label %306

176:                                              ; preds = %141
  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 1, ptr %11, align 4, !tbaa !5
  br label %177

177:                                              ; preds = %232, %176
  %178 = load i32, ptr %11, align 4, !tbaa !5
  %179 = load i32, ptr %7, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %180
  %182 = getelementptr inbounds %struct.Q, ptr %181, i32 0, i32 3
  %183 = load i32, ptr %182, align 4, !tbaa !22
  %184 = icmp slt i32 %178, %183
  br i1 %184, label %186, label %185

185:                                              ; preds = %177
  store i32 18, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %235

186:                                              ; preds = %177
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %187 = load i32, ptr %7, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %188
  %190 = getelementptr inbounds %struct.Q, ptr %189, i32 0, i32 1
  %191 = load i32, ptr %190, align 4, !tbaa !21
  %192 = load i32, ptr %11, align 4, !tbaa !5
  %193 = call noundef i32 @_Z5queryii(i32 noundef %191, i32 noundef %192)
  %194 = load i32, ptr %7, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %195
  %197 = getelementptr inbounds %struct.Q, ptr %196, i32 0, i32 0
  %198 = load i32, ptr %197, align 4, !tbaa !23
  %199 = sub nsw i32 %198, 1
  %200 = load i32, ptr %11, align 4, !tbaa !5
  %201 = call noundef i32 @_Z5queryii(i32 noundef %199, i32 noundef %200)
  %202 = sub nsw i32 %193, %201
  store i32 %202, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %203

203:                                              ; preds = %207, %186
  %204 = load i32, ptr %13, align 4, !tbaa !5
  %205 = load i32, ptr %12, align 4, !tbaa !5
  %206 = icmp slt i32 %204, %205
  br i1 %206, label %207, label %220

207:                                              ; preds = %203
  %208 = load i32, ptr %11, align 4, !tbaa !5
  %209 = load i32, ptr %13, align 4, !tbaa !5
  %210 = mul nsw i32 %208, %209
  %211 = load i32, ptr %10, align 4, !tbaa !5
  %212 = add nsw i32 %211, 1
  store i32 %212, ptr %10, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [3010 x i32], ptr @b, i64 0, i64 %213
  store i32 %210, ptr %214, align 4, !tbaa !5
  %215 = load i32, ptr %13, align 4, !tbaa !5
  %216 = load i32, ptr %12, align 4, !tbaa !5
  %217 = sub nsw i32 %216, %215
  store i32 %217, ptr %12, align 4, !tbaa !5
  %218 = load i32, ptr %13, align 4, !tbaa !5
  %219 = shl i32 %218, 1
  store i32 %219, ptr %13, align 4, !tbaa !5
  br label %203, !llvm.loop !24

220:                                              ; preds = %203
  %221 = load i32, ptr %12, align 4, !tbaa !5
  %222 = icmp ne i32 %221, 0
  br i1 %222, label %223, label %231

223:                                              ; preds = %220
  %224 = load i32, ptr %12, align 4, !tbaa !5
  %225 = load i32, ptr %11, align 4, !tbaa !5
  %226 = mul nsw i32 %224, %225
  %227 = load i32, ptr %10, align 4, !tbaa !5
  %228 = add nsw i32 %227, 1
  store i32 %228, ptr %10, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [3010 x i32], ptr @b, i64 0, i64 %229
  store i32 %226, ptr %230, align 4, !tbaa !5
  br label %231

231:                                              ; preds = %223, %220
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %232

232:                                              ; preds = %231
  %233 = load i32, ptr %11, align 4, !tbaa !5
  %234 = add nsw i32 %233, 1
  store i32 %234, ptr %11, align 4, !tbaa !5
  br label %177, !llvm.loop !25

235:                                              ; preds = %185
  call void @llvm.memset.p0.i64(ptr align 16 @f, i8 0, i64 440, i1 false)
  store i32 1, ptr @f, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 1, ptr %14, align 4, !tbaa !5
  br label %236

236:                                              ; preds = %276, %235
  %237 = load i32, ptr %14, align 4, !tbaa !5
  %238 = load i32, ptr %10, align 4, !tbaa !5
  %239 = icmp sle i32 %237, %238
  br i1 %239, label %241, label %240

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

241:                                              ; preds = %236
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %242 = load i32, ptr %7, align 4, !tbaa !5
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %243
  %245 = getelementptr inbounds %struct.Q, ptr %244, i32 0, i32 3
  %246 = load i32, ptr %245, align 4, !tbaa !22
  store i32 %246, ptr %15, align 4, !tbaa !5
  br label %247

247:                                              ; preds = %272, %241
  %248 = load i32, ptr %15, align 4, !tbaa !5
  %249 = load i32, ptr %14, align 4, !tbaa !5
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [3010 x i32], ptr @b, i64 0, i64 %250
  %252 = load i32, ptr %251, align 4, !tbaa !5
  %253 = icmp sge i32 %248, %252
  br i1 %253, label %255, label %254

254:                                              ; preds = %247
  store i32 26, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %275

255:                                              ; preds = %247
  %256 = load i32, ptr %15, align 4, !tbaa !5
  %257 = sext i32 %256 to i64
  %258 = getelementptr inbounds [110 x i32], ptr @f, i64 0, i64 %257
  %259 = load i32, ptr %15, align 4, !tbaa !5
  %260 = load i32, ptr %14, align 4, !tbaa !5
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds [3010 x i32], ptr @b, i64 0, i64 %261
  %263 = load i32, ptr %262, align 4, !tbaa !5
  %264 = sub nsw i32 %259, %263
  %265 = sext i32 %264 to i64
  %266 = getelementptr inbounds [110 x i32], ptr @f, i64 0, i64 %265
  %267 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %258, ptr noundef nonnull align 4 dereferenceable(4) %266)
  %268 = load i32, ptr %267, align 4, !tbaa !5
  %269 = load i32, ptr %15, align 4, !tbaa !5
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds [110 x i32], ptr @f, i64 0, i64 %270
  store i32 %268, ptr %271, align 4, !tbaa !5
  br label %272

272:                                              ; preds = %255
  %273 = load i32, ptr %15, align 4, !tbaa !5
  %274 = add nsw i32 %273, -1
  store i32 %274, ptr %15, align 4, !tbaa !5
  br label %247, !llvm.loop !26

275:                                              ; preds = %254
  br label %276

276:                                              ; preds = %275
  %277 = load i32, ptr %14, align 4, !tbaa !5
  %278 = add nsw i32 %277, 1
  store i32 %278, ptr %14, align 4, !tbaa !5
  br label %236, !llvm.loop !27

279:                                              ; preds = %240
  %280 = load i32, ptr %7, align 4, !tbaa !5
  %281 = sext i32 %280 to i64
  %282 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %281
  %283 = getelementptr inbounds %struct.Q, ptr %282, i32 0, i32 3
  %284 = load i32, ptr %283, align 4, !tbaa !22
  %285 = sext i32 %284 to i64
  %286 = getelementptr inbounds [110 x i32], ptr @f, i64 0, i64 %285
  %287 = load i32, ptr %286, align 4, !tbaa !5
  %288 = icmp ne i32 %287, 0
  br i1 %288, label %289, label %297

289:                                              ; preds = %279
  %290 = load i32, ptr %7, align 4, !tbaa !5
  %291 = sext i32 %290 to i64
  %292 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %291
  %293 = getelementptr inbounds %struct.Q, ptr %292, i32 0, i32 4
  %294 = load i32, ptr %293, align 4, !tbaa !14
  %295 = sext i32 %294 to i64
  %296 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %295
  store i32 0, ptr %296, align 4, !tbaa !5
  br label %305

297:                                              ; preds = %279
  %298 = load i32, ptr %7, align 4, !tbaa !5
  %299 = sext i32 %298 to i64
  %300 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %299
  %301 = getelementptr inbounds %struct.Q, ptr %300, i32 0, i32 4
  %302 = load i32, ptr %301, align 4, !tbaa !14
  %303 = sext i32 %302 to i64
  %304 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %303
  store i32 1, ptr %304, align 4, !tbaa !5
  br label %305

305:                                              ; preds = %297, %289
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %306

306:                                              ; preds = %305, %168
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %307

307:                                              ; preds = %306
  %308 = load i32, ptr %7, align 4, !tbaa !5
  %309 = add nsw i32 %308, 1
  store i32 %309, ptr %7, align 4, !tbaa !5
  br label %104, !llvm.loop !28

310:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 1, ptr %16, align 4, !tbaa !5
  br label %311

311:                                              ; preds = %322, %310
  %312 = load i32, ptr %16, align 4, !tbaa !5
  %313 = load i32, ptr @m, align 4, !tbaa !5
  %314 = icmp sle i32 %312, %313
  br i1 %314, label %316, label %315

315:                                              ; preds = %311
  store i32 29, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %325

316:                                              ; preds = %311
  %317 = load i32, ptr %16, align 4, !tbaa !5
  %318 = sext i32 %317 to i64
  %319 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %318
  %320 = load i32, ptr %319, align 4, !tbaa !5
  %321 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %320)
  br label %322

322:                                              ; preds = %316
  %323 = load i32, ptr %16, align 4, !tbaa !5
  %324 = add nsw i32 %323, 1
  store i32 %324, ptr %16, align 4, !tbaa !5
  br label %311, !llvm.loop !29

325:                                              ; preds = %315
  %326 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %18, !llvm.loop !30

327:                                              ; preds = %18
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %328 = load i32, ptr %1, align 4
  ret i32 %328
}

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

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

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

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

; 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 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 #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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!12, !6, i64 8}
!12 = !{!"_ZTS1A", !6, i64 0, !6, i64 4, !6, i64 8}
!13 = distinct !{!13, !10}
!14 = !{!15, !6, i64 16}
!15 = !{!"_ZTS1Q", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!16 = distinct !{!16, !10}
!17 = !{!12, !6, i64 4}
!18 = !{!15, !6, i64 8}
!19 = !{!12, !6, i64 0}
!20 = distinct !{!20, !10}
!21 = !{!15, !6, i64 4}
!22 = !{!15, !6, i64 12}
!23 = !{!15, !6, i64 0}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}
!28 = distinct !{!28, !10}
!29 = distinct !{!29, !10}
!30 = distinct !{!30, !10}


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

%struct.A = type { i32, i32, i32 }
%struct.Q = type { i32, i32, i32, i32, i32 }

@a = external dso_local global [20010 x %struct.A], align 16
@q = external dso_local global [100010 x %struct.Q], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@C = external dso_local local_unnamed_addr global [20010 x [110 x i32]], align 16
@ans = external dso_local local_unnamed_addr global [100010 x i32], align 16
@b = external dso_local local_unnamed_addr global [3010 x i32], align 16
@f = external dso_local global [110 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 [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3cmp1AS_(i64, i32, i64, i32) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4cmp21QS_(ptr noundef byval(%struct.Q) align 8, ptr noundef byval(%struct.Q) align 8) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3addii(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 nounwind uwtable
declare dso_local noundef i32 @_Z5queryii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %3 = load i32, ptr %1, align 4, !tbaa !5
  %4 = add nsw i32 %3, -1
  store i32 %4, ptr %1, align 4, !tbaa !5
  %.not144 = icmp eq i32 %3, 0
  br i1 %.not144, label %._crit_edge147, label %.lr.ph146

.lr.ph146:                                        ; preds = %0, %._crit_edge142
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not8297 = icmp slt i32 %6, 1
  br i1 %.not8297, label %.preheader94.._crit_edge_crit_edge, label %.lr.ph

.preheader94:                                     ; preds = %.lr.ph
  %.not8399 = icmp slt i32 %10, 1
  br i1 %.not8399, label %.preheader94.._crit_edge_crit_edge, label %.lr.ph101

.preheader94.._crit_edge_crit_edge:               ; preds = %.lr.ph146, %.preheader94
  %7 = phi i32 [ %10, %.preheader94 ], [ %6, %.lr.ph146 ]
  %.pre178 = sext i32 %7 to i64
  br label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph146, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.lr.ph146 ]
  %8 = getelementptr inbounds [20010 x %struct.A], ptr @a, i64 0, i64 %indvars.iv
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %8)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %.not82.not = icmp slt i64 %indvars.iv, %11
  br i1 %.not82.not, label %.lr.ph, label %.preheader94, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph101, %.preheader94.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre178, %.preheader94.._crit_edge_crit_edge ], [ %19, %.lr.ph101 ]
  %gep = getelementptr %struct.A, ptr getelementptr inbounds (i8, ptr @a, i64 12), i64 %.pre-phi
  call void @_ZSt4sortIP1APFiS0_S0_EEvT_S4_T0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 12), ptr noundef nonnull %gep, ptr noundef nonnull @_Z3cmp1AS_)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8804400) @C, i8 0, i64 8804400, i1 false)
  %12 = load i32, ptr @m, align 4, !tbaa !5
  %.not84102 = icmp slt i32 %12, 1
  br i1 %.not84102, label %._crit_edge.._crit_edge106_crit_edge, label %.lr.ph105

._crit_edge.._crit_edge106_crit_edge:             ; preds = %._crit_edge
  %.pre179 = sext i32 %12 to i64
  br label %._crit_edge106

.lr.ph101:                                        ; preds = %.preheader94, %.lr.ph101
  %indvars.iv154 = phi i64 [ %indvars.iv.next155, %.lr.ph101 ], [ 1, %.preheader94 ]
  %13 = getelementptr inbounds [20010 x %struct.A], ptr @a, i64 0, i64 %indvars.iv154
  %14 = getelementptr inbounds i8, ptr %13, i64 4
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %14)
  %16 = getelementptr inbounds i8, ptr %13, i64 8
  %17 = trunc nuw nsw i64 %indvars.iv154 to i32
  store i32 %17, ptr %16, align 4, !tbaa !11
  %indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %.not83.not = icmp slt i64 %indvars.iv154, %19
  br i1 %.not83.not, label %.lr.ph101, label %._crit_edge, !llvm.loop !13

._crit_edge106:                                   ; preds = %.lr.ph105, %._crit_edge.._crit_edge106_crit_edge
  %.pre-phi180 = phi i64 [ %.pre179, %._crit_edge.._crit_edge106_crit_edge ], [ %33, %.lr.ph105 ]
  %gep143 = getelementptr %struct.Q, ptr getelementptr inbounds (i8, ptr @q, i64 20), i64 %.pre-phi180
  call void @_ZSt4sortIP1QPFiS0_S0_EEvT_S4_T0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @q, i64 20), ptr noundef nonnull %gep143, ptr noundef nonnull @_Z4cmp21QS_)
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [20010 x %struct.A], ptr @a, i64 0, i64 %22, i32 1
  store i32 1000000010, ptr %23, align 4, !tbaa !14
  %24 = load i32, ptr @m, align 4, !tbaa !5
  %.not85136 = icmp slt i32 %24, 1
  br i1 %.not85136, label %._crit_edge142, label %.preheader92

.lr.ph105:                                        ; preds = %._crit_edge, %.lr.ph105
  %indvars.iv157 = phi i64 [ %indvars.iv.next158, %.lr.ph105 ], [ 1, %._crit_edge ]
  %25 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %indvars.iv157
  %26 = getelementptr inbounds i8, ptr %25, i64 4
  %27 = getelementptr inbounds i8, ptr %25, i64 8
  %28 = getelementptr inbounds i8, ptr %25, i64 12
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %25, ptr noundef nonnull %26, ptr noundef nonnull %27, ptr noundef nonnull %28)
  %30 = getelementptr inbounds i8, ptr %25, i64 16
  %31 = trunc nuw nsw i64 %indvars.iv157 to i32
  store i32 %31, ptr %30, align 4, !tbaa !15
  %indvars.iv.next158 = add nuw nsw i64 %indvars.iv157, 1
  %32 = load i32, ptr @m, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %.not84.not = icmp slt i64 %indvars.iv157, %33
  br i1 %.not84.not, label %.lr.ph105, label %._crit_edge106, !llvm.loop !17

.preheader93:                                     ; preds = %122
  %.not86139 = icmp slt i32 %123, 1
  br i1 %.not86139, label %._crit_edge142, label %.lr.ph141

.preheader92:                                     ; preds = %._crit_edge106, %122
  %indvars.iv172 = phi i64 [ %indvars.iv.next173, %122 ], [ 1, %._crit_edge106 ]
  %.074137 = phi i32 [ %.175.lcssa, %122 ], [ 1, %._crit_edge106 ]
  %34 = getelementptr inbounds [100010 x %struct.Q], ptr @q, i64 0, i64 %indvars.iv172
  %35 = getelementptr inbounds i8, ptr %34, i64 8
  %36 = sext i32 %.074137 to i64
  %37 = getelementptr inbounds [20010 x %struct.A], ptr @a, i64 0, i64 %36
  %38 = getelementptr inbounds i8, ptr %37, i64 4
  %39 = load i32, ptr %38, align 4, !tbaa !14
  %40 = load i32, ptr %35, align 4, !tbaa !18
  %41 = icmp sle i32 %39, %40
  %42 = load i32, ptr @n, align 4
  %43 = icmp sle i32 %.074137, %42
  %44 = select i1 %41, i1 %43, i1 false
  br i1 %44, label %.lr.ph109, label %._crit_edge110

.lr.ph109:                                        ; preds = %.preheader92, %.lr.ph109
  %indvars.iv160 = phi i64 [ %indvars.iv.next161, %.lr.ph109 ], [ %36, %.preheader92 ]
  %45 = phi ptr [ %49, %.lr.ph109 ], [ %37, %.preheader92 ]
  %46 = getelementptr inbounds i8, ptr %45, i64 8
  %47 = load i32, ptr %46, align 4, !tbaa !11
  %48 = load i32, ptr %45, align 4, !tbaa !19
  call void @_Z3addii(i32 noundef %47, i32 noundef %48)
  %indvars.iv.next161 = add nsw i64 %indvars.iv160, 1
  %49 = getelementptr inbounds [20010 x %struct.A], ptr @a, i64 0, i64 %indvars.iv.next161
  %50 = getelementptr inbounds i8, ptr %49, i64 4
  %51 = load i32, ptr %50, align 4, !tbaa !14
  %52 = load i32, ptr %35, align 4, !tbaa !18
  %53 = icmp sle i32 %51, %52
  %54 = load i32, ptr @n, align 4
  %55 = sext i32 %54 to i64
  %56 = icmp slt i64 %indvars.iv160, %55
  %57 = select i1 %53, i1 %56, i1 false
  br i1 %57, label %.lr.ph109, label %._crit_edge110.loopexit, !llvm.loop !20

._crit_edge110.loopexit:                          ; preds = %.lr.ph109
  %58 = trunc nsw i64 %indvars.iv.next161 to i32
  br label %._crit_edge110

._crit_edge110:                                   ; preds = %._crit_edge110.loopexit, %.preheader92
  %.175.lcssa = phi i32 [ %.074137, %.preheader92 ], [ %58, %._crit_edge110.loopexit ]
  %59 = getelementptr inbounds i8, ptr %34, i64 4
  %60 = load i32, ptr %59, align 4, !tbaa !21
  %61 = getelementptr inbounds i8, ptr %34, i64 12
  %62 = load i32, ptr %61, align 4, !tbaa !22
  %63 = call noundef i32 @_Z5queryii(i32 noundef %60, i32 noundef %62)
  %64 = load i32, ptr %34, align 4, !tbaa !23
  %65 = add nsw i32 %64, -1
  %66 = load i32, ptr %61, align 4, !tbaa !22
  %67 = call noundef i32 @_Z5queryii(i32 noundef %65, i32 noundef %66)
  %.not87 = icmp eq i32 %63, %67
  br i1 %.not87, label %.preheader, label %70

.preheader:                                       ; preds = %._crit_edge110
  %68 = load i32, ptr %61, align 4, !tbaa !22
  %69 = icmp sgt i32 %68, 1
  br i1 %69, label %.lr.ph123, label %._crit_edge124.thread

._crit_edge124.thread:                            ; preds = %.preheader
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(440) @f, i8 0, i64 440, i1 false)
  store i32 1, ptr @f, align 16, !tbaa !5
  br label %._crit_edge135

70:                                               ; preds = %._crit_edge110
  %71 = getelementptr inbounds i8, ptr %34, i64 16
  %72 = load i32, ptr %71, align 4, !tbaa !15
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %73
  store i32 0, ptr %74, align 4, !tbaa !5
  br label %122

._crit_edge124:                                   ; preds = %95
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(440) @f, i8 0, i64 440, i1 false)
  store i32 1, ptr @f, align 16, !tbaa !5
  %.not88131 = icmp slt i32 %.2, 1
  br i1 %.not88131, label %._crit_edge135, label %.lr.ph134.preheader

.lr.ph134.preheader:                              ; preds = %._crit_edge124
  %75 = add nuw i32 %.2, 1
  %wide.trip.count = zext i32 %75 to i64
  br label %.lr.ph134

.lr.ph123:                                        ; preds = %.preheader, %95
  %.071122 = phi i32 [ %96, %95 ], [ 1, %.preheader ]
  %.072121 = phi i32 [ %.2, %95 ], [ 0, %.preheader ]
  %76 = load i32, ptr %59, align 4, !tbaa !21
  %77 = call noundef i32 @_Z5queryii(i32 noundef %76, i32 noundef %.071122)
  %78 = load i32, ptr %34, align 4, !tbaa !23
  %79 = add nsw i32 %78, -1
  %80 = call noundef i32 @_Z5queryii(i32 noundef %79, i32 noundef %.071122)
  %81 = sub nsw i32 %77, %80
  %82 = icmp sgt i32 %81, 1
  br i1 %82, label %.lr.ph117.preheader, label %._crit_edge118

.lr.ph117.preheader:                              ; preds = %.lr.ph123
  %83 = sext i32 %.072121 to i64
  br label %.lr.ph117

.lr.ph117:                                        ; preds = %.lr.ph117.preheader, %.lr.ph117
  %indvars.iv163 = phi i64 [ %83, %.lr.ph117.preheader ], [ %indvars.iv.next164, %.lr.ph117 ]
  %.069115 = phi i32 [ 1, %.lr.ph117.preheader ], [ %87, %.lr.ph117 ]
  %.070114 = phi i32 [ %81, %.lr.ph117.preheader ], [ %86, %.lr.ph117 ]
  %84 = mul nsw i32 %.069115, %.071122
  %indvars.iv.next164 = add nsw i64 %indvars.iv163, 1
  %85 = getelementptr inbounds [3010 x i32], ptr @b, i64 0, i64 %indvars.iv.next164
  store i32 %84, ptr %85, align 4, !tbaa !5
  %86 = sub nsw i32 %.070114, %.069115
  %87 = shl i32 %.069115, 1
  %88 = icmp slt i32 %87, %86
  br i1 %88, label %.lr.ph117, label %._crit_edge118.loopexit, !llvm.loop !24

._crit_edge118.loopexit:                          ; preds = %.lr.ph117
  %89 = trunc nsw i64 %indvars.iv.next164 to i32
  br label %._crit_edge118

._crit_edge118:                                   ; preds = %._crit_edge118.loopexit, %.lr.ph123
  %.1.lcssa = phi i32 [ %.072121, %.lr.ph123 ], [ %89, %._crit_edge118.loopexit ]
  %.070.lcssa = phi i32 [ %81, %.lr.ph123 ], [ %86, %._crit_edge118.loopexit ]
  %.not91 = icmp eq i32 %.070.lcssa, 0
  br i1 %.not91, label %95, label %90

90:                                               ; preds = %._crit_edge118
  %91 = mul nsw i32 %.070.lcssa, %.071122
  %92 = add nsw i32 %.1.lcssa, 1
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [3010 x i32], ptr @b, i64 0, i64 %93
  store i32 %91, ptr %94, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %90, %._crit_edge118
  %.2 = phi i32 [ %92, %90 ], [ %.1.lcssa, %._crit_edge118 ]
  %96 = add nuw nsw i32 %.071122, 1
  %97 = load i32, ptr %61, align 4, !tbaa !22
  %98 = icmp slt i32 %96, %97
  br i1 %98, label %.lr.ph123, label %._crit_edge124, !llvm.loop !25

._crit_edge135.loopexit:                          ; preds = %._crit_edge130
  %.pre = load i32, ptr %61, align 4, !tbaa !22
  br label %._crit_edge135

._crit_edge135:                                   ; preds = %._crit_edge124.thread, %._crit_edge135.loopexit, %._crit_edge124
  %99 = phi i32 [ %.pre, %._crit_edge135.loopexit ], [ %97, %._crit_edge124 ], [ %68, %._crit_edge124.thread ]
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [110 x i32], ptr @f, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %.not89 = icmp eq i32 %102, 0
  %103 = getelementptr inbounds i8, ptr %34, i64 16
  %104 = load i32, ptr %103, align 4, !tbaa !15
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %105
  br i1 %.not89, label %121, label %120

.lr.ph134:                                        ; preds = %.lr.ph134.preheader, %._crit_edge130
  %indvars.iv169 = phi i64 [ 1, %.lr.ph134.preheader ], [ %indvars.iv.next170, %._crit_edge130 ]
  %107 = load i32, ptr %61, align 4, !tbaa !22
  %108 = getelementptr inbounds [3010 x i32], ptr @b, i64 0, i64 %indvars.iv169
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %.not90126 = icmp slt i32 %107, %109
  br i1 %.not90126, label %._crit_edge130, label %.lr.ph129.preheader

.lr.ph129.preheader:                              ; preds = %.lr.ph134
  %110 = sext i32 %107 to i64
  br label %.lr.ph129

._crit_edge130:                                   ; preds = %.lr.ph129, %.lr.ph134
  %indvars.iv.next170 = add nuw nsw i64 %indvars.iv169, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next170, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge135.loopexit, label %.lr.ph134, !llvm.loop !26

.lr.ph129:                                        ; preds = %.lr.ph129.preheader, %.lr.ph129
  %indvars.iv166 = phi i64 [ %110, %.lr.ph129.preheader ], [ %indvars.iv.next167, %.lr.ph129 ]
  %111 = phi i32 [ %109, %.lr.ph129.preheader ], [ %118, %.lr.ph129 ]
  %112 = getelementptr inbounds [110 x i32], ptr @f, i64 0, i64 %indvars.iv166
  %113 = sext i32 %111 to i64
  %114 = sub nsw i64 %indvars.iv166, %113
  %115 = getelementptr inbounds [110 x i32], ptr @f, i64 0, i64 %114
  %116 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %112, ptr noundef nonnull align 4 dereferenceable(4) %115)
  %117 = load i32, ptr %116, align 4, !tbaa !5
  store i32 %117, ptr %112, align 4, !tbaa !5
  %indvars.iv.next167 = add nsw i64 %indvars.iv166, -1
  %118 = load i32, ptr %108, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %.not90.not = icmp sgt i64 %indvars.iv166, %119
  br i1 %.not90.not, label %.lr.ph129, label %._crit_edge130, !llvm.loop !27

120:                                              ; preds = %._crit_edge135
  store i32 0, ptr %106, align 4, !tbaa !5
  br label %122

121:                                              ; preds = %._crit_edge135
  store i32 1, ptr %106, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %120, %121, %70
  %indvars.iv.next173 = add nuw nsw i64 %indvars.iv172, 1
  %123 = load i32, ptr @m, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %.not85.not = icmp slt i64 %indvars.iv172, %124
  br i1 %.not85.not, label %.preheader92, label %.preheader93, !llvm.loop !28

._crit_edge142:                                   ; preds = %.lr.ph141, %._crit_edge106, %.preheader93
  %125 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %126 = load i32, ptr %1, align 4, !tbaa !5
  %127 = add nsw i32 %126, -1
  store i32 %127, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %126, 0
  br i1 %.not, label %._crit_edge147, label %.lr.ph146, !llvm.loop !29

.lr.ph141:                                        ; preds = %.preheader93, %.lr.ph141
  %indvars.iv175 = phi i64 [ %indvars.iv.next176, %.lr.ph141 ], [ 1, %.preheader93 ]
  %128 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %indvars.iv175
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %129)
  %indvars.iv.next176 = add nuw nsw i64 %indvars.iv175, 1
  %131 = load i32, ptr @m, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %.not86.not = icmp slt i64 %indvars.iv175, %132
  br i1 %.not86.not, label %.lr.ph141, label %._crit_edge142, !llvm.loop !30

._crit_edge147:                                   ; preds = %._crit_edge142, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0
}

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

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

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

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

; 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 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 #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 = { 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 nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!12, !6, i64 8}
!12 = !{!"_ZTS1A", !6, i64 0, !6, i64 4, !6, i64 8}
!13 = distinct !{!13, !10}
!14 = !{!12, !6, i64 4}
!15 = !{!16, !6, i64 16}
!16 = !{!"_ZTS1Q", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!17 = distinct !{!17, !10}
!18 = !{!16, !6, i64 8}
!19 = !{!12, !6, i64 0}
!20 = distinct !{!20, !10}
!21 = !{!16, !6, i64 4}
!22 = !{!16, !6, i64 12}
!23 = !{!16, !6, i64 0}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}
!28 = distinct !{!28, !10}
!29 = distinct !{!29, !10}
!30 = distinct !{!30, !10}


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