; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ/1254.ll (Z3bfsiiii)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.node = type { i32, i32, i32, i32, i32 }
%"class.std::queue.0" = type { %"class.std::deque.1" }
%"class.std::deque.1" = type { %"class.std::_Deque_base.2" }
%"class.std::_Deque_base.2" = type { %"struct.std::_Deque_base<node, std::allocator<node>>::_Deque_impl" }
%"struct.std::_Deque_base<node, std::allocator<node>>::_Deque_impl" = type { %"struct.std::_Deque_base<node, std::allocator<node>>::_Deque_impl_data" }
%"struct.std::_Deque_base<node, std::allocator<node>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator.6", %"struct.std::_Deque_iterator.6" }
%"struct.std::_Deque_iterator.6" = type { ptr, ptr, ptr, ptr }

@a = external dso_local global %struct.node, align 4
@b = external dso_local global %struct.node, align 4
@dir = external dso_local global [4 x [2 x i32]], align 16
@map = external dso_local global [10 x [10 x i32]], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@mark = external dso_local global [10 x [10 x [10 x [10 x i32]]]], align 16

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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z3bfsiiii(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #0 personality ptr @__gxx_personality_v0 {
  %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 %"class.std::queue.0", align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 %0, ptr %6, align 4, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %15 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %15, ptr @a, align 4, !tbaa !9
  %16 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %16, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 1), align 4, !tbaa !11
  %17 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %17, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 3), align 4, !tbaa !12
  %18 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %18, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 4), align 4, !tbaa !13
  store i32 0, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 2), align 4, !tbaa !14
  call void @llvm.memset.p0.i64(ptr align 16 @mark, i8 0, i64 40000, i1 false)
  %19 = load i32, ptr @a, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [10 x [10 x [10 x [10 x i32]]]], ptr @mark, i64 0, i64 %20
  %22 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 1), align 4, !tbaa !11
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [10 x [10 x [10 x i32]]], ptr %21, i64 0, i64 %23
  %25 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 3), align 4, !tbaa !12
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [10 x [10 x i32]], ptr %24, i64 0, i64 %26
  %28 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 4), align 4, !tbaa !13
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [10 x i32], ptr %27, i64 0, i64 %29
  store i32 1, ptr %30, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 80, ptr %11) #6
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %11, ptr noundef nonnull align 4 dereferenceable(20) @a)
          to label %31 unwind label %50

31:                                               ; preds = %4
  br label %32

32:                                               ; preds = %300, %31
  %33 = invoke noundef zeroext i1 @_ZNKSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %34 unwind label %50

34:                                               ; preds = %32
  %35 = xor i1 %33, true
  br i1 %35, label %36, label %301

36:                                               ; preds = %34
  %37 = invoke noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %38 unwind label %50

38:                                               ; preds = %36
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @b, ptr align 4 %37, i64 20, i1 false), !tbaa.struct !15
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %39 unwind label %50

39:                                               ; preds = %38
  %40 = load i32, ptr @b, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %41
  %43 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [10 x i32], ptr %42, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = icmp eq i32 %46, 3
  br i1 %47, label %48, label %54

48:                                               ; preds = %39
  %49 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 2), align 4, !tbaa !14
  store i32 %49, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %302

50:                                               ; preds = %277, %266, %234, %223, %189, %178, %143, %132, %38, %36, %32, %4
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %12, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %13, align 4
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %11) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %304

54:                                               ; preds = %39
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %297, %54
  %56 = load i32, ptr %10, align 4, !tbaa !5
  %57 = icmp slt i32 %56, 4
  br i1 %57, label %58, label %300

58:                                               ; preds = %55
  %59 = load i32, ptr @b, align 4, !tbaa !9
  %60 = load i32, ptr %10, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [4 x [2 x i32]], ptr @dir, i64 0, i64 %61
  %63 = getelementptr inbounds [2 x i32], ptr %62, i64 0, i64 0
  %64 = load i32, ptr %63, align 8, !tbaa !5
  %65 = add nsw i32 %59, %64
  store i32 %65, ptr @a, align 4, !tbaa !9
  %66 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %67 = load i32, ptr %10, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [4 x [2 x i32]], ptr @dir, i64 0, i64 %68
  %70 = getelementptr inbounds [2 x i32], ptr %69, i64 0, i64 1
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = add nsw i32 %66, %71
  store i32 %72, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 1), align 4, !tbaa !11
  %73 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 2), align 4, !tbaa !14
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 2), align 4, !tbaa !14
  %75 = load i32, ptr @a, align 4, !tbaa !9
  %76 = icmp slt i32 %75, 1
  br i1 %76, label %88, label %77

77:                                               ; preds = %58
  %78 = load i32, ptr @a, align 4, !tbaa !9
  %79 = load i32, ptr @n, align 4, !tbaa !5
  %80 = icmp sgt i32 %78, %79
  br i1 %80, label %88, label %81

81:                                               ; preds = %77
  %82 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 1), align 4, !tbaa !11
  %83 = icmp slt i32 %82, 1
  br i1 %83, label %88, label %84

84:                                               ; preds = %81
  %85 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 1), align 4, !tbaa !11
  %86 = load i32, ptr @m, align 4, !tbaa !5
  %87 = icmp sgt i32 %85, %86
  br i1 %87, label %88, label %89

88:                                               ; preds = %84, %81, %77, %58
  br label %297

89:                                               ; preds = %84
  %90 = load i32, ptr @a, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %91
  %93 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 1), align 4, !tbaa !11
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [10 x i32], ptr %92, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = icmp eq i32 %96, 1
  br i1 %97, label %98, label %99

98:                                               ; preds = %89
  br label %297

99:                                               ; preds = %89
  %100 = load i32, ptr @a, align 4, !tbaa !9
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [10 x [10 x [10 x [10 x i32]]]], ptr @mark, i64 0, i64 %101
  %103 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 1), align 4, !tbaa !11
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [10 x [10 x [10 x i32]]], ptr %102, i64 0, i64 %104
  %106 = load i32, ptr @b, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [10 x [10 x i32]], ptr %105, i64 0, i64 %107
  %109 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [10 x i32], ptr %108, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = icmp ne i32 %112, 0
  br i1 %113, label %114, label %115

114:                                              ; preds = %99
  br label %297

115:                                              ; preds = %99
  %116 = load i32, ptr %10, align 4, !tbaa !5
  %117 = icmp eq i32 %116, 0
  br i1 %117, label %118, label %160

118:                                              ; preds = %115
  %119 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %120 = sub nsw i32 %119, 1
  %121 = icmp sge i32 %120, 1
  br i1 %121, label %122, label %159

122:                                              ; preds = %118
  %123 = load i32, ptr @b, align 4, !tbaa !9
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %124
  %126 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %127 = sub nsw i32 %126, 1
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [10 x i32], ptr %125, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = icmp ne i32 %130, 1
  br i1 %131, label %132, label %159

132:                                              ; preds = %122
  %133 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 3), align 4, !tbaa !12
  %134 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 4), align 4, !tbaa !13
  %135 = load i32, ptr @b, align 4, !tbaa !9
  %136 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %137 = sub nsw i32 %136, 1
  %138 = load i32, ptr @b, align 4, !tbaa !9
  %139 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %140 = invoke noundef i32 @_Z9judge_bfsiiiiii(i32 noundef %133, i32 noundef %134, i32 noundef %135, i32 noundef %137, i32 noundef %138, i32 noundef %139)
          to label %141 unwind label %50

141:                                              ; preds = %132
  %142 = icmp ne i32 %140, 0
  br i1 %142, label %143, label %159

143:                                              ; preds = %141
  %144 = load i32, ptr @b, align 4, !tbaa !9
  store i32 %144, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 3), align 4, !tbaa !12
  %145 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  store i32 %145, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 4), align 4, !tbaa !13
  %146 = load i32, ptr @a, align 4, !tbaa !9
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [10 x [10 x [10 x [10 x i32]]]], ptr @mark, i64 0, i64 %147
  %149 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 1), align 4, !tbaa !11
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [10 x [10 x [10 x i32]]], ptr %148, i64 0, i64 %150
  %152 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 3), align 4, !tbaa !12
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [10 x [10 x i32]], ptr %151, i64 0, i64 %153
  %155 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 4), align 4, !tbaa !13
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [10 x i32], ptr %154, i64 0, i64 %156
  store i32 1, ptr %157, align 4, !tbaa !5
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %11, ptr noundef nonnull align 4 dereferenceable(20) @a)
          to label %158 unwind label %50

158:                                              ; preds = %143
  br label %159

159:                                              ; preds = %158, %141, %122, %118
  br label %296

160:                                              ; preds = %115
  %161 = load i32, ptr %10, align 4, !tbaa !5
  %162 = icmp eq i32 %161, 1
  br i1 %162, label %163, label %206

163:                                              ; preds = %160
  %164 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %165 = add nsw i32 %164, 1
  %166 = load i32, ptr @m, align 4, !tbaa !5
  %167 = icmp sle i32 %165, %166
  br i1 %167, label %168, label %205

168:                                              ; preds = %163
  %169 = load i32, ptr @b, align 4, !tbaa !9
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %170
  %172 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %173 = add nsw i32 %172, 1
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [10 x i32], ptr %171, i64 0, i64 %174
  %176 = load i32, ptr %175, align 4, !tbaa !5
  %177 = icmp ne i32 %176, 1
  br i1 %177, label %178, label %205

178:                                              ; preds = %168
  %179 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 3), align 4, !tbaa !12
  %180 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 4), align 4, !tbaa !13
  %181 = load i32, ptr @b, align 4, !tbaa !9
  %182 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %183 = add nsw i32 %182, 1
  %184 = load i32, ptr @b, align 4, !tbaa !9
  %185 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %186 = invoke noundef i32 @_Z9judge_bfsiiiiii(i32 noundef %179, i32 noundef %180, i32 noundef %181, i32 noundef %183, i32 noundef %184, i32 noundef %185)
          to label %187 unwind label %50

187:                                              ; preds = %178
  %188 = icmp ne i32 %186, 0
  br i1 %188, label %189, label %205

189:                                              ; preds = %187
  %190 = load i32, ptr @b, align 4, !tbaa !9
  store i32 %190, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 3), align 4, !tbaa !12
  %191 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  store i32 %191, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 4), align 4, !tbaa !13
  %192 = load i32, ptr @a, align 4, !tbaa !9
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [10 x [10 x [10 x [10 x i32]]]], ptr @mark, i64 0, i64 %193
  %195 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 1), align 4, !tbaa !11
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [10 x [10 x [10 x i32]]], ptr %194, i64 0, i64 %196
  %198 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 3), align 4, !tbaa !12
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [10 x [10 x i32]], ptr %197, i64 0, i64 %199
  %201 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 4), align 4, !tbaa !13
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [10 x i32], ptr %200, i64 0, i64 %202
  store i32 1, ptr %203, align 4, !tbaa !5
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %11, ptr noundef nonnull align 4 dereferenceable(20) @a)
          to label %204 unwind label %50

204:                                              ; preds = %189
  br label %205

205:                                              ; preds = %204, %187, %168, %163
  br label %295

206:                                              ; preds = %160
  %207 = load i32, ptr %10, align 4, !tbaa !5
  %208 = icmp eq i32 %207, 2
  br i1 %208, label %209, label %251

209:                                              ; preds = %206
  %210 = load i32, ptr @b, align 4, !tbaa !9
  %211 = sub nsw i32 %210, 1
  %212 = icmp sge i32 %211, 1
  br i1 %212, label %213, label %250

213:                                              ; preds = %209
  %214 = load i32, ptr @b, align 4, !tbaa !9
  %215 = sub nsw i32 %214, 1
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %216
  %218 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [10 x i32], ptr %217, i64 0, i64 %219
  %221 = load i32, ptr %220, align 4, !tbaa !5
  %222 = icmp ne i32 %221, 1
  br i1 %222, label %223, label %250

223:                                              ; preds = %213
  %224 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 3), align 4, !tbaa !12
  %225 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 4), align 4, !tbaa !13
  %226 = load i32, ptr @b, align 4, !tbaa !9
  %227 = sub nsw i32 %226, 1
  %228 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %229 = load i32, ptr @b, align 4, !tbaa !9
  %230 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %231 = invoke noundef i32 @_Z9judge_bfsiiiiii(i32 noundef %224, i32 noundef %225, i32 noundef %227, i32 noundef %228, i32 noundef %229, i32 noundef %230)
          to label %232 unwind label %50

232:                                              ; preds = %223
  %233 = icmp ne i32 %231, 0
  br i1 %233, label %234, label %250

234:                                              ; preds = %232
  %235 = load i32, ptr @b, align 4, !tbaa !9
  store i32 %235, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 3), align 4, !tbaa !12
  %236 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  store i32 %236, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 4), align 4, !tbaa !13
  %237 = load i32, ptr @a, align 4, !tbaa !9
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [10 x [10 x [10 x [10 x i32]]]], ptr @mark, i64 0, i64 %238
  %240 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 1), align 4, !tbaa !11
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [10 x [10 x [10 x i32]]], ptr %239, i64 0, i64 %241
  %243 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 3), align 4, !tbaa !12
  %244 = sext i32 %243 to i64
  %245 = getelementptr inbounds [10 x [10 x i32]], ptr %242, i64 0, i64 %244
  %246 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 4), align 4, !tbaa !13
  %247 = sext i32 %246 to i64
  %248 = getelementptr inbounds [10 x i32], ptr %245, i64 0, i64 %247
  store i32 1, ptr %248, align 4, !tbaa !5
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %11, ptr noundef nonnull align 4 dereferenceable(20) @a)
          to label %249 unwind label %50

249:                                              ; preds = %234
  br label %250

250:                                              ; preds = %249, %232, %213, %209
  br label %294

251:                                              ; preds = %206
  %252 = load i32, ptr @b, align 4, !tbaa !9
  %253 = add nsw i32 %252, 1
  %254 = load i32, ptr @n, align 4, !tbaa !5
  %255 = icmp sle i32 %253, %254
  br i1 %255, label %256, label %293

256:                                              ; preds = %251
  %257 = load i32, ptr @b, align 4, !tbaa !9
  %258 = add nsw i32 %257, 1
  %259 = sext i32 %258 to i64
  %260 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %259
  %261 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [10 x i32], ptr %260, i64 0, i64 %262
  %264 = load i32, ptr %263, align 4, !tbaa !5
  %265 = icmp ne i32 %264, 1
  br i1 %265, label %266, label %293

266:                                              ; preds = %256
  %267 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 3), align 4, !tbaa !12
  %268 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 4), align 4, !tbaa !13
  %269 = load i32, ptr @b, align 4, !tbaa !9
  %270 = add nsw i32 %269, 1
  %271 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %272 = load i32, ptr @b, align 4, !tbaa !9
  %273 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  %274 = invoke noundef i32 @_Z9judge_bfsiiiiii(i32 noundef %267, i32 noundef %268, i32 noundef %270, i32 noundef %271, i32 noundef %272, i32 noundef %273)
          to label %275 unwind label %50

275:                                              ; preds = %266
  %276 = icmp ne i32 %274, 0
  br i1 %276, label %277, label %293

277:                                              ; preds = %275
  %278 = load i32, ptr @b, align 4, !tbaa !9
  store i32 %278, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 3), align 4, !tbaa !12
  %279 = load i32, ptr getelementptr inbounds (%struct.node, ptr @b, i32 0, i32 1), align 4, !tbaa !11
  store i32 %279, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 4), align 4, !tbaa !13
  %280 = load i32, ptr @a, align 4, !tbaa !9
  %281 = sext i32 %280 to i64
  %282 = getelementptr inbounds [10 x [10 x [10 x [10 x i32]]]], ptr @mark, i64 0, i64 %281
  %283 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 1), align 4, !tbaa !11
  %284 = sext i32 %283 to i64
  %285 = getelementptr inbounds [10 x [10 x [10 x i32]]], ptr %282, i64 0, i64 %284
  %286 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 3), align 4, !tbaa !12
  %287 = sext i32 %286 to i64
  %288 = getelementptr inbounds [10 x [10 x i32]], ptr %285, i64 0, i64 %287
  %289 = load i32, ptr getelementptr inbounds (%struct.node, ptr @a, i32 0, i32 4), align 4, !tbaa !13
  %290 = sext i32 %289 to i64
  %291 = getelementptr inbounds [10 x i32], ptr %288, i64 0, i64 %290
  store i32 1, ptr %291, align 4, !tbaa !5
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %11, ptr noundef nonnull align 4 dereferenceable(20) @a)
          to label %292 unwind label %50

292:                                              ; preds = %277
  br label %293

293:                                              ; preds = %292, %275, %256, %251
  br label %294

294:                                              ; preds = %293, %250
  br label %295

295:                                              ; preds = %294, %205
  br label %296

296:                                              ; preds = %295, %159
  br label %297

297:                                              ; preds = %296, %114, %98, %88
  %298 = load i32, ptr %10, align 4, !tbaa !5
  %299 = add nsw i32 %298, 1
  store i32 %299, ptr %10, align 4, !tbaa !5
  br label %55, !llvm.loop !16

300:                                              ; preds = %55
  br label %32, !llvm.loop !18

301:                                              ; preds = %34
  store i32 0, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %302

302:                                              ; preds = %301, %48
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %11) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %303 = load i32, ptr %5, align 4
  ret i32 %303

304:                                              ; preds = %50
  %305 = load ptr, ptr %12, align 8
  %306 = load i32, ptr %13, align 4
  %307 = insertvalue { ptr, i32 } poison, ptr %305, 0
  %308 = insertvalue { ptr, i32 } %307, i32 %306, 1
  resume { ptr, i32 } %308
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(20)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) #4 align 2

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

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


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

%struct.node = type { i32, i32, i32, i32, i32 }
%"class.std::queue.0" = type { %"class.std::deque.1" }
%"class.std::deque.1" = type { %"class.std::_Deque_base.2" }
%"class.std::_Deque_base.2" = type { %"struct.std::_Deque_base<node, std::allocator<node>>::_Deque_impl" }
%"struct.std::_Deque_base<node, std::allocator<node>>::_Deque_impl" = type { %"struct.std::_Deque_base<node, std::allocator<node>>::_Deque_impl_data" }
%"struct.std::_Deque_base<node, std::allocator<node>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator.6", %"struct.std::_Deque_iterator.6" }
%"struct.std::_Deque_iterator.6" = type { ptr, ptr, ptr, ptr }

@a = external dso_local global %struct.node, align 4
@b = external dso_local local_unnamed_addr global %struct.node, align 4
@dir = external dso_local local_unnamed_addr global [4 x [2 x i32]], align 16
@map = external dso_local local_unnamed_addr global [10 x [10 x i32]], align 16
@n = external dso_local local_unnamed_addr global i32, align 4
@m = external dso_local local_unnamed_addr global i32, align 4
@mark = external dso_local local_unnamed_addr global [10 x [10 x [10 x [10 x i32]]]], align 16

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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z3bfsiiii(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.std::queue.0", align 8
  store i32 %0, ptr @a, align 4, !tbaa !5
  store i32 %1, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !10
  store i32 %2, ptr getelementptr inbounds (i8, ptr @a, i64 12), align 4, !tbaa !11
  store i32 %3, ptr getelementptr inbounds (i8, ptr @a, i64 16), align 4, !tbaa !12
  store i32 0, ptr getelementptr inbounds (i8, ptr @a, i64 8), align 4, !tbaa !13
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40000) @mark, i8 0, i64 40000, i1 false)
  %6 = sext i32 %0 to i64
  %7 = sext i32 %1 to i64
  %8 = sext i32 %2 to i64
  %9 = sext i32 %3 to i64
  %10 = getelementptr inbounds [10 x [10 x [10 x [10 x i32]]]], ptr @mark, i64 0, i64 %6, i64 %7, i64 %8, i64 %9
  store i32 1, ptr %10, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %5) #6
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(20) @a)
          to label %.preheader34 unwind label %.loopexit.split-lp

.preheader34:                                     ; preds = %4
  %11 = call noundef zeroext i1 @_ZNKSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %11, label %.loopexit35, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader34, %.loopexit
  %12 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) @b, ptr noundef nonnull align 4 dereferenceable(20) %12, i64 20, i1 false), !tbaa.struct !15
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %13 = load i32, ptr @b, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 4), align 4, !tbaa !10
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %14, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !14
  %19 = icmp eq i32 %18, 3
  br i1 %19, label %27, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.lr.ph
  %20 = load i32, ptr @dir, align 16, !tbaa !14
  %21 = add nsw i32 %20, %13
  store i32 %21, ptr @a, align 4, !tbaa !5
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 4), align 4, !tbaa !14
  %23 = add nsw i32 %22, %15
  store i32 %23, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !10
  %24 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 8), align 4, !tbaa !13
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr getelementptr inbounds (i8, ptr @a, i64 8), align 4, !tbaa !13
  %26 = icmp slt i32 %21, 1
  br i1 %26, label %.preheader.1, label %30

27:                                               ; preds = %.lr.ph
  %28 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 8), align 4, !tbaa !13
  br label %.loopexit35

.loopexit33:                                      ; preds = %200, %195, %153, %148, %105, %100, %52, %57
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %29

.loopexit.split-lp:                               ; preds = %4
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %29

29:                                               ; preds = %.loopexit.split-lp, %.loopexit33
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit33 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #6
  resume { ptr, i32 } %lpad.phi

30:                                               ; preds = %.preheader.preheader
  %31 = load i32, ptr @n, align 4, !tbaa !14
  %32 = icmp sgt i32 %21, %31
  %33 = icmp slt i32 %23, 1
  %or.cond = select i1 %32, i1 true, i1 %33
  %34 = load i32, ptr @m, align 4
  %35 = icmp sgt i32 %23, %34
  %or.cond39 = select i1 %or.cond, i1 true, i1 %35
  br i1 %or.cond39, label %.preheader.1, label %36

36:                                               ; preds = %30
  %37 = zext nneg i32 %21 to i64
  %38 = zext nneg i32 %23 to i64
  %39 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %37, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !14
  %41 = icmp eq i32 %40, 1
  br i1 %41, label %.preheader.1, label %42

42:                                               ; preds = %36
  %43 = getelementptr inbounds [10 x [10 x [10 x [10 x i32]]]], ptr @mark, i64 0, i64 %37, i64 %38, i64 %14, i64 %16
  %44 = load i32, ptr %43, align 4, !tbaa !14
  %.not = icmp eq i32 %44, 0
  br i1 %.not, label %45, label %.preheader.1

45:                                               ; preds = %42
  %46 = add nsw i32 %15, -1
  %47 = icmp sgt i32 %15, 1
  br i1 %47, label %48, label %.preheader.1

48:                                               ; preds = %45
  %49 = zext nneg i32 %46 to i64
  %50 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %14, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !14
  %.not31 = icmp eq i32 %51, 1
  br i1 %.not31, label %.preheader.1, label %52

52:                                               ; preds = %48
  %53 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 12), align 4, !tbaa !11
  %54 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 16), align 4, !tbaa !12
  %55 = invoke noundef i32 @_Z9judge_bfsiiiiii(i32 noundef %53, i32 noundef %54, i32 noundef %13, i32 noundef %46, i32 noundef %13, i32 noundef %15)
          to label %56 unwind label %.loopexit33

56:                                               ; preds = %52
  %.not32 = icmp eq i32 %55, 0
  br i1 %.not32, label %.preheader.1, label %57

57:                                               ; preds = %56
  %58 = load i32, ptr @b, align 4, !tbaa !5
  store i32 %58, ptr getelementptr inbounds (i8, ptr @a, i64 12), align 4, !tbaa !11
  %59 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 4), align 4, !tbaa !10
  store i32 %59, ptr getelementptr inbounds (i8, ptr @a, i64 16), align 4, !tbaa !12
  %60 = load i32, ptr @a, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !10
  %63 = sext i32 %62 to i64
  %64 = sext i32 %58 to i64
  %65 = sext i32 %59 to i64
  %66 = getelementptr inbounds [10 x [10 x [10 x [10 x i32]]]], ptr @mark, i64 0, i64 %61, i64 %63, i64 %64, i64 %65
  store i32 1, ptr %66, align 4, !tbaa !14
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(20) @a)
          to label %.preheader.1 unwind label %.loopexit33

.preheader.1:                                     ; preds = %57, %56, %48, %45, %42, %36, %.preheader.preheader, %30
  %67 = load i32, ptr @b, align 4, !tbaa !5
  %68 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 8), align 8, !tbaa !14
  %69 = add nsw i32 %68, %67
  store i32 %69, ptr @a, align 4, !tbaa !5
  %70 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 4), align 4, !tbaa !10
  %71 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 12), align 4, !tbaa !14
  %72 = add nsw i32 %71, %70
  store i32 %72, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !10
  %73 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 8), align 4, !tbaa !13
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr getelementptr inbounds (i8, ptr @a, i64 8), align 4, !tbaa !13
  %75 = icmp slt i32 %69, 1
  br i1 %75, label %.preheader.2, label %76

76:                                               ; preds = %.preheader.1
  %77 = load i32, ptr @n, align 4, !tbaa !14
  %78 = icmp sgt i32 %69, %77
  %79 = icmp slt i32 %72, 1
  %or.cond.1 = select i1 %78, i1 true, i1 %79
  br i1 %or.cond.1, label %.preheader.2, label %80

80:                                               ; preds = %76
  %81 = load i32, ptr @m, align 4, !tbaa !14
  %82 = icmp sgt i32 %72, %81
  br i1 %82, label %.preheader.2, label %83

83:                                               ; preds = %80
  %84 = zext nneg i32 %69 to i64
  %85 = zext nneg i32 %72 to i64
  %86 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %84, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !14
  %88 = icmp eq i32 %87, 1
  br i1 %88, label %.preheader.2, label %89

89:                                               ; preds = %83
  %90 = sext i32 %67 to i64
  %91 = sext i32 %70 to i64
  %92 = getelementptr inbounds [10 x [10 x [10 x [10 x i32]]]], ptr @mark, i64 0, i64 %84, i64 %85, i64 %90, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !14
  %.not.1 = icmp eq i32 %93, 0
  br i1 %.not.1, label %94, label %.preheader.2

94:                                               ; preds = %89
  %95 = add nsw i32 %70, 1
  %.not28.not.1 = icmp slt i32 %70, %81
  br i1 %.not28.not.1, label %96, label %.preheader.2

96:                                               ; preds = %94
  %97 = sext i32 %95 to i64
  %98 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %90, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !14
  %.not29.1 = icmp eq i32 %99, 1
  br i1 %.not29.1, label %.preheader.2, label %100

100:                                              ; preds = %96
  %101 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 12), align 4, !tbaa !11
  %102 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 16), align 4, !tbaa !12
  %103 = invoke noundef i32 @_Z9judge_bfsiiiiii(i32 noundef %101, i32 noundef %102, i32 noundef %67, i32 noundef %95, i32 noundef %67, i32 noundef %70)
          to label %104 unwind label %.loopexit33

104:                                              ; preds = %100
  %.not30.1 = icmp eq i32 %103, 0
  br i1 %.not30.1, label %.preheader.2, label %105

105:                                              ; preds = %104
  %106 = load i32, ptr @b, align 4, !tbaa !5
  store i32 %106, ptr getelementptr inbounds (i8, ptr @a, i64 12), align 4, !tbaa !11
  %107 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 4), align 4, !tbaa !10
  store i32 %107, ptr getelementptr inbounds (i8, ptr @a, i64 16), align 4, !tbaa !12
  %108 = load i32, ptr @a, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !10
  %111 = sext i32 %110 to i64
  %112 = sext i32 %106 to i64
  %113 = sext i32 %107 to i64
  %114 = getelementptr inbounds [10 x [10 x [10 x [10 x i32]]]], ptr @mark, i64 0, i64 %109, i64 %111, i64 %112, i64 %113
  store i32 1, ptr %114, align 4, !tbaa !14
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(20) @a)
          to label %.preheader.2 unwind label %.loopexit33

.preheader.2:                                     ; preds = %105, %104, %96, %94, %89, %83, %80, %76, %.preheader.1
  %115 = load i32, ptr @b, align 4, !tbaa !5
  %116 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 16), align 16, !tbaa !14
  %117 = add nsw i32 %116, %115
  store i32 %117, ptr @a, align 4, !tbaa !5
  %118 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 4), align 4, !tbaa !10
  %119 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 20), align 4, !tbaa !14
  %120 = add nsw i32 %119, %118
  store i32 %120, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !10
  %121 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 8), align 4, !tbaa !13
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr getelementptr inbounds (i8, ptr @a, i64 8), align 4, !tbaa !13
  %123 = icmp slt i32 %117, 1
  br i1 %123, label %.preheader.3, label %124

124:                                              ; preds = %.preheader.2
  %125 = load i32, ptr @n, align 4, !tbaa !14
  %126 = icmp sgt i32 %117, %125
  %127 = icmp slt i32 %120, 1
  %or.cond.2 = select i1 %126, i1 true, i1 %127
  %128 = load i32, ptr @m, align 4
  %129 = icmp sgt i32 %120, %128
  %or.cond41 = select i1 %or.cond.2, i1 true, i1 %129
  br i1 %or.cond41, label %.preheader.3, label %130

130:                                              ; preds = %124
  %131 = zext nneg i32 %117 to i64
  %132 = zext nneg i32 %120 to i64
  %133 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %131, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !14
  %135 = icmp eq i32 %134, 1
  br i1 %135, label %.preheader.3, label %136

136:                                              ; preds = %130
  %137 = sext i32 %115 to i64
  %138 = sext i32 %118 to i64
  %139 = getelementptr inbounds [10 x [10 x [10 x [10 x i32]]]], ptr @mark, i64 0, i64 %131, i64 %132, i64 %137, i64 %138
  %140 = load i32, ptr %139, align 4, !tbaa !14
  %.not.2 = icmp eq i32 %140, 0
  br i1 %.not.2, label %141, label %.preheader.3

141:                                              ; preds = %136
  %142 = add nsw i32 %115, -1
  %143 = icmp sgt i32 %115, 1
  br i1 %143, label %144, label %.preheader.3

144:                                              ; preds = %141
  %145 = zext nneg i32 %142 to i64
  %146 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %145, i64 %138
  %147 = load i32, ptr %146, align 4, !tbaa !14
  %.not26.2 = icmp eq i32 %147, 1
  br i1 %.not26.2, label %.preheader.3, label %148

148:                                              ; preds = %144
  %149 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 12), align 4, !tbaa !11
  %150 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 16), align 4, !tbaa !12
  %151 = invoke noundef i32 @_Z9judge_bfsiiiiii(i32 noundef %149, i32 noundef %150, i32 noundef %142, i32 noundef %118, i32 noundef %115, i32 noundef %118)
          to label %152 unwind label %.loopexit33

152:                                              ; preds = %148
  %.not27.2 = icmp eq i32 %151, 0
  br i1 %.not27.2, label %.preheader.3, label %153

153:                                              ; preds = %152
  %154 = load i32, ptr @b, align 4, !tbaa !5
  store i32 %154, ptr getelementptr inbounds (i8, ptr @a, i64 12), align 4, !tbaa !11
  %155 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 4), align 4, !tbaa !10
  store i32 %155, ptr getelementptr inbounds (i8, ptr @a, i64 16), align 4, !tbaa !12
  %156 = load i32, ptr @a, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !10
  %159 = sext i32 %158 to i64
  %160 = sext i32 %154 to i64
  %161 = sext i32 %155 to i64
  %162 = getelementptr inbounds [10 x [10 x [10 x [10 x i32]]]], ptr @mark, i64 0, i64 %157, i64 %159, i64 %160, i64 %161
  store i32 1, ptr %162, align 4, !tbaa !14
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(20) @a)
          to label %.preheader.3 unwind label %.loopexit33

.preheader.3:                                     ; preds = %153, %152, %144, %141, %136, %130, %124, %.preheader.2
  %163 = load i32, ptr @b, align 4, !tbaa !5
  %164 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 24), align 8, !tbaa !14
  %165 = add nsw i32 %164, %163
  store i32 %165, ptr @a, align 4, !tbaa !5
  %166 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 4), align 4, !tbaa !10
  %167 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 28), align 4, !tbaa !14
  %168 = add nsw i32 %167, %166
  store i32 %168, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !10
  %169 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 8), align 4, !tbaa !13
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr getelementptr inbounds (i8, ptr @a, i64 8), align 4, !tbaa !13
  %171 = icmp slt i32 %165, 1
  br i1 %171, label %.loopexit, label %172

172:                                              ; preds = %.preheader.3
  %173 = load i32, ptr @n, align 4, !tbaa !14
  %174 = icmp sgt i32 %165, %173
  %175 = icmp slt i32 %168, 1
  %or.cond.3 = select i1 %174, i1 true, i1 %175
  %176 = load i32, ptr @m, align 4
  %177 = icmp sgt i32 %168, %176
  %or.cond43 = select i1 %or.cond.3, i1 true, i1 %177
  br i1 %or.cond43, label %.loopexit, label %178

178:                                              ; preds = %172
  %179 = zext nneg i32 %165 to i64
  %180 = zext nneg i32 %168 to i64
  %181 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %179, i64 %180
  %182 = load i32, ptr %181, align 4, !tbaa !14
  %183 = icmp eq i32 %182, 1
  br i1 %183, label %.loopexit, label %184

184:                                              ; preds = %178
  %185 = sext i32 %163 to i64
  %186 = sext i32 %166 to i64
  %187 = getelementptr inbounds [10 x [10 x [10 x [10 x i32]]]], ptr @mark, i64 0, i64 %179, i64 %180, i64 %185, i64 %186
  %188 = load i32, ptr %187, align 4, !tbaa !14
  %.not.3 = icmp eq i32 %188, 0
  br i1 %.not.3, label %189, label %.loopexit

189:                                              ; preds = %184
  %190 = add nsw i32 %163, 1
  %.not23.not.3 = icmp slt i32 %163, %173
  br i1 %.not23.not.3, label %191, label %.loopexit

191:                                              ; preds = %189
  %192 = sext i32 %190 to i64
  %193 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %192, i64 %186
  %194 = load i32, ptr %193, align 4, !tbaa !14
  %.not24.3 = icmp eq i32 %194, 1
  br i1 %.not24.3, label %.loopexit, label %195

195:                                              ; preds = %191
  %196 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 12), align 4, !tbaa !11
  %197 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 16), align 4, !tbaa !12
  %198 = invoke noundef i32 @_Z9judge_bfsiiiiii(i32 noundef %196, i32 noundef %197, i32 noundef %190, i32 noundef %166, i32 noundef %163, i32 noundef %166)
          to label %199 unwind label %.loopexit33

199:                                              ; preds = %195
  %.not25.3 = icmp eq i32 %198, 0
  br i1 %.not25.3, label %.loopexit, label %200

200:                                              ; preds = %199
  %201 = load i32, ptr @b, align 4, !tbaa !5
  store i32 %201, ptr getelementptr inbounds (i8, ptr @a, i64 12), align 4, !tbaa !11
  %202 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 4), align 4, !tbaa !10
  store i32 %202, ptr getelementptr inbounds (i8, ptr @a, i64 16), align 4, !tbaa !12
  %203 = load i32, ptr @a, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %205 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !10
  %206 = sext i32 %205 to i64
  %207 = sext i32 %201 to i64
  %208 = sext i32 %202 to i64
  %209 = getelementptr inbounds [10 x [10 x [10 x [10 x i32]]]], ptr @mark, i64 0, i64 %204, i64 %206, i64 %207, i64 %208
  store i32 1, ptr %209, align 4, !tbaa !14
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(20) @a)
          to label %.loopexit unwind label %.loopexit33

.loopexit:                                        ; preds = %200, %199, %191, %189, %184, %178, %172, %.preheader.3
  %210 = call noundef zeroext i1 @_ZNKSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %210, label %.loopexit35, label %.lr.ph, !llvm.loop !16

.loopexit35:                                      ; preds = %.loopexit, %.preheader34, %27
  %.0 = phi i32 [ %28, %27 ], [ 0, %.preheader34 ], [ 0, %.loopexit ]
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #6
  ret i32 %.0
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(20)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #4 align 2

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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, !7, i64 0}
!6 = !{!"_ZTS4node", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!6, !7, i64 12}
!12 = !{!6, !7, i64 16}
!13 = !{!6, !7, i64 8}
!14 = !{!7, !7, i64 0}
!15 = !{i64 0, i64 4, !14, i64 4, i64 4, !14, i64 8, i64 4, !14, i64 12, i64 4, !14, i64 16, i64 4, !14}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass