; LLVM IR from mackorone/mms :: old/v1/src/algo/FloodFill/FloodFill.ll (ZN9FloodFill7victoryEv)

; 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::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<Cell *, std::allocator<Cell *>>::_Deque_impl" }
%"struct.std::_Deque_base<Cell *, std::allocator<Cell *>>::_Deque_impl" = type { %"struct.std::_Deque_base<Cell *, std::allocator<Cell *>>::_Deque_impl_data" }
%"struct.std::_Deque_base<Cell *, std::allocator<Cell *>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%class.FloodFill = type <{ %class.IAlgorithm, ptr, [16 x [16 x %class.Cell]], i32, i32, i32, i32, i8, i8, [6 x i8], %class.History, i8, [7 x i8] }>
%class.IAlgorithm = type { ptr }
%class.Cell = type { i32, i32, i32, i8, i8, [4 x i8], [4 x i8], ptr }
%class.History = type { i32, i32, ptr, %"class.std::stack", %"class.std::queue", %"class.std::__cxx11::list", %"class.std::__cxx11::list.9" }
%"class.std::queue" = type { %"class.std::deque.0" }
%"class.std::deque.0" = type { %"class.std::_Deque_base.1" }
%"class.std::_Deque_base.1" = type { %"struct.std::_Deque_base<std::stack<Cell *>, std::allocator<std::stack<Cell *>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::stack<Cell *>, std::allocator<std::stack<Cell *>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::stack<Cell *>, std::allocator<std::stack<Cell *>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::stack<Cell *>, std::allocator<std::stack<Cell *>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator.5", %"struct.std::_Deque_iterator.5" }
%"struct.std::_Deque_iterator.5" = type { ptr, ptr, ptr, ptr }
%"class.std::__cxx11::list" = type { %"class.std::__cxx11::_List_base" }
%"class.std::__cxx11::_List_base" = type { %"struct.std::__cxx11::_List_base<int, std::allocator<int>>::_List_impl" }
%"struct.std::__cxx11::_List_base<int, std::allocator<int>>::_List_impl" = type { %"struct.std::__detail::_List_node_header" }
%"struct.std::__detail::_List_node_header" = type { %"struct.std::__detail::_List_node_base", i64 }
%"struct.std::__detail::_List_node_base" = type { ptr, ptr }
%"class.std::__cxx11::list.9" = type { %"class.std::__cxx11::_List_base.10" }
%"class.std::__cxx11::_List_base.10" = type { %"struct.std::__cxx11::_List_base<std::__cxx11::list<Cellmod>, std::allocator<std::__cxx11::list<Cellmod>>>::_List_impl" }
%"struct.std::__cxx11::_List_base<std::__cxx11::list<Cellmod>, std::allocator<std::__cxx11::list<Cellmod>>>::_List_impl" = type { %"struct.std::__detail::_List_node_header" }

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9FloodFill6inGoalEii(ptr noundef nonnull align 8 dereferenceable(8457), i32 noundef, i32 noundef) #1 align 2

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9FloodFill7victoryEv(ptr noundef nonnull align 8 dereferenceable(8457) %0) #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.std::stack", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %9 = load ptr, ptr %2, align 8
  br label %10

10:                                               ; preds = %114, %1
  call void @llvm.lifetime.start.p0(i64 80, ptr %3) #5
  call void @_ZNSt5stackIP4CellSt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br label %11

11:                                               ; preds = %44, %10
  %12 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 3
  %13 = load i32, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 4
  %15 = load i32, ptr %14, align 4, !tbaa !36
  %16 = invoke noundef zeroext i1 @_ZN9FloodFill6inGoalEii(ptr noundef nonnull align 8 dereferenceable(8457) %9, i32 noundef %13, i32 noundef %15)
          to label %17 unwind label %45

17:                                               ; preds = %11
  br i1 %16, label %31, label %18

18:                                               ; preds = %17
  %19 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 1
  %20 = load ptr, ptr %19, align 8, !tbaa !37
  %21 = invoke noundef zeroext i1 @_ZN3sim14MouseInterface13undoRequestedEv(ptr noundef nonnull align 8 dereferenceable(40) %20)
          to label %22 unwind label %45

22:                                               ; preds = %18
  br i1 %21, label %28, label %23

23:                                               ; preds = %22
  %24 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 1
  %25 = load ptr, ptr %24, align 8, !tbaa !37
  %26 = invoke noundef zeroext i1 @_ZN3sim14MouseInterface14resetRequestedEv(ptr noundef nonnull align 8 dereferenceable(40) %25)
          to label %27 unwind label %45

27:                                               ; preds = %23
  br label %28

28:                                               ; preds = %27, %22
  %29 = phi i1 [ true, %22 ], [ %26, %27 ]
  %30 = xor i1 %29, true
  br label %31

31:                                               ; preds = %28, %17
  %32 = phi i1 [ false, %17 ], [ %30, %28 ]
  br i1 %32, label %33, label %53

33:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %34 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 2
  %35 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 3
  %36 = load i32, ptr %35, align 8, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %34, i64 0, i64 %37
  %39 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 4
  %40 = load i32, ptr %39, align 4, !tbaa !36
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [16 x %class.Cell], ptr %38, i64 0, i64 %41
  store ptr %42, ptr %6, align 8, !tbaa !5
  invoke void @_ZNSt5stackIP4CellSt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %43 unwind label %49

43:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  invoke void @_ZN9FloodFill15moveTowardsGoalEv(ptr noundef nonnull align 8 dereferenceable(8457) %9)
          to label %44 unwind label %45

44:                                               ; preds = %43
  br label %11, !llvm.loop !38

45:                                               ; preds = %107, %104, %102, %93, %88, %67, %62, %43, %23, %18, %11
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %4, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %5, align 4
  br label %115

49:                                               ; preds = %33
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %4, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %115

53:                                               ; preds = %31
  br label %54

54:                                               ; preds = %83, %53
  %55 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 3
  %56 = load i32, ptr %55, align 8, !tbaa !9
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %62, label %58

58:                                               ; preds = %54
  %59 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 4
  %60 = load i32, ptr %59, align 4, !tbaa !36
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %62, label %75

62:                                               ; preds = %58, %54
  %63 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 1
  %64 = load ptr, ptr %63, align 8, !tbaa !37
  %65 = invoke noundef zeroext i1 @_ZN3sim14MouseInterface13undoRequestedEv(ptr noundef nonnull align 8 dereferenceable(40) %64)
          to label %66 unwind label %45

66:                                               ; preds = %62
  br i1 %65, label %72, label %67

67:                                               ; preds = %66
  %68 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 1
  %69 = load ptr, ptr %68, align 8, !tbaa !37
  %70 = invoke noundef zeroext i1 @_ZN3sim14MouseInterface14resetRequestedEv(ptr noundef nonnull align 8 dereferenceable(40) %69)
          to label %71 unwind label %45

71:                                               ; preds = %67
  br label %72

72:                                               ; preds = %71, %66
  %73 = phi i1 [ true, %66 ], [ %70, %71 ]
  %74 = xor i1 %73, true
  br label %75

75:                                               ; preds = %72, %58
  %76 = phi i1 [ false, %58 ], [ %74, %72 ]
  br i1 %76, label %77, label %88

77:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %78 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4CellSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %79 unwind label %84

79:                                               ; preds = %77
  %80 = load ptr, ptr %78, align 8, !tbaa !5
  store ptr %80, ptr %7, align 8, !tbaa !5
  invoke void @_ZNSt5stackIP4CellSt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %81 unwind label %84

81:                                               ; preds = %79
  %82 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void @_ZN9FloodFill11moveOneCellEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %9, ptr noundef %82)
          to label %83 unwind label %84

83:                                               ; preds = %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %54, !llvm.loop !40

84:                                               ; preds = %81, %79, %77
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %4, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %115

88:                                               ; preds = %75
  %89 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 1
  %90 = load ptr, ptr %89, align 8, !tbaa !37
  %91 = invoke noundef zeroext i1 @_ZN3sim14MouseInterface13undoRequestedEv(ptr noundef nonnull align 8 dereferenceable(40) %90)
          to label %92 unwind label %45

92:                                               ; preds = %88
  br i1 %91, label %107, label %93

93:                                               ; preds = %92
  %94 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 1
  %95 = load ptr, ptr %94, align 8, !tbaa !37
  %96 = invoke noundef zeroext i1 @_ZN3sim14MouseInterface14resetRequestedEv(ptr noundef nonnull align 8 dereferenceable(40) %95)
          to label %97 unwind label %45

97:                                               ; preds = %93
  br i1 %96, label %107, label %98

98:                                               ; preds = %97
  %99 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 5
  %100 = load i32, ptr %99, align 8, !tbaa !41
  %101 = icmp eq i32 %100, 2
  br i1 %101, label %102, label %104

102:                                              ; preds = %98
  invoke void @_ZN9FloodFill10turnAroundEv(ptr noundef nonnull align 8 dereferenceable(8457) %9)
          to label %103 unwind label %45

103:                                              ; preds = %102
  br label %106

104:                                              ; preds = %98
  invoke void @_ZN9FloodFill9turnRightEv(ptr noundef nonnull align 8 dereferenceable(8457) %9)
          to label %105 unwind label %45

105:                                              ; preds = %104
  br label %106

106:                                              ; preds = %105, %103
  br label %107

107:                                              ; preds = %106, %97, %92
  %108 = invoke noundef zeroext i1 @_ZN9FloodFill19checkRequestVictoryEv(ptr noundef nonnull align 8 dereferenceable(8457) %9)
          to label %109 unwind label %45

109:                                              ; preds = %107
  br i1 %108, label %110, label %111

110:                                              ; preds = %109
  store i32 1, ptr %8, align 4
  br label %112

111:                                              ; preds = %109
  store i32 0, ptr %8, align 4
  br label %112

112:                                              ; preds = %111, %110
  call void @_ZNSt5stackIP4CellSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #5
  %113 = load i32, ptr %8, align 4
  switch i32 %113, label %122 [
    i32 0, label %114
    i32 1, label %116
  ]

114:                                              ; preds = %112
  br label %10, !llvm.loop !42

115:                                              ; preds = %84, %49, %45
  call void @_ZNSt5stackIP4CellSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #5
  br label %117

116:                                              ; preds = %112
  ret void

117:                                              ; preds = %115
  %118 = load ptr, ptr %4, align 8
  %119 = load i32, ptr %5, align 4
  %120 = insertvalue { ptr, i32 } poison, ptr %118, 0
  %121 = insertvalue { ptr, i32 } %120, i32 %119, 1
  resume { ptr, i32 } %121

122:                                              ; preds = %112
  unreachable
}

declare noundef zeroext i1 @_ZN3sim14MouseInterface13undoRequestedEv(ptr noundef nonnull align 8 dereferenceable(40)) #4

declare noundef zeroext i1 @_ZN3sim14MouseInterface14resetRequestedEv(ptr noundef nonnull align 8 dereferenceable(40)) #4

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9FloodFill11moveOneCellEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457), ptr noundef) #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN9FloodFill19checkRequestVictoryEv(ptr noundef nonnull align 8 dereferenceable(8457)) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 #4 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !12, i64 8208}
!10 = !{!"_ZTS9FloodFill", !11, i64 0, !6, i64 8, !7, i64 16, !12, i64 8208, !12, i64 8212, !12, i64 8216, !12, i64 8220, !13, i64 8224, !13, i64 8225, !14, i64 8232, !13, i64 8456}
!11 = !{!"_ZTS10IAlgorithm"}
!12 = !{!"int", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTS7History", !12, i64 0, !12, i64 4, !6, i64 8, !15, i64 16, !22, i64 96, !28, i64 176, !33, i64 200}
!15 = !{!"_ZTSSt5stackIP4CellSt5dequeIS1_SaIS1_EEE", !16, i64 0}
!16 = !{!"_ZTSSt5dequeIP4CellSaIS1_EE", !17, i64 0}
!17 = !{!"_ZTSSt11_Deque_baseIP4CellSaIS1_EE", !18, i64 0}
!18 = !{!"_ZTSNSt11_Deque_baseIP4CellSaIS1_EE11_Deque_implE", !19, i64 0}
!19 = !{!"_ZTSNSt11_Deque_baseIP4CellSaIS1_EE16_Deque_impl_dataE", !6, i64 0, !20, i64 8, !21, i64 16, !21, i64 48}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_ZTSSt15_Deque_iteratorIP4CellRS1_PS1_E", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!22 = !{!"_ZTSSt5queueISt5stackIP4CellSt5dequeIS2_SaIS2_EEES3_IS6_SaIS6_EEE", !23, i64 0}
!23 = !{!"_ZTSSt5dequeISt5stackIP4CellS_IS2_SaIS2_EEESaIS5_EE", !24, i64 0}
!24 = !{!"_ZTSSt11_Deque_baseISt5stackIP4CellSt5dequeIS2_SaIS2_EEESaIS6_EE", !25, i64 0}
!25 = !{!"_ZTSNSt11_Deque_baseISt5stackIP4CellSt5dequeIS2_SaIS2_EEESaIS6_EE11_Deque_implE", !26, i64 0}
!26 = !{!"_ZTSNSt11_Deque_baseISt5stackIP4CellSt5dequeIS2_SaIS2_EEESaIS6_EE16_Deque_impl_dataE", !6, i64 0, !20, i64 8, !27, i64 16, !27, i64 48}
!27 = !{!"_ZTSSt15_Deque_iteratorISt5stackIP4CellSt5dequeIS2_SaIS2_EEERS6_PS6_E", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!28 = !{!"_ZTSNSt7__cxx114listIiSaIiEEE", !29, i64 0}
!29 = !{!"_ZTSNSt7__cxx1110_List_baseIiSaIiEEE", !30, i64 0}
!30 = !{!"_ZTSNSt7__cxx1110_List_baseIiSaIiEE10_List_implE", !31, i64 0}
!31 = !{!"_ZTSNSt8__detail17_List_node_headerE", !32, i64 0, !20, i64 16}
!32 = !{!"_ZTSNSt8__detail15_List_node_baseE", !6, i64 0, !6, i64 8}
!33 = !{!"_ZTSNSt7__cxx114listINS0_I7CellmodSaIS1_EEESaIS3_EEE", !34, i64 0}
!34 = !{!"_ZTSNSt7__cxx1110_List_baseINS_4listI7CellmodSaIS2_EEESaIS4_EEE", !35, i64 0}
!35 = !{!"_ZTSNSt7__cxx1110_List_baseINS_4listI7CellmodSaIS2_EEESaIS4_EE10_List_implE", !31, i64 0}
!36 = !{!10, !12, i64 8212}
!37 = !{!10, !6, i64 8}
!38 = distinct !{!38, !39}
!39 = !{!"llvm.loop.mustprogress"}
!40 = distinct !{!40, !39}
!41 = !{!10, !12, i64 8216}
!42 = distinct !{!42, !39}


; 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::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<Cell *, std::allocator<Cell *>>::_Deque_impl" }
%"struct.std::_Deque_base<Cell *, std::allocator<Cell *>>::_Deque_impl" = type { %"struct.std::_Deque_base<Cell *, std::allocator<Cell *>>::_Deque_impl_data" }
%"struct.std::_Deque_base<Cell *, std::allocator<Cell *>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%class.Cell = type { i32, i32, i32, i8, i8, [4 x i8], [4 x i8], ptr }

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9FloodFill6inGoalEii(ptr noundef nonnull align 8 dereferenceable(8457), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9FloodFill7victoryEv(ptr noundef nonnull align 8 dereferenceable(8457) %0) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::stack", align 8
  %3 = alloca ptr, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 8208
  %5 = getelementptr inbounds i8, ptr %0, i64 8212
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = getelementptr inbounds i8, ptr %0, i64 8216
  br label %9

9:                                                ; preds = %60, %1
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %2) #5
  call void @_ZNSt5stackIP4CellSt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  br label %10

10:                                               ; preds = %28, %9
  %11 = load i32, ptr %4, align 8, !tbaa !5
  %12 = load i32, ptr %5, align 4, !tbaa !35
  %13 = call noundef zeroext i1 @_ZN9FloodFill6inGoalEii(ptr noundef nonnull align 8 dereferenceable(8457) %0, i32 noundef %11, i32 noundef %12)
  br i1 %13, label %.critedge.preheader, label %14

14:                                               ; preds = %10
  %15 = load ptr, ptr %6, align 8, !tbaa !36
  %16 = invoke noundef zeroext i1 @_ZN3sim14MouseInterface13undoRequestedEv(ptr noundef nonnull align 8 dereferenceable(40) %15)
          to label %17 unwind label %.loopexit.split-lp.loopexit

17:                                               ; preds = %14
  br i1 %16, label %.critedge.preheader, label %18

18:                                               ; preds = %17
  %19 = load ptr, ptr %6, align 8, !tbaa !36
  %20 = invoke noundef zeroext i1 @_ZN3sim14MouseInterface14resetRequestedEv(ptr noundef nonnull align 8 dereferenceable(40) %19)
          to label %21 unwind label %.loopexit.split-lp.loopexit

21:                                               ; preds = %18
  br i1 %20, label %.critedge.preheader, label %22

.critedge.preheader:                              ; preds = %17, %10, %21
  br label %.critedge

22:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %23 = load i32, ptr %4, align 8, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = load i32, ptr %5, align 4, !tbaa !35
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %7, i64 0, i64 %24, i64 %26
  store ptr %27, ptr %3, align 8, !tbaa !37
  invoke void @_ZNSt5stackIP4CellSt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %28 unwind label %29

28:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  invoke void @_ZN9FloodFill15moveTowardsGoalEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
          to label %10 unwind label %.loopexit.split-lp.loopexit, !llvm.loop !38

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

.loopexit.split-lp.loopexit:                      ; preds = %28, %18, %14
  %lpad.loopexit12 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp.loopexit.split-lp:             ; preds = %58, %57, %56, %49, %.critedge2
  %lpad.loopexit.split-lp13 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

29:                                               ; preds = %22
  %30 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br label %.loopexit.split-lp

.critedge:                                        ; preds = %.critedge.preheader, %41
  %31 = load i32, ptr %4, align 8, !tbaa !5
  %.not = icmp eq i32 %31, 0
  %32 = load i32, ptr %5, align 4
  %.not8 = icmp eq i32 %32, 0
  %or.cond = select i1 %.not, i1 %.not8, i1 false
  br i1 %or.cond, label %.critedge2, label %33

33:                                               ; preds = %.critedge
  %34 = load ptr, ptr %6, align 8, !tbaa !36
  %35 = invoke noundef zeroext i1 @_ZN3sim14MouseInterface13undoRequestedEv(ptr noundef nonnull align 8 dereferenceable(40) %34)
          to label %36 unwind label %.loopexit

36:                                               ; preds = %33
  br i1 %35, label %.critedge2, label %37

37:                                               ; preds = %36
  %38 = load ptr, ptr %6, align 8, !tbaa !36
  %39 = invoke noundef zeroext i1 @_ZN3sim14MouseInterface14resetRequestedEv(ptr noundef nonnull align 8 dereferenceable(40) %38)
          to label %40 unwind label %.loopexit

40:                                               ; preds = %37
  br i1 %39, label %.critedge2, label %41

41:                                               ; preds = %40
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4CellSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  %43 = load ptr, ptr %42, align 8, !tbaa !37
  call void @_ZNSt5stackIP4CellSt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  invoke void @_ZN9FloodFill11moveOneCellEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %0, ptr noundef %43)
          to label %.critedge unwind label %44, !llvm.loop !40

44:                                               ; preds = %41
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.critedge2:                                       ; preds = %36, %.critedge, %40
  %46 = load ptr, ptr %6, align 8, !tbaa !36
  %47 = invoke noundef zeroext i1 @_ZN3sim14MouseInterface13undoRequestedEv(ptr noundef nonnull align 8 dereferenceable(40) %46)
          to label %48 unwind label %.loopexit.split-lp.loopexit.split-lp

48:                                               ; preds = %.critedge2
  br i1 %47, label %58, label %49

49:                                               ; preds = %48
  %50 = load ptr, ptr %6, align 8, !tbaa !36
  %51 = invoke noundef zeroext i1 @_ZN3sim14MouseInterface14resetRequestedEv(ptr noundef nonnull align 8 dereferenceable(40) %50)
          to label %52 unwind label %.loopexit.split-lp.loopexit.split-lp

52:                                               ; preds = %49
  br i1 %51, label %58, label %53

53:                                               ; preds = %52
  %54 = load i32, ptr %8, align 8, !tbaa !41
  %55 = icmp eq i32 %54, 2
  br i1 %55, label %56, label %57

56:                                               ; preds = %53
  invoke void @_ZN9FloodFill10turnAroundEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
          to label %58 unwind label %.loopexit.split-lp.loopexit.split-lp

57:                                               ; preds = %53
  invoke void @_ZN9FloodFill9turnRightEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
          to label %58 unwind label %.loopexit.split-lp.loopexit.split-lp

58:                                               ; preds = %56, %57, %52, %48
  %59 = invoke noundef zeroext i1 @_ZN9FloodFill19checkRequestVictoryEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
          to label %60 unwind label %.loopexit.split-lp.loopexit.split-lp

60:                                               ; preds = %58
  call void @_ZNSt5stackIP4CellSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %2) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %2) #5
  br i1 %59, label %61, label %9

.loopexit.split-lp:                               ; preds = %.loopexit, %.loopexit.split-lp.loopexit.split-lp, %.loopexit.split-lp.loopexit, %44, %29
  %.pn = phi { ptr, i32 } [ %45, %44 ], [ %30, %29 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit12, %.loopexit.split-lp.loopexit ], [ %lpad.loopexit.split-lp13, %.loopexit.split-lp.loopexit.split-lp ]
  call void @_ZNSt5stackIP4CellSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %2) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %2) #5
  resume { ptr, i32 } %.pn

61:                                               ; preds = %60
  ret void
}

declare noundef zeroext i1 @_ZN3sim14MouseInterface13undoRequestedEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #4

declare noundef zeroext i1 @_ZN3sim14MouseInterface14resetRequestedEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #4

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9FloodFill11moveOneCellEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457), ptr noundef) local_unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN9FloodFill19checkRequestVictoryEv(ptr noundef nonnull align 8 dereferenceable(8457)) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 #4 = { "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, !11, i64 8208}
!6 = !{!"_ZTS9FloodFill", !7, i64 0, !8, i64 8, !9, i64 16, !11, i64 8208, !11, i64 8212, !11, i64 8216, !11, i64 8220, !12, i64 8224, !12, i64 8225, !13, i64 8232, !12, i64 8456}
!7 = !{!"_ZTS10IAlgorithm"}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"bool", !9, i64 0}
!13 = !{!"_ZTS7History", !11, i64 0, !11, i64 4, !8, i64 8, !14, i64 16, !21, i64 96, !27, i64 176, !32, i64 200}
!14 = !{!"_ZTSSt5stackIP4CellSt5dequeIS1_SaIS1_EEE", !15, i64 0}
!15 = !{!"_ZTSSt5dequeIP4CellSaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSSt11_Deque_baseIP4CellSaIS1_EE", !17, i64 0}
!17 = !{!"_ZTSNSt11_Deque_baseIP4CellSaIS1_EE11_Deque_implE", !18, i64 0}
!18 = !{!"_ZTSNSt11_Deque_baseIP4CellSaIS1_EE16_Deque_impl_dataE", !8, i64 0, !19, i64 8, !20, i64 16, !20, i64 48}
!19 = !{!"long", !9, i64 0}
!20 = !{!"_ZTSSt15_Deque_iteratorIP4CellRS1_PS1_E", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24}
!21 = !{!"_ZTSSt5queueISt5stackIP4CellSt5dequeIS2_SaIS2_EEES3_IS6_SaIS6_EEE", !22, i64 0}
!22 = !{!"_ZTSSt5dequeISt5stackIP4CellS_IS2_SaIS2_EEESaIS5_EE", !23, i64 0}
!23 = !{!"_ZTSSt11_Deque_baseISt5stackIP4CellSt5dequeIS2_SaIS2_EEESaIS6_EE", !24, i64 0}
!24 = !{!"_ZTSNSt11_Deque_baseISt5stackIP4CellSt5dequeIS2_SaIS2_EEESaIS6_EE11_Deque_implE", !25, i64 0}
!25 = !{!"_ZTSNSt11_Deque_baseISt5stackIP4CellSt5dequeIS2_SaIS2_EEESaIS6_EE16_Deque_impl_dataE", !8, i64 0, !19, i64 8, !26, i64 16, !26, i64 48}
!26 = !{!"_ZTSSt15_Deque_iteratorISt5stackIP4CellSt5dequeIS2_SaIS2_EEERS6_PS6_E", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24}
!27 = !{!"_ZTSNSt7__cxx114listIiSaIiEEE", !28, i64 0}
!28 = !{!"_ZTSNSt7__cxx1110_List_baseIiSaIiEEE", !29, i64 0}
!29 = !{!"_ZTSNSt7__cxx1110_List_baseIiSaIiEE10_List_implE", !30, i64 0}
!30 = !{!"_ZTSNSt8__detail17_List_node_headerE", !31, i64 0, !19, i64 16}
!31 = !{!"_ZTSNSt8__detail15_List_node_baseE", !8, i64 0, !8, i64 8}
!32 = !{!"_ZTSNSt7__cxx114listINS0_I7CellmodSaIS1_EEESaIS3_EEE", !33, i64 0}
!33 = !{!"_ZTSNSt7__cxx1110_List_baseINS_4listI7CellmodSaIS2_EEESaIS4_EEE", !34, i64 0}
!34 = !{!"_ZTSNSt7__cxx1110_List_baseINS_4listI7CellmodSaIS2_EEESaIS4_EE10_List_implE", !30, i64 0}
!35 = !{!6, !11, i64 8212}
!36 = !{!6, !8, i64 8}
!37 = !{!8, !8, i64 0}
!38 = distinct !{!38, !39}
!39 = !{!"llvm.loop.mustprogress"}
!40 = distinct !{!40, !39}
!41 = !{!6, !11, i64 8216}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass