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

; 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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9FloodFill12checkDeadEndEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %0, ptr noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %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
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %22, %2
  %11 = load i32, ptr %6, align 4, !tbaa !9
  %12 = icmp slt i32 %11, 4
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %25

14:                                               ; preds = %10
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = load i32, ptr %6, align 4, !tbaa !9
  %17 = call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef %16)
  br i1 %17, label %18, label %21

18:                                               ; preds = %14
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = add nsw i32 %19, 1
  store i32 %20, ptr %5, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %18, %14
  br label %22

22:                                               ; preds = %21
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %6, align 4, !tbaa !9
  br label %10, !llvm.loop !11

25:                                               ; preds = %13
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = icmp eq i32 %26, 3
  br i1 %27, label %28, label %174

28:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %169, %28
  %30 = load i32, ptr %7, align 4, !tbaa !9
  %31 = icmp slt i32 %30, 4
  br i1 %31, label %33, label %32

32:                                               ; preds = %29
  store i32 5, ptr %8, align 4
  br label %172

33:                                               ; preds = %29
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = load i32, ptr %7, align 4, !tbaa !9
  %36 = call noundef zeroext i1 @_ZN4Cell16getWallInspectedEi(ptr noundef nonnull align 8 dereferenceable(32) %34, i32 noundef %35)
  br i1 %36, label %168, label %37

37:                                               ; preds = %33
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = load i32, ptr %7, align 4, !tbaa !9
  call void @_ZN4Cell7setWallEib(ptr noundef nonnull align 8 dereferenceable(32) %38, i32 noundef %39, i1 noundef zeroext true)
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = load i32, ptr %7, align 4, !tbaa !9
  call void @_ZN4Cell16setWallInspectedEib(ptr noundef nonnull align 8 dereferenceable(32) %40, i32 noundef %41, i1 noundef zeroext true)
  %42 = load i32, ptr %7, align 4, !tbaa !9
  switch i32 %42, label %167 [
    i32 0, label %43
    i32 1, label %74
    i32 2, label %105
    i32 3, label %136
  ]

43:                                               ; preds = %37
  %44 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 2
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %45)
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %44, i64 0, i64 %47
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %49)
  %51 = add nsw i32 %50, 1
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [16 x %class.Cell], ptr %48, i64 0, i64 %52
  call void @_ZN4Cell7setWallEib(ptr noundef nonnull align 8 dereferenceable(32) %53, i32 noundef 2, i1 noundef zeroext true)
  %54 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 2
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %55)
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %54, i64 0, i64 %57
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %59)
  %61 = add nsw i32 %60, 1
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [16 x %class.Cell], ptr %58, i64 0, i64 %62
  call void @_ZN4Cell16setWallInspectedEib(ptr noundef nonnull align 8 dereferenceable(32) %63, i32 noundef 2, i1 noundef zeroext true)
  %64 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 2
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %65)
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %64, i64 0, i64 %67
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %69)
  %71 = add nsw i32 %70, 1
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [16 x %class.Cell], ptr %68, i64 0, i64 %72
  call void @_ZN9FloodFill12checkDeadEndEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %9, ptr noundef %73)
  br label %167

74:                                               ; preds = %37
  %75 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 2
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %76)
  %78 = add nsw i32 %77, 1
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %75, i64 0, i64 %79
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %81)
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [16 x %class.Cell], ptr %80, i64 0, i64 %83
  call void @_ZN4Cell7setWallEib(ptr noundef nonnull align 8 dereferenceable(32) %84, i32 noundef 3, i1 noundef zeroext true)
  %85 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 2
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %86)
  %88 = add nsw i32 %87, 1
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %85, i64 0, i64 %89
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %91)
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [16 x %class.Cell], ptr %90, i64 0, i64 %93
  call void @_ZN4Cell16setWallInspectedEib(ptr noundef nonnull align 8 dereferenceable(32) %94, i32 noundef 3, i1 noundef zeroext true)
  %95 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 2
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %96)
  %98 = add nsw i32 %97, 1
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %95, i64 0, i64 %99
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %101)
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [16 x %class.Cell], ptr %100, i64 0, i64 %103
  call void @_ZN9FloodFill12checkDeadEndEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %9, ptr noundef %104)
  br label %167

105:                                              ; preds = %37
  %106 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 2
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %107)
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %106, i64 0, i64 %109
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  %112 = call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %111)
  %113 = sub nsw i32 %112, 1
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [16 x %class.Cell], ptr %110, i64 0, i64 %114
  call void @_ZN4Cell7setWallEib(ptr noundef nonnull align 8 dereferenceable(32) %115, i32 noundef 0, i1 noundef zeroext true)
  %116 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 2
  %117 = load ptr, ptr %4, align 8, !tbaa !5
  %118 = call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %117)
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %116, i64 0, i64 %119
  %121 = load ptr, ptr %4, align 8, !tbaa !5
  %122 = call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %121)
  %123 = sub nsw i32 %122, 1
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [16 x %class.Cell], ptr %120, i64 0, i64 %124
  call void @_ZN4Cell16setWallInspectedEib(ptr noundef nonnull align 8 dereferenceable(32) %125, i32 noundef 0, i1 noundef zeroext true)
  %126 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 2
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  %128 = call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %127)
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %126, i64 0, i64 %129
  %131 = load ptr, ptr %4, align 8, !tbaa !5
  %132 = call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %131)
  %133 = sub nsw i32 %132, 1
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [16 x %class.Cell], ptr %130, i64 0, i64 %134
  call void @_ZN9FloodFill12checkDeadEndEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %9, ptr noundef %135)
  br label %167

136:                                              ; preds = %37
  %137 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 2
  %138 = load ptr, ptr %4, align 8, !tbaa !5
  %139 = call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %138)
  %140 = sub nsw i32 %139, 1
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %137, i64 0, i64 %141
  %143 = load ptr, ptr %4, align 8, !tbaa !5
  %144 = call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %143)
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [16 x %class.Cell], ptr %142, i64 0, i64 %145
  call void @_ZN4Cell7setWallEib(ptr noundef nonnull align 8 dereferenceable(32) %146, i32 noundef 1, i1 noundef zeroext true)
  %147 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 2
  %148 = load ptr, ptr %4, align 8, !tbaa !5
  %149 = call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %148)
  %150 = sub nsw i32 %149, 1
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %147, i64 0, i64 %151
  %153 = load ptr, ptr %4, align 8, !tbaa !5
  %154 = call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %153)
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [16 x %class.Cell], ptr %152, i64 0, i64 %155
  call void @_ZN4Cell16setWallInspectedEib(ptr noundef nonnull align 8 dereferenceable(32) %156, i32 noundef 1, i1 noundef zeroext true)
  %157 = getelementptr inbounds %class.FloodFill, ptr %9, i32 0, i32 2
  %158 = load ptr, ptr %4, align 8, !tbaa !5
  %159 = call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %158)
  %160 = sub nsw i32 %159, 1
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %157, i64 0, i64 %161
  %163 = load ptr, ptr %4, align 8, !tbaa !5
  %164 = call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %163)
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [16 x %class.Cell], ptr %162, i64 0, i64 %165
  call void @_ZN9FloodFill12checkDeadEndEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %9, ptr noundef %166)
  br label %167

167:                                              ; preds = %136, %105, %74, %43, %37
  store i32 5, ptr %8, align 4
  br label %172

168:                                              ; preds = %33
  br label %169

169:                                              ; preds = %168
  %170 = load i32, ptr %7, align 4, !tbaa !9
  %171 = add nsw i32 %170, 1
  store i32 %171, ptr %7, align 4, !tbaa !9
  br label %29, !llvm.loop !13

172:                                              ; preds = %167, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %173

173:                                              ; preds = %172
  br label %174

174:                                              ; preds = %173, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret void
}

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; 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 }

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

declare void @_ZN4Cell7setWallEib(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i1 noundef zeroext) local_unnamed_addr #0

declare void @_ZN4Cell16setWallInspectedEib(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i1 noundef zeroext) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9FloodFill12checkDeadEndEP4Cell(ptr noundef nonnull align 8 dereferenceable(8457) %0, ptr noundef %1) local_unnamed_addr #1 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  br label %tailrecurse

tailrecurse:                                      ; preds = %tailrecurse.backedge, %2
  %.tr41 = phi ptr [ %1, %2 ], [ %31, %tailrecurse.backedge ]
  %4 = tail call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %.tr41, i32 noundef 0)
  %5 = zext i1 %4 to i32
  %6 = tail call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %.tr41, i32 noundef 1)
  %7 = zext i1 %6 to i32
  %spec.select.1 = add nuw nsw i32 %5, %7
  %8 = tail call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %.tr41, i32 noundef 2)
  %9 = zext i1 %8 to i32
  %spec.select.2 = add nuw nsw i32 %spec.select.1, %9
  %10 = tail call noundef zeroext i1 @_ZN4Cell6isWallEi(ptr noundef nonnull align 8 dereferenceable(32) %.tr41, i32 noundef 3)
  %11 = zext i1 %10 to i32
  %spec.select.3 = add nuw nsw i32 %spec.select.2, %11
  %12 = icmp eq i32 %spec.select.3, 3
  br i1 %12, label %.preheader.preheader, label %.loopexit

.preheader.preheader:                             ; preds = %tailrecurse
  %13 = tail call noundef zeroext i1 @_ZN4Cell16getWallInspectedEi(ptr noundef nonnull align 8 dereferenceable(32) %.tr41, i32 noundef 0)
  br i1 %13, label %.preheader.1, label %14

14:                                               ; preds = %.preheader.preheader
  tail call void @_ZN4Cell7setWallEib(ptr noundef nonnull align 8 dereferenceable(32) %.tr41, i32 noundef 0, i1 noundef zeroext true)
  tail call void @_ZN4Cell16setWallInspectedEib(ptr noundef nonnull align 8 dereferenceable(32) %.tr41, i32 noundef 0, i1 noundef zeroext true)
  %15 = tail call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %16 = sext i32 %15 to i64
  %17 = tail call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %18 = add nsw i32 %17, 1
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %3, i64 0, i64 %16, i64 %19
  tail call void @_ZN4Cell7setWallEib(ptr noundef nonnull align 8 dereferenceable(32) %20, i32 noundef 2, i1 noundef zeroext true)
  %21 = tail call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %22 = sext i32 %21 to i64
  %23 = tail call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %24 = add nsw i32 %23, 1
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %3, i64 0, i64 %22, i64 %25
  tail call void @_ZN4Cell16setWallInspectedEib(ptr noundef nonnull align 8 dereferenceable(32) %26, i32 noundef 2, i1 noundef zeroext true)
  %27 = tail call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %28 = tail call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %29 = add nsw i32 %28, 1
  br label %tailrecurse.backedge

tailrecurse.backedge:                             ; preds = %14, %32, %48, %64
  %.sink56 = phi i32 [ %29, %14 ], [ %47, %32 ], [ %63, %48 ], [ %79, %64 ]
  %.sink.in = phi i32 [ %27, %14 ], [ %46, %32 ], [ %61, %48 ], [ %78, %64 ]
  %.sink = sext i32 %.sink.in to i64
  %30 = sext i32 %.sink56 to i64
  %31 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %3, i64 0, i64 %.sink, i64 %30
  br label %tailrecurse

32:                                               ; preds = %.preheader.1
  tail call void @_ZN4Cell7setWallEib(ptr noundef nonnull align 8 dereferenceable(32) %.tr41, i32 noundef 1, i1 noundef zeroext true)
  tail call void @_ZN4Cell16setWallInspectedEib(ptr noundef nonnull align 8 dereferenceable(32) %.tr41, i32 noundef 1, i1 noundef zeroext true)
  %33 = tail call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %34 = add nsw i32 %33, 1
  %35 = sext i32 %34 to i64
  %36 = tail call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %3, i64 0, i64 %35, i64 %37
  tail call void @_ZN4Cell7setWallEib(ptr noundef nonnull align 8 dereferenceable(32) %38, i32 noundef 3, i1 noundef zeroext true)
  %39 = tail call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %40 = add nsw i32 %39, 1
  %41 = sext i32 %40 to i64
  %42 = tail call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %3, i64 0, i64 %41, i64 %43
  tail call void @_ZN4Cell16setWallInspectedEib(ptr noundef nonnull align 8 dereferenceable(32) %44, i32 noundef 3, i1 noundef zeroext true)
  %45 = tail call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %46 = add nsw i32 %45, 1
  %47 = tail call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  br label %tailrecurse.backedge

48:                                               ; preds = %.preheader.2
  tail call void @_ZN4Cell7setWallEib(ptr noundef nonnull align 8 dereferenceable(32) %.tr41, i32 noundef 2, i1 noundef zeroext true)
  tail call void @_ZN4Cell16setWallInspectedEib(ptr noundef nonnull align 8 dereferenceable(32) %.tr41, i32 noundef 2, i1 noundef zeroext true)
  %49 = tail call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %50 = sext i32 %49 to i64
  %51 = tail call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %52 = add nsw i32 %51, -1
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %3, i64 0, i64 %50, i64 %53
  tail call void @_ZN4Cell7setWallEib(ptr noundef nonnull align 8 dereferenceable(32) %54, i32 noundef 0, i1 noundef zeroext true)
  %55 = tail call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %56 = sext i32 %55 to i64
  %57 = tail call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %58 = add nsw i32 %57, -1
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %3, i64 0, i64 %56, i64 %59
  tail call void @_ZN4Cell16setWallInspectedEib(ptr noundef nonnull align 8 dereferenceable(32) %60, i32 noundef 0, i1 noundef zeroext true)
  %61 = tail call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %62 = tail call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %63 = add nsw i32 %62, -1
  br label %tailrecurse.backedge

64:                                               ; preds = %.preheader.3
  tail call void @_ZN4Cell7setWallEib(ptr noundef nonnull align 8 dereferenceable(32) %.tr41, i32 noundef 3, i1 noundef zeroext true)
  tail call void @_ZN4Cell16setWallInspectedEib(ptr noundef nonnull align 8 dereferenceable(32) %.tr41, i32 noundef 3, i1 noundef zeroext true)
  %65 = tail call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %66 = add nsw i32 %65, -1
  %67 = sext i32 %66 to i64
  %68 = tail call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %3, i64 0, i64 %67, i64 %69
  tail call void @_ZN4Cell7setWallEib(ptr noundef nonnull align 8 dereferenceable(32) %70, i32 noundef 1, i1 noundef zeroext true)
  %71 = tail call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %72 = add nsw i32 %71, -1
  %73 = sext i32 %72 to i64
  %74 = tail call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [16 x [16 x %class.Cell]], ptr %3, i64 0, i64 %73, i64 %75
  tail call void @_ZN4Cell16setWallInspectedEib(ptr noundef nonnull align 8 dereferenceable(32) %76, i32 noundef 1, i1 noundef zeroext true)
  %77 = tail call noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  %78 = add nsw i32 %77, -1
  %79 = tail call noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32) %.tr41)
  br label %tailrecurse.backedge

.preheader.1:                                     ; preds = %.preheader.preheader
  %80 = tail call noundef zeroext i1 @_ZN4Cell16getWallInspectedEi(ptr noundef nonnull align 8 dereferenceable(32) %.tr41, i32 noundef 1)
  br i1 %80, label %.preheader.2, label %32

.preheader.2:                                     ; preds = %.preheader.1
  %81 = tail call noundef zeroext i1 @_ZN4Cell16getWallInspectedEi(ptr noundef nonnull align 8 dereferenceable(32) %.tr41, i32 noundef 2)
  br i1 %81, label %.preheader.3, label %48

.preheader.3:                                     ; preds = %.preheader.2
  %82 = tail call noundef zeroext i1 @_ZN4Cell16getWallInspectedEi(ptr noundef nonnull align 8 dereferenceable(32) %.tr41, i32 noundef 3)
  br i1 %82, label %.loopexit, label %64

.loopexit:                                        ; preds = %tailrecurse, %.preheader.3
  ret void
}

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

declare noundef i32 @_ZN4Cell4getXEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0

declare noundef i32 @_ZN4Cell4getYEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0

attributes #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" }

!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: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass