; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ/1372.ll (Z3bfsv)

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

@dir = external dso_local global [8 x [2 x i32]], align 16
@map = external dso_local global [10 x [10 x i32]], align 16
@ex = external dso_local global i32, align 4
@ey = external dso_local global i32, align 4
@s1 = external dso_local global [5 x i8], align 1
@s2 = external dso_local global [5 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z3bfsv() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %struct.node, align 4
  %4 = alloca %struct.node, align 4
  %5 = alloca %"class.std::queue", align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.memset.p0.i64(ptr align 16 @map, i8 0, i64 400, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 12, ptr %4) #6
  %9 = load i8, ptr @s1, align 1, !tbaa !5
  %10 = sext i8 %9 to i32
  %11 = sub nsw i32 %10, 97
  %12 = getelementptr inbounds %struct.node, ptr %3, i32 0, i32 0
  store i32 %11, ptr %12, align 4, !tbaa !8
  %13 = load i8, ptr getelementptr inbounds ([5 x i8], ptr @s1, i64 0, i64 1), align 1, !tbaa !5
  %14 = sext i8 %13 to i32
  %15 = sub nsw i32 %14, 49
  %16 = getelementptr inbounds %struct.node, ptr %3, i32 0, i32 1
  store i32 %15, ptr %16, align 4, !tbaa !11
  %17 = getelementptr inbounds %struct.node, ptr %3, i32 0, i32 2
  store i32 0, ptr %17, align 4, !tbaa !12
  %18 = load i8, ptr @s2, align 1, !tbaa !5
  %19 = sext i8 %18 to i32
  %20 = sub nsw i32 %19, 97
  store i32 %20, ptr @ex, align 4, !tbaa !13
  %21 = load i8, ptr getelementptr inbounds ([5 x i8], ptr @s2, i64 0, i64 1), align 1, !tbaa !5
  %22 = sext i8 %21 to i32
  %23 = sub nsw i32 %22, 49
  store i32 %23, ptr @ey, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 80, ptr %5) #6
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %24 = getelementptr inbounds %struct.node, ptr %3, i32 0, i32 0
  %25 = load i32, ptr %24, align 4, !tbaa !8
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %26
  %28 = getelementptr inbounds %struct.node, ptr %3, i32 0, i32 1
  %29 = load i32, ptr %28, align 4, !tbaa !11
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [10 x i32], ptr %27, i64 0, i64 %30
  store i32 1, ptr %31, align 4, !tbaa !13
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(12) %3)
          to label %32 unwind label %53

32:                                               ; preds = %0
  br label %33

33:                                               ; preds = %124, %32
  %34 = invoke noundef zeroext i1 @_ZNKSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
          to label %35 unwind label %53

35:                                               ; preds = %33
  %36 = xor i1 %34, true
  br i1 %36, label %37, label %125

37:                                               ; preds = %35
  %38 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
          to label %39 unwind label %53

39:                                               ; preds = %37
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %3, ptr align 4 %38, i64 12, i1 false), !tbaa.struct !14
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
          to label %40 unwind label %53

40:                                               ; preds = %39
  %41 = getelementptr inbounds %struct.node, ptr %3, i32 0, i32 0
  %42 = load i32, ptr %41, align 4, !tbaa !8
  %43 = load i32, ptr @ex, align 4, !tbaa !13
  %44 = icmp eq i32 %42, %43
  br i1 %44, label %45, label %57

45:                                               ; preds = %40
  %46 = getelementptr inbounds %struct.node, ptr %3, i32 0, i32 1
  %47 = load i32, ptr %46, align 4, !tbaa !11
  %48 = load i32, ptr @ey, align 4, !tbaa !13
  %49 = icmp eq i32 %47, %48
  br i1 %49, label %50, label %57

50:                                               ; preds = %45
  %51 = getelementptr inbounds %struct.node, ptr %3, i32 0, i32 2
  %52 = load i32, ptr %51, align 4, !tbaa !12
  store i32 %52, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %126

53:                                               ; preds = %106, %39, %37, %33, %0
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %6, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %7, align 4
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %128

57:                                               ; preds = %45, %40
  store i32 0, ptr %2, align 4, !tbaa !13
  br label %58

58:                                               ; preds = %121, %57
  %59 = load i32, ptr %2, align 4, !tbaa !13
  %60 = icmp slt i32 %59, 8
  br i1 %60, label %61, label %124

61:                                               ; preds = %58
  %62 = getelementptr inbounds %struct.node, ptr %3, i32 0, i32 0
  %63 = load i32, ptr %62, align 4, !tbaa !8
  %64 = load i32, ptr %2, align 4, !tbaa !13
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [8 x [2 x i32]], ptr @dir, i64 0, i64 %65
  %67 = getelementptr inbounds [2 x i32], ptr %66, i64 0, i64 0
  %68 = load i32, ptr %67, align 8, !tbaa !13
  %69 = add nsw i32 %63, %68
  %70 = getelementptr inbounds %struct.node, ptr %4, i32 0, i32 0
  store i32 %69, ptr %70, align 4, !tbaa !8
  %71 = getelementptr inbounds %struct.node, ptr %3, i32 0, i32 1
  %72 = load i32, ptr %71, align 4, !tbaa !11
  %73 = load i32, ptr %2, align 4, !tbaa !13
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [8 x [2 x i32]], ptr @dir, i64 0, i64 %74
  %76 = getelementptr inbounds [2 x i32], ptr %75, i64 0, i64 1
  %77 = load i32, ptr %76, align 4, !tbaa !13
  %78 = add nsw i32 %72, %77
  %79 = getelementptr inbounds %struct.node, ptr %4, i32 0, i32 1
  store i32 %78, ptr %79, align 4, !tbaa !11
  %80 = getelementptr inbounds %struct.node, ptr %4, i32 0, i32 0
  %81 = load i32, ptr %80, align 4, !tbaa !8
  %82 = icmp sge i32 %81, 0
  br i1 %82, label %83, label %120

83:                                               ; preds = %61
  %84 = getelementptr inbounds %struct.node, ptr %4, i32 0, i32 0
  %85 = load i32, ptr %84, align 4, !tbaa !8
  %86 = icmp slt i32 %85, 8
  br i1 %86, label %87, label %120

87:                                               ; preds = %83
  %88 = getelementptr inbounds %struct.node, ptr %4, i32 0, i32 1
  %89 = load i32, ptr %88, align 4, !tbaa !11
  %90 = icmp sge i32 %89, 0
  br i1 %90, label %91, label %120

91:                                               ; preds = %87
  %92 = getelementptr inbounds %struct.node, ptr %4, i32 0, i32 1
  %93 = load i32, ptr %92, align 4, !tbaa !11
  %94 = icmp slt i32 %93, 8
  br i1 %94, label %95, label %120

95:                                               ; preds = %91
  %96 = getelementptr inbounds %struct.node, ptr %4, i32 0, i32 0
  %97 = load i32, ptr %96, align 4, !tbaa !8
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %98
  %100 = getelementptr inbounds %struct.node, ptr %4, i32 0, i32 1
  %101 = load i32, ptr %100, align 4, !tbaa !11
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [10 x i32], ptr %99, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !13
  %105 = icmp eq i32 %104, 0
  br i1 %105, label %106, label %120

106:                                              ; preds = %95
  %107 = getelementptr inbounds %struct.node, ptr %3, i32 0, i32 2
  %108 = load i32, ptr %107, align 4, !tbaa !12
  %109 = add nsw i32 %108, 1
  %110 = getelementptr inbounds %struct.node, ptr %4, i32 0, i32 2
  store i32 %109, ptr %110, align 4, !tbaa !12
  %111 = getelementptr inbounds %struct.node, ptr %4, i32 0, i32 0
  %112 = load i32, ptr %111, align 4, !tbaa !8
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %113
  %115 = getelementptr inbounds %struct.node, ptr %4, i32 0, i32 1
  %116 = load i32, ptr %115, align 4, !tbaa !11
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [10 x i32], ptr %114, i64 0, i64 %117
  store i32 1, ptr %118, align 4, !tbaa !13
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %119 unwind label %53

119:                                              ; preds = %106
  br label %120

120:                                              ; preds = %119, %95, %91, %87, %83, %61
  br label %121

121:                                              ; preds = %120
  %122 = load i32, ptr %2, align 4, !tbaa !13
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %2, align 4, !tbaa !13
  br label %58, !llvm.loop !15

124:                                              ; preds = %58
  br label %33, !llvm.loop !17

125:                                              ; preds = %35
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %126

126:                                              ; preds = %125, %50
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %127 = load i32, ptr %1, align 4
  ret i32 %127

128:                                              ; preds = %53
  %129 = load ptr, ptr %6, align 8
  %130 = load i32, ptr %7, align 4
  %131 = insertvalue { ptr, i32 } poison, ptr %129, 0
  %132 = insertvalue { ptr, i32 } %131, i32 %130, 1
  resume { ptr, i32 } %132
}

; 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

; 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(12)) #0 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)) #3 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)) #3 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) #4

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

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

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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 0}
!9 = !{!"_ZTS4node", !10, i64 0, !10, i64 4, !10, i64 8}
!10 = !{!"int", !6, i64 0}
!11 = !{!9, !10, i64 4}
!12 = !{!9, !10, i64 8}
!13 = !{!10, !10, i64 0}
!14 = !{i64 0, i64 4, !13, i64 4, i64 4, !13, i64 8, i64 4, !13}
!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 }

@dir = external dso_local local_unnamed_addr global [8 x [2 x i32]], align 16
@map = external dso_local local_unnamed_addr global [10 x [10 x i32]], align 16
@ex = external dso_local local_unnamed_addr global i32, align 4
@ey = external dso_local local_unnamed_addr global i32, align 4
@s1 = external dso_local local_unnamed_addr global [5 x i8], align 1
@s2 = external dso_local local_unnamed_addr global [5 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z3bfsv() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %struct.node, align 4
  %2 = alloca %struct.node, align 4
  %3 = alloca %"class.std::queue", align 8
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) @map, i8 0, i64 400, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %2) #6
  %4 = load i8, ptr @s1, align 1, !tbaa !5
  %5 = sext i8 %4 to i32
  %6 = add nsw i32 %5, -97
  store i32 %6, ptr %1, align 4, !tbaa !8
  %7 = load i8, ptr getelementptr inbounds (i8, ptr @s1, i64 1), align 1, !tbaa !5
  %8 = sext i8 %7 to i32
  %9 = add nsw i32 %8, -49
  %10 = getelementptr inbounds i8, ptr %1, i64 4
  store i32 %9, ptr %10, align 4, !tbaa !11
  %11 = getelementptr inbounds i8, ptr %1, i64 8
  store i32 0, ptr %11, align 4, !tbaa !12
  %12 = load i8, ptr @s2, align 1, !tbaa !5
  %13 = sext i8 %12 to i32
  %14 = add nsw i32 %13, -97
  store i32 %14, ptr @ex, align 4, !tbaa !13
  %15 = load i8, ptr getelementptr inbounds (i8, ptr @s2, i64 1), align 1, !tbaa !5
  %16 = sext i8 %15 to i32
  %17 = add nsw i32 %16, -49
  store i32 %17, ptr @ey, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %3) #6
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %18 = sext i32 %6 to i64
  %19 = sext i32 %9 to i64
  %20 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %18, i64 %19
  store i32 1, ptr %20, align 4, !tbaa !13
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(12) %1)
          to label %.preheader unwind label %.loopexit.split-lp

.preheader:                                       ; preds = %0
  %21 = call noundef zeroext i1 @_ZNKSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %21, label %.loopexit18, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %22 = getelementptr inbounds i8, ptr %2, i64 4
  %23 = getelementptr inbounds i8, ptr %2, i64 8
  br label %24

24:                                               ; preds = %.lr.ph, %.loopexit
  %25 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %25, i64 12, i1 false), !tbaa.struct !14
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %26 = load i32, ptr %1, align 4, !tbaa !8
  %27 = load i32, ptr @ex, align 4, !tbaa !13
  %28 = icmp eq i32 %26, %27
  %.pre = load i32, ptr %10, align 4, !tbaa !11
  %29 = load i32, ptr @ey, align 4
  %30 = icmp eq i32 %.pre, %29
  %or.cond42 = select i1 %28, i1 %30, i1 false
  br i1 %or.cond42, label %31, label %34

31:                                               ; preds = %24
  %32 = load i32, ptr %11, align 4, !tbaa !12
  br label %.loopexit18

.loopexit17:                                      ; preds = %165, %148, %131, %114, %97, %80, %63, %46
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %33

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

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

34:                                               ; preds = %24
  %35 = load i32, ptr @dir, align 16, !tbaa !13
  %36 = add nsw i32 %35, %26
  store i32 %36, ptr %2, align 4, !tbaa !8
  %37 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 4), align 4, !tbaa !13
  %38 = add nsw i32 %37, %.pre
  store i32 %38, ptr %22, align 4, !tbaa !11
  %or.cond = icmp ult i32 %36, 8
  %39 = icmp ult i32 %38, 8
  %or.cond8 = select i1 %or.cond, i1 %39, i1 false
  br i1 %or.cond8, label %40, label %49

40:                                               ; preds = %34
  %41 = zext nneg i32 %36 to i64
  %42 = zext nneg i32 %38 to i64
  %43 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %41, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !13
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %46, label %49

46:                                               ; preds = %40
  %47 = load i32, ptr %11, align 4, !tbaa !12
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %23, align 4, !tbaa !12
  store i32 1, ptr %43, align 4, !tbaa !13
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(12) %2)
          to label %._crit_edge unwind label %.loopexit17

._crit_edge:                                      ; preds = %46
  %.pre21 = load i32, ptr %1, align 4, !tbaa !8
  %.pre22 = load i32, ptr %10, align 4, !tbaa !11
  br label %49

49:                                               ; preds = %._crit_edge, %34, %40
  %50 = phi i32 [ %.pre22, %._crit_edge ], [ %.pre, %34 ], [ %.pre, %40 ]
  %51 = phi i32 [ %.pre21, %._crit_edge ], [ %26, %34 ], [ %26, %40 ]
  %52 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 8), align 8, !tbaa !13
  %53 = add nsw i32 %52, %51
  store i32 %53, ptr %2, align 4, !tbaa !8
  %54 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 12), align 4, !tbaa !13
  %55 = add nsw i32 %54, %50
  store i32 %55, ptr %22, align 4, !tbaa !11
  %or.cond.1 = icmp ult i32 %53, 8
  %56 = icmp ult i32 %55, 8
  %or.cond8.1 = select i1 %or.cond.1, i1 %56, i1 false
  br i1 %or.cond8.1, label %57, label %66

57:                                               ; preds = %49
  %58 = zext nneg i32 %53 to i64
  %59 = zext nneg i32 %55 to i64
  %60 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %58, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !13
  %62 = icmp eq i32 %61, 0
  br i1 %62, label %63, label %66

63:                                               ; preds = %57
  %64 = load i32, ptr %11, align 4, !tbaa !12
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %23, align 4, !tbaa !12
  store i32 1, ptr %60, align 4, !tbaa !13
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(12) %2)
          to label %._crit_edge23 unwind label %.loopexit17

._crit_edge23:                                    ; preds = %63
  %.pre24 = load i32, ptr %1, align 4, !tbaa !8
  %.pre25 = load i32, ptr %10, align 4, !tbaa !11
  br label %66

66:                                               ; preds = %._crit_edge23, %57, %49
  %67 = phi i32 [ %.pre25, %._crit_edge23 ], [ %50, %57 ], [ %50, %49 ]
  %68 = phi i32 [ %.pre24, %._crit_edge23 ], [ %51, %57 ], [ %51, %49 ]
  %69 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 16), align 16, !tbaa !13
  %70 = add nsw i32 %69, %68
  store i32 %70, ptr %2, align 4, !tbaa !8
  %71 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 20), align 4, !tbaa !13
  %72 = add nsw i32 %71, %67
  store i32 %72, ptr %22, align 4, !tbaa !11
  %or.cond.2 = icmp ult i32 %70, 8
  %73 = icmp ult i32 %72, 8
  %or.cond8.2 = select i1 %or.cond.2, i1 %73, i1 false
  br i1 %or.cond8.2, label %74, label %83

74:                                               ; preds = %66
  %75 = zext nneg i32 %70 to i64
  %76 = zext nneg i32 %72 to i64
  %77 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %75, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !13
  %79 = icmp eq i32 %78, 0
  br i1 %79, label %80, label %83

80:                                               ; preds = %74
  %81 = load i32, ptr %11, align 4, !tbaa !12
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %23, align 4, !tbaa !12
  store i32 1, ptr %77, align 4, !tbaa !13
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(12) %2)
          to label %._crit_edge26 unwind label %.loopexit17

._crit_edge26:                                    ; preds = %80
  %.pre27 = load i32, ptr %1, align 4, !tbaa !8
  %.pre28 = load i32, ptr %10, align 4, !tbaa !11
  br label %83

83:                                               ; preds = %._crit_edge26, %74, %66
  %84 = phi i32 [ %.pre28, %._crit_edge26 ], [ %67, %74 ], [ %67, %66 ]
  %85 = phi i32 [ %.pre27, %._crit_edge26 ], [ %68, %74 ], [ %68, %66 ]
  %86 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 24), align 8, !tbaa !13
  %87 = add nsw i32 %86, %85
  store i32 %87, ptr %2, align 4, !tbaa !8
  %88 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 28), align 4, !tbaa !13
  %89 = add nsw i32 %88, %84
  store i32 %89, ptr %22, align 4, !tbaa !11
  %or.cond.3 = icmp ult i32 %87, 8
  %90 = icmp ult i32 %89, 8
  %or.cond8.3 = select i1 %or.cond.3, i1 %90, i1 false
  br i1 %or.cond8.3, label %91, label %100

91:                                               ; preds = %83
  %92 = zext nneg i32 %87 to i64
  %93 = zext nneg i32 %89 to i64
  %94 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %92, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !13
  %96 = icmp eq i32 %95, 0
  br i1 %96, label %97, label %100

97:                                               ; preds = %91
  %98 = load i32, ptr %11, align 4, !tbaa !12
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %23, align 4, !tbaa !12
  store i32 1, ptr %94, align 4, !tbaa !13
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(12) %2)
          to label %._crit_edge29 unwind label %.loopexit17

._crit_edge29:                                    ; preds = %97
  %.pre30 = load i32, ptr %1, align 4, !tbaa !8
  %.pre31 = load i32, ptr %10, align 4, !tbaa !11
  br label %100

100:                                              ; preds = %._crit_edge29, %91, %83
  %101 = phi i32 [ %.pre31, %._crit_edge29 ], [ %84, %91 ], [ %84, %83 ]
  %102 = phi i32 [ %.pre30, %._crit_edge29 ], [ %85, %91 ], [ %85, %83 ]
  %103 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 32), align 16, !tbaa !13
  %104 = add nsw i32 %103, %102
  store i32 %104, ptr %2, align 4, !tbaa !8
  %105 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 36), align 4, !tbaa !13
  %106 = add nsw i32 %105, %101
  store i32 %106, ptr %22, align 4, !tbaa !11
  %or.cond.4 = icmp ult i32 %104, 8
  %107 = icmp ult i32 %106, 8
  %or.cond8.4 = select i1 %or.cond.4, i1 %107, i1 false
  br i1 %or.cond8.4, label %108, label %117

108:                                              ; preds = %100
  %109 = zext nneg i32 %104 to i64
  %110 = zext nneg i32 %106 to i64
  %111 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %109, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !13
  %113 = icmp eq i32 %112, 0
  br i1 %113, label %114, label %117

114:                                              ; preds = %108
  %115 = load i32, ptr %11, align 4, !tbaa !12
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %23, align 4, !tbaa !12
  store i32 1, ptr %111, align 4, !tbaa !13
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(12) %2)
          to label %._crit_edge32 unwind label %.loopexit17

._crit_edge32:                                    ; preds = %114
  %.pre33 = load i32, ptr %1, align 4, !tbaa !8
  %.pre34 = load i32, ptr %10, align 4, !tbaa !11
  br label %117

117:                                              ; preds = %._crit_edge32, %108, %100
  %118 = phi i32 [ %.pre34, %._crit_edge32 ], [ %101, %108 ], [ %101, %100 ]
  %119 = phi i32 [ %.pre33, %._crit_edge32 ], [ %102, %108 ], [ %102, %100 ]
  %120 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 40), align 8, !tbaa !13
  %121 = add nsw i32 %120, %119
  store i32 %121, ptr %2, align 4, !tbaa !8
  %122 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 44), align 4, !tbaa !13
  %123 = add nsw i32 %122, %118
  store i32 %123, ptr %22, align 4, !tbaa !11
  %or.cond.5 = icmp ult i32 %121, 8
  %124 = icmp ult i32 %123, 8
  %or.cond8.5 = select i1 %or.cond.5, i1 %124, i1 false
  br i1 %or.cond8.5, label %125, label %134

125:                                              ; preds = %117
  %126 = zext nneg i32 %121 to i64
  %127 = zext nneg i32 %123 to i64
  %128 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %126, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !13
  %130 = icmp eq i32 %129, 0
  br i1 %130, label %131, label %134

131:                                              ; preds = %125
  %132 = load i32, ptr %11, align 4, !tbaa !12
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %23, align 4, !tbaa !12
  store i32 1, ptr %128, align 4, !tbaa !13
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(12) %2)
          to label %._crit_edge35 unwind label %.loopexit17

._crit_edge35:                                    ; preds = %131
  %.pre36 = load i32, ptr %1, align 4, !tbaa !8
  %.pre37 = load i32, ptr %10, align 4, !tbaa !11
  br label %134

134:                                              ; preds = %._crit_edge35, %125, %117
  %135 = phi i32 [ %.pre37, %._crit_edge35 ], [ %118, %125 ], [ %118, %117 ]
  %136 = phi i32 [ %.pre36, %._crit_edge35 ], [ %119, %125 ], [ %119, %117 ]
  %137 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 48), align 16, !tbaa !13
  %138 = add nsw i32 %137, %136
  store i32 %138, ptr %2, align 4, !tbaa !8
  %139 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 52), align 4, !tbaa !13
  %140 = add nsw i32 %139, %135
  store i32 %140, ptr %22, align 4, !tbaa !11
  %or.cond.6 = icmp ult i32 %138, 8
  %141 = icmp ult i32 %140, 8
  %or.cond8.6 = select i1 %or.cond.6, i1 %141, i1 false
  br i1 %or.cond8.6, label %142, label %151

142:                                              ; preds = %134
  %143 = zext nneg i32 %138 to i64
  %144 = zext nneg i32 %140 to i64
  %145 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %143, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !13
  %147 = icmp eq i32 %146, 0
  br i1 %147, label %148, label %151

148:                                              ; preds = %142
  %149 = load i32, ptr %11, align 4, !tbaa !12
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %23, align 4, !tbaa !12
  store i32 1, ptr %145, align 4, !tbaa !13
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(12) %2)
          to label %._crit_edge38 unwind label %.loopexit17

._crit_edge38:                                    ; preds = %148
  %.pre39 = load i32, ptr %1, align 4, !tbaa !8
  %.pre40 = load i32, ptr %10, align 4, !tbaa !11
  br label %151

151:                                              ; preds = %._crit_edge38, %142, %134
  %152 = phi i32 [ %.pre40, %._crit_edge38 ], [ %135, %142 ], [ %135, %134 ]
  %153 = phi i32 [ %.pre39, %._crit_edge38 ], [ %136, %142 ], [ %136, %134 ]
  %154 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 56), align 8, !tbaa !13
  %155 = add nsw i32 %154, %153
  store i32 %155, ptr %2, align 4, !tbaa !8
  %156 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 60), align 4, !tbaa !13
  %157 = add nsw i32 %156, %152
  store i32 %157, ptr %22, align 4, !tbaa !11
  %or.cond.7 = icmp ult i32 %155, 8
  %158 = icmp ult i32 %157, 8
  %or.cond8.7 = select i1 %or.cond.7, i1 %158, i1 false
  br i1 %or.cond8.7, label %159, label %.loopexit

159:                                              ; preds = %151
  %160 = zext nneg i32 %155 to i64
  %161 = zext nneg i32 %157 to i64
  %162 = getelementptr inbounds [10 x [10 x i32]], ptr @map, i64 0, i64 %160, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !13
  %164 = icmp eq i32 %163, 0
  br i1 %164, label %165, label %.loopexit

165:                                              ; preds = %159
  %166 = load i32, ptr %11, align 4, !tbaa !12
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %23, align 4, !tbaa !12
  store i32 1, ptr %162, align 4, !tbaa !13
  invoke void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(12) %2)
          to label %.loopexit unwind label %.loopexit17

.loopexit:                                        ; preds = %165, %159, %151
  %168 = call noundef zeroext i1 @_ZNKSt5queueI4nodeSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %168, label %.loopexit18, label %24, !llvm.loop !15

.loopexit18:                                      ; preds = %.loopexit, %.preheader, %31
  %.0 = phi i32 [ %32, %31 ], [ 0, %.preheader ], [ 0, %.loopexit ]
  call void @_ZNSt5queueI4nodeSt5dequeIS0_SaIS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %1) #6
  ret i32 %.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

; 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(12)) local_unnamed_addr #0 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 #3 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 #3 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) #4

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

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

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 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 0}
!9 = !{!"_ZTS4node", !10, i64 0, !10, i64 4, !10, i64 8}
!10 = !{!"int", !6, i64 0}
!11 = !{!9, !10, i64 4}
!12 = !{!9, !10, i64 8}
!13 = !{!10, !10, i64 0}
!14 = !{i64 0, i64 4, !13, i64 4, i64 4, !13, i64 8, i64 4, !13}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


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