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

; 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
@q = external dso_local global i32, align 4
@que = external dso_local global [260100 x i32], align 16
@l = external dso_local global i32, align 4
@r = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@vis = external dso_local global [510 x [510 x i8]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZL2dx = external hidden constant [4 x i32], align 16
@_ZL2dy = external hidden constant [4 x i32], align 16
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3ridiRiS_(i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5vaildii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %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 [4 x i32], align 16
  %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
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca [4 x i32], align 16
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %325, %0
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = load i32, ptr @t, align 4, !tbaa !5
  %32 = icmp sle i32 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %328

34:                                               ; preds = %29
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %35)
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @n, ptr noundef @m, ptr noundef @q)
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 260100, i1 false)
  store i32 0, ptr @ans, align 4, !tbaa !5
  store i32 0, ptr @r, align 4, !tbaa !5
  store i32 0, ptr @l, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  br label %38

38:                                               ; preds = %170, %34
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = load i32, ptr @q, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %173

43:                                               ; preds = %38
  %44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %5, ptr noundef %6)
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = add nsw i32 %45, -1
  store i32 %46, ptr %5, align 4, !tbaa !5
  %47 = load i32, ptr %6, align 4, !tbaa !5
  %48 = add nsw i32 %47, -1
  store i32 %48, ptr %6, align 4, !tbaa !5
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %50
  %52 = load i32, ptr %6, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [510 x i8], ptr %51, i64 0, i64 %53
  %55 = load i8, ptr %54, align 1, !tbaa !9, !range !11, !noundef !12
  %56 = trunc i8 %55 to i1
  br i1 %56, label %57, label %58

57:                                               ; preds = %43
  br label %170

58:                                               ; preds = %43
  %59 = load i32, ptr %5, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %60
  %62 = load i32, ptr %6, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [510 x i8], ptr %61, i64 0, i64 %63
  store i8 1, ptr %64, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %166, %58
  %66 = load i32, ptr %7, align 4, !tbaa !5
  %67 = icmp slt i32 %66, 4
  br i1 %67, label %69, label %68

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

69:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %70 = load i32, ptr %5, align 4, !tbaa !5
  %71 = load i32, ptr %7, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [4 x i32], ptr @_ZL2dx, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = add nsw i32 %70, %74
  store i32 %75, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = load i32, ptr %7, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [4 x i32], ptr @_ZL2dy, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = add nsw i32 %76, %80
  store i32 %81, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #5
  call void @llvm.memset.p0.i64(ptr align 16 %11, i8 0, i64 16, i1 false)
  %82 = load i32, ptr %8, align 4, !tbaa !5
  %83 = load i32, ptr %9, align 4, !tbaa !5
  %84 = call noundef zeroext i1 @_Z5vaildii(i32 noundef %82, i32 noundef %83)
  br i1 %84, label %85, label %94

85:                                               ; preds = %69
  %86 = load i32, ptr %8, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %87
  %89 = load i32, ptr %9, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [510 x i8], ptr %88, i64 0, i64 %90
  %92 = load i8, ptr %91, align 1, !tbaa !9, !range !11, !noundef !12
  %93 = trunc i8 %92 to i1
  br i1 %93, label %94, label %95

94:                                               ; preds = %85, %69
  store i32 10, ptr %3, align 4
  br label %163

95:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %132, %95
  %97 = load i32, ptr %12, align 4, !tbaa !5
  %98 = icmp slt i32 %97, 4
  br i1 %98, label %100, label %99

99:                                               ; preds = %96
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %135

100:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %101 = load i32, ptr %8, align 4, !tbaa !5
  %102 = load i32, ptr %12, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [4 x i32], ptr @_ZL2dx, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = add nsw i32 %101, %105
  store i32 %106, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %107 = load i32, ptr %9, align 4, !tbaa !5
  %108 = load i32, ptr %12, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [4 x i32], ptr @_ZL2dy, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = add nsw i32 %107, %111
  store i32 %112, ptr %14, align 4, !tbaa !5
  %113 = load i32, ptr %13, align 4, !tbaa !5
  %114 = load i32, ptr %14, align 4, !tbaa !5
  %115 = call noundef zeroext i1 @_Z5vaildii(i32 noundef %113, i32 noundef %114)
  br i1 %115, label %116, label %131

116:                                              ; preds = %100
  %117 = load i32, ptr %13, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %118
  %120 = load i32, ptr %14, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [510 x i8], ptr %119, i64 0, i64 %121
  %123 = load i8, ptr %122, align 1, !tbaa !9, !range !11, !noundef !12
  %124 = trunc i8 %123 to i1
  br i1 %124, label %125, label %131

125:                                              ; preds = %116
  %126 = load i32, ptr %12, align 4, !tbaa !5
  %127 = load i32, ptr %10, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %10, align 4, !tbaa !5
  %129 = sext i32 %127 to i64
  %130 = getelementptr inbounds [4 x i32], ptr %11, i64 0, i64 %129
  store i32 %126, ptr %130, align 4, !tbaa !5
  br label %131

131:                                              ; preds = %125, %116, %100
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %132

132:                                              ; preds = %131
  %133 = load i32, ptr %12, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %12, align 4, !tbaa !5
  br label %96, !llvm.loop !13

135:                                              ; preds = %99
  %136 = load i32, ptr %10, align 4, !tbaa !5
  %137 = icmp sgt i32 %136, 2
  br i1 %137, label %148, label %138

138:                                              ; preds = %135
  %139 = load i32, ptr %10, align 4, !tbaa !5
  %140 = icmp eq i32 %139, 2
  br i1 %140, label %141, label %162

141:                                              ; preds = %138
  %142 = getelementptr inbounds [4 x i32], ptr %11, i64 0, i64 0
  %143 = load i32, ptr %142, align 16, !tbaa !5
  %144 = getelementptr inbounds [4 x i32], ptr %11, i64 0, i64 1
  %145 = load i32, ptr %144, align 4, !tbaa !5
  %146 = add nsw i32 %143, %145
  %147 = icmp ne i32 %146, 3
  br i1 %147, label %148, label %162

148:                                              ; preds = %141, %135
  %149 = load i32, ptr %8, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %150
  %152 = load i32, ptr %9, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [510 x i8], ptr %151, i64 0, i64 %153
  store i8 1, ptr %154, align 1, !tbaa !9
  %155 = load i32, ptr %8, align 4, !tbaa !5
  %156 = load i32, ptr %9, align 4, !tbaa !5
  %157 = call noundef i32 @_Z3idxii(i32 noundef %155, i32 noundef %156)
  %158 = load i32, ptr @r, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr @r, align 4, !tbaa !5
  %160 = sext i32 %158 to i64
  %161 = getelementptr inbounds [260100 x i32], ptr @que, i64 0, i64 %160
  store i32 %157, ptr %161, align 4, !tbaa !5
  br label %162

162:                                              ; preds = %148, %141, %138
  store i32 0, ptr %3, align 4
  br label %163

163:                                              ; preds = %162, %94
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %164 = load i32, ptr %3, align 4
  switch i32 %164, label %329 [
    i32 0, label %165
    i32 10, label %166
  ]

165:                                              ; preds = %163
  br label %166

166:                                              ; preds = %165, %163
  %167 = load i32, ptr %7, align 4, !tbaa !5
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr %7, align 4, !tbaa !5
  br label %65, !llvm.loop !15

169:                                              ; preds = %68
  br label %170

170:                                              ; preds = %169, %57
  %171 = load i32, ptr %4, align 4, !tbaa !5
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %4, align 4, !tbaa !5
  br label %38, !llvm.loop !16

173:                                              ; preds = %42
  br label %174

174:                                              ; preds = %289, %173
  %175 = load i32, ptr @l, align 4, !tbaa !5
  %176 = load i32, ptr @r, align 4, !tbaa !5
  %177 = icmp slt i32 %175, %176
  br i1 %177, label %178, label %290

178:                                              ; preds = %174
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %179 = load i32, ptr @l, align 4, !tbaa !5
  %180 = add nsw i32 %179, 1
  store i32 %180, ptr @l, align 4, !tbaa !5
  %181 = sext i32 %179 to i64
  %182 = getelementptr inbounds [260100 x i32], ptr @que, i64 0, i64 %181
  %183 = load i32, ptr %182, align 4, !tbaa !5
  store i32 %183, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %184 = load i32, ptr %15, align 4, !tbaa !5
  call void @_Z3ridiRiS_(i32 noundef %184, ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) %17)
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %185

185:                                              ; preds = %286, %178
  %186 = load i32, ptr %18, align 4, !tbaa !5
  %187 = icmp slt i32 %186, 4
  br i1 %187, label %189, label %188

188:                                              ; preds = %185
  store i32 16, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %289

189:                                              ; preds = %185
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %190 = load i32, ptr %16, align 4, !tbaa !5
  %191 = load i32, ptr %18, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [4 x i32], ptr @_ZL2dx, i64 0, i64 %192
  %194 = load i32, ptr %193, align 4, !tbaa !5
  %195 = add nsw i32 %190, %194
  store i32 %195, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  %196 = load i32, ptr %17, align 4, !tbaa !5
  %197 = load i32, ptr %18, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [4 x i32], ptr @_ZL2dy, i64 0, i64 %198
  %200 = load i32, ptr %199, align 4, !tbaa !5
  %201 = add nsw i32 %196, %200
  store i32 %201, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  store i32 0, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %22) #5
  call void @llvm.memset.p0.i64(ptr align 16 %22, i8 0, i64 16, i1 false)
  %202 = load i32, ptr %19, align 4, !tbaa !5
  %203 = load i32, ptr %20, align 4, !tbaa !5
  %204 = call noundef zeroext i1 @_Z5vaildii(i32 noundef %202, i32 noundef %203)
  br i1 %204, label %205, label %214

205:                                              ; preds = %189
  %206 = load i32, ptr %19, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %207
  %209 = load i32, ptr %20, align 4, !tbaa !5
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds [510 x i8], ptr %208, i64 0, i64 %210
  %212 = load i8, ptr %211, align 1, !tbaa !9, !range !11, !noundef !12
  %213 = trunc i8 %212 to i1
  br i1 %213, label %214, label %215

214:                                              ; preds = %205, %189
  store i32 18, ptr %3, align 4
  br label %283

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

216:                                              ; preds = %252, %215
  %217 = load i32, ptr %23, align 4, !tbaa !5
  %218 = icmp slt i32 %217, 4
  br i1 %218, label %220, label %219

219:                                              ; preds = %216
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  br label %255

220:                                              ; preds = %216
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  %221 = load i32, ptr %19, align 4, !tbaa !5
  %222 = load i32, ptr %23, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [4 x i32], ptr @_ZL2dx, i64 0, i64 %223
  %225 = load i32, ptr %224, align 4, !tbaa !5
  %226 = add nsw i32 %221, %225
  store i32 %226, ptr %24, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  %227 = load i32, ptr %20, align 4, !tbaa !5
  %228 = load i32, ptr %23, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [4 x i32], ptr @_ZL2dy, i64 0, i64 %229
  %231 = load i32, ptr %230, align 4, !tbaa !5
  %232 = add nsw i32 %227, %231
  store i32 %232, ptr %25, align 4, !tbaa !5
  %233 = load i32, ptr %24, align 4, !tbaa !5
  %234 = load i32, ptr %25, align 4, !tbaa !5
  %235 = call noundef zeroext i1 @_Z5vaildii(i32 noundef %233, i32 noundef %234)
  br i1 %235, label %236, label %251

236:                                              ; preds = %220
  %237 = load i32, ptr %24, align 4, !tbaa !5
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %238
  %240 = load i32, ptr %25, align 4, !tbaa !5
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [510 x i8], ptr %239, i64 0, i64 %241
  %243 = load i8, ptr %242, align 1, !tbaa !9, !range !11, !noundef !12
  %244 = trunc i8 %243 to i1
  br i1 %244, label %245, label %251

245:                                              ; preds = %236
  %246 = load i32, ptr %23, align 4, !tbaa !5
  %247 = load i32, ptr %21, align 4, !tbaa !5
  %248 = add nsw i32 %247, 1
  store i32 %248, ptr %21, align 4, !tbaa !5
  %249 = sext i32 %247 to i64
  %250 = getelementptr inbounds [4 x i32], ptr %22, i64 0, i64 %249
  store i32 %246, ptr %250, align 4, !tbaa !5
  br label %251

251:                                              ; preds = %245, %236, %220
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  br label %252

252:                                              ; preds = %251
  %253 = load i32, ptr %23, align 4, !tbaa !5
  %254 = add nsw i32 %253, 1
  store i32 %254, ptr %23, align 4, !tbaa !5
  br label %216, !llvm.loop !17

255:                                              ; preds = %219
  %256 = load i32, ptr %21, align 4, !tbaa !5
  %257 = icmp sgt i32 %256, 2
  br i1 %257, label %268, label %258

258:                                              ; preds = %255
  %259 = load i32, ptr %21, align 4, !tbaa !5
  %260 = icmp eq i32 %259, 2
  br i1 %260, label %261, label %282

261:                                              ; preds = %258
  %262 = getelementptr inbounds [4 x i32], ptr %22, i64 0, i64 0
  %263 = load i32, ptr %262, align 16, !tbaa !5
  %264 = getelementptr inbounds [4 x i32], ptr %22, i64 0, i64 1
  %265 = load i32, ptr %264, align 4, !tbaa !5
  %266 = add nsw i32 %263, %265
  %267 = icmp ne i32 %266, 3
  br i1 %267, label %268, label %282

268:                                              ; preds = %261, %255
  %269 = load i32, ptr %19, align 4, !tbaa !5
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %270
  %272 = load i32, ptr %20, align 4, !tbaa !5
  %273 = sext i32 %272 to i64
  %274 = getelementptr inbounds [510 x i8], ptr %271, i64 0, i64 %273
  store i8 1, ptr %274, align 1, !tbaa !9
  %275 = load i32, ptr %19, align 4, !tbaa !5
  %276 = load i32, ptr %20, align 4, !tbaa !5
  %277 = call noundef i32 @_Z3idxii(i32 noundef %275, i32 noundef %276)
  %278 = load i32, ptr @r, align 4, !tbaa !5
  %279 = add nsw i32 %278, 1
  store i32 %279, ptr @r, align 4, !tbaa !5
  %280 = sext i32 %278 to i64
  %281 = getelementptr inbounds [260100 x i32], ptr @que, i64 0, i64 %280
  store i32 %277, ptr %281, align 4, !tbaa !5
  br label %282

282:                                              ; preds = %268, %261, %258
  store i32 0, ptr %3, align 4
  br label %283

283:                                              ; preds = %282, %214
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  %284 = load i32, ptr %3, align 4
  switch i32 %284, label %329 [
    i32 0, label %285
    i32 18, label %286
  ]

285:                                              ; preds = %283
  br label %286

286:                                              ; preds = %285, %283
  %287 = load i32, ptr %18, align 4, !tbaa !5
  %288 = add nsw i32 %287, 1
  store i32 %288, ptr %18, align 4, !tbaa !5
  br label %185, !llvm.loop !18

289:                                              ; preds = %188
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %174, !llvm.loop !19

290:                                              ; preds = %174
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #5
  store i32 0, ptr %26, align 4, !tbaa !5
  br label %291

291:                                              ; preds = %319, %290
  %292 = load i32, ptr %26, align 4, !tbaa !5
  %293 = load i32, ptr @n, align 4, !tbaa !5
  %294 = icmp slt i32 %292, %293
  br i1 %294, label %296, label %295

295:                                              ; preds = %291
  store i32 22, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  br label %322

296:                                              ; preds = %291
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #5
  store i32 0, ptr %27, align 4, !tbaa !5
  br label %297

297:                                              ; preds = %315, %296
  %298 = load i32, ptr %27, align 4, !tbaa !5
  %299 = load i32, ptr @m, align 4, !tbaa !5
  %300 = icmp slt i32 %298, %299
  br i1 %300, label %302, label %301

301:                                              ; preds = %297
  store i32 25, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #5
  br label %318

302:                                              ; preds = %297
  %303 = load i32, ptr %26, align 4, !tbaa !5
  %304 = sext i32 %303 to i64
  %305 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %304
  %306 = load i32, ptr %27, align 4, !tbaa !5
  %307 = sext i32 %306 to i64
  %308 = getelementptr inbounds [510 x i8], ptr %305, i64 0, i64 %307
  %309 = load i8, ptr %308, align 1, !tbaa !9, !range !11, !noundef !12
  %310 = trunc i8 %309 to i1
  br i1 %310, label %311, label %314

311:                                              ; preds = %302
  %312 = load i32, ptr @ans, align 4, !tbaa !5
  %313 = add nsw i32 %312, 1
  store i32 %313, ptr @ans, align 4, !tbaa !5
  br label %314

314:                                              ; preds = %311, %302
  br label %315

315:                                              ; preds = %314
  %316 = load i32, ptr %27, align 4, !tbaa !5
  %317 = add nsw i32 %316, 1
  store i32 %317, ptr %27, align 4, !tbaa !5
  br label %297, !llvm.loop !20

318:                                              ; preds = %301
  br label %319

319:                                              ; preds = %318
  %320 = load i32, ptr %26, align 4, !tbaa !5
  %321 = add nsw i32 %320, 1
  store i32 %321, ptr %26, align 4, !tbaa !5
  br label %291, !llvm.loop !21

322:                                              ; preds = %295
  %323 = load i32, ptr @ans, align 4, !tbaa !5
  %324 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %323)
  br label %325

325:                                              ; preds = %322
  %326 = load i32, ptr %2, align 4, !tbaa !5
  %327 = add nsw i32 %326, 1
  store i32 %327, ptr %2, align 4, !tbaa !5
  br label %29, !llvm.loop !22

328:                                              ; preds = %33
  ret i32 0

329:                                              ; preds = %283, %163
  unreachable
}

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

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

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

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }

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

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


; 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
@q = external dso_local global i32, align 4
@que = external dso_local local_unnamed_addr global [260100 x i32], align 16
@l = external dso_local local_unnamed_addr global i32, align 4
@r = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@vis = external dso_local local_unnamed_addr global [510 x [510 x i8]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZL2dx = external hidden local_unnamed_addr constant [4 x i32], align 16
@_ZL2dy = external hidden local_unnamed_addr constant [4 x i32], align 16
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3ridiRiS_(i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5vaildii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca [4 x i32], align 16
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca [4 x i32], align 16
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %8 = load i32, ptr @t, align 4, !tbaa !5
  %.not100 = icmp slt i32 %8, 1
  br i1 %.not100, label %._crit_edge104, label %.lr.ph103

.lr.ph103:                                        ; preds = %0
  %9 = getelementptr inbounds i8, ptr %3, i64 4
  %10 = getelementptr inbounds i8, ptr %6, i64 4
  %11 = load i32, ptr @_ZL2dx, align 16
  %12 = load i32, ptr @_ZL2dy, align 16
  %13 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dx, i64 4), align 4
  %14 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dy, i64 4), align 4
  %15 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dx, i64 8), align 8
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dy, i64 8), align 8
  %17 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dx, i64 12), align 4
  %18 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dy, i64 12), align 4
  %19 = load i32, ptr @_ZL2dx, align 16
  %20 = load i32, ptr @_ZL2dy, align 16
  %21 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dx, i64 4), align 4
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dy, i64 4), align 4
  %23 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dx, i64 8), align 8
  %24 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dy, i64 8), align 8
  %25 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dx, i64 12), align 4
  %26 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dy, i64 12), align 4
  br label %27

._crit_edge104:                                   ; preds = %._crit_edge99, %0
  ret i32 0

27:                                               ; preds = %.lr.ph103, %._crit_edge99
  %.065101 = phi i32 [ 1, %.lr.ph103 ], [ %243, %._crit_edge99 ]
  %28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.065101)
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @q)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(260100) @vis, i8 0, i64 260100, i1 false)
  store i32 0, ptr @ans, align 4, !tbaa !5
  store i32 0, ptr @r, align 4, !tbaa !5
  store i32 0, ptr @l, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %30 = load i32, ptr @q, align 4, !tbaa !5
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  br label %.preheader79

._crit_edge:                                      ; preds = %.loopexit
  %.pre = load i32, ptr @l, align 4, !tbaa !5
  %.pre125 = load i32, ptr @r, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %32 = icmp slt i32 %.pre, %.pre125
  br i1 %32, label %.lr.ph88, label %.preheader79

.lr.ph:                                           ; preds = %27, %.loopexit
  %.06883 = phi i32 [ %124, %.loopexit ], [ 0, %27 ]
  %33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %34 = load i32, ptr %1, align 4, !tbaa !5
  %35 = add nsw i32 %34, -1
  store i32 %35, ptr %1, align 4, !tbaa !5
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = add nsw i32 %36, -1
  store i32 %37, ptr %2, align 4, !tbaa !5
  %38 = sext i32 %35 to i64
  %39 = sext i32 %37 to i64
  %40 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %38, i64 %39
  %41 = load i8, ptr %40, align 1, !tbaa !9, !range !11, !noundef !12
  %42 = trunc nuw i8 %41 to i1
  br i1 %42, label %.loopexit, label %43

