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

; 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.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::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.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 uwtable
declare dso_local void @_ZN9FloodFill11moveOneCellEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457), ptr noundef) #1 align 2

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

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

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

declare noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32)) #3

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN9FloodFill14tryUntraversedEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %0, ptr noundef %1) #1 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %15 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 -1, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 -1, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %92, %2
  %17 = load i32, ptr %8, align 4, !tbaa !9
  %18 = icmp slt i32 %17, 3
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %95

20:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store ptr null, ptr %9, align 8, !tbaa !5
  %21 = load i32, ptr %8, align 4, !tbaa !9
  switch i32 %21, label %28 [
    i32 0, label %22
    i32 1, label %24
    i32 2, label %26
  ]

22:                                               ; preds = %20
  %23 = call noundef ptr @_ZN9FloodFill12getFrontCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %15)
  store ptr %23, ptr %9, align 8, !tbaa !5
  br label %28

24:                                               ; preds = %20
  %25 = call noundef ptr @_ZN9FloodFill12getRightCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %15)
  store ptr %25, ptr %9, align 8, !tbaa !5
  br label %28

26:                                               ; preds = %20
  %27 = call noundef ptr @_ZN9FloodFill11getLeftCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %15)
  store ptr %27, ptr %9, align 8, !tbaa !5
  br label %28

28:                                               ; preds = %26, %24, %22, %20
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  %30 = call noundef zeroext i1 @_ZN9FloodFill13isOneCellAwayEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %15, ptr noundef %29)
  br i1 %30, label %31, label %91

31:                                               ; preds = %28
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = call noundef zeroext i1 @_ZN4Cell12getTraversedEv(ptr noundef nonnull align 8 dereferenceable(32) %32)
  br i1 %33, label %91, label %34

34:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %35)
  store ptr %36, ptr %10, align 8, !tbaa !5
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %90

39:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %40 = getelementptr inbounds %class.FloodFill, ptr %15, i32 0, i32 2
  %41 = getelementptr inbounds %class.FloodFill, ptr %15, i32 0, i32 3
  %42 = load i32, ptr %41, align 8, !tbaa !11
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %40, i64 0, i64 %43
  %45 = getelementptr inbounds %class.FloodFill, ptr %15, i32 0, i32 4
  %46 = load i32, ptr %45, align 4, !tbaa !37
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [16 x %class.Cell], ptr %44, i64 0, i64 %47
  store ptr %48, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %49

49:                                               ; preds = %69, %39
  %50 = load ptr, ptr %11, align 8, !tbaa !5
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %51)
  %53 = icmp ne ptr %50, %52
  br i1 %53, label %54, label %74

54:                                               ; preds = %49
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  %56 = load ptr, ptr %11, align 8, !tbaa !5
  %57 = icmp eq ptr %55, %56
  br i1 %57, label %58, label %69

58:                                               ; preds = %54
  %59 = load i32, ptr %6, align 4, !tbaa !9
  %60 = icmp eq i32 %59, -1
  br i1 %60, label %65, label %61

61:                                               ; preds = %58
  %62 = load i32, ptr %12, align 4, !tbaa !9
  %63 = load i32, ptr %7, align 4, !tbaa !9
  %64 = icmp slt i32 %62, %63
  br i1 %64, label %65, label %68

65:                                               ; preds = %61, %58
  %66 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %66, ptr %6, align 4, !tbaa !9
  %67 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %67, ptr %7, align 4, !tbaa !9
  br label %68

68:                                               ; preds = %65, %61
  br label %74

69:                                               ; preds = %54
  %70 = load i32, ptr %12, align 4, !tbaa !9
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %12, align 4, !tbaa !9
  %72 = load ptr, ptr %11, align 8, !tbaa !5
  %73 = call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %72)
  store ptr %73, ptr %11, align 8, !tbaa !5
  br label %49, !llvm.loop !38

74:                                               ; preds = %68, %49
  %75 = load ptr, ptr %10, align 8, !tbaa !5
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  %77 = icmp eq ptr %75, %76
  br i1 %77, label %78, label %89

78:                                               ; preds = %74
  %79 = load i32, ptr %6, align 4, !tbaa !9
  %80 = icmp eq i32 %79, -1
  br i1 %80, label %85, label %81

81:                                               ; preds = %78
  %82 = load i32, ptr %12, align 4, !tbaa !9
  %83 = load i32, ptr %7, align 4, !tbaa !9
  %84 = icmp slt i32 %82, %83
  br i1 %84, label %85, label %88

85:                                               ; preds = %81, %78
  %86 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %86, ptr %6, align 4, !tbaa !9
  %87 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %87, ptr %7, align 4, !tbaa !9
  br label %88

88:                                               ; preds = %85, %81
  br label %89

89:                                               ; preds = %88, %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %90

90:                                               ; preds = %89, %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %91

91:                                               ; preds = %90, %31, %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %92

92:                                               ; preds = %91
  %93 = load i32, ptr %8, align 4, !tbaa !9
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %8, align 4, !tbaa !9
  br label %16, !llvm.loop !40

95:                                               ; preds = %19
  %96 = load i32, ptr %6, align 4, !tbaa !9
  %97 = icmp sge i32 %96, 0
  br i1 %97, label %98, label %113

98:                                               ; preds = %95
  %99 = load i32, ptr %7, align 4, !tbaa !9
  %100 = icmp sgt i32 %99, 1
  br i1 %100, label %101, label %113

101:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store ptr null, ptr %13, align 8, !tbaa !5
  %102 = load i32, ptr %6, align 4, !tbaa !9
  switch i32 %102, label %109 [
    i32 0, label %103
    i32 1, label %105
    i32 2, label %107
  ]

103:                                              ; preds = %101
  %104 = call noundef ptr @_ZN9FloodFill12getFrontCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %15)
  store ptr %104, ptr %13, align 8, !tbaa !5
  br label %109

105:                                              ; preds = %101
  %106 = call noundef ptr @_ZN9FloodFill12getRightCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %15)
  store ptr %106, ptr %13, align 8, !tbaa !5
  br label %109

107:                                              ; preds = %101
  %108 = call noundef ptr @_ZN9FloodFill11getLeftCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %15)
  store ptr %108, ptr %13, align 8, !tbaa !5
  br label %109

109:                                              ; preds = %107, %105, %103, %101
  %110 = load ptr, ptr %13, align 8, !tbaa !5
  call void @_ZN9FloodFill11moveOneCellEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %15, ptr noundef %110)
  %111 = load ptr, ptr %13, align 8, !tbaa !5
  %112 = call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %111)
  call void @_ZN9FloodFill11moveOneCellEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %15, ptr noundef %112)
  store i1 true, ptr %3, align 1
  store i32 1, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %114

113:                                              ; preds = %98, %95
  store i1 false, ptr %3, align 1
  store i32 1, ptr %14, align 4
  br label %114

114:                                              ; preds = %113, %109
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %115 = load i1, ptr %3, align 1
  ret i1 %115
}

declare noundef zeroext i1 @_ZN4Cell12getTraversedEv(ptr noundef nonnull align 8 dereferenceable(32)) #3

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

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

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

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

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

declare noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN9FloodFill14tryUntraversedEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %0, ptr noundef %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = getelementptr inbounds i8, ptr %0, i64 8208
  %5 = getelementptr inbounds i8, ptr %0, i64 8212
  %6 = tail call noundef ptr @_ZN9FloodFill12getFrontCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  %7 = tail call noundef zeroext i1 @_ZN9FloodFill13isOneCellAwayEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %0, ptr noundef %6)
  br i1 %7, label %8, label %27

8:                                                ; preds = %2
  %9 = tail call noundef zeroext i1 @_ZN4Cell12getTraversedEv(ptr noundef nonnull align 8 dereferenceable(32) %6)
  br i1 %9, label %27, label %10

10:                                               ; preds = %8
  %11 = tail call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %6)
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %27, label %12

12:                                               ; preds = %10
  %13 = load i32, ptr %4, align 8, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = load i32, ptr %5, align 4, !tbaa !35
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %3, i64 0, i64 %14, i64 %16
  %18 = tail call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %.not4456 = icmp eq ptr %17, %18
  br i1 %.not4456, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %12, %20
  %.03258 = phi i32 [ %21, %20 ], [ 0, %12 ]
  %.03357 = phi ptr [ %22, %20 ], [ %17, %12 ]
  %19 = icmp eq ptr %11, %.03357
  br i1 %19, label %.loopexit.thread, label %20

20:                                               ; preds = %.lr.ph
  %21 = add nuw nsw i32 %.03258, 1
  %22 = tail call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %.03357)
  %23 = tail call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %.not44 = icmp eq ptr %22, %23
  br i1 %.not44, label %.loopexit, label %.lr.ph, !llvm.loop !36

.loopexit:                                        ; preds = %20, %12
  %.03353 = phi ptr [ %17, %12 ], [ %22, %20 ]
  %.03251 = phi i32 [ 0, %12 ], [ %21, %20 ]
  %24 = icmp eq ptr %11, %.03353
  br i1 %24, label %.loopexit.thread, label %27

.loopexit.thread:                                 ; preds = %.lr.ph, %.loopexit
  %.172 = phi i32 [ -1, %.loopexit ], [ %.03258, %.lr.ph ]
  %.13971 = phi i32 [ -1, %.loopexit ], [ 0, %.lr.ph ]
  %25 = phi i1 [ true, %.loopexit ], [ false, %.lr.ph ]
  %.0325170 = phi i32 [ %.03251, %.loopexit ], [ %.03258, %.lr.ph ]
  %26 = icmp slt i32 %.0325170, %.172
  %or.cond46 = select i1 %25, i1 true, i1 %26
  %spec.select48 = select i1 %or.cond46, i32 0, i32 %.13971
  %spec.select49 = select i1 %or.cond46, i32 %.0325170, i32 %.172
  br label %27

27:                                               ; preds = %.loopexit.thread, %10, %.loopexit, %8, %2
  %.442 = phi i32 [ -1, %8 ], [ -1, %2 ], [ -1, %10 ], [ -1, %.loopexit ], [ %spec.select48, %.loopexit.thread ]
  %.4 = phi i32 [ -1, %8 ], [ -1, %2 ], [ -1, %10 ], [ -1, %.loopexit ], [ %spec.select49, %.loopexit.thread ]
  %28 = tail call noundef ptr @_ZN9FloodFill12getRightCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  %29 = tail call noundef zeroext i1 @_ZN9FloodFill13isOneCellAwayEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %0, ptr noundef %28)
  br i1 %29, label %30, label %52

30:                                               ; preds = %27
  %31 = tail call noundef zeroext i1 @_ZN4Cell12getTraversedEv(ptr noundef nonnull align 8 dereferenceable(32) %28)
  br i1 %31, label %52, label %32

32:                                               ; preds = %30
  %33 = tail call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %28)
  %.not.1 = icmp eq ptr %33, null
  br i1 %.not.1, label %52, label %34

34:                                               ; preds = %32
  %35 = load i32, ptr %4, align 8, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = load i32, ptr %5, align 4, !tbaa !35
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %3, i64 0, i64 %36, i64 %38
  %40 = tail call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %.not4456.1 = icmp eq ptr %39, %40
  br i1 %.not4456.1, label %.loopexit.1, label %.lr.ph.1

.lr.ph.1:                                         ; preds = %34, %42
  %.03258.1 = phi i32 [ %43, %42 ], [ 0, %34 ]
  %.03357.1 = phi ptr [ %44, %42 ], [ %39, %34 ]
  %41 = icmp eq ptr %33, %.03357.1
  br i1 %41, label %.loopexit.1.thread, label %42

42:                                               ; preds = %.lr.ph.1
  %43 = add nuw nsw i32 %.03258.1, 1
  %44 = tail call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %.03357.1)
  %45 = tail call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %.not44.1 = icmp eq ptr %44, %45
  br i1 %.not44.1, label %.loopexit.1, label %.lr.ph.1, !llvm.loop !36

.loopexit.1.thread:                               ; preds = %.lr.ph.1
  %46 = icmp eq i32 %.442, -1
  %47 = icmp slt i32 %.03258.1, %.4
  %or.cond45.1 = select i1 %46, i1 true, i1 %47
  %spec.select.1 = select i1 %or.cond45.1, i32 1, i32 %.442
  %spec.select47.1 = select i1 %or.cond45.1, i32 %.03258.1, i32 %.4
  br label %49

.loopexit.1:                                      ; preds = %42, %34
  %.03353.1 = phi ptr [ %39, %34 ], [ %44, %42 ]
  %.03251.1 = phi i32 [ 0, %34 ], [ %43, %42 ]
  %48 = icmp eq ptr %33, %.03353.1
  br i1 %48, label %49, label %52

49:                                               ; preds = %.loopexit.1.thread, %.loopexit.1
  %.1.179 = phi i32 [ %spec.select47.1, %.loopexit.1.thread ], [ %.4, %.loopexit.1 ]
  %.139.178 = phi i32 [ %spec.select.1, %.loopexit.1.thread ], [ %.442, %.loopexit.1 ]
  %.03251.177 = phi i32 [ %.03258.1, %.loopexit.1.thread ], [ %.03251.1, %.loopexit.1 ]
  %50 = icmp eq i32 %.139.178, -1
  %51 = icmp slt i32 %.03251.177, %.1.179
  %or.cond46.1 = select i1 %50, i1 true, i1 %51
  %spec.select48.1 = select i1 %or.cond46.1, i32 1, i32 %.139.178
  %spec.select49.1 = select i1 %or.cond46.1, i32 %.03251.177, i32 %.1.179
  br label %52

52:                                               ; preds = %49, %.loopexit.1, %32, %30, %27
  %.442.1 = phi i32 [ %.442, %30 ], [ %.442, %27 ], [ %.442, %32 ], [ %.442, %.loopexit.1 ], [ %spec.select48.1, %49 ]
  %.4.1 = phi i32 [ %.4, %30 ], [ %.4, %27 ], [ %.4, %32 ], [ %.4, %.loopexit.1 ], [ %spec.select49.1, %49 ]
  %53 = tail call noundef ptr @_ZN9FloodFill11getLeftCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  %54 = tail call noundef zeroext i1 @_ZN9FloodFill13isOneCellAwayEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %0, ptr noundef %53)
  br i1 %54, label %55, label %77

55:                                               ; preds = %52
  %56 = tail call noundef zeroext i1 @_ZN4Cell12getTraversedEv(ptr noundef nonnull align 8 dereferenceable(32) %53)
  br i1 %56, label %77, label %57

57:                                               ; preds = %55
  %58 = tail call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %53)
  %.not.2 = icmp eq ptr %58, null
  br i1 %.not.2, label %77, label %59

59:                                               ; preds = %57
  %60 = load i32, ptr %4, align 8, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = load i32, ptr %5, align 4, !tbaa !35
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %3, i64 0, i64 %61, i64 %63
  %65 = tail call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %.not4456.2 = icmp eq ptr %64, %65
  br i1 %.not4456.2, label %.loopexit.2, label %.lr.ph.2

.lr.ph.2:                                         ; preds = %59, %67
  %.03258.2 = phi i32 [ %68, %67 ], [ 0, %59 ]
  %.03357.2 = phi ptr [ %69, %67 ], [ %64, %59 ]
  %66 = icmp eq ptr %58, %.03357.2
  br i1 %66, label %.loopexit.2.thread, label %67

67:                                               ; preds = %.lr.ph.2
  %68 = add nuw nsw i32 %.03258.2, 1
  %69 = tail call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %.03357.2)
  %70 = tail call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %.not44.2 = icmp eq ptr %69, %70
  br i1 %.not44.2, label %.loopexit.2, label %.lr.ph.2, !llvm.loop !36

.loopexit.2.thread:                               ; preds = %.lr.ph.2
  %71 = icmp eq i32 %.442.1, -1
  %72 = icmp slt i32 %.03258.2, %.4.1
  %or.cond45.2 = select i1 %71, i1 true, i1 %72
  %spec.select.2 = select i1 %or.cond45.2, i32 2, i32 %.442.1
  %spec.select47.2 = select i1 %or.cond45.2, i32 %.03258.2, i32 %.4.1
  br label %74

.loopexit.2:                                      ; preds = %67, %59
  %.03353.2 = phi ptr [ %64, %59 ], [ %69, %67 ]
  %.03251.2 = phi i32 [ 0, %59 ], [ %68, %67 ]
  %73 = icmp eq ptr %58, %.03353.2
  br i1 %73, label %74, label %77

74:                                               ; preds = %.loopexit.2.thread, %.loopexit.2
  %.1.286 = phi i32 [ %spec.select47.2, %.loopexit.2.thread ], [ %.4.1, %.loopexit.2 ]
  %.139.285 = phi i32 [ %spec.select.2, %.loopexit.2.thread ], [ %.442.1, %.loopexit.2 ]
  %.03251.284 = phi i32 [ %.03258.2, %.loopexit.2.thread ], [ %.03251.2, %.loopexit.2 ]
  %75 = icmp eq i32 %.139.285, -1
  %76 = icmp slt i32 %.03251.284, %.1.286
  %or.cond46.2 = select i1 %75, i1 true, i1 %76
  %spec.select48.2 = select i1 %or.cond46.2, i32 2, i32 %.139.285
  %spec.select49.2 = select i1 %or.cond46.2, i32 %.03251.284, i32 %.1.286
  br label %77

77:                                               ; preds = %74, %.loopexit.2, %57, %55, %52
  %.442.2 = phi i32 [ %.442.1, %55 ], [ %.442.1, %52 ], [ %.442.1, %57 ], [ %.442.1, %.loopexit.2 ], [ %spec.select48.2, %74 ]
  %.4.2 = phi i32 [ %.4.1, %55 ], [ %.4.1, %52 ], [ %.4.1, %57 ], [ %.4.1, %.loopexit.2 ], [ %spec.select49.2, %74 ]
  %78 = icmp sgt i32 %.442.2, -1
  %79 = icmp sgt i32 %.4.2, 1
  %or.cond = select i1 %78, i1 %79, i1 false
  br i1 %or.cond, label %80, label %89

80:                                               ; preds = %77
  switch i32 %.442.2, label %87 [
    i32 0, label %81
    i32 1, label %83
    i32 2, label %85
  ]

81:                                               ; preds = %80
  %82 = tail call noundef ptr @_ZN9FloodFill12getFrontCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  br label %87

83:                                               ; preds = %80
  %84 = tail call noundef ptr @_ZN9FloodFill12getRightCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  br label %87

85:                                               ; preds = %80
  %86 = tail call noundef ptr @_ZN9FloodFill11getLeftCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  br label %87

87:                                               ; preds = %85, %83, %81, %80
  %.0 = phi ptr [ null, %80 ], [ %86, %85 ], [ %84, %83 ], [ %82, %81 ]
  tail call void @_ZN9FloodFill11moveOneCellEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %0, ptr noundef %.0)
  %88 = tail call noundef ptr @_ZN4Cell7getPrevEv(ptr noundef nonnull align 8 dereferenceable(32) %.0)
  tail call void @_ZN9FloodFill11moveOneCellEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %0, ptr noundef %88)
  br label %89

89:                                               ; preds = %77, %87
  ret i1 %or.cond
}

declare noundef zeroext i1 @_ZN4Cell12getTraversedEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 = { "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" }

!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 = distinct !{!36, !37}
!37 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass