; LLVM IR from tangjz/acm-icpc :: hdu/bestcoder/2015 Astar Contest (1 - 1005)

; 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
@k = external dso_local global i32, align 4
@x1 = external dso_local global i32, align 4
@y1 = external dso_local global i32, align 4
@f = external dso_local global [1010 x [1010 x [2 x i32]]], align 16
@x2 = external dso_local global i32, align 4
@y2 = external dso_local global i32, align 4
@g = external dso_local global [1010 x [1010 x [2 x i32]]], align 16
@que = external dso_local global [2040200 x i32], align 16
@l = external dso_local global i32, align 4
@r = external dso_local global i32, align 4
@vis = external dso_local global [2040200 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZL2d1 = external hidden constant [8 x [2 x i32]], align 16
@_ZL2d2 = external hidden constant [8 x [2 x i32]], align 16
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3ridiRiS_S_(i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #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 i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %24

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

28:                                               ; preds = %24
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %360

29:                                               ; preds = %24
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m, ptr noundef @k)
  store i32 0, ptr @r, align 4, !tbaa !5
  store i32 0, ptr @l, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 2040200, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @f, i8 63, i64 8160800, i1 false)
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @x1, ptr noundef @y1)
  %32 = load i32, ptr @x1, align 4, !tbaa !5
  %33 = add nsw i32 %32, -1
  store i32 %33, ptr @x1, align 4, !tbaa !5
  %34 = load i32, ptr @y1, align 4, !tbaa !5
  %35 = add nsw i32 %34, -1
  store i32 %35, ptr @y1, align 4, !tbaa !5
  %36 = load i32, ptr @x1, align 4, !tbaa !5
  %37 = load i32, ptr @y1, align 4, !tbaa !5
  %38 = call noundef i32 @_Z3idxiii(i32 noundef %36, i32 noundef %37, i32 noundef 0)
  %39 = load i32, ptr @r, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr @r, align 4, !tbaa !5
  %41 = sext i32 %39 to i64
  %42 = getelementptr inbounds [2040200 x i32], ptr @que, i64 0, i64 %41
  store i32 %38, ptr %42, align 4, !tbaa !5
  %43 = load i32, ptr @x1, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @f, i64 0, i64 %44
  %46 = load i32, ptr @y1, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [1010 x [2 x i32]], ptr %45, i64 0, i64 %47
  %49 = getelementptr inbounds [2 x i32], ptr %48, i64 0, i64 0
  store i32 0, ptr %49, align 8, !tbaa !5
  %50 = load i32, ptr @x1, align 4, !tbaa !5
  %51 = load i32, ptr @y1, align 4, !tbaa !5
  %52 = call noundef i32 @_Z3idxiii(i32 noundef %50, i32 noundef %51, i32 noundef 0)
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [2040200 x i8], ptr @vis, i64 0, i64 %53
  store i8 1, ptr %54, align 1, !tbaa !9
  br label %55

55:                                               ; preds = %160, %158, %29
  %56 = load i32, ptr @l, align 4, !tbaa !5
  %57 = load i32, ptr @r, align 4, !tbaa !5
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %59, label %161

59:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %60 = load i32, ptr @l, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr @l, align 4, !tbaa !5
  %62 = sext i32 %60 to i64
  %63 = getelementptr inbounds [2040200 x i32], ptr @que, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  store i32 %64, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %65 = load i32, ptr %4, align 4, !tbaa !5
  call void @_Z3ridiRiS_S_(i32 noundef %65, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %66 = load i32, ptr %5, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @f, i64 0, i64 %67
  %69 = load i32, ptr %6, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [1010 x [2 x i32]], ptr %68, i64 0, i64 %70
  %72 = load i32, ptr %7, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [2 x i32], ptr %71, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = load i32, ptr @k, align 4, !tbaa !5
  %77 = icmp sge i32 %75, %76
  br i1 %77, label %78, label %79

78:                                               ; preds = %59
  store i32 5, ptr %3, align 4
  br label %158, !llvm.loop !11

79:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %154, %79
  %81 = load i32, ptr %8, align 4, !tbaa !5
  %82 = icmp slt i32 %81, 8
  br i1 %82, label %84, label %83

83:                                               ; preds = %80
  store i32 7, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %157

84:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = load i32, ptr %8, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [8 x [2 x i32]], ptr @_ZL2d1, i64 0, i64 %87
  %89 = getelementptr inbounds [2 x i32], ptr %88, i64 0, i64 0
  %90 = load i32, ptr %89, align 8, !tbaa !5
  %91 = add nsw i32 %85, %90
  store i32 %91, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = load i32, ptr %8, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [8 x [2 x i32]], ptr @_ZL2d1, i64 0, i64 %94
  %96 = getelementptr inbounds [2 x i32], ptr %95, i64 0, i64 1
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = add nsw i32 %92, %97
  store i32 %98, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %99 = load i32, ptr %9, align 4, !tbaa !5
  %100 = load i32, ptr %10, align 4, !tbaa !5
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = xor i32 %101, 1
  %103 = call noundef i32 @_Z3idxiii(i32 noundef %99, i32 noundef %100, i32 noundef %102)
  store i32 %103, ptr %11, align 4, !tbaa !5
  %104 = load i32, ptr %9, align 4, !tbaa !5
  %105 = icmp sge i32 %104, 0
  br i1 %105, label %106, label %153

106:                                              ; preds = %84
  %107 = load i32, ptr %9, align 4, !tbaa !5
  %108 = load i32, ptr @n, align 4, !tbaa !5
  %109 = icmp slt i32 %107, %108
  br i1 %109, label %110, label %153

110:                                              ; preds = %106
  %111 = load i32, ptr %10, align 4, !tbaa !5
  %112 = icmp sge i32 %111, 0
  br i1 %112, label %113, label %153

113:                                              ; preds = %110
  %114 = load i32, ptr %10, align 4, !tbaa !5
  %115 = load i32, ptr @m, align 4, !tbaa !5
  %116 = icmp slt i32 %114, %115
  br i1 %116, label %117, label %153

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

123:                                              ; preds = %117
  %124 = load i32, ptr %5, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @f, i64 0, i64 %125
  %127 = load i32, ptr %6, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [1010 x [2 x i32]], ptr %126, i64 0, i64 %128
  %130 = load i32, ptr %7, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [2 x i32], ptr %129, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  %135 = load i32, ptr %9, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @f, i64 0, i64 %136
  %138 = load i32, ptr %10, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [1010 x [2 x i32]], ptr %137, i64 0, i64 %139
  %141 = load i32, ptr %7, align 4, !tbaa !5
  %142 = xor i32 %141, 1
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [2 x i32], ptr %140, i64 0, i64 %143
  store i32 %134, ptr %144, align 4, !tbaa !5
  %145 = load i32, ptr %11, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [2040200 x i8], ptr @vis, i64 0, i64 %146
  store i8 1, ptr %147, align 1, !tbaa !9
  %148 = load i32, ptr %11, align 4, !tbaa !5
  %149 = load i32, ptr @r, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr @r, align 4, !tbaa !5
  %151 = sext i32 %149 to i64
  %152 = getelementptr inbounds [2040200 x i32], ptr @que, i64 0, i64 %151
  store i32 %148, ptr %152, align 4, !tbaa !5
  br label %153

153:                                              ; preds = %123, %117, %113, %110, %106, %84
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %8, align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %8, align 4, !tbaa !5
  br label %80, !llvm.loop !15

157:                                              ; preds = %83
  store i32 0, ptr %3, align 4
  br label %158

158:                                              ; preds = %157, %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  %159 = load i32, ptr %3, align 4
  switch i32 %159, label %361 [
    i32 0, label %160
    i32 5, label %55
  ]

160:                                              ; preds = %158
  br label %55, !llvm.loop !11

161:                                              ; preds = %55
  store i32 0, ptr @r, align 4, !tbaa !5
  store i32 0, ptr @l, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 2040200, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @g, i8 63, i64 8160800, i1 false)
  %162 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @x2, ptr noundef @y2)
  %163 = load i32, ptr @x2, align 4, !tbaa !5
  %164 = add nsw i32 %163, -1
  store i32 %164, ptr @x2, align 4, !tbaa !5
  %165 = load i32, ptr @y2, align 4, !tbaa !5
  %166 = add nsw i32 %165, -1
  store i32 %166, ptr @y2, align 4, !tbaa !5
  %167 = load i32, ptr @x2, align 4, !tbaa !5
  %168 = load i32, ptr @y2, align 4, !tbaa !5
  %169 = call noundef i32 @_Z3idxiii(i32 noundef %167, i32 noundef %168, i32 noundef 0)
  %170 = load i32, ptr @r, align 4, !tbaa !5
  %171 = add nsw i32 %170, 1
  store i32 %171, ptr @r, align 4, !tbaa !5
  %172 = sext i32 %170 to i64
  %173 = getelementptr inbounds [2040200 x i32], ptr @que, i64 0, i64 %172
  store i32 %169, ptr %173, align 4, !tbaa !5
  %174 = load i32, ptr @x2, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @g, i64 0, i64 %175
  %177 = load i32, ptr @y2, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [1010 x [2 x i32]], ptr %176, i64 0, i64 %178
  %180 = getelementptr inbounds [2 x i32], ptr %179, i64 0, i64 0
  store i32 0, ptr %180, align 8, !tbaa !5
  %181 = load i32, ptr @x2, align 4, !tbaa !5
  %182 = load i32, ptr @y2, align 4, !tbaa !5
  %183 = call noundef i32 @_Z3idxiii(i32 noundef %181, i32 noundef %182, i32 noundef 0)
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [2040200 x i8], ptr @vis, i64 0, i64 %184
  store i8 1, ptr %185, align 1, !tbaa !9
  br label %186

186:                                              ; preds = %291, %289, %161
  %187 = load i32, ptr @l, align 4, !tbaa !5
  %188 = load i32, ptr @r, align 4, !tbaa !5
  %189 = icmp slt i32 %187, %188
  br i1 %189, label %190, label %292

190:                                              ; preds = %186
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %191 = load i32, ptr @l, align 4, !tbaa !5
  %192 = add nsw i32 %191, 1
  store i32 %192, ptr @l, align 4, !tbaa !5
  %193 = sext i32 %191 to i64
  %194 = getelementptr inbounds [2040200 x i32], ptr @que, i64 0, i64 %193
  %195 = load i32, ptr %194, align 4, !tbaa !5
  store i32 %195, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %196 = load i32, ptr %12, align 4, !tbaa !5
  call void @_Z3ridiRiS_S_(i32 noundef %196, ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %197 = load i32, ptr %13, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @g, i64 0, i64 %198
  %200 = load i32, ptr %14, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [1010 x [2 x i32]], ptr %199, i64 0, i64 %201
  %203 = load i32, ptr %15, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [2 x i32], ptr %202, i64 0, i64 %204
  %206 = load i32, ptr %205, align 4, !tbaa !5
  %207 = load i32, ptr @k, align 4, !tbaa !5
  %208 = icmp sge i32 %206, %207
  br i1 %208, label %209, label %210

209:                                              ; preds = %190
  store i32 10, ptr %3, align 4
  br label %289, !llvm.loop !16

210:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %211

211:                                              ; preds = %285, %210
  %212 = load i32, ptr %16, align 4, !tbaa !5
  %213 = icmp slt i32 %212, 8
  br i1 %213, label %215, label %214

214:                                              ; preds = %211
  store i32 12, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %288

215:                                              ; preds = %211
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %216 = load i32, ptr %13, align 4, !tbaa !5
  %217 = load i32, ptr %16, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [8 x [2 x i32]], ptr @_ZL2d2, i64 0, i64 %218
  %220 = getelementptr inbounds [2 x i32], ptr %219, i64 0, i64 0
  %221 = load i32, ptr %220, align 8, !tbaa !5
  %222 = add nsw i32 %216, %221
  store i32 %222, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %223 = load i32, ptr %14, align 4, !tbaa !5
  %224 = load i32, ptr %16, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [8 x [2 x i32]], ptr @_ZL2d2, i64 0, i64 %225
  %227 = getelementptr inbounds [2 x i32], ptr %226, i64 0, i64 1
  %228 = load i32, ptr %227, align 4, !tbaa !5
  %229 = add nsw i32 %223, %228
  store i32 %229, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %230 = load i32, ptr %17, align 4, !tbaa !5
  %231 = load i32, ptr %18, align 4, !tbaa !5
  %232 = load i32, ptr %15, align 4, !tbaa !5
  %233 = xor i32 %232, 1
  %234 = call noundef i32 @_Z3idxiii(i32 noundef %230, i32 noundef %231, i32 noundef %233)
  store i32 %234, ptr %19, align 4, !tbaa !5
  %235 = load i32, ptr %17, align 4, !tbaa !5
  %236 = icmp sge i32 %235, 0
  br i1 %236, label %237, label %284

237:                                              ; preds = %215
  %238 = load i32, ptr %17, align 4, !tbaa !5
  %239 = load i32, ptr @n, align 4, !tbaa !5
  %240 = icmp slt i32 %238, %239
  br i1 %240, label %241, label %284

241:                                              ; preds = %237
  %242 = load i32, ptr %18, align 4, !tbaa !5
  %243 = icmp sge i32 %242, 0
  br i1 %243, label %244, label %284

244:                                              ; preds = %241
  %245 = load i32, ptr %18, align 4, !tbaa !5
  %246 = load i32, ptr @m, align 4, !tbaa !5
  %247 = icmp slt i32 %245, %246
  br i1 %247, label %248, label %284

248:                                              ; preds = %244
  %249 = load i32, ptr %19, align 4, !tbaa !5
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [2040200 x i8], ptr @vis, i64 0, i64 %250
  %252 = load i8, ptr %251, align 1, !tbaa !9, !range !13, !noundef !14
  %253 = trunc i8 %252 to i1
  br i1 %253, label %284, label %254

254:                                              ; preds = %248
  %255 = load i32, ptr %13, align 4, !tbaa !5
  %256 = sext i32 %255 to i64
  %257 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @g, i64 0, i64 %256
  %258 = load i32, ptr %14, align 4, !tbaa !5
  %259 = sext i32 %258 to i64
  %260 = getelementptr inbounds [1010 x [2 x i32]], ptr %257, i64 0, i64 %259
  %261 = load i32, ptr %15, align 4, !tbaa !5
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [2 x i32], ptr %260, i64 0, i64 %262
  %264 = load i32, ptr %263, align 4, !tbaa !5
  %265 = add nsw i32 %264, 1
  %266 = load i32, ptr %17, align 4, !tbaa !5
  %267 = sext i32 %266 to i64
  %268 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @g, i64 0, i64 %267
  %269 = load i32, ptr %18, align 4, !tbaa !5
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds [1010 x [2 x i32]], ptr %268, i64 0, i64 %270
  %272 = load i32, ptr %15, align 4, !tbaa !5
  %273 = xor i32 %272, 1
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds [2 x i32], ptr %271, i64 0, i64 %274
  store i32 %265, ptr %275, align 4, !tbaa !5
  %276 = load i32, ptr %19, align 4, !tbaa !5
  %277 = sext i32 %276 to i64
  %278 = getelementptr inbounds [2040200 x i8], ptr @vis, i64 0, i64 %277
  store i8 1, ptr %278, align 1, !tbaa !9
  %279 = load i32, ptr %19, align 4, !tbaa !5
  %280 = load i32, ptr @r, align 4, !tbaa !5
  %281 = add nsw i32 %280, 1
  store i32 %281, ptr @r, align 4, !tbaa !5
  %282 = sext i32 %280 to i64
  %283 = getelementptr inbounds [2040200 x i32], ptr @que, i64 0, i64 %282
  store i32 %279, ptr %283, align 4, !tbaa !5
  br label %284

284:                                              ; preds = %254, %248, %244, %241, %237, %215
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %285

285:                                              ; preds = %284
  %286 = load i32, ptr %16, align 4, !tbaa !5
  %287 = add nsw i32 %286, 1
  store i32 %287, ptr %16, align 4, !tbaa !5
  br label %211, !llvm.loop !17

288:                                              ; preds = %214
  store i32 0, ptr %3, align 4
  br label %289

289:                                              ; preds = %288, %209
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  %290 = load i32, ptr %3, align 4
  switch i32 %290, label %361 [
    i32 0, label %291
    i32 10, label %186
  ]

291:                                              ; preds = %289
  br label %186, !llvm.loop !16

292:                                              ; preds = %186
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 1061109567, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 0, ptr %21, align 4, !tbaa !5
  br label %293

293:                                              ; preds = %343, %292
  %294 = load i32, ptr %21, align 4, !tbaa !5
  %295 = load i32, ptr @n, align 4, !tbaa !5
  %296 = icmp slt i32 %294, %295
  br i1 %296, label %298, label %297

297:                                              ; preds = %293
  store i32 15, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %346

298:                                              ; preds = %293
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 0, ptr %22, align 4, !tbaa !5
  br label %299

299:                                              ; preds = %339, %298
  %300 = load i32, ptr %22, align 4, !tbaa !5
  %301 = load i32, ptr @m, align 4, !tbaa !5
  %302 = icmp slt i32 %300, %301
  br i1 %302, label %304, label %303

303:                                              ; preds = %299
  store i32 18, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  br label %342

304:                                              ; preds = %299
  %305 = load i32, ptr %21, align 4, !tbaa !5
  %306 = sext i32 %305 to i64
  %307 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @f, i64 0, i64 %306
  %308 = load i32, ptr %22, align 4, !tbaa !5
  %309 = sext i32 %308 to i64
  %310 = getelementptr inbounds [1010 x [2 x i32]], ptr %307, i64 0, i64 %309
  %311 = getelementptr inbounds [2 x i32], ptr %310, i64 0, i64 0
  %312 = load i32, ptr %21, align 4, !tbaa !5
  %313 = sext i32 %312 to i64
  %314 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @g, i64 0, i64 %313
  %315 = load i32, ptr %22, align 4, !tbaa !5
  %316 = sext i32 %315 to i64
  %317 = getelementptr inbounds [1010 x [2 x i32]], ptr %314, i64 0, i64 %316
  %318 = getelementptr inbounds [2 x i32], ptr %317, i64 0, i64 0
  %319 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %311, ptr noundef nonnull align 4 dereferenceable(4) %318)
  %320 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %20, ptr noundef nonnull align 4 dereferenceable(4) %319)
  %321 = load i32, ptr %320, align 4, !tbaa !5
  store i32 %321, ptr %20, align 4, !tbaa !5
  %322 = load i32, ptr %21, align 4, !tbaa !5
  %323 = sext i32 %322 to i64
  %324 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @f, i64 0, i64 %323
  %325 = load i32, ptr %22, align 4, !tbaa !5
  %326 = sext i32 %325 to i64
  %327 = getelementptr inbounds [1010 x [2 x i32]], ptr %324, i64 0, i64 %326
  %328 = getelementptr inbounds [2 x i32], ptr %327, i64 0, i64 1
  %329 = load i32, ptr %21, align 4, !tbaa !5
  %330 = sext i32 %329 to i64
  %331 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @g, i64 0, i64 %330
  %332 = load i32, ptr %22, align 4, !tbaa !5
  %333 = sext i32 %332 to i64
  %334 = getelementptr inbounds [1010 x [2 x i32]], ptr %331, i64 0, i64 %333
  %335 = getelementptr inbounds [2 x i32], ptr %334, i64 0, i64 1
  %336 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %328, ptr noundef nonnull align 4 dereferenceable(4) %335)
  %337 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %20, ptr noundef nonnull align 4 dereferenceable(4) %336)
  %338 = load i32, ptr %337, align 4, !tbaa !5
  store i32 %338, ptr %20, align 4, !tbaa !5
  br label %339

339:                                              ; preds = %304
  %340 = load i32, ptr %22, align 4, !tbaa !5
  %341 = add nsw i32 %340, 1
  store i32 %341, ptr %22, align 4, !tbaa !5
  br label %299, !llvm.loop !18

342:                                              ; preds = %303
  br label %343

343:                                              ; preds = %342
  %344 = load i32, ptr %21, align 4, !tbaa !5
  %345 = add nsw i32 %344, 1
  store i32 %345, ptr %21, align 4, !tbaa !5
  br label %293, !llvm.loop !19

346:                                              ; preds = %297
  %347 = load i32, ptr %2, align 4, !tbaa !5
  %348 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %347)
  %349 = load i32, ptr %20, align 4, !tbaa !5
  %350 = icmp eq i32 %349, 1061109567
  br i1 %350, label %351, label %353

351:                                              ; preds = %346
  %352 = call i32 @puts(ptr noundef @.str.4)
  br label %356

353:                                              ; preds = %346
  %354 = load i32, ptr %20, align 4, !tbaa !5
  %355 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %354)
  br label %356

356:                                              ; preds = %353, %351
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %357

357:                                              ; preds = %356
  %358 = load i32, ptr %2, align 4, !tbaa !5
  %359 = add nsw i32 %358, 1
  store i32 %359, ptr %2, align 4, !tbaa !5
  br label %24, !llvm.loop !20

360:                                              ; preds = %28
  ret i32 0

361:                                              ; preds = %289, %158
  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

; 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

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

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

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

declare i32 @puts(ptr noundef) #2

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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}


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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@x1 = external dso_local global i32, align 4
@y1 = external dso_local global i32, align 4
@f = external dso_local global [1010 x [1010 x [2 x i32]]], align 16
@x2 = external dso_local global i32, align 4
@y2 = external dso_local global i32, align 4
@g = external dso_local global [1010 x [1010 x [2 x i32]]], align 16
@que = external dso_local local_unnamed_addr global [2040200 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
@vis = external dso_local local_unnamed_addr global [2040200 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZL2d1 = external hidden local_unnamed_addr constant [8 x [2 x i32]], align 16
@_ZL2d2 = external hidden local_unnamed_addr constant [8 x [2 x i32]], align 16
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3ridiRiS_S_(i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) 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 i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %9 = load i32, ptr @t, align 4, !tbaa !5
  %.not80 = icmp slt i32 %9, 1
  br i1 %.not80, label %._crit_edge84, label %.lr.ph83

._crit_edge84:                                    ; preds = %204, %0
  ret i32 0

.lr.ph83:                                         ; preds = %0, %204
  %.05181 = phi i32 [ %205, %204 ], [ 1, %0 ]
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @k)
  store i32 0, ptr @r, align 4, !tbaa !5
  store i32 0, ptr @l, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2040200) @vis, i8 0, i64 2040200, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8160800) @f, i8 63, i64 8160800, i1 false)
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @x1, ptr noundef nonnull @y1)
  %12 = load i32, ptr @x1, align 4, !tbaa !5
  %13 = add nsw i32 %12, -1
  store i32 %13, ptr @x1, align 4, !tbaa !5
  %14 = load i32, ptr @y1, align 4, !tbaa !5
  %15 = add nsw i32 %14, -1
  store i32 %15, ptr @y1, align 4, !tbaa !5
  %16 = call noundef i32 @_Z3idxiii(i32 noundef %13, i32 noundef %15, i32 noundef 0)
  %17 = load i32, ptr @r, align 4, !tbaa !5
  %18 = add nsw i32 %17, 1
  store i32 %18, ptr @r, align 4, !tbaa !5
  %19 = sext i32 %17 to i64
  %20 = getelementptr inbounds [2040200 x i32], ptr @que, i64 0, i64 %19
  store i32 %16, ptr %20, align 4, !tbaa !5
  %21 = load i32, ptr @x1, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = load i32, ptr @y1, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @f, i64 0, i64 %22, i64 %24
  store i32 0, ptr %25, align 8, !tbaa !5
  %26 = call noundef i32 @_Z3idxiii(i32 noundef %21, i32 noundef %23, i32 noundef 0)
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [2040200 x i8], ptr @vis, i64 0, i64 %27
  store i8 1, ptr %28, align 1, !tbaa !9
  %29 = load i32, ptr @l, align 4, !tbaa !5
  %30 = load i32, ptr @r, align 4, !tbaa !5
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph83, %.loopexit69
  %32 = phi i32 [ %89, %.loopexit69 ], [ %29, %.lr.ph83 ]
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr @l, align 4, !tbaa !5
  %34 = sext i32 %32 to i64
  %35 = getelementptr inbounds [2040200 x i32], ptr @que, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  call void @_Z3ridiRiS_S_(i32 noundef %36, ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %37 = load i32, ptr %1, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @f, i64 0, i64 %38, i64 %40, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = load i32, ptr @k, align 4, !tbaa !5
  %.not62 = icmp slt i32 %44, %45
  br i1 %.not62, label %.preheader68, label %.loopexit69, !llvm.loop !11

.preheader68:                                     ; preds = %.lr.ph, %88
  %indvars.iv = phi i64 [ %indvars.iv.next, %88 ], [ 0, %.lr.ph ]
  %46 = load i32, ptr %1, align 4, !tbaa !5
  %47 = getelementptr inbounds [8 x [2 x i32]], ptr @_ZL2d1, i64 0, i64 %indvars.iv
  %48 = load i32, ptr %47, align 8, !tbaa !5
  %49 = add nsw i32 %48, %46
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %47, i64 4
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = add nsw i32 %52, %50
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = xor i32 %54, 1
  %56 = call noundef i32 @_Z3idxiii(i32 noundef %49, i32 noundef %53, i32 noundef %55)
  %57 = icmp sgt i32 %49, -1
  br i1 %57, label %58, label %88

58:                                               ; preds = %.preheader68
  %59 = load i32, ptr @n, align 4, !tbaa !5
  %60 = icmp slt i32 %49, %59
  %61 = icmp sgt i32 %53, -1
  %or.cond = and i1 %61, %60
  %62 = load i32, ptr @m, align 4
  %63 = icmp slt i32 %53, %62
  %or.cond64 = select i1 %or.cond, i1 %63, i1 false
  br i1 %or.cond64, label %64, label %88

64:                                               ; preds = %58
  %65 = sext i32 %56 to i64
  %66 = getelementptr inbounds [2040200 x i8], ptr @vis, i64 0, i64 %65
  %67 = load i8, ptr %66, align 1, !tbaa !9, !range !13, !noundef !14
  %68 = trunc nuw i8 %67 to i1
  br i1 %68, label %88, label %69

69:                                               ; preds = %64
  %70 = load i32, ptr %1, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = load i32, ptr %2, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = load i32, ptr %3, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @f, i64 0, i64 %71, i64 %73, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  %79 = zext nneg i32 %49 to i64
  %80 = zext nneg i32 %53 to i64
  %81 = xor i32 %74, 1
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @f, i64 0, i64 %79, i64 %80, i64 %82
  store i32 %78, ptr %83, align 4, !tbaa !5
  store i8 1, ptr %66, align 1, !tbaa !9
  %84 = load i32, ptr @r, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr @r, align 4, !tbaa !5
  %86 = sext i32 %84 to i64
  %87 = getelementptr inbounds [2040200 x i32], ptr @que, i64 0, i64 %86
  store i32 %56, ptr %87, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %69, %64, %58, %.preheader68
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 8
  br i1 %exitcond.not, label %.loopexit69, label %.preheader68, !llvm.loop !15

.loopexit69:                                      ; preds = %88, %.lr.ph
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %89 = load i32, ptr @l, align 4, !tbaa !5
  %90 = load i32, ptr @r, align 4, !tbaa !5
  %91 = icmp slt i32 %89, %90
  br i1 %91, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.loopexit69, %.lr.ph83
  store i32 0, ptr @r, align 4, !tbaa !5
  store i32 0, ptr @l, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2040200) @vis, i8 0, i64 2040200, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8160800) @g, i8 63, i64 8160800, i1 false)
  %92 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @x2, ptr noundef nonnull @y2)
  %93 = load i32, ptr @x2, align 4, !tbaa !5
  %94 = add nsw i32 %93, -1
  store i32 %94, ptr @x2, align 4, !tbaa !5
  %95 = load i32, ptr @y2, align 4, !tbaa !5
  %96 = add nsw i32 %95, -1
  store i32 %96, ptr @y2, align 4, !tbaa !5
  %97 = call noundef i32 @_Z3idxiii(i32 noundef %94, i32 noundef %96, i32 noundef 0)
  %98 = load i32, ptr @r, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr @r, align 4, !tbaa !5
  %100 = sext i32 %98 to i64
  %101 = getelementptr inbounds [2040200 x i32], ptr @que, i64 0, i64 %100
  store i32 %97, ptr %101, align 4, !tbaa !5
  %102 = load i32, ptr @x2, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = load i32, ptr @y2, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @g, i64 0, i64 %103, i64 %105
  store i32 0, ptr %106, align 8, !tbaa !5
  %107 = call noundef i32 @_Z3idxiii(i32 noundef %102, i32 noundef %104, i32 noundef 0)
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [2040200 x i8], ptr @vis, i64 0, i64 %108
  store i8 1, ptr %109, align 1, !tbaa !9
  %110 = load i32, ptr @l, align 4, !tbaa !5
  %111 = load i32, ptr @r, align 4, !tbaa !5
  %112 = icmp slt i32 %110, %111
  br i1 %112, label %.lr.ph73, label %._crit_edge74

.lr.ph73:                                         ; preds = %._crit_edge, %.loopexit
  %113 = phi i32 [ %170, %.loopexit ], [ %110, %._crit_edge ]
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr @l, align 4, !tbaa !5
  %115 = sext i32 %113 to i64
  %116 = getelementptr inbounds [2040200 x i32], ptr @que, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  call void @_Z3ridiRiS_S_(i32 noundef %117, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %118 = load i32, ptr %4, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = load i32, ptr %5, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = load i32, ptr %6, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @g, i64 0, i64 %119, i64 %121, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = load i32, ptr @k, align 4, !tbaa !5
  %.not61 = icmp slt i32 %125, %126
  br i1 %.not61, label %.preheader67, label %.loopexit, !llvm.loop !16

.preheader67:                                     ; preds = %.lr.ph73, %169
  %indvars.iv87 = phi i64 [ %indvars.iv.next88, %169 ], [ 0, %.lr.ph73 ]
  %127 = load i32, ptr %4, align 4, !tbaa !5
  %128 = getelementptr inbounds [8 x [2 x i32]], ptr @_ZL2d2, i64 0, i64 %indvars.iv87
  %129 = load i32, ptr %128, align 8, !tbaa !5
  %130 = add nsw i32 %129, %127
  %131 = load i32, ptr %5, align 4, !tbaa !5
  %132 = getelementptr inbounds i8, ptr %128, i64 4
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = add nsw i32 %133, %131
  %135 = load i32, ptr %6, align 4, !tbaa !5
  %136 = xor i32 %135, 1
  %137 = call noundef i32 @_Z3idxiii(i32 noundef %130, i32 noundef %134, i32 noundef %136)
  %138 = icmp sgt i32 %130, -1
  br i1 %138, label %139, label %169

139:                                              ; preds = %.preheader67
  %140 = load i32, ptr @n, align 4, !tbaa !5
  %141 = icmp slt i32 %130, %140
  %142 = icmp sgt i32 %134, -1
  %or.cond3 = and i1 %142, %141
  %143 = load i32, ptr @m, align 4
  %144 = icmp slt i32 %134, %143
  %or.cond66 = select i1 %or.cond3, i1 %144, i1 false
  br i1 %or.cond66, label %145, label %169

145:                                              ; preds = %139
  %146 = sext i32 %137 to i64
  %147 = getelementptr inbounds [2040200 x i8], ptr @vis, i64 0, i64 %146
  %148 = load i8, ptr %147, align 1, !tbaa !9, !range !13, !noundef !14
  %149 = trunc nuw i8 %148 to i1
  br i1 %149, label %169, label %150

150:                                              ; preds = %145
  %151 = load i32, ptr %4, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = load i32, ptr %5, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = load i32, ptr %6, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @g, i64 0, i64 %152, i64 %154, i64 %156
  %158 = load i32, ptr %157, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  %160 = zext nneg i32 %130 to i64
  %161 = zext nneg i32 %134 to i64
  %162 = xor i32 %155, 1
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @g, i64 0, i64 %160, i64 %161, i64 %163
  store i32 %159, ptr %164, align 4, !tbaa !5
  store i8 1, ptr %147, align 1, !tbaa !9
  %165 = load i32, ptr @r, align 4, !tbaa !5
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr @r, align 4, !tbaa !5
  %167 = sext i32 %165 to i64
  %168 = getelementptr inbounds [2040200 x i32], ptr @que, i64 0, i64 %167
  store i32 %137, ptr %168, align 4, !tbaa !5
  br label %169

169:                                              ; preds = %150, %145, %139, %.preheader67
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
  %exitcond90.not = icmp eq i64 %indvars.iv.next88, 8
  br i1 %exitcond90.not, label %.loopexit, label %.preheader67, !llvm.loop !17

.loopexit:                                        ; preds = %169, %.lr.ph73
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %170 = load i32, ptr @l, align 4, !tbaa !5
  %171 = load i32, ptr @r, align 4, !tbaa !5
  %172 = icmp slt i32 %170, %171
  br i1 %172, label %.lr.ph73, label %._crit_edge74

._crit_edge74:                                    ; preds = %.loopexit, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  store i32 1061109567, ptr %7, align 4, !tbaa !5
  %173 = load i32, ptr @n, align 4, !tbaa !5
  %174 = icmp sgt i32 %173, 0
  %175 = load i32, ptr @m, align 4
  %176 = icmp sgt i32 %175, 0
  %or.cond98 = select i1 %174, i1 %176, i1 false
  br i1 %or.cond98, label %.preheader, label %._crit_edge79

.preheader:                                       ; preds = %._crit_edge74, %._crit_edge77
  %177 = phi i32 [ %183, %._crit_edge77 ], [ %173, %._crit_edge74 ]
  %178 = phi i32 [ %184, %._crit_edge77 ], [ %175, %._crit_edge74 ]
  %indvars.iv94 = phi i64 [ %indvars.iv.next95, %._crit_edge77 ], [ 0, %._crit_edge74 ]
  %179 = icmp sgt i32 %178, 0
  br i1 %179, label %.lr.ph76, label %._crit_edge77

._crit_edge79:                                    ; preds = %._crit_edge77, %._crit_edge74
  %180 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.05181)
  %181 = load i32, ptr %7, align 4, !tbaa !5
  %182 = icmp eq i32 %181, 1061109567
  br i1 %182, label %200, label %202

._crit_edge77.loopexit:                           ; preds = %.lr.ph76
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge77

._crit_edge77:                                    ; preds = %._crit_edge77.loopexit, %.preheader
  %183 = phi i32 [ %.pre, %._crit_edge77.loopexit ], [ %177, %.preheader ]
  %184 = phi i32 [ %197, %._crit_edge77.loopexit ], [ %178, %.preheader ]
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %185 = sext i32 %183 to i64
  %186 = icmp slt i64 %indvars.iv.next95, %185
  br i1 %186, label %.preheader, label %._crit_edge79, !llvm.loop !18

.lr.ph76:                                         ; preds = %.preheader, %.lr.ph76
  %indvars.iv91 = phi i64 [ %indvars.iv.next92, %.lr.ph76 ], [ 0, %.preheader ]
  %187 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @f, i64 0, i64 %indvars.iv94, i64 %indvars.iv91
  %188 = getelementptr inbounds [1010 x [1010 x [2 x i32]]], ptr @g, i64 0, i64 %indvars.iv94, i64 %indvars.iv91
  %189 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %187, ptr noundef nonnull align 4 dereferenceable(4) %188)
  %190 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %189)
  %191 = load i32, ptr %190, align 4, !tbaa !5
  store i32 %191, ptr %7, align 4, !tbaa !5
  %192 = getelementptr inbounds i8, ptr %187, i64 4
  %193 = getelementptr inbounds i8, ptr %188, i64 4
  %194 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %192, ptr noundef nonnull align 4 dereferenceable(4) %193)
  %195 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %194)
  %196 = load i32, ptr %195, align 4, !tbaa !5
  store i32 %196, ptr %7, align 4, !tbaa !5
  %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
  %197 = load i32, ptr @m, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = icmp slt i64 %indvars.iv.next92, %198
  br i1 %199, label %.lr.ph76, label %._crit_edge77.loopexit, !llvm.loop !20

200:                                              ; preds = %._crit_edge79
  %201 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %204

202:                                              ; preds = %._crit_edge79
  %203 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %181)
  br label %204

204:                                              ; preds = %202, %200
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  %205 = add nuw nsw i32 %.05181, 1
  %206 = load i32, ptr @t, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.05181, %206
  br i1 %.not.not, label %.lr.ph83, label %._crit_edge84, !llvm.loop !21
}

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

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

; Function Attrs: 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 #5

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

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

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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12, !19}
!19 = !{!"llvm.loop.unswitch.partial.disable"}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}


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