43:                                               ; preds = %.lr.ph
  store i8 1, ptr %40, align 1, !tbaa !9
  br label %44

44:                                               ; preds = %43, %123
  %indvars.iv = phi i64 [ 0, %43 ], [ %indvars.iv.next, %123 ]
  %45 = load i32, ptr %1, align 4, !tbaa !5
  %46 = getelementptr inbounds [4 x i32], ptr @_ZL2dx, i64 0, i64 %indvars.iv
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = add nsw i32 %47, %45
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = getelementptr inbounds [4 x i32], ptr @_ZL2dy, i64 0, i64 %indvars.iv
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = add nsw i32 %51, %49
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %3, i8 0, i64 16, i1 false)
  %53 = call noundef zeroext i1 @_Z5vaildii(i32 noundef %48, i32 noundef %52)
  br i1 %53, label %54, label %123

54:                                               ; preds = %44
  %55 = sext i32 %48 to i64
  %56 = sext i32 %52 to i64
  %57 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %55, i64 %56
  %58 = load i8, ptr %57, align 1, !tbaa !9, !range !11, !noundef !12
  %59 = trunc nuw i8 %58 to i1
  br i1 %59, label %123, label %.preheader77.preheader

.preheader77.preheader:                           ; preds = %54
  %60 = add nsw i32 %11, %48
  %61 = add nsw i32 %12, %52
  %62 = call noundef zeroext i1 @_Z5vaildii(i32 noundef %60, i32 noundef %61)
  br i1 %62, label %63, label %.preheader77.1

63:                                               ; preds = %.preheader77.preheader
  %64 = sext i32 %60 to i64
  %65 = sext i32 %61 to i64
  %66 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %64, i64 %65
  %67 = load i8, ptr %66, align 1, !tbaa !9, !range !11, !noundef !12
  %68 = trunc nuw i8 %67 to i1
  br i1 %68, label %69, label %.preheader77.1

69:                                               ; preds = %63
  store i32 0, ptr %3, align 16, !tbaa !5
  br label %.preheader77.1

.preheader77.1:                                   ; preds = %69, %63, %.preheader77.preheader
  %.172 = phi i32 [ 1, %69 ], [ 0, %63 ], [ 0, %.preheader77.preheader ]
  %70 = add nsw i32 %13, %48
  %71 = add nsw i32 %14, %52
  %72 = call noundef zeroext i1 @_Z5vaildii(i32 noundef %70, i32 noundef %71)
  br i1 %72, label %73, label %.preheader77.2

73:                                               ; preds = %.preheader77.1
  %74 = sext i32 %70 to i64
  %75 = sext i32 %71 to i64
  %76 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %74, i64 %75
  %77 = load i8, ptr %76, align 1, !tbaa !9, !range !11, !noundef !12
  %78 = trunc nuw i8 %77 to i1
  br i1 %78, label %79, label %.preheader77.2

79:                                               ; preds = %73
  %80 = add nuw nsw i32 %.172, 1
  %81 = zext nneg i32 %.172 to i64
  %82 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 %81
  store i32 1, ptr %82, align 4, !tbaa !5
  br label %.preheader77.2

.preheader77.2:                                   ; preds = %79, %73, %.preheader77.1
  %.172.1 = phi i32 [ %80, %79 ], [ %.172, %73 ], [ %.172, %.preheader77.1 ]
  %83 = add nsw i32 %15, %48
  %84 = add nsw i32 %16, %52
  %85 = call noundef zeroext i1 @_Z5vaildii(i32 noundef %83, i32 noundef %84)
  br i1 %85, label %86, label %.preheader77.3

86:                                               ; preds = %.preheader77.2
  %87 = sext i32 %83 to i64
  %88 = sext i32 %84 to i64
  %89 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %87, i64 %88
  %90 = load i8, ptr %89, align 1, !tbaa !9, !range !11, !noundef !12
  %91 = trunc nuw i8 %90 to i1
  br i1 %91, label %92, label %.preheader77.3

92:                                               ; preds = %86
  %93 = add nuw nsw i32 %.172.1, 1
  %94 = zext nneg i32 %.172.1 to i64
  %95 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 %94
  store i32 2, ptr %95, align 4, !tbaa !5
  br label %.preheader77.3

.preheader77.3:                                   ; preds = %92, %86, %.preheader77.2
  %.172.2 = phi i32 [ %93, %92 ], [ %.172.1, %86 ], [ %.172.1, %.preheader77.2 ]
  %96 = add nsw i32 %17, %48
  %97 = add nsw i32 %18, %52
  %98 = call noundef zeroext i1 @_Z5vaildii(i32 noundef %96, i32 noundef %97)
  br i1 %98, label %99, label %109

99:                                               ; preds = %.preheader77.3
  %100 = sext i32 %96 to i64
  %101 = sext i32 %97 to i64
  %102 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %100, i64 %101
  %103 = load i8, ptr %102, align 1, !tbaa !9, !range !11, !noundef !12
  %104 = trunc nuw i8 %103 to i1
  br i1 %104, label %105, label %109

105:                                              ; preds = %99
  %106 = add nuw nsw i32 %.172.2, 1
  %107 = zext nneg i32 %.172.2 to i64
  %108 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 %107
  store i32 3, ptr %108, align 4, !tbaa !5
  br label %109

109:                                              ; preds = %105, %99, %.preheader77.3
  %.172.3 = phi i32 [ %106, %105 ], [ %.172.2, %99 ], [ %.172.2, %.preheader77.3 ]
  %110 = icmp ugt i32 %.172.3, 2
  br i1 %110, label %117, label %111

111:                                              ; preds = %109
  %112 = icmp eq i32 %.172.3, 2
  br i1 %112, label %113, label %123

113:                                              ; preds = %111
  %114 = load i32, ptr %3, align 16, !tbaa !5
  %115 = load i32, ptr %9, align 4, !tbaa !5
  %116 = add nsw i32 %115, %114
  %.not76 = icmp eq i32 %116, 3
  br i1 %.not76, label %123, label %117

117:                                              ; preds = %113, %109
  store i8 1, ptr %57, align 1, !tbaa !9
  %118 = call noundef i32 @_Z3idxii(i32 noundef %48, i32 noundef %52)
  %119 = load i32, ptr @r, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr @r, align 4, !tbaa !5
  %121 = sext i32 %119 to i64
  %122 = getelementptr inbounds [260100 x i32], ptr @que, i64 0, i64 %121
  store i32 %118, ptr %122, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %111, %113, %117, %44, %54
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 4
  br i1 %exitcond.not, label %.loopexit, label %44, !llvm.loop !13

.loopexit:                                        ; preds = %123, %.lr.ph
  %124 = add nuw nsw i32 %.06883, 1
  %125 = load i32, ptr @q, align 4, !tbaa !5
  %126 = icmp slt i32 %124, %125
  br i1 %126, label %.lr.ph, label %._crit_edge, !llvm.loop !15

.preheader79:                                     ; preds = %157, %._crit_edge.thread, %._crit_edge
  %127 = load i32, ptr @n, align 4, !tbaa !5
  %128 = icmp sgt i32 %127, 0
  %ans.promoted92 = load i32, ptr @ans, align 4, !tbaa !5
  br i1 %128, label %.preheader78.lr.ph, label %._crit_edge99

.preheader78.lr.ph:                               ; preds = %.preheader79
  %129 = load i32, ptr @m, align 4, !tbaa !5
  %130 = icmp sgt i32 %129, 0
  br i1 %130, label %.preheader78.us.preheader, label %._crit_edge99

.preheader78.us.preheader:                        ; preds = %.preheader78.lr.ph
  %wide.trip.count123 = zext nneg i32 %127 to i64
  %wide.trip.count = zext nneg i32 %129 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %131 = icmp eq i32 %129, 1
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader78.us

.preheader78.us:                                  ; preds = %.preheader78.us.preheader, %._crit_edge91.us
  %indvars.iv120 = phi i64 [ 0, %.preheader78.us.preheader ], [ %indvars.iv.next121, %._crit_edge91.us ]
  %ans.promoted9697.us = phi i32 [ %ans.promoted92, %.preheader78.us.preheader ], [ %ans.promoted94.us.lcssa, %._crit_edge91.us ]
  br i1 %131, label %._crit_edge91.us.unr-lcssa, label %.preheader78.us.new

.preheader78.us.new:                              ; preds = %.preheader78.us, %145
  %indvars.iv116 = phi i64 [ %indvars.iv.next117.1, %145 ], [ 0, %.preheader78.us ]
  %ans.promoted95.us = phi i32 [ %ans.promoted94.us.1, %145 ], [ %ans.promoted9697.us, %.preheader78.us ]
  %132 = phi i32 [ %146, %145 ], [ %ans.promoted9697.us, %.preheader78.us ]
  %niter = phi i64 [ %niter.next.1, %145 ], [ 0, %.preheader78.us ]
  %133 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %indvars.iv120, i64 %indvars.iv116
  %134 = load i8, ptr %133, align 2, !tbaa !9, !range !11, !noundef !12
  %135 = trunc nuw i8 %134 to i1
  br i1 %135, label %136, label %138

136:                                              ; preds = %.preheader78.us.new
  %137 = add nsw i32 %132, 1
  store i32 %137, ptr @ans, align 4, !tbaa !5
  br label %138

138:                                              ; preds = %136, %.preheader78.us.new
  %ans.promoted94.us = phi i32 [ %ans.promoted95.us, %.preheader78.us.new ], [ %137, %136 ]
  %139 = phi i32 [ %132, %.preheader78.us.new ], [ %137, %136 ]
  %indvars.iv.next117 = or disjoint i64 %indvars.iv116, 1
  %140 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %indvars.iv120, i64 %indvars.iv.next117
  %141 = load i8, ptr %140, align 1, !tbaa !9, !range !11, !noundef !12
  %142 = trunc nuw i8 %141 to i1
  br i1 %142, label %143, label %145

143:                                              ; preds = %138
  %144 = add nsw i32 %139, 1
  store i32 %144, ptr @ans, align 4, !tbaa !5
  br label %145

145:                                              ; preds = %143, %138
  %ans.promoted94.us.1 = phi i32 [ %ans.promoted94.us, %138 ], [ %144, %143 ]
  %146 = phi i32 [ %139, %138 ], [ %144, %143 ]
  %indvars.iv.next117.1 = add nuw nsw i64 %indvars.iv116, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge91.us.unr-lcssa, label %.preheader78.us.new, !llvm.loop !16

._crit_edge91.us.unr-lcssa:                       ; preds = %145, %.preheader78.us
  %ans.promoted94.us.lcssa.ph = phi i32 [ poison, %.preheader78.us ], [ %ans.promoted94.us.1, %145 ]
  %indvars.iv116.unr = phi i64 [ 0, %.preheader78.us ], [ %indvars.iv.next117.1, %145 ]
  %ans.promoted95.us.unr = phi i32 [ %ans.promoted9697.us, %.preheader78.us ], [ %ans.promoted94.us.1, %145 ]
  %.unr = phi i32 [ %ans.promoted9697.us, %.preheader78.us ], [ %146, %145 ]
  br i1 %lcmp.mod.not, label %._crit_edge91.us, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge91.us.unr-lcssa
  %147 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %indvars.iv120, i64 %indvars.iv116.unr
  %148 = load i8, ptr %147, align 1, !tbaa !9, !range !11, !noundef !12
  %149 = trunc nuw i8 %148 to i1
  br i1 %149, label %150, label %._crit_edge91.us

150:                                              ; preds = %.epil.preheader
  %151 = add nsw i32 %.unr, 1
  store i32 %151, ptr @ans, align 4, !tbaa !5
  br label %._crit_edge91.us

._crit_edge91.us:                                 ; preds = %.epil.preheader, %150, %._crit_edge91.us.unr-lcssa
  %ans.promoted94.us.lcssa = phi i32 [ %ans.promoted94.us.lcssa.ph, %._crit_edge91.us.unr-lcssa ], [ %ans.promoted95.us.unr, %.epil.preheader ], [ %151, %150 ]
  %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
  %exitcond124.not = icmp eq i64 %indvars.iv.next121, %wide.trip.count123
  br i1 %exitcond124.not, label %._crit_edge99, label %.preheader78.us, !llvm.loop !17

.lr.ph88:                                         ; preds = %._crit_edge, %157
  %152 = phi i32 [ %158, %157 ], [ %.pre, %._crit_edge ]
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr @l, align 4, !tbaa !5
  %154 = sext i32 %152 to i64
  %155 = getelementptr inbounds [260100 x i32], ptr @que, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  call void @_Z3ridiRiS_(i32 noundef %156, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  br label %161

157:                                              ; preds = %240
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  %158 = load i32, ptr @l, align 4, !tbaa !5
  %159 = load i32, ptr @r, align 4, !tbaa !5
  %160 = icmp slt i32 %158, %159
  br i1 %160, label %.lr.ph88, label %.preheader79, !llvm.loop !18

161:                                              ; preds = %.lr.ph88, %240
  %indvars.iv112 = phi i64 [ 0, %.lr.ph88 ], [ %indvars.iv.next113, %240 ]
  %162 = load i32, ptr %4, align 4, !tbaa !5
  %163 = getelementptr inbounds [4 x i32], ptr @_ZL2dx, i64 0, i64 %indvars.iv112
  %164 = load i32, ptr %163, align 4, !tbaa !5
  %165 = add nsw i32 %164, %162
  %166 = load i32, ptr %5, align 4, !tbaa !5
  %167 = getelementptr inbounds [4 x i32], ptr @_ZL2dy, i64 0, i64 %indvars.iv112
  %168 = load i32, ptr %167, align 4, !tbaa !5
  %169 = add nsw i32 %168, %166
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %6, i8 0, i64 16, i1 false)
  %170 = call noundef zeroext i1 @_Z5vaildii(i32 noundef %165, i32 noundef %169)
  br i1 %170, label %171, label %240

171:                                              ; preds = %161
  %172 = sext i32 %165 to i64
  %173 = sext i32 %169 to i64
  %174 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %172, i64 %173
  %175 = load i8, ptr %174, align 1, !tbaa !9, !range !11, !noundef !12
  %176 = trunc nuw i8 %175 to i1
  br i1 %176, label %240, label %.preheader.preheader

.preheader.preheader:                             ; preds = %171
  %177 = add nsw i32 %19, %165
  %178 = add nsw i32 %20, %169
  %179 = call noundef zeroext i1 @_Z5vaildii(i32 noundef %177, i32 noundef %178)
  br i1 %179, label %180, label %.preheader.1

180:                                              ; preds = %.preheader.preheader
  %181 = sext i32 %177 to i64
  %182 = sext i32 %178 to i64
  %183 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %181, i64 %182
  %184 = load i8, ptr %183, align 1, !tbaa !9, !range !11, !noundef !12
  %185 = trunc nuw i8 %184 to i1
  br i1 %185, label %186, label %.preheader.1

186:                                              ; preds = %180
  store i32 0, ptr %6, align 16, !tbaa !5
  br label %.preheader.1

.preheader.1:                                     ; preds = %186, %180, %.preheader.preheader
  %.1 = phi i32 [ 1, %186 ], [ 0, %180 ], [ 0, %.preheader.preheader ]
  %187 = add nsw i32 %21, %165
  %188 = add nsw i32 %22, %169
  %189 = call noundef zeroext i1 @_Z5vaildii(i32 noundef %187, i32 noundef %188)
  br i1 %189, label %190, label %.preheader.2

190:                                              ; preds = %.preheader.1
  %191 = sext i32 %187 to i64
  %192 = sext i32 %188 to i64
  %193 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %191, i64 %192
  %194 = load i8, ptr %193, align 1, !tbaa !9, !range !11, !noundef !12
  %195 = trunc nuw i8 %194 to i1
  br i1 %195, label %196, label %.preheader.2

196:                                              ; preds = %190
  %197 = add nuw nsw i32 %.1, 1
  %198 = zext nneg i32 %.1 to i64
  %199 = getelementptr inbounds [4 x i32], ptr %6, i64 0, i64 %198
  store i32 1, ptr %199, align 4, !tbaa !5
  br label %.preheader.2

.preheader.2:                                     ; preds = %196, %190, %.preheader.1
  %.1.1 = phi i32 [ %197, %196 ], [ %.1, %190 ], [ %.1, %.preheader.1 ]
  %200 = add nsw i32 %23, %165
  %201 = add nsw i32 %24, %169
  %202 = call noundef zeroext i1 @_Z5vaildii(i32 noundef %200, i32 noundef %201)
  br i1 %202, label %203, label %.preheader.3

203:                                              ; preds = %.preheader.2
  %204 = sext i32 %200 to i64
  %205 = sext i32 %201 to i64
  %206 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %204, i64 %205
  %207 = load i8, ptr %206, align 1, !tbaa !9, !range !11, !noundef !12
  %208 = trunc nuw i8 %207 to i1
  br i1 %208, label %209, label %.preheader.3

209:                                              ; preds = %203
  %210 = add nuw nsw i32 %.1.1, 1
  %211 = zext nneg i32 %.1.1 to i64
  %212 = getelementptr inbounds [4 x i32], ptr %6, i64 0, i64 %211
  store i32 2, ptr %212, align 4, !tbaa !5
  br label %.preheader.3

.preheader.3:                                     ; preds = %209, %203, %.preheader.2
  %.1.2 = phi i32 [ %210, %209 ], [ %.1.1, %203 ], [ %.1.1, %.preheader.2 ]
  %213 = add nsw i32 %25, %165
  %214 = add nsw i32 %26, %169
  %215 = call noundef zeroext i1 @_Z5vaildii(i32 noundef %213, i32 noundef %214)
  br i1 %215, label %216, label %226

216:                                              ; preds = %.preheader.3
  %217 = sext i32 %213 to i64
  %218 = sext i32 %214 to i64
  %219 = getelementptr inbounds [510 x [510 x i8]], ptr @vis, i64 0, i64 %217, i64 %218
  %220 = load i8, ptr %219, align 1, !tbaa !9, !range !11, !noundef !12
  %221 = trunc nuw i8 %220 to i1
  br i1 %221, label %222, label %226

222:                                              ; preds = %216
  %223 = add nuw nsw i32 %.1.2, 1
  %224 = zext nneg i32 %.1.2 to i64
  %225 = getelementptr inbounds [4 x i32], ptr %6, i64 0, i64 %224
  store i32 3, ptr %225, align 4, !tbaa !5
  br label %226

226:                                              ; preds = %222, %216, %.preheader.3
  %.1.3 = phi i32 [ %223, %222 ], [ %.1.2, %216 ], [ %.1.2, %.preheader.3 ]
  %227 = icmp ugt i32 %.1.3, 2
  br i1 %227, label %234, label %228

228:                                              ; preds = %226
  %229 = icmp eq i32 %.1.3, 2
  br i1 %229, label %230, label %240

230:                                              ; preds = %228
  %231 = load i32, ptr %6, align 16, !tbaa !5
  %232 = load i32, ptr %10, align 4, !tbaa !5
  %233 = add nsw i32 %232, %231
  %.not75 = icmp eq i32 %233, 3
  br i1 %.not75, label %240, label %234

234:                                              ; preds = %230, %226
  store i8 1, ptr %174, align 1, !tbaa !9
  %235 = call noundef i32 @_Z3idxii(i32 noundef %165, i32 noundef %169)
  %236 = load i32, ptr @r, align 4, !tbaa !5
  %237 = add nsw i32 %236, 1
  store i32 %237, ptr @r, align 4, !tbaa !5
  %238 = sext i32 %236 to i64
  %239 = getelementptr inbounds [260100 x i32], ptr @que, i64 0, i64 %238
  store i32 %235, ptr %239, align 4, !tbaa !5
  br label %240

240:                                              ; preds = %228, %230, %234, %161, %171
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #5
  %indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
  %exitcond115.not = icmp eq i64 %indvars.iv.next113, 4
  br i1 %exitcond115.not, label %157, label %161, !llvm.loop !19

._crit_edge99:                                    ; preds = %._crit_edge91.us, %.preheader79, %.preheader78.lr.ph
  %241 = phi i32 [ %ans.promoted92, %.preheader78.lr.ph ], [ %ans.promoted92, %.preheader79 ], [ %ans.promoted94.us.lcssa, %._crit_edge91.us ]
  %242 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %241)
  %243 = add nuw nsw i32 %.065101, 1
  %244 = load i32, ptr @t, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.065101, %244
  br i1 %.not.not, label %27, label %._crit_edge104, !llvm.loop !20
}

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

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

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

; 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 norecurse 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 #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }

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

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


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