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

; 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
define dso_local void @_ZN9FloodFill15moveTowardsGoalEv(ptr noundef nonnull align 8 dereferenceable(8457) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %6 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 2
  %7 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 3
  %8 = load i32, ptr %7, align 8, !tbaa !9
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %6, i64 0, i64 %9
  %11 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 4
  %12 = load i32, ptr %11, align 4, !tbaa !36
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [16 x %class.Cell], ptr %10, i64 0, i64 %13
  %15 = call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %14)
  store i32 %15, ptr %3, align 4, !tbaa !37
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !37
  %16 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 2
  %17 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 3
  %18 = load i32, ptr %17, align 8, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %16, i64 0, i64 %19
  %21 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 4
  %22 = load i32, ptr %21, align 4, !tbaa !36
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [16 x %class.Cell], ptr %20, i64 0, i64 %23
  %25 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 5
  %26 = load i32, ptr %25, align 8, !tbaa !38
  %27 = add nsw i32 %26, 3
  %28 = srem i32 %27, 4
  %29 = call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %24, i32 noundef %28)
  br i1 %29, label %39, label %30

30:                                               ; preds = %1
  %31 = call noundef ptr @_ZN9FloodFill11getLeftCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %5)
  %32 = call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %31)
  %33 = load i32, ptr %3, align 4, !tbaa !37
  %34 = icmp sle i32 %32, %33
  br i1 %34, label %35, label %38

35:                                               ; preds = %30
  %36 = call noundef ptr @_ZN9FloodFill11getLeftCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %5)
  %37 = call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %36)
  store i32 %37, ptr %3, align 4, !tbaa !37
  store i32 3, ptr %4, align 4, !tbaa !37
  br label %38

38:                                               ; preds = %35, %30
  br label %39

39:                                               ; preds = %38, %1
  %40 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 2
  %41 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 3
  %42 = load i32, ptr %41, align 8, !tbaa !9
  %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 %5, i32 0, i32 4
  %46 = load i32, ptr %45, align 4, !tbaa !36
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [16 x %class.Cell], ptr %44, i64 0, i64 %47
  %49 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 5
  %50 = load i32, ptr %49, align 8, !tbaa !38
  %51 = add nsw i32 %50, 2
  %52 = srem i32 %51, 4
  %53 = call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %48, i32 noundef %52)
  br i1 %53, label %63, label %54

54:                                               ; preds = %39
  %55 = call noundef ptr @_ZN9FloodFill11getRearCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %5)
  %56 = call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %55)
  %57 = load i32, ptr %3, align 4, !tbaa !37
  %58 = icmp sle i32 %56, %57
  br i1 %58, label %59, label %62

59:                                               ; preds = %54
  %60 = call noundef ptr @_ZN9FloodFill11getRearCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %5)
  %61 = call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %60)
  store i32 %61, ptr %3, align 4, !tbaa !37
  store i32 2, ptr %4, align 4, !tbaa !37
  br label %62

62:                                               ; preds = %59, %54
  br label %63

63:                                               ; preds = %62, %39
  %64 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 2
  %65 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 3
  %66 = load i32, ptr %65, align 8, !tbaa !9
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %64, i64 0, i64 %67
  %69 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 4
  %70 = load i32, ptr %69, align 4, !tbaa !36
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [16 x %class.Cell], ptr %68, i64 0, i64 %71
  %73 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 5
  %74 = load i32, ptr %73, align 8, !tbaa !38
  %75 = add nsw i32 %74, 1
  %76 = srem i32 %75, 4
  %77 = call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %72, i32 noundef %76)
  br i1 %77, label %87, label %78

78:                                               ; preds = %63
  %79 = call noundef ptr @_ZN9FloodFill12getRightCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %5)
  %80 = call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %79)
  %81 = load i32, ptr %3, align 4, !tbaa !37
  %82 = icmp sle i32 %80, %81
  br i1 %82, label %83, label %86

83:                                               ; preds = %78
  %84 = call noundef ptr @_ZN9FloodFill12getRightCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %5)
  %85 = call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %84)
  store i32 %85, ptr %3, align 4, !tbaa !37
  store i32 1, ptr %4, align 4, !tbaa !37
  br label %86

86:                                               ; preds = %83, %78
  br label %87

87:                                               ; preds = %86, %63
  %88 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 2
  %89 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 3
  %90 = load i32, ptr %89, align 8, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %88, i64 0, i64 %91
  %93 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 4
  %94 = load i32, ptr %93, align 4, !tbaa !36
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [16 x %class.Cell], ptr %92, i64 0, i64 %95
  %97 = getelementptr inbounds %class.FloodFill, ptr %5, i32 0, i32 5
  %98 = load i32, ptr %97, align 8, !tbaa !38
  %99 = call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %96, i32 noundef %98)
  br i1 %99, label %109, label %100

100:                                              ; preds = %87
  %101 = call noundef ptr @_ZN9FloodFill12getFrontCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %5)
  %102 = call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %101)
  %103 = load i32, ptr %3, align 4, !tbaa !37
  %104 = icmp sle i32 %102, %103
  br i1 %104, label %105, label %108

105:                                              ; preds = %100
  %106 = call noundef ptr @_ZN9FloodFill12getFrontCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %5)
  %107 = call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %106)
  store i32 %107, ptr %3, align 4, !tbaa !37
  store i32 0, ptr %4, align 4, !tbaa !37
  br label %108

108:                                              ; preds = %105, %100
  br label %109

109:                                              ; preds = %108, %87
  %110 = load i32, ptr %4, align 4, !tbaa !37
  switch i32 %110, label %114 [
    i32 1, label %111
    i32 2, label %112
    i32 3, label %113
  ]

111:                                              ; preds = %109
  call void @_ZN9FloodFill9turnRightEv(ptr noundef nonnull align 8 dereferenceable(8457) %5)
  br label %114

112:                                              ; preds = %109
  call void @_ZN9FloodFill10turnAroundEv(ptr noundef nonnull align 8 dereferenceable(8457) %5)
  br label %114

113:                                              ; preds = %109
  call void @_ZN9FloodFill8turnLeftEv(ptr noundef nonnull align 8 dereferenceable(8457) %5)
  br label %114

114:                                              ; preds = %113, %112, %111, %109
  call void @_ZN9FloodFill11moveForwardEv(ptr noundef nonnull align 8 dereferenceable(8457) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret void
}

declare noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32)) #2

declare noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #2

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

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

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

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

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

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

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

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

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 = { "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 = { 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 = { 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 = !{!12, !12, i64 0}
!38 = !{!10, !12, i64 8216}


; 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
define dso_local void @_ZN9FloodFill15moveTowardsGoalEv(ptr noundef nonnull align 8 dereferenceable(8457) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %3 = getelementptr inbounds i8, ptr %0, i64 8208
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = sext i32 %4 to i64
  %6 = getelementptr inbounds i8, ptr %0, i64 8212
  %7 = load i32, ptr %6, align 4, !tbaa !35
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %2, i64 0, i64 %5, i64 %8
  %10 = tail call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  %11 = load i32, ptr %3, align 8, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = load i32, ptr %6, align 4, !tbaa !35
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %2, i64 0, i64 %12, i64 %14
  %16 = getelementptr inbounds i8, ptr %0, i64 8216
  %17 = load i32, ptr %16, align 8, !tbaa !36
  %18 = add nsw i32 %17, 3
  %19 = srem i32 %18, 4
  %20 = tail call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef %19)
  br i1 %20, label %27, label %21

21:                                               ; preds = %1
  %22 = tail call noundef ptr @_ZN9FloodFill11getLeftCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  %23 = tail call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %22)
  %.not = icmp sgt i32 %23, %10
  br i1 %.not, label %27, label %24

24:                                               ; preds = %21
  %25 = tail call noundef ptr @_ZN9FloodFill11getLeftCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  %26 = tail call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %25)
  br label %27

27:                                               ; preds = %21, %24, %1
  %.05 = phi i32 [ %10, %1 ], [ %26, %24 ], [ %10, %21 ]
  %.0 = phi i32 [ 0, %1 ], [ 3, %24 ], [ 0, %21 ]
  %28 = load i32, ptr %3, align 8, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = load i32, ptr %6, align 4, !tbaa !35
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %2, i64 0, i64 %29, i64 %31
  %33 = load i32, ptr %16, align 8, !tbaa !36
  %34 = add nsw i32 %33, 2
  %35 = srem i32 %34, 4
  %36 = tail call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %32, i32 noundef %35)
  br i1 %36, label %43, label %37

37:                                               ; preds = %27
  %38 = tail call noundef ptr @_ZN9FloodFill11getRearCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  %39 = tail call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %38)
  %.not9 = icmp sgt i32 %39, %.05
  br i1 %.not9, label %43, label %40

40:                                               ; preds = %37
  %41 = tail call noundef ptr @_ZN9FloodFill11getRearCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  %42 = tail call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %41)
  br label %43

43:                                               ; preds = %37, %40, %27
  %.16 = phi i32 [ %.05, %27 ], [ %42, %40 ], [ %.05, %37 ]
  %.1 = phi i32 [ %.0, %27 ], [ 2, %40 ], [ %.0, %37 ]
  %44 = load i32, ptr %3, align 8, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = load i32, ptr %6, align 4, !tbaa !35
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %2, i64 0, i64 %45, i64 %47
  %49 = load i32, ptr %16, align 8, !tbaa !36
  %50 = add nsw i32 %49, 1
  %51 = srem i32 %50, 4
  %52 = tail call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %48, i32 noundef %51)
  br i1 %52, label %59, label %53

53:                                               ; preds = %43
  %54 = tail call noundef ptr @_ZN9FloodFill12getRightCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  %55 = tail call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %54)
  %.not10 = icmp sgt i32 %55, %.16
  br i1 %.not10, label %59, label %56

56:                                               ; preds = %53
  %57 = tail call noundef ptr @_ZN9FloodFill12getRightCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  %58 = tail call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %57)
  br label %59

59:                                               ; preds = %53, %56, %43
  %.27 = phi i32 [ %.16, %43 ], [ %58, %56 ], [ %.16, %53 ]
  %.2 = phi i32 [ %.1, %43 ], [ 1, %56 ], [ %.1, %53 ]
  %60 = load i32, ptr %3, align 8, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = load i32, ptr %6, align 4, !tbaa !35
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %2, i64 0, i64 %61, i64 %63
  %65 = load i32, ptr %16, align 8, !tbaa !36
  %66 = tail call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %64, i32 noundef %65)
  br i1 %66, label %72, label %67

67:                                               ; preds = %59
  %68 = tail call noundef ptr @_ZN9FloodFill12getFrontCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  %69 = tail call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %68)
  %.not11 = icmp sgt i32 %69, %.27
  br i1 %.not11, label %72, label %.thread

.thread:                                          ; preds = %67
  %70 = tail call noundef ptr @_ZN9FloodFill12getFrontCellEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  %71 = tail call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %70)
  br label %76

72:                                               ; preds = %67, %59
  switch i32 %.2, label %76 [
    i32 1, label %73
    i32 2, label %74
    i32 3, label %75
  ]

73:                                               ; preds = %72
  tail call void @_ZN9FloodFill9turnRightEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  br label %76

74:                                               ; preds = %72
  tail call void @_ZN9FloodFill10turnAroundEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  br label %76

75:                                               ; preds = %72
  tail call void @_ZN9FloodFill8turnLeftEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  br label %76

76:                                               ; preds = %.thread, %75, %74, %73, %72
  tail call void @_ZN9FloodFill11moveForwardEv(ptr noundef nonnull align 8 dereferenceable(8457) %0)
  ret void
}

declare noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1

declare noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #1

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9FloodFill11moveForwardEv(ptr noundef nonnull align 8 dereferenceable(8457)) local_unnamed_addr #0 align 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 = { "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" }

!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, !11, i64 8216}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass