; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ/2612.ll (Z3bfsii)

; 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 }
%"class.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = 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", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@map = external dso_local global [210 x [210 x i8]], align 16
@vis = external dso_local global [210 x [210 x i32]], align 16
@dis = external dso_local global [210 x [210 x [2 x i32]]], align 16
@flag = external dso_local global i32, align 4
@dir = external dso_local global [4 x [2 x i32]], align 16

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3bfsii(i32 noundef %0, i32 noundef %1) #1 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %struct.node, align 4
  %6 = alloca %struct.node, align 4
  %7 = alloca %"class.std::queue", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 12, ptr %6) #5
  %11 = load i32, ptr %3, align 4, !tbaa !5
  %12 = getelementptr inbounds %struct.node, ptr %5, i32 0, i32 0
  store i32 %11, ptr %12, align 4, !tbaa !9
  %13 = load i32, ptr %4, align 4, !tbaa !5
  %14 = getelementptr inbounds %struct.node, ptr %5, i32 0, i32 1
  store i32 %13, ptr %14, align 4, !tbaa !11
  %15 = getelementptr inbounds %struct.node, ptr %5, i32 0, i32 2
  store i32 0, ptr %15, align 4, !tbaa !12
  %16 = load i32, ptr %3, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [210 x [210 x i32]], ptr @vis, i64 0, i64 %17
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [210 x i32], ptr %18, i64 0, i64 %20
  store i32 1, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 80, ptr %7) #5
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %7, ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %22 unwind label %35

22:                                               ; preds = %2
  br label %23

23:                                               ; preds = %148, %22
  %24 = invoke noundef zeroext i1 @_ZNKSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %25 unwind label %35

25:                                               ; preds = %23
  %26 = xor i1 %24, true
  br i1 %26, label %27, label %149

27:                                               ; preds = %25
  %28 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %29 unwind label %35

29:                                               ; preds = %27
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 4 %28, i64 12, i1 false), !tbaa.struct !13
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %30 unwind label %35

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

31:                                               ; preds = %145, %30
  %32 = load i32, ptr %10, align 4, !tbaa !5
  %33 = icmp slt i32 %32, 4
  br i1 %33, label %39, label %34

34:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %148

35:                                               ; preds = %29, %27, %23, %2
  %36 = landingpad { ptr, i32 }
          cleanup
  %37 = extractvalue { ptr, i32 } %36, 0
  store ptr %37, ptr %8, align 8
  %38 = extractvalue { ptr, i32 } %36, 1
  store i32 %38, ptr %9, align 4
  br label %150

39:                                               ; preds = %31
  %40 = getelementptr inbounds %struct.node, ptr %5, i32 0, i32 0
  %41 = load i32, ptr %40, align 4, !tbaa !9
  %42 = load i32, ptr %10, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [4 x [2 x i32]], ptr @dir, i64 0, i64 %43
  %45 = getelementptr inbounds [2 x i32], ptr %44, i64 0, i64 0
  %46 = load i32, ptr %45, align 8, !tbaa !5
  %47 = add nsw i32 %41, %46
  %48 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 0
  store i32 %47, ptr %48, align 4, !tbaa !9
  %49 = getelementptr inbounds %struct.node, ptr %5, i32 0, i32 1
  %50 = load i32, ptr %49, align 4, !tbaa !11
  %51 = load i32, ptr %10, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [4 x [2 x i32]], ptr @dir, i64 0, i64 %52
  %54 = getelementptr inbounds [2 x i32], ptr %53, i64 0, i64 1
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = add nsw i32 %50, %55
  %57 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 1
  store i32 %56, ptr %57, align 4, !tbaa !11
  %58 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 0
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 1
  %61 = load i32, ptr %60, align 4, !tbaa !11
  %62 = call noundef zeroext i1 @_Z5checkii(i32 noundef %59, i32 noundef %61)
  br i1 %62, label %63, label %144

63:                                               ; preds = %39
  %64 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 0
  %65 = load i32, ptr %64, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [210 x [210 x i8]], ptr @map, i64 0, i64 %66
  %68 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 1
  %69 = load i32, ptr %68, align 4, !tbaa !11
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [210 x i8], ptr %67, i64 0, i64 %70
  %72 = load i8, ptr %71, align 1, !tbaa !14
  %73 = sext i8 %72 to i32
  %74 = icmp eq i32 %73, 46
  br i1 %74, label %87, label %75

75:                                               ; preds = %63
  %76 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 0
  %77 = load i32, ptr %76, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [210 x [210 x i8]], ptr @map, i64 0, i64 %78
  %80 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 1
  %81 = load i32, ptr %80, align 4, !tbaa !11
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [210 x i8], ptr %79, i64 0, i64 %82
  %84 = load i8, ptr %83, align 1, !tbaa !14
  %85 = sext i8 %84 to i32
  %86 = icmp eq i32 %85, 64
  br i1 %86, label %87, label %144

87:                                               ; preds = %75, %63
  %88 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 0
  %89 = load i32, ptr %88, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [210 x [210 x i32]], ptr @vis, i64 0, i64 %90
  %92 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 1
  %93 = load i32, ptr %92, align 4, !tbaa !11
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [210 x i32], ptr %91, i64 0, i64 %94
  store i32 1, ptr %95, align 4, !tbaa !5
  %96 = getelementptr inbounds %struct.node, ptr %5, i32 0, i32 2
  %97 = load i32, ptr %96, align 4, !tbaa !12
  %98 = add nsw i32 %97, 1
  %99 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 2
  store i32 %98, ptr %99, align 4, !tbaa !12
  %100 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 0
  %101 = load i32, ptr %100, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [210 x [210 x i8]], ptr @map, i64 0, i64 %102
  %104 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 1
  %105 = load i32, ptr %104, align 4, !tbaa !11
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [210 x i8], ptr %103, i64 0, i64 %106
  %108 = load i8, ptr %107, align 1, !tbaa !14
  %109 = sext i8 %108 to i32
  %110 = icmp eq i32 %109, 64
  br i1 %110, label %111, label %142

111:                                              ; preds = %87
  %112 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 0
  %113 = load i32, ptr %112, align 4, !tbaa !9
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [210 x [210 x [2 x i32]]], ptr @dis, i64 0, i64 %114
  %116 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 1
  %117 = load i32, ptr %116, align 4, !tbaa !11
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [210 x [2 x i32]], ptr %115, i64 0, i64 %118
  %120 = load i32, ptr @flag, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [2 x i32], ptr %119, i64 0, i64 %121
  %123 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 2
  %124 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %122, ptr noundef nonnull align 4 dereferenceable(4) %123)
          to label %125 unwind label %138

125:                                              ; preds = %111
  %126 = load i32, ptr %124, align 4, !tbaa !5
  %127 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 0
  %128 = load i32, ptr %127, align 4, !tbaa !9
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [210 x [210 x [2 x i32]]], ptr @dis, i64 0, i64 %129
  %131 = getelementptr inbounds %struct.node, ptr %6, i32 0, i32 1
  %132 = load i32, ptr %131, align 4, !tbaa !11
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [210 x [2 x i32]], ptr %130, i64 0, i64 %133
  %135 = load i32, ptr @flag, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [2 x i32], ptr %134, i64 0, i64 %136
  store i32 %126, ptr %137, align 4, !tbaa !5
  br label %142

138:                                              ; preds = %142, %111
  %139 = landingpad { ptr, i32 }
          cleanup
  %140 = extractvalue { ptr, i32 } %139, 0
  store ptr %140, ptr %8, align 8
  %141 = extractvalue { ptr, i32 } %139, 1
  store i32 %141, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %150

142:                                              ; preds = %125, %87
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %7, ptr noundef nonnull align 4 dereferenceable(12) %6)
          to label %143 unwind label %138

143:                                              ; preds = %142
  br label %144

144:                                              ; preds = %143, %75, %39
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %10, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %10, align 4, !tbaa !5
  br label %31, !llvm.loop !15

148:                                              ; preds = %34
  br label %23, !llvm.loop !17

149:                                              ; preds = %25
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %7) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %5) #5
  ret void

150:                                              ; preds = %138, %35
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %7) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %5) #5
  br label %151

151:                                              ; preds = %150
  %152 = load ptr, ptr %8, align 8
  %153 = load i32, ptr %9, align 4
  %154 = insertvalue { ptr, i32 } poison, ptr %152, 0
  %155 = insertvalue { ptr, i32 } %154, i32 %153, 1
  resume { ptr, i32 } %155
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #1 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(12)) #1 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; 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: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) #0 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #4 align 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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { nounwind }

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

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


; 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 }
%"class.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = 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", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@map = external dso_local local_unnamed_addr global [210 x [210 x i8]], align 16
@vis = external dso_local local_unnamed_addr global [210 x [210 x i32]], align 16
@dis = external dso_local global [210 x [210 x [2 x i32]]], align 16
@flag = external dso_local local_unnamed_addr global i32, align 4
@dir = external dso_local local_unnamed_addr global [4 x [2 x i32]], align 16

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3bfsii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %3 = alloca %struct.node, align 8
  %4 = alloca %struct.node, align 8
  %5 = alloca %"class.std::queue", align 8
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #5
  store i32 %0, ptr %3, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 %1, ptr %6, align 4, !tbaa !10
  %7 = getelementptr inbounds i8, ptr %3, i64 8
  store i32 0, ptr %7, align 8, !tbaa !11
  %8 = sext i32 %0 to i64
  %9 = sext i32 %1 to i64
  %10 = getelementptr inbounds [210 x [210 x i32]], ptr @vis, i64 0, i64 %8, i64 %9
  store i32 1, ptr %10, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %5) #5
  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(12) %3)
          to label %.preheader unwind label %22

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

.lr.ph:                                           ; preds = %.preheader
  %12 = getelementptr inbounds i8, ptr %4, i64 4
  %13 = getelementptr inbounds i8, ptr %4, i64 8
  br label %14

14:                                               ; preds = %.lr.ph, %.loopexit
  %15 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %3, ptr noundef nonnull align 4 dereferenceable(12) %15, i64 12, i1 false), !tbaa.struct !13
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %16 = load <2 x i32>, ptr %3, align 8, !tbaa !12
  %17 = load <2 x i32>, ptr @dir, align 16, !tbaa !12
  %18 = add nsw <2 x i32> %17, %16
  store <2 x i32> %18, ptr %4, align 8, !tbaa !12
  %19 = extractelement <2 x i32> %18, i64 0
  %20 = extractelement <2 x i32> %18, i64 1
  %21 = call noundef zeroext i1 @_Z5checkii(i32 noundef %19, i32 noundef %20)
  br i1 %21, label %24, label %52

22:                                               ; preds = %2
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %152

24:                                               ; preds = %14
  %25 = load i32, ptr %4, align 8, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = load i32, ptr %12, align 4, !tbaa !10
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [210 x [210 x i8]], ptr @map, i64 0, i64 %26, i64 %28
  %30 = load i8, ptr %29, align 1, !tbaa !14
  switch i8 %30, label %52 [
    i8 46, label %31
    i8 64, label %31
  ]

31:                                               ; preds = %24, %24
  %32 = getelementptr inbounds [210 x [210 x i32]], ptr @vis, i64 0, i64 %26, i64 %28
  store i32 1, ptr %32, align 4, !tbaa !12
  %33 = load i32, ptr %7, align 8, !tbaa !11
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %13, align 8, !tbaa !11
  %35 = icmp eq i8 %30, 64
  br i1 %35, label %36, label %51

36:                                               ; preds = %31
  %37 = load i32, ptr @flag, align 4, !tbaa !12
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [210 x [210 x [2 x i32]]], ptr @dis, i64 0, i64 %26, i64 %28, i64 %38
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %39, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %41 = load i32, ptr %40, align 4, !tbaa !12
  %42 = load i32, ptr %4, align 8, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = load i32, ptr %12, align 4, !tbaa !10
  %45 = sext i32 %44 to i64
  %46 = load i32, ptr @flag, align 4, !tbaa !12
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [210 x [210 x [2 x i32]]], ptr @dis, i64 0, i64 %43, i64 %45, i64 %47
  store i32 %41, ptr %48, align 4, !tbaa !12
  br label %51

49:                                               ; preds = %150, %117, %84, %51
  %50 = landingpad { ptr, i32 }
          cleanup
  br label %152

51:                                               ; preds = %36, %31
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %52 unwind label %49

52:                                               ; preds = %24, %14, %51
  %53 = load <2 x i32>, ptr %3, align 8, !tbaa !12
  %54 = load <2 x i32>, ptr getelementptr inbounds (i8, ptr @dir, i64 8), align 8, !tbaa !12
  %55 = add nsw <2 x i32> %54, %53
  store <2 x i32> %55, ptr %4, align 8, !tbaa !12
  %56 = extractelement <2 x i32> %55, i64 0
  %57 = extractelement <2 x i32> %55, i64 1
  %58 = call noundef zeroext i1 @_Z5checkii(i32 noundef %56, i32 noundef %57)
  br i1 %58, label %59, label %85

59:                                               ; preds = %52
  %60 = load i32, ptr %4, align 8, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = load i32, ptr %12, align 4, !tbaa !10
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [210 x [210 x i8]], ptr @map, i64 0, i64 %61, i64 %63
  %65 = load i8, ptr %64, align 1, !tbaa !14
  switch i8 %65, label %85 [
    i8 46, label %66
    i8 64, label %66
  ]

66:                                               ; preds = %59, %59
  %67 = getelementptr inbounds [210 x [210 x i32]], ptr @vis, i64 0, i64 %61, i64 %63
  store i32 1, ptr %67, align 4, !tbaa !12
  %68 = load i32, ptr %7, align 8, !tbaa !11
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %13, align 8, !tbaa !11
  %70 = icmp eq i8 %65, 64
  br i1 %70, label %71, label %84

71:                                               ; preds = %66
  %72 = load i32, ptr @flag, align 4, !tbaa !12
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [210 x [210 x [2 x i32]]], ptr @dis, i64 0, i64 %61, i64 %63, i64 %73
  %75 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %74, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %76 = load i32, ptr %75, align 4, !tbaa !12
  %77 = load i32, ptr %4, align 8, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = load i32, ptr %12, align 4, !tbaa !10
  %80 = sext i32 %79 to i64
  %81 = load i32, ptr @flag, align 4, !tbaa !12
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [210 x [210 x [2 x i32]]], ptr @dis, i64 0, i64 %78, i64 %80, i64 %82
  store i32 %76, ptr %83, align 4, !tbaa !12
  br label %84

84:                                               ; preds = %71, %66
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %85 unwind label %49

85:                                               ; preds = %84, %59, %52
  %86 = load <2 x i32>, ptr %3, align 8, !tbaa !12
  %87 = load <2 x i32>, ptr getelementptr inbounds (i8, ptr @dir, i64 16), align 16, !tbaa !12
  %88 = add nsw <2 x i32> %87, %86
  store <2 x i32> %88, ptr %4, align 8, !tbaa !12
  %89 = extractelement <2 x i32> %88, i64 0
  %90 = extractelement <2 x i32> %88, i64 1
  %91 = call noundef zeroext i1 @_Z5checkii(i32 noundef %89, i32 noundef %90)
  br i1 %91, label %92, label %118

92:                                               ; preds = %85
  %93 = load i32, ptr %4, align 8, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = load i32, ptr %12, align 4, !tbaa !10
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [210 x [210 x i8]], ptr @map, i64 0, i64 %94, i64 %96
  %98 = load i8, ptr %97, align 1, !tbaa !14
  switch i8 %98, label %118 [
    i8 46, label %99
    i8 64, label %99
  ]

99:                                               ; preds = %92, %92
  %100 = getelementptr inbounds [210 x [210 x i32]], ptr @vis, i64 0, i64 %94, i64 %96
  store i32 1, ptr %100, align 4, !tbaa !12
  %101 = load i32, ptr %7, align 8, !tbaa !11
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %13, align 8, !tbaa !11
  %103 = icmp eq i8 %98, 64
  br i1 %103, label %104, label %117

104:                                              ; preds = %99
  %105 = load i32, ptr @flag, align 4, !tbaa !12
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [210 x [210 x [2 x i32]]], ptr @dis, i64 0, i64 %94, i64 %96, i64 %106
  %108 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %107, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %109 = load i32, ptr %108, align 4, !tbaa !12
  %110 = load i32, ptr %4, align 8, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = load i32, ptr %12, align 4, !tbaa !10
  %113 = sext i32 %112 to i64
  %114 = load i32, ptr @flag, align 4, !tbaa !12
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [210 x [210 x [2 x i32]]], ptr @dis, i64 0, i64 %111, i64 %113, i64 %115
  store i32 %109, ptr %116, align 4, !tbaa !12
  br label %117

117:                                              ; preds = %104, %99
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %118 unwind label %49

118:                                              ; preds = %117, %92, %85
  %119 = load <2 x i32>, ptr %3, align 8, !tbaa !12
  %120 = load <2 x i32>, ptr getelementptr inbounds (i8, ptr @dir, i64 24), align 8, !tbaa !12
  %121 = add nsw <2 x i32> %120, %119
  store <2 x i32> %121, ptr %4, align 8, !tbaa !12
  %122 = extractelement <2 x i32> %121, i64 0
  %123 = extractelement <2 x i32> %121, i64 1
  %124 = call noundef zeroext i1 @_Z5checkii(i32 noundef %122, i32 noundef %123)
  br i1 %124, label %125, label %.loopexit

125:                                              ; preds = %118
  %126 = load i32, ptr %4, align 8, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = load i32, ptr %12, align 4, !tbaa !10
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [210 x [210 x i8]], ptr @map, i64 0, i64 %127, i64 %129
  %131 = load i8, ptr %130, align 1, !tbaa !14
  switch i8 %131, label %.loopexit [
    i8 46, label %132
    i8 64, label %132
  ]

132:                                              ; preds = %125, %125
  %133 = getelementptr inbounds [210 x [210 x i32]], ptr @vis, i64 0, i64 %127, i64 %129
  store i32 1, ptr %133, align 4, !tbaa !12
  %134 = load i32, ptr %7, align 8, !tbaa !11
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %13, align 8, !tbaa !11
  %136 = icmp eq i8 %131, 64
  br i1 %136, label %137, label %150

137:                                              ; preds = %132
  %138 = load i32, ptr @flag, align 4, !tbaa !12
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [210 x [210 x [2 x i32]]], ptr @dis, i64 0, i64 %127, i64 %129, i64 %139
  %141 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %140, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %142 = load i32, ptr %141, align 4, !tbaa !12
  %143 = load i32, ptr %4, align 8, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = load i32, ptr %12, align 4, !tbaa !10
  %146 = sext i32 %145 to i64
  %147 = load i32, ptr @flag, align 4, !tbaa !12
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [210 x [210 x [2 x i32]]], ptr @dis, i64 0, i64 %144, i64 %146, i64 %148
  store i32 %142, ptr %149, align 4, !tbaa !12
  br label %150

150:                                              ; preds = %137, %132
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %.loopexit unwind label %49

.loopexit:                                        ; preds = %150, %125, %118
  %151 = call noundef zeroext i1 @_ZNKSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %151, label %._crit_edge, label %14, !llvm.loop !15

._crit_edge:                                      ; preds = %.loopexit, %.preheader
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #5
  ret void

152:                                              ; preds = %49, %22
  %.pn = phi { ptr, i32 } [ %50, %49 ], [ %23, %22 ]
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #1 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(12)) local_unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; 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 nounwind uwtable
declare dso_local void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 align 2

; 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 #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #4 align 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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { nounwind }

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

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


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