; LLVM IR from mackorone/mms :: old/v2/src/sim/MouseInterface.ll (ZN3sim14MouseInterface18inputButtonPressedEi)

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

@.str.84 = external hidden unnamed_addr constant [102 x i8], align 1

declare noundef ptr @_ZN3sim1LEv() #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3sim14MouseInterface18inputButtonPressedEi(ptr noundef nonnull align 8 dereferenceable(296) %0, i32 noundef %1) #1 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %6 = load ptr, ptr %4, align 8
  %7 = load i32, ptr %5, align 4, !tbaa !9
  %8 = icmp slt i32 %7, 0
  br i1 %8, label %12, label %9

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

12:                                               ; preds = %9, %2
  %13 = call noundef ptr @_ZN3sim1LEv()
  call void @_ZN2el6Logger4warnIiJEEEvPKcRKT_DpRKT0_(ptr noundef nonnull align 8 dereferenceable(728) %13, ptr noundef @.str.84, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i1 false, ptr %3, align 1
  br label %18

14:                                               ; preds = %9
  %15 = call noundef ptr @_ZN3sim1SEv()
  %16 = load i32, ptr %5, align 4, !tbaa !9
  %17 = call noundef zeroext i1 @_ZN3sim5State21inputButtonWasPressedEi(ptr noundef nonnull align 8 dereferenceable(168) %15, i32 noundef %16)
  store i1 %17, ptr %3, align 1
  br label %18

18:                                               ; preds = %14, %12
  %19 = load i1, ptr %3, align 1
  ret i1 %19
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN2el6Logger4warnIiJEEEvPKcRKT_DpRKT0_(ptr noundef nonnull align 8 dereferenceable(728), ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

declare noundef ptr @_ZN3sim1SEv() #0

declare noundef zeroext i1 @_ZN3sim5State21inputButtonWasPressedEi(ptr noundef nonnull align 8 dereferenceable(168), i32 noundef) #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" }
attributes #2 = { inlinehint 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)"}
!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"

@.str.84 = external hidden unnamed_addr constant [102 x i8], align 1

declare noundef ptr @_ZN3sim1LEv() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3sim14MouseInterface18inputButtonPressedEi(ptr nocapture noundef nonnull readnone align 8 dereferenceable(296) %0, i32 noundef %1) local_unnamed_addr #1 align 2 {
  %3 = alloca i32, align 4
  store i32 %1, ptr %3, align 4, !tbaa !5
  %or.cond = icmp ugt i32 %1, 9
  br i1 %or.cond, label %4, label %6

4:                                                ; preds = %2
  %5 = tail call noundef ptr @_ZN3sim1LEv()
  call void @_ZN2el6Logger4warnIiJEEEvPKcRKT_DpRKT0_(ptr noundef nonnull align 8 dereferenceable(728) %5, ptr noundef nonnull @.str.84, ptr noundef nonnull align 4 dereferenceable(4) %3)
  br label %9

6:                                                ; preds = %2
  %7 = tail call noundef ptr @_ZN3sim1SEv()
  %8 = tail call noundef zeroext i1 @_ZN3sim5State21inputButtonWasPressedEi(ptr noundef nonnull align 8 dereferenceable(168) %7, i32 noundef %1)
  br label %9

9:                                                ; preds = %6, %4
  %.0 = phi i1 [ false, %4 ], [ %8, %6 ]
  ret i1 %.0
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN2el6Logger4warnIiJEEEvPKcRKT_DpRKT0_(ptr noundef nonnull align 8 dereferenceable(728), ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2 align 2

declare noundef ptr @_ZN3sim1SEv() local_unnamed_addr #0

declare noundef zeroext i1 @_ZN3sim5State21inputButtonWasPressedEi(ptr noundef nonnull align 8 dereferenceable(168), i32 noundef) 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" }
attributes #2 = { inlinehint 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)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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