; LLVM IR from mackorone/mms :: old/v2/src/mouse/mackAlgoTwo/MackAlgoTwo.ll (ZN11mackAlgoTwo11MackAlgoTwo4stepEv)

; 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.mackAlgoTwo::MackAlgoTwo" = type <{ %class.IMouseAlgorithm, ptr, i8, i8, i8, i8, i8, [3 x i8] }>
%class.IMouseAlgorithm = type { ptr }

; 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 i8 @_ZN11mackAlgoTwo4Maze7getCellEhh(i8 noundef zeroext, i8 noundef zeroext) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11mackAlgoTwo11MackAlgoTwo4stepEv(ptr noundef nonnull align 8 dereferenceable(21) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i8, align 1
  %4 = alloca i8, align 1
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  call void @_ZN11mackAlgoTwo11MackAlgoTwo9readWallsEv(ptr noundef nonnull align 8 dereferenceable(21) %6)
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #4
  %7 = getelementptr inbounds %"class.mackAlgoTwo::MackAlgoTwo", ptr %6, i32 0, i32 2
  %8 = load i8, ptr %7, align 8, !tbaa !9
  %9 = getelementptr inbounds %"class.mackAlgoTwo::MackAlgoTwo", ptr %6, i32 0, i32 3
  %10 = load i8, ptr %9, align 1, !tbaa !12
  %11 = call noundef zeroext i8 @_ZN11mackAlgoTwo4Maze7getCellEhh(i8 noundef zeroext %8, i8 noundef zeroext %10)
  store i8 %11, ptr %3, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #4
  %12 = load i8, ptr %3, align 1, !tbaa !13
  %13 = call noundef zeroext i8 @_ZN11mackAlgoTwo11MackAlgoTwo12generatePathEh(ptr noundef nonnull align 8 dereferenceable(21) %6, i8 noundef zeroext %12)
  store i8 %13, ptr %4, align 1, !tbaa !13
  %14 = load i8, ptr %4, align 1, !tbaa !13
  %15 = zext i8 %14 to i32
  %16 = load i8, ptr %3, align 1, !tbaa !13
  %17 = zext i8 %16 to i32
  %18 = icmp ne i32 %15, %17
  br i1 %18, label %19, label %21

19:                                               ; preds = %1
  %20 = getelementptr inbounds %"class.mackAlgoTwo::MackAlgoTwo", ptr %6, i32 0, i32 5
  store i8 2, ptr %20, align 1, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %50

21:                                               ; preds = %1
  %22 = load i8, ptr %4, align 1, !tbaa !13
  call void @_ZN11mackAlgoTwo11MackAlgoTwo8drawPathEh(ptr noundef nonnull align 8 dereferenceable(21) %6, i8 noundef zeroext %22)
  %23 = load i8, ptr %4, align 1, !tbaa !13
  call void @_ZN11mackAlgoTwo11MackAlgoTwo10followPathEh(ptr noundef nonnull align 8 dereferenceable(21) %6, i8 noundef zeroext %23)
  %24 = getelementptr inbounds %"class.mackAlgoTwo::MackAlgoTwo", ptr %6, i32 0, i32 5
  %25 = load i8, ptr %24, align 1, !tbaa !14
  %26 = zext i8 %25 to i32
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %36

28:                                               ; preds = %21
  %29 = getelementptr inbounds %"class.mackAlgoTwo::MackAlgoTwo", ptr %6, i32 0, i32 2
  %30 = load i8, ptr %29, align 8, !tbaa !9
  %31 = getelementptr inbounds %"class.mackAlgoTwo::MackAlgoTwo", ptr %6, i32 0, i32 3
  %32 = load i8, ptr %31, align 1, !tbaa !12
  %33 = call noundef zeroext i1 @_ZN11mackAlgoTwo11MackAlgoTwo8inCenterEhh(ptr noundef nonnull align 8 dereferenceable(21) %6, i8 noundef zeroext %30, i8 noundef zeroext %32)
  br i1 %33, label %34, label %36

34:                                               ; preds = %28
  %35 = getelementptr inbounds %"class.mackAlgoTwo::MackAlgoTwo", ptr %6, i32 0, i32 5
  store i8 1, ptr %35, align 1, !tbaa !14
  br label %36

36:                                               ; preds = %34, %28, %21
  %37 = getelementptr inbounds %"class.mackAlgoTwo::MackAlgoTwo", ptr %6, i32 0, i32 5
  %38 = load i8, ptr %37, align 1, !tbaa !14
  %39 = zext i8 %38 to i32
  %40 = icmp eq i32 %39, 1
  br i1 %40, label %41, label %49

41:                                               ; preds = %36
  %42 = getelementptr inbounds %"class.mackAlgoTwo::MackAlgoTwo", ptr %6, i32 0, i32 2
  %43 = load i8, ptr %42, align 8, !tbaa !9
  %44 = getelementptr inbounds %"class.mackAlgoTwo::MackAlgoTwo", ptr %6, i32 0, i32 3
  %45 = load i8, ptr %44, align 1, !tbaa !12
  %46 = call noundef zeroext i1 @_ZN11mackAlgoTwo11MackAlgoTwo8inOriginEhh(ptr noundef nonnull align 8 dereferenceable(21) %6, i8 noundef zeroext %43, i8 noundef zeroext %45)
  br i1 %46, label %47, label %49

47:                                               ; preds = %41
  %48 = getelementptr inbounds %"class.mackAlgoTwo::MackAlgoTwo", ptr %6, i32 0, i32 5
  store i8 0, ptr %48, align 1, !tbaa !14
  br label %49

49:                                               ; preds = %47, %41, %36
  store i32 0, ptr %5, align 4
  br label %50

50:                                               ; preds = %49, %19
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #4
  %51 = load i32, ptr %5, align 4
  switch i32 %51, label %53 [
    i32 0, label %52
    i32 1, label %52
  ]

52:                                               ; preds = %50, %50
  ret void

53:                                               ; preds = %50
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i8 @_ZN11mackAlgoTwo11MackAlgoTwo12generatePathEh(ptr noundef nonnull align 8 dereferenceable(21), i8 noundef zeroext) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11mackAlgoTwo11MackAlgoTwo8drawPathEh(ptr noundef nonnull align 8 dereferenceable(21), i8 noundef zeroext) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11mackAlgoTwo11MackAlgoTwo10followPathEh(ptr noundef nonnull align 8 dereferenceable(21), i8 noundef zeroext) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN11mackAlgoTwo11MackAlgoTwo8inCenterEhh(ptr noundef nonnull align 8 dereferenceable(21), i8 noundef zeroext, i8 noundef zeroext) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN11mackAlgoTwo11MackAlgoTwo8inOriginEhh(ptr noundef nonnull align 8 dereferenceable(21), i8 noundef zeroext, i8 noundef zeroext) #3 align 2

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 = { 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, !7, i64 16}
!10 = !{!"_ZTSN11mackAlgoTwo11MackAlgoTwoE", !11, i64 0, !6, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19, !7, i64 20}
!11 = !{!"_ZTS15IMouseAlgorithm"}
!12 = !{!10, !7, i64 17}
!13 = !{!7, !7, i64 0}
!14 = !{!10, !7, i64 19}


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

declare noundef zeroext i8 @_ZN11mackAlgoTwo4Maze7getCellEhh(i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11mackAlgoTwo11MackAlgoTwo4stepEv(ptr noundef nonnull align 8 dereferenceable(21) %0) local_unnamed_addr #1 align 2 {
  tail call void @_ZN11mackAlgoTwo11MackAlgoTwo9readWallsEv(ptr noundef nonnull align 8 dereferenceable(21) %0)
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %3 = load i8, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 17
  %5 = load i8, ptr %4, align 1, !tbaa !11
  %6 = tail call noundef zeroext i8 @_ZN11mackAlgoTwo4Maze7getCellEhh(i8 noundef zeroext %3, i8 noundef zeroext %5)
  %7 = tail call noundef zeroext i8 @_ZN11mackAlgoTwo11MackAlgoTwo12generatePathEh(ptr noundef nonnull align 8 dereferenceable(21) %0, i8 noundef zeroext %6)
  %.not = icmp eq i8 %7, %6
  br i1 %.not, label %10, label %8

8:                                                ; preds = %1
  %9 = getelementptr inbounds i8, ptr %0, i64 19
  store i8 2, ptr %9, align 1, !tbaa !12
  br label %26

10:                                               ; preds = %1
  tail call void @_ZN11mackAlgoTwo11MackAlgoTwo8drawPathEh(ptr noundef nonnull align 8 dereferenceable(21) %0, i8 noundef zeroext %6)
  tail call void @_ZN11mackAlgoTwo11MackAlgoTwo10followPathEh(ptr noundef nonnull align 8 dereferenceable(21) %0, i8 noundef zeroext %6)
  %11 = getelementptr inbounds i8, ptr %0, i64 19
  %12 = load i8, ptr %11, align 1, !tbaa !12
  %13 = icmp eq i8 %12, 0
  br i1 %13, label %14, label %18

14:                                               ; preds = %10
  %15 = load i8, ptr %2, align 8, !tbaa !5
  %16 = load i8, ptr %4, align 1, !tbaa !11
  %17 = tail call noundef zeroext i1 @_ZN11mackAlgoTwo11MackAlgoTwo8inCenterEhh(ptr noundef nonnull align 8 dereferenceable(21) %0, i8 noundef zeroext %15, i8 noundef zeroext %16)
  br i1 %17, label %.thread, label %thread-pre-split

.thread:                                          ; preds = %14
  store i8 1, ptr %11, align 1, !tbaa !12
  br label %21

thread-pre-split:                                 ; preds = %14
  %.pr = load i8, ptr %11, align 1, !tbaa !12
  br label %18

18:                                               ; preds = %thread-pre-split, %10
  %19 = phi i8 [ %.pr, %thread-pre-split ], [ %12, %10 ]
  %20 = icmp eq i8 %19, 1
  br i1 %20, label %21, label %26

21:                                               ; preds = %.thread, %18
  %22 = load i8, ptr %2, align 8, !tbaa !5
  %23 = load i8, ptr %4, align 1, !tbaa !11
  %24 = tail call noundef zeroext i1 @_ZN11mackAlgoTwo11MackAlgoTwo8inOriginEhh(ptr noundef nonnull align 8 dereferenceable(21) %0, i8 noundef zeroext %22, i8 noundef zeroext %23)
  br i1 %24, label %25, label %26

25:                                               ; preds = %21
  store i8 0, ptr %11, align 1, !tbaa !12
  br label %26

26:                                               ; preds = %18, %21, %25, %8
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i8 @_ZN11mackAlgoTwo11MackAlgoTwo12generatePathEh(ptr noundef nonnull align 8 dereferenceable(21), i8 noundef zeroext) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11mackAlgoTwo11MackAlgoTwo8drawPathEh(ptr noundef nonnull align 8 dereferenceable(21), i8 noundef zeroext) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11mackAlgoTwo11MackAlgoTwo10followPathEh(ptr noundef nonnull align 8 dereferenceable(21), i8 noundef zeroext) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN11mackAlgoTwo11MackAlgoTwo8inCenterEhh(ptr noundef nonnull align 8 dereferenceable(21), i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN11mackAlgoTwo11MackAlgoTwo8inOriginEhh(ptr noundef nonnull align 8 dereferenceable(21), i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #2 align 2

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" }
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, !9, i64 16}
!6 = !{!"_ZTSN11mackAlgoTwo11MackAlgoTwoE", !7, i64 0, !8, i64 8, !9, i64 16, !9, i64 17, !9, i64 18, !9, i64 19, !9, i64 20}
!7 = !{!"_ZTS15IMouseAlgorithm"}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!6, !9, i64 17}
!12 = !{!6, !9, i64 19}


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