; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ/1242.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"

%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<node, std::allocator<node>>::_Vector_impl" }
%"struct.std::_Vector_base<node, std::allocator<node>>::_Vector_impl" = type { %"struct.std::_Vector_base<node, std::allocator<node>>::_Vector_impl_data" }
%"struct.std::_Vector_base<node, std::allocator<node>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.node = type { i32, i32, i32 }

@map = external dso_local global [1001 x [1001 x i8]], align 16
@visited = external dso_local global [1001 x [1001 x i32]], align 16
@dir = external dso_local global [4 x [2 x i32]], align 16

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_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 i32, align 4
  %6 = alloca %"class.std::priority_queue", align 8
  %7 = alloca %struct.node, align 4
  %8 = alloca %struct.node, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #6
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
  call void @llvm.memset.p0.i64(ptr align 16 @visited, i8 0, i64 4008004, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 12, ptr %8) #6
  %13 = load i32, ptr %4, align 4, !tbaa !5
  %14 = getelementptr inbounds %struct.node, ptr %7, i32 0, i32 0
  store i32 %13, ptr %14, align 4, !tbaa !9
  %15 = load i32, ptr %5, align 4, !tbaa !5
  %16 = getelementptr inbounds %struct.node, ptr %7, i32 0, i32 1
  store i32 %15, ptr %16, align 4, !tbaa !11
  %17 = getelementptr inbounds %struct.node, ptr %7, i32 0, i32 2
  store i32 0, ptr %17, align 4, !tbaa !12
  %18 = getelementptr inbounds %struct.node, ptr %7, i32 0, i32 0
  %19 = load i32, ptr %18, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [1001 x [1001 x i32]], ptr @visited, i64 0, i64 %20
  %22 = getelementptr inbounds %struct.node, ptr %7, i32 0, i32 1
  %23 = load i32, ptr %22, align 4, !tbaa !11
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [1001 x i32], ptr %21, i64 0, i64 %24
  store i32 1, ptr %25, align 4, !tbaa !5
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(25) %6, ptr noundef nonnull align 4 dereferenceable(12) %7)
          to label %26 unwind label %49

26:                                               ; preds = %2
  br label %27

27:                                               ; preds = %134, %26
  %28 = invoke noundef zeroext i1 @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
          to label %29 unwind label %49

29:                                               ; preds = %27
  %30 = xor i1 %28, true
  br i1 %30, label %31, label %135

31:                                               ; preds = %29
  %32 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
          to label %33 unwind label %49

33:                                               ; preds = %31
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 4 %32, i64 12, i1 false), !tbaa.struct !13
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
          to label %34 unwind label %49

34:                                               ; preds = %33
  %35 = getelementptr inbounds %struct.node, ptr %7, i32 0, i32 0
  %36 = load i32, ptr %35, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [1001 x [1001 x i8]], ptr @map, i64 0, i64 %37
  %39 = getelementptr inbounds %struct.node, ptr %7, i32 0, i32 1
  %40 = load i32, ptr %39, align 4, !tbaa !11
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [1001 x i8], ptr %38, i64 0, i64 %41
  %43 = load i8, ptr %42, align 1, !tbaa !14
  %44 = sext i8 %43 to i32
  %45 = icmp eq i32 %44, 97
  br i1 %45, label %46, label %53

46:                                               ; preds = %34
  %47 = getelementptr inbounds %struct.node, ptr %7, i32 0, i32 2
  %48 = load i32, ptr %47, align 4, !tbaa !12
  store i32 %48, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %136

49:                                               ; preds = %33, %31, %27, %2
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %9, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %10, align 4
  br label %138

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

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

57:                                               ; preds = %54
  store i32 4, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %134

58:                                               ; preds = %54
  %59 = getelementptr inbounds %struct.node, ptr %7, i32 0, i32 0
  %60 = load i32, ptr %59, align 4, !tbaa !9
  %61 = load i32, ptr %12, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [4 x [2 x i32]], ptr @dir, i64 0, i64 %62
  %64 = getelementptr inbounds [2 x i32], ptr %63, i64 0, i64 0
  %65 = load i32, ptr %64, align 8, !tbaa !5
  %66 = add nsw i32 %60, %65
  %67 = getelementptr inbounds %struct.node, ptr %8, i32 0, i32 0
  store i32 %66, ptr %67, align 4, !tbaa !9
  %68 = getelementptr inbounds %struct.node, ptr %7, i32 0, i32 1
  %69 = load i32, ptr %68, align 4, !tbaa !11
  %70 = load i32, ptr %12, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [4 x [2 x i32]], ptr @dir, i64 0, i64 %71
  %73 = getelementptr inbounds [2 x i32], ptr %72, i64 0, i64 1
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = add nsw i32 %69, %74
  %76 = getelementptr inbounds %struct.node, ptr %8, i32 0, i32 1
  store i32 %75, ptr %76, align 4, !tbaa !11
  %77 = getelementptr inbounds %struct.node, ptr %8, i32 0, i32 0
  %78 = load i32, ptr %77, align 4, !tbaa !9
  %79 = getelementptr inbounds %struct.node, ptr %8, i32 0, i32 1
  %80 = load i32, ptr %79, align 4, !tbaa !11
  %81 = call noundef i32 @_Z5checkii(i32 noundef %78, i32 noundef %80)
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %130

83:                                               ; preds = %58
  %84 = getelementptr inbounds %struct.node, ptr %8, i32 0, i32 0
  %85 = load i32, ptr %84, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [1001 x [1001 x i32]], ptr @visited, i64 0, i64 %86
  %88 = getelementptr inbounds %struct.node, ptr %8, i32 0, i32 1
  %89 = load i32, ptr %88, align 4, !tbaa !11
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [1001 x i32], ptr %87, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %130, label %94

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

106:                                              ; preds = %94
  %107 = getelementptr inbounds %struct.node, ptr %7, i32 0, i32 2
  %108 = load i32, ptr %107, align 4, !tbaa !12
  %109 = add nsw i32 %108, 2
  %110 = getelementptr inbounds %struct.node, ptr %8, i32 0, i32 2
  store i32 %109, ptr %110, align 4, !tbaa !12
  br label %116

111:                                              ; preds = %94
  %112 = getelementptr inbounds %struct.node, ptr %7, i32 0, i32 2
  %113 = load i32, ptr %112, align 4, !tbaa !12
  %114 = add nsw i32 %113, 1
  %115 = getelementptr inbounds %struct.node, ptr %8, i32 0, i32 2
  store i32 %114, ptr %115, align 4, !tbaa !12
  br label %116

116:                                              ; preds = %111, %106
  %117 = getelementptr inbounds %struct.node, ptr %8, i32 0, i32 0
  %118 = load i32, ptr %117, align 4, !tbaa !9
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [1001 x [1001 x i32]], ptr @visited, i64 0, i64 %119
  %121 = getelementptr inbounds %struct.node, ptr %8, i32 0, i32 1
  %122 = load i32, ptr %121, align 4, !tbaa !11
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [1001 x i32], ptr %120, i64 0, i64 %123
  store i32 1, ptr %124, align 4, !tbaa !5
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(25) %6, ptr noundef nonnull align 4 dereferenceable(12) %8)
          to label %125 unwind label %126

125:                                              ; preds = %116
  br label %130

126:                                              ; preds = %116
  %127 = landingpad { ptr, i32 }
          cleanup
  %128 = extractvalue { ptr, i32 } %127, 0
  store ptr %128, ptr %9, align 8
  %129 = extractvalue { ptr, i32 } %127, 1
  store i32 %129, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %138

130:                                              ; preds = %125, %83, %58
  br label %131

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

134:                                              ; preds = %57
  br label %27, !llvm.loop !17

135:                                              ; preds = %29
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %136

136:                                              ; preds = %135, %46
  call void @llvm.lifetime.end.p0(i64 12, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %7) #6
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %6) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #6
  %137 = load i32, ptr %3, align 4
  ret i32 %137

138:                                              ; preds = %126, %49
  call void @llvm.lifetime.end.p0(i64 12, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %7) #6
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %6) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #6
  br label %139

139:                                              ; preds = %138
  %140 = load ptr, ptr %9, align 8
  %141 = load i32, ptr %10, align 4
  %142 = insertvalue { ptr, i32 } poison, ptr %140, 0
  %143 = insertvalue { ptr, i32 } %142, i32 %141, 1
  resume { ptr, i32 } %143
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(25), 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 @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) #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) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) #1 align 2

; 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 @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #5 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: write) }
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 = !{!"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"

%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<node, std::allocator<node>>::_Vector_impl" }
%"struct.std::_Vector_base<node, std::allocator<node>>::_Vector_impl" = type { %"struct.std::_Vector_base<node, std::allocator<node>>::_Vector_impl_data" }
%"struct.std::_Vector_base<node, std::allocator<node>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.node = type { i32, i32, i32 }

@map = external dso_local local_unnamed_addr global [1001 x [1001 x i8]], align 16
@visited = external dso_local local_unnamed_addr global [1001 x [1001 x i32]], align 16
@dir = external dso_local local_unnamed_addr global [4 x [2 x i32]], align 16

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z3bfsii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::priority_queue", align 8
  %4 = alloca %struct.node, align 8
  %5 = alloca %struct.node, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #6
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4008004) @visited, i8 0, i64 4008004, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #6
  store i32 %0, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %4, i64 4
  store i32 %1, ptr %6, align 4, !tbaa !10
  %7 = getelementptr inbounds i8, ptr %4, 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 [1001 x [1001 x i32]], ptr @visited, i64 0, i64 %8, i64 %9
  store i32 1, ptr %10, align 4, !tbaa !12
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(25) %3, ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %.preheader13 unwind label %.loopexit.split-lp

.preheader13:                                     ; preds = %2
  %11 = call noundef zeroext i1 @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
  br i1 %11, label %.loopexit14, label %.lr.ph

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

14:                                               ; preds = %.lr.ph, %.loopexit
  %15 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %4, ptr noundef nonnull align 4 dereferenceable(12) %15, i64 12, i1 false), !tbaa.struct !13
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
          to label %16 unwind label %.loopexit15

16:                                               ; preds = %14
  %17 = load i32, ptr %4, align 8, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = load i32, ptr %6, align 4, !tbaa !10
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [1001 x [1001 x i8]], ptr @map, i64 0, i64 %18, i64 %20
  %22 = load i8, ptr %21, align 1, !tbaa !14
  %23 = icmp eq i8 %22, 97
  br i1 %23, label %29, label %.preheader.preheader

.preheader.preheader:                             ; preds = %16
  %24 = load i32, ptr @dir, align 16, !tbaa !12
  %25 = add nsw i32 %24, %17
  store i32 %25, ptr %5, align 8, !tbaa !5
  %26 = load i32, ptr getelementptr inbounds (i8, ptr @dir, i64 4), align 4, !tbaa !12
  %27 = add nsw i32 %26, %19
  store i32 %27, ptr %12, align 4, !tbaa !10
  %28 = call noundef i32 @_Z5checkii(i32 noundef %25, i32 noundef %27)
  %.not = icmp eq i32 %28, 0
  br i1 %.not, label %.preheader.1, label %31

29:                                               ; preds = %16
  %30 = load i32, ptr %7, align 8, !tbaa !11
  br label %.loopexit14

.loopexit15:                                      ; preds = %14
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %104

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

31:                                               ; preds = %.preheader.preheader
  %32 = load i32, ptr %5, align 8, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = load i32, ptr %12, align 4, !tbaa !10
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [1001 x [1001 x i32]], ptr @visited, i64 0, i64 %33, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !12
  %.not11 = icmp eq i32 %37, 0
  br i1 %.not11, label %38, label %.preheader.1

38:                                               ; preds = %31
  %39 = getelementptr inbounds [1001 x [1001 x i8]], ptr @map, i64 0, i64 %33, i64 %35
  %40 = load i8, ptr %39, align 1, !tbaa !14
  %41 = icmp eq i8 %40, 120
  %42 = load i32, ptr %7, align 8, !tbaa !11
  %. = select i1 %41, i32 2, i32 1
  %43 = add nsw i32 %42, %.
  store i32 %43, ptr %13, align 8, !tbaa !11
  store i32 1, ptr %36, align 4, !tbaa !12
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(25) %3, ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %.preheader.1 unwind label %44

44:                                               ; preds = %97, %78, %59, %38
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %104

.preheader.1:                                     ; preds = %.preheader.preheader, %31, %38
  %46 = load <2 x i32>, ptr %4, align 8, !tbaa !12
  %47 = load <2 x i32>, ptr getelementptr inbounds (i8, ptr @dir, i64 8), align 8, !tbaa !12
  %48 = add nsw <2 x i32> %47, %46
  store <2 x i32> %48, ptr %5, align 8, !tbaa !12
  %49 = extractelement <2 x i32> %48, i64 0
  %50 = extractelement <2 x i32> %48, i64 1
  %51 = call noundef i32 @_Z5checkii(i32 noundef %49, i32 noundef %50)
  %.not.1 = icmp eq i32 %51, 0
  br i1 %.not.1, label %.preheader.2, label %52

52:                                               ; preds = %.preheader.1
  %53 = load i32, ptr %5, align 8, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = load i32, ptr %12, align 4, !tbaa !10
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [1001 x [1001 x i32]], ptr @visited, i64 0, i64 %54, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !12
  %.not11.1 = icmp eq i32 %58, 0
  br i1 %.not11.1, label %59, label %.preheader.2

59:                                               ; preds = %52
  %60 = getelementptr inbounds [1001 x [1001 x i8]], ptr @map, i64 0, i64 %54, i64 %56
  %61 = load i8, ptr %60, align 1, !tbaa !14
  %62 = icmp eq i8 %61, 120
  %63 = load i32, ptr %7, align 8, !tbaa !11
  %.24 = select i1 %62, i32 2, i32 1
  %64 = add nsw i32 %63, %.24
  store i32 %64, ptr %13, align 8, !tbaa !11
  store i32 1, ptr %57, align 4, !tbaa !12
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(25) %3, ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %.preheader.2 unwind label %44

.preheader.2:                                     ; preds = %59, %52, %.preheader.1
  %65 = load <2 x i32>, ptr %4, align 8, !tbaa !12
  %66 = load <2 x i32>, ptr getelementptr inbounds (i8, ptr @dir, i64 16), align 16, !tbaa !12
  %67 = add nsw <2 x i32> %66, %65
  store <2 x i32> %67, ptr %5, align 8, !tbaa !12
  %68 = extractelement <2 x i32> %67, i64 0
  %69 = extractelement <2 x i32> %67, i64 1
  %70 = call noundef i32 @_Z5checkii(i32 noundef %68, i32 noundef %69)
  %.not.2 = icmp eq i32 %70, 0
  br i1 %.not.2, label %.preheader.3, label %71

71:                                               ; preds = %.preheader.2
  %72 = load i32, ptr %5, align 8, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = load i32, ptr %12, align 4, !tbaa !10
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [1001 x [1001 x i32]], ptr @visited, i64 0, i64 %73, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !12
  %.not11.2 = icmp eq i32 %77, 0
  br i1 %.not11.2, label %78, label %.preheader.3

78:                                               ; preds = %71
  %79 = getelementptr inbounds [1001 x [1001 x i8]], ptr @map, i64 0, i64 %73, i64 %75
  %80 = load i8, ptr %79, align 1, !tbaa !14
  %81 = icmp eq i8 %80, 120
  %82 = load i32, ptr %7, align 8, !tbaa !11
  %.25 = select i1 %81, i32 2, i32 1
  %83 = add nsw i32 %82, %.25
  store i32 %83, ptr %13, align 8, !tbaa !11
  store i32 1, ptr %76, align 4, !tbaa !12
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(25) %3, ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %.preheader.3 unwind label %44

.preheader.3:                                     ; preds = %78, %71, %.preheader.2
  %84 = load <2 x i32>, ptr %4, align 8, !tbaa !12
  %85 = load <2 x i32>, ptr getelementptr inbounds (i8, ptr @dir, i64 24), align 8, !tbaa !12
  %86 = add nsw <2 x i32> %85, %84
  store <2 x i32> %86, ptr %5, align 8, !tbaa !12
  %87 = extractelement <2 x i32> %86, i64 0
  %88 = extractelement <2 x i32> %86, i64 1
  %89 = call noundef i32 @_Z5checkii(i32 noundef %87, i32 noundef %88)
  %.not.3 = icmp eq i32 %89, 0
  br i1 %.not.3, label %.loopexit, label %90

90:                                               ; preds = %.preheader.3
  %91 = load i32, ptr %5, align 8, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = load i32, ptr %12, align 4, !tbaa !10
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [1001 x [1001 x i32]], ptr @visited, i64 0, i64 %92, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !12
  %.not11.3 = icmp eq i32 %96, 0
  br i1 %.not11.3, label %97, label %.loopexit

97:                                               ; preds = %90
  %98 = getelementptr inbounds [1001 x [1001 x i8]], ptr @map, i64 0, i64 %92, i64 %94
  %99 = load i8, ptr %98, align 1, !tbaa !14
  %100 = icmp eq i8 %99, 120
  %101 = load i32, ptr %7, align 8, !tbaa !11
  %.26 = select i1 %100, i32 2, i32 1
  %102 = add nsw i32 %101, %.26
  store i32 %102, ptr %13, align 8, !tbaa !11
  store i32 1, ptr %95, align 4, !tbaa !12
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(25) %3, ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %.loopexit unwind label %44

.loopexit:                                        ; preds = %97, %90, %.preheader.3
  %103 = call noundef zeroext i1 @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
  br i1 %103, label %.loopexit14, label %14, !llvm.loop !15

.loopexit14:                                      ; preds = %.loopexit, %.preheader13, %29
  %.010 = phi i32 [ %30, %29 ], [ -1, %.preheader13 ], [ -1, %.loopexit ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #6
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %3) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  ret i32 %.010

104:                                              ; preds = %.loopexit15, %.loopexit.split-lp, %44
  %.pn = phi { ptr, i32 } [ %45, %44 ], [ %lpad.loopexit, %.loopexit15 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #6
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %3) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  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 nounwind uwtable
declare dso_local void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(25), 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 @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) 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) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #1 align 2

; 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 @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #5 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: write) }
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, !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