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

; 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 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
define dso_local void @_ZN9FloodFill5floodEii(ptr noundef nonnull align 8 dereferenceable(8457) %0, i32 noundef %1, i32 noundef %2) #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  %11 = load ptr, ptr %4, align 8
  %12 = load i32, ptr %5, align 4, !tbaa !9
  %13 = load i32, ptr %6, align 4, !tbaa !9
  %14 = call noundef zeroext i1 @_ZN9FloodFill6inGoalEii(ptr noundef nonnull align 8 dereferenceable(8457) %11, i32 noundef %12, i32 noundef %13)
  br i1 %14, label %174, label %15

15:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 256, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 256, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 256, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 256, ptr %10, align 4, !tbaa !9
  %16 = getelementptr inbounds %class.FloodFill, ptr %11, i32 0, i32 2
  %17 = load i32, ptr %5, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %16, i64 0, i64 %18
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [16 x %class.Cell], ptr %19, i64 0, i64 %21
  %23 = call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %22, i32 noundef 0)
  br i1 %23, label %34, label %24

24:                                               ; preds = %15
  %25 = getelementptr inbounds %class.FloodFill, ptr %11, i32 0, i32 2
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %25, i64 0, i64 %27
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = add nsw i32 %29, 1
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [16 x %class.Cell], ptr %28, i64 0, i64 %31
  %33 = call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %32)
  store i32 %33, ptr %7, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %24, %15
  %35 = getelementptr inbounds %class.FloodFill, ptr %11, i32 0, i32 2
  %36 = load i32, ptr %5, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %35, i64 0, i64 %37
  %39 = load i32, ptr %6, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [16 x %class.Cell], ptr %38, i64 0, i64 %40
  %42 = call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %41, i32 noundef 1)
  br i1 %42, label %53, label %43

43:                                               ; preds = %34
  %44 = getelementptr inbounds %class.FloodFill, ptr %11, i32 0, i32 2
  %45 = load i32, ptr %5, align 4, !tbaa !9
  %46 = add nsw i32 %45, 1
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %44, i64 0, i64 %47
  %49 = load i32, ptr %6, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [16 x %class.Cell], ptr %48, i64 0, i64 %50
  %52 = call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %51)
  store i32 %52, ptr %8, align 4, !tbaa !9
  br label %53

53:                                               ; preds = %43, %34
  %54 = getelementptr inbounds %class.FloodFill, ptr %11, i32 0, i32 2
  %55 = load i32, ptr %5, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %54, i64 0, i64 %56
  %58 = load i32, ptr %6, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [16 x %class.Cell], ptr %57, i64 0, i64 %59
  %61 = call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %60, i32 noundef 2)
  br i1 %61, label %72, label %62

62:                                               ; preds = %53
  %63 = getelementptr inbounds %class.FloodFill, ptr %11, i32 0, i32 2
  %64 = load i32, ptr %5, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %63, i64 0, i64 %65
  %67 = load i32, ptr %6, align 4, !tbaa !9
  %68 = sub nsw i32 %67, 1
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [16 x %class.Cell], ptr %66, i64 0, i64 %69
  %71 = call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %70)
  store i32 %71, ptr %9, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %62, %53
  %73 = getelementptr inbounds %class.FloodFill, ptr %11, i32 0, i32 2
  %74 = load i32, ptr %5, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %73, i64 0, i64 %75
  %77 = load i32, ptr %6, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [16 x %class.Cell], ptr %76, i64 0, i64 %78
  %80 = call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %79, i32 noundef 3)
  br i1 %80, label %91, label %81

81:                                               ; preds = %72
  %82 = getelementptr inbounds %class.FloodFill, ptr %11, i32 0, i32 2
  %83 = load i32, ptr %5, align 4, !tbaa !9
  %84 = sub nsw i32 %83, 1
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %82, i64 0, i64 %85
  %87 = load i32, ptr %6, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [16 x %class.Cell], ptr %86, i64 0, i64 %88
  %90 = call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %89)
  store i32 %90, ptr %10, align 4, !tbaa !9
  br label %91

91:                                               ; preds = %81, %72
  %92 = getelementptr inbounds %class.FloodFill, ptr %11, i32 0, i32 2
  %93 = load i32, ptr %5, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %92, i64 0, i64 %94
  %96 = load i32, ptr %6, align 4, !tbaa !9
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [16 x %class.Cell], ptr %95, i64 0, i64 %97
  %99 = call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %98)
  %100 = load i32, ptr %7, align 4, !tbaa !9
  %101 = load i32, ptr %8, align 4, !tbaa !9
  %102 = load i32, ptr %9, align 4, !tbaa !9
  %103 = load i32, ptr %10, align 4, !tbaa !9
  %104 = call noundef i32 @_ZN9FloodFill3minEiiii(ptr noundef nonnull align 8 dereferenceable(8457) %11, i32 noundef %100, i32 noundef %101, i32 noundef %102, i32 noundef %103)
  %105 = add nsw i32 %104, 1
  %106 = icmp ne i32 %99, %105
  br i1 %106, label %107, label %173

107:                                              ; preds = %91
  %108 = getelementptr inbounds %class.FloodFill, ptr %11, i32 0, i32 2
  %109 = load i32, ptr %5, align 4, !tbaa !9
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %108, i64 0, i64 %110
  %112 = load i32, ptr %6, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [16 x %class.Cell], ptr %111, i64 0, i64 %113
  %115 = load i32, ptr %7, align 4, !tbaa !9
  %116 = load i32, ptr %8, align 4, !tbaa !9
  %117 = load i32, ptr %9, align 4, !tbaa !9
  %118 = load i32, ptr %10, align 4, !tbaa !9
  %119 = call noundef i32 @_ZN9FloodFill3minEiiii(ptr noundef nonnull align 8 dereferenceable(8457) %11, i32 noundef %115, i32 noundef %116, i32 noundef %117, i32 noundef %118)
  %120 = add nsw i32 %119, 1
  call void @_ZN4Cell11setDistanceEi(ptr noundef nonnull align 8 dereferenceable(32) %114, i32 noundef %120)
  %121 = getelementptr inbounds %class.FloodFill, ptr %11, i32 0, i32 2
  %122 = load i32, ptr %5, align 4, !tbaa !9
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %121, i64 0, i64 %123
  %125 = load i32, ptr %6, align 4, !tbaa !9
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [16 x %class.Cell], ptr %124, i64 0, i64 %126
  %128 = call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %127, i32 noundef 0)
  br i1 %128, label %133, label %129

129:                                              ; preds = %107
  %130 = load i32, ptr %5, align 4, !tbaa !9
  %131 = load i32, ptr %6, align 4, !tbaa !9
  %132 = add nsw i32 %131, 1
  call void @_ZN9FloodFill5floodEii(ptr noundef nonnull align 8 dereferenceable(8457) %11, i32 noundef %130, i32 noundef %132)
  br label %133

133:                                              ; preds = %129, %107
  %134 = getelementptr inbounds %class.FloodFill, ptr %11, i32 0, i32 2
  %135 = load i32, ptr %5, align 4, !tbaa !9
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %134, i64 0, i64 %136
  %138 = load i32, ptr %6, align 4, !tbaa !9
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [16 x %class.Cell], ptr %137, i64 0, i64 %139
  %141 = call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %140, i32 noundef 1)
  br i1 %141, label %146, label %142

142:                                              ; preds = %133
  %143 = load i32, ptr %5, align 4, !tbaa !9
  %144 = add nsw i32 %143, 1
  %145 = load i32, ptr %6, align 4, !tbaa !9
  call void @_ZN9FloodFill5floodEii(ptr noundef nonnull align 8 dereferenceable(8457) %11, i32 noundef %144, i32 noundef %145)
  br label %146

146:                                              ; preds = %142, %133
  %147 = getelementptr inbounds %class.FloodFill, ptr %11, i32 0, i32 2
  %148 = load i32, ptr %5, align 4, !tbaa !9
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %147, i64 0, i64 %149
  %151 = load i32, ptr %6, align 4, !tbaa !9
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [16 x %class.Cell], ptr %150, i64 0, i64 %152
  %154 = call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %153, i32 noundef 2)
  br i1 %154, label %159, label %155

155:                                              ; preds = %146
  %156 = load i32, ptr %5, align 4, !tbaa !9
  %157 = load i32, ptr %6, align 4, !tbaa !9
  %158 = sub nsw i32 %157, 1
  call void @_ZN9FloodFill5floodEii(ptr noundef nonnull align 8 dereferenceable(8457) %11, i32 noundef %156, i32 noundef %158)
  br label %159

159:                                              ; preds = %155, %146
  %160 = getelementptr inbounds %class.FloodFill, ptr %11, i32 0, i32 2
  %161 = load i32, ptr %5, align 4, !tbaa !9
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %160, i64 0, i64 %162
  %164 = load i32, ptr %6, align 4, !tbaa !9
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [16 x %class.Cell], ptr %163, i64 0, i64 %165
  %167 = call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %166, i32 noundef 3)
  br i1 %167, label %172, label %168

168:                                              ; preds = %159
  %169 = load i32, ptr %5, align 4, !tbaa !9
  %170 = sub nsw i32 %169, 1
  %171 = load i32, ptr %6, align 4, !tbaa !9
  call void @_ZN9FloodFill5floodEii(ptr noundef nonnull align 8 dereferenceable(8457) %11, i32 noundef %170, i32 noundef %171)
  br label %172

172:                                              ; preds = %168, %159
  br label %173

173:                                              ; preds = %172, %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %174

174:                                              ; preds = %173, %3
  ret void
}

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

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

declare void @_ZN4Cell11setDistanceEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN9FloodFill3minEiiii(ptr noundef nonnull align 8 dereferenceable(8457), i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1 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 = { "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}


; 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9FloodFill6inGoalEii(ptr noundef nonnull align 8 dereferenceable(8457), i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9FloodFill5floodEii(ptr noundef nonnull align 8 dereferenceable(8457) %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #1 align 2 {
  %4 = tail call noundef zeroext i1 @_ZN9FloodFill6inGoalEii(ptr noundef nonnull align 8 dereferenceable(8457) %0, i32 noundef %1, i32 noundef %2)
  br i1 %4, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = sext i32 %2 to i64
  %7 = add nsw i32 %2, 1
  %8 = sext i32 %7 to i64
  %9 = add nsw i32 %2, -1
  %10 = sext i32 %9 to i64
  %11 = sext i32 %1 to i64
  br label %14

tailrecurse:                                      ; preds = %56
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %12 = trunc nsw i64 %indvars.iv.next to i32
  %13 = tail call noundef zeroext i1 @_ZN9FloodFill6inGoalEii(ptr noundef nonnull align 8 dereferenceable(8457) %0, i32 noundef %12, i32 noundef %2)
  br i1 %13, label %._crit_edge, label %14

14:                                               ; preds = %.lr.ph, %tailrecurse
  %indvars.iv = phi i64 [ %11, %.lr.ph ], [ %indvars.iv.next, %tailrecurse ]
  %15 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %5, i64 0, i64 %indvars.iv, i64 %6
  %16 = tail call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef 0)
  br i1 %16, label %20, label %17

17:                                               ; preds = %14
  %18 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %5, i64 0, i64 %indvars.iv, i64 %8
  %19 = tail call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %18)
  br label %20

20:                                               ; preds = %17, %14
  %.048 = phi i32 [ 256, %14 ], [ %19, %17 ]
  %21 = tail call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef 1)
  br i1 %21, label %26, label %22

22:                                               ; preds = %20
  %23 = add nsw i64 %indvars.iv, 1
  %24 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %5, i64 0, i64 %23, i64 %6
  %25 = tail call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %24)
  br label %26

26:                                               ; preds = %22, %20
  %.047 = phi i32 [ 256, %20 ], [ %25, %22 ]
  %27 = tail call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef 2)
  br i1 %27, label %31, label %28

28:                                               ; preds = %26
  %29 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %5, i64 0, i64 %indvars.iv, i64 %10
  %30 = tail call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %29)
  br label %31

31:                                               ; preds = %28, %26
  %.046 = phi i32 [ 256, %26 ], [ %30, %28 ]
  %32 = tail call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef 3)
  br i1 %32, label %37, label %33

33:                                               ; preds = %31
  %34 = add nsw i64 %indvars.iv, -1
  %35 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %5, i64 0, i64 %34, i64 %6
  %36 = tail call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %35)
  br label %37

37:                                               ; preds = %33, %31
  %.0 = phi i32 [ 256, %31 ], [ %36, %33 ]
  %38 = tail call noundef i32 @_ZN4Cell11getDistanceEv(ptr noundef nonnull align 8 dereferenceable(32) %15)
  %39 = tail call noundef i32 @_ZN9FloodFill3minEiiii(ptr noundef nonnull align 8 dereferenceable(8457) %0, i32 noundef %.048, i32 noundef %.047, i32 noundef %.046, i32 noundef %.0)
  %40 = add nsw i32 %39, 1
  %.not = icmp eq i32 %38, %40
  br i1 %.not, label %._crit_edge, label %41

41:                                               ; preds = %37
  %42 = tail call noundef i32 @_ZN9FloodFill3minEiiii(ptr noundef nonnull align 8 dereferenceable(8457) %0, i32 noundef %.048, i32 noundef %.047, i32 noundef %.046, i32 noundef %.0)
  %43 = add nsw i32 %42, 1
  tail call void @_ZN4Cell11setDistanceEi(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef %43)
  %44 = tail call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef 0)
  br i1 %44, label %47, label %45

45:                                               ; preds = %41
  %46 = trunc nsw i64 %indvars.iv to i32
  tail call void @_ZN9FloodFill5floodEii(ptr noundef nonnull align 8 dereferenceable(8457) %0, i32 noundef %46, i32 noundef %7)
  br label %47

47:                                               ; preds = %45, %41
  %48 = tail call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef 1)
  br i1 %48, label %52, label %49

49:                                               ; preds = %47
  %50 = trunc i64 %indvars.iv to i32
  %51 = add i32 %50, 1
  tail call void @_ZN9FloodFill5floodEii(ptr noundef nonnull align 8 dereferenceable(8457) %0, i32 noundef %51, i32 noundef %2)
  br label %52

52:                                               ; preds = %49, %47
  %53 = tail call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef 2)
  br i1 %53, label %56, label %54

54:                                               ; preds = %52
  %55 = trunc nsw i64 %indvars.iv to i32
  tail call void @_ZN9FloodFill5floodEii(ptr noundef nonnull align 8 dereferenceable(8457) %0, i32 noundef %55, i32 noundef %9)
  br label %56

56:                                               ; preds = %54, %52
  %57 = tail call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef 3)
  br i1 %57, label %._crit_edge, label %tailrecurse

._crit_edge:                                      ; preds = %tailrecurse, %56, %37, %3
  ret void
}

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

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

declare void @_ZN4Cell11setDistanceEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #2

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

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


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