; LLVM IR from mackorone/mms :: old/v2/src/mouse/leftWallFollow (LeftWallFollow)

; 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.leftWallFollow::LeftWallFollow" = type { %class.IMouseAlgorithm, ptr }
%class.IMouseAlgorithm = type { ptr }

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK14leftWallFollow14LeftWallFollow21automaticallyClearFogEv(ptr noundef nonnull align 8 dereferenceable(16) %0) unnamed_addr #0 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8
  %5 = getelementptr inbounds %"class.leftWallFollow::LeftWallFollow", ptr %4, i32 0, i32 1
  %6 = load ptr, ptr %5, align 8, !tbaa !9
  %7 = call noundef zeroext i1 @_ZN3sim14MouseInterface18inputButtonPressedEi(ptr noundef nonnull align 8 dereferenceable(296) %6, i32 noundef 0)
  br i1 %7, label %8, label %18

8:                                                ; preds = %1
  %9 = getelementptr inbounds %"class.leftWallFollow::LeftWallFollow", ptr %4, i32 0, i32 1
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = call noundef zeroext i1 @_ZN3sim14MouseInterface18inputButtonPressedEi(ptr noundef nonnull align 8 dereferenceable(296) %10, i32 noundef 1)
  br i1 %11, label %12, label %17

12:                                               ; preds = %8
  %13 = getelementptr inbounds %"class.leftWallFollow::LeftWallFollow", ptr %4, i32 0, i32 1
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  call void @_ZN3sim14MouseInterface29acknowledgeInputButtonPressedEi(ptr noundef nonnull align 8 dereferenceable(296) %14, i32 noundef 0)
  %15 = getelementptr inbounds %"class.leftWallFollow::LeftWallFollow", ptr %4, i32 0, i32 1
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  call void @_ZN3sim14MouseInterface29acknowledgeInputButtonPressedEi(ptr noundef nonnull align 8 dereferenceable(296) %16, i32 noundef 1)
  br label %17

17:                                               ; preds = %12, %8
  store i1 false, ptr %2, align 1
  br label %27

18:                                               ; preds = %1
  %19 = getelementptr inbounds %"class.leftWallFollow::LeftWallFollow", ptr %4, i32 0, i32 1
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  %21 = call noundef zeroext i1 @_ZN3sim14MouseInterface18inputButtonPressedEi(ptr noundef nonnull align 8 dereferenceable(296) %20, i32 noundef 1)
  br i1 %21, label %22, label %25

22:                                               ; preds = %18
  %23 = getelementptr inbounds %"class.leftWallFollow::LeftWallFollow", ptr %4, i32 0, i32 1
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  call void @_ZN3sim14MouseInterface29acknowledgeInputButtonPressedEi(ptr noundef nonnull align 8 dereferenceable(296) %24, i32 noundef 1)
  br label %25

25:                                               ; preds = %22, %18
  br label %26

26:                                               ; preds = %25
  store i1 true, ptr %2, align 1
  br label %27

27:                                               ; preds = %26, %17
  %28 = load i1, ptr %2, align 1
  ret i1 %28
}

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

declare void @_ZN3sim14MouseInterface29acknowledgeInputButtonPressedEi(ptr noundef nonnull align 8 dereferenceable(296), i32 noundef) #1

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

!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, !6, i64 8}
!10 = !{!"_ZTSN14leftWallFollow14LeftWallFollowE", !11, i64 0, !6, i64 8}
!11 = !{!"_ZTS15IMouseAlgorithm"}


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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK14leftWallFollow14LeftWallFollow21automaticallyClearFogEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(16) %0) unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = tail call noundef zeroext i1 @_ZN3sim14MouseInterface18inputButtonPressedEi(ptr noundef nonnull align 8 dereferenceable(296) %3, i32 noundef 0)
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = tail call noundef zeroext i1 @_ZN3sim14MouseInterface18inputButtonPressedEi(ptr noundef nonnull align 8 dereferenceable(296) %5, i32 noundef 1)
  br i1 %4, label %7, label %10

7:                                                ; preds = %1
  br i1 %6, label %8, label %12

8:                                                ; preds = %7
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  tail call void @_ZN3sim14MouseInterface29acknowledgeInputButtonPressedEi(ptr noundef nonnull align 8 dereferenceable(296) %9, i32 noundef 0)
  br label %.sink.split

10:                                               ; preds = %1
  br i1 %6, label %.sink.split, label %12

.sink.split:                                      ; preds = %10, %8
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  tail call void @_ZN3sim14MouseInterface29acknowledgeInputButtonPressedEi(ptr noundef nonnull align 8 dereferenceable(296) %11, i32 noundef 1)
  br label %12

12:                                               ; preds = %.sink.split, %10, %7
  %.0 = xor i1 %4, true
  ret i1 %.0
}

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

declare void @_ZN3sim14MouseInterface29acknowledgeInputButtonPressedEi(ptr noundef nonnull align 8 dereferenceable(296), i32 noundef) local_unnamed_addr #1

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

!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, !8, i64 8}
!6 = !{!"_ZTSN14leftWallFollow14LeftWallFollowE", !7, i64 0, !8, i64 8}
!7 = !{!"_ZTS15IMouseAlgorithm"}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass