; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode/juce_gui_basics.ll (ZN4juce9Component7hitTestEii)

; 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.juce::Point" = type { i32, i32 }
%"class.juce::Component" = type <{ %"class.juce::MouseListener", %"class.juce::String", %"class.juce::String", ptr, %"class.juce::Rectangle", %"class.juce::ScopedPointer", %"class.juce::ScopedPointer.0", %"class.juce::Array", ptr, %"class.juce::MouseCursor", ptr, %"class.juce::ScopedPointer.1", %"class.juce::ScopedPointer.2", %"class.juce::ScopedPointer.3", %"class.juce::ListenerList", %"class.juce::NamedValueSet", %"class.juce::WeakReference<juce::Component>::Master", %union.anon, i8, [3 x i8] }>
%"class.juce::MouseListener" = type { ptr }
%"class.juce::String" = type { %"class.juce::CharPointer_UTF8" }
%"class.juce::CharPointer_UTF8" = type { ptr }
%"class.juce::Rectangle" = type { %"class.juce::Point", i32, i32 }
%"class.juce::ScopedPointer" = type { ptr }
%"class.juce::ScopedPointer.0" = type { ptr }
%"class.juce::Array" = type { %"class.juce::ArrayAllocationBase", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase" = type <{ %"class.juce::HeapBlock", i32, [4 x i8] }>
%"class.juce::HeapBlock" = type { ptr }
%"class.juce::MouseCursor" = type { ptr }
%"class.juce::ScopedPointer.1" = type { ptr }
%"class.juce::ScopedPointer.2" = type { ptr }
%"class.juce::ScopedPointer.3" = type { ptr }
%"class.juce::ListenerList" = type { %"class.juce::Array.4" }
%"class.juce::Array.4" = type { %"class.juce::ArrayAllocationBase.5", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.5" = type <{ %"class.juce::HeapBlock.6", i32, [4 x i8] }>
%"class.juce::HeapBlock.6" = type { ptr }
%"class.juce::NamedValueSet" = type { %"class.juce::Array.9" }
%"class.juce::Array.9" = type { %"class.juce::ArrayAllocationBase.10", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.10" = type <{ %"class.juce::HeapBlock.11", i32, [4 x i8] }>
%"class.juce::HeapBlock.11" = type { ptr }
%"class.juce::WeakReference<juce::Component>::Master" = type { %"class.juce::ReferenceCountedObjectPtr" }
%"class.juce::ReferenceCountedObjectPtr" = type { ptr }
%union.anon = type { i32 }

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce5ArrayIPNS_9ComponentENS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20)) #0 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce9Component9isVisibleEv(ptr noundef nonnull align 8 dereferenceable(197)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce5ArrayIPNS_9ComponentENS_20DummyCriticalSectionELi0EE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20), i32 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce9Component7hitTestEii(ptr noundef nonnull align 8 dereferenceable(197) %0, i32 noundef %1, i32 noundef %2) unnamed_addr #3 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca %"class.juce::Point", align 4
  %12 = alloca %"class.juce::Point", align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  %13 = load ptr, ptr %5, align 8
  %14 = getelementptr inbounds %"class.juce::Component", ptr %13, i32 0, i32 17
  %15 = load i16, ptr %14, align 8
  %16 = lshr i16 %15, 3
  %17 = and i16 %16, 1
  %18 = trunc i16 %17 to i1
  br i1 %18, label %20, label %19

19:                                               ; preds = %3
  store i1 true, ptr %4, align 1
  br label %55

20:                                               ; preds = %3
  %21 = getelementptr inbounds %"class.juce::Component", ptr %13, i32 0, i32 17
  %22 = load i16, ptr %21, align 8
  %23 = lshr i16 %22, 4
  %24 = and i16 %23, 1
  %25 = trunc i16 %24 to i1
  br i1 %25, label %26, label %54

26:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %27 = getelementptr inbounds %"class.juce::Component", ptr %13, i32 0, i32 7
  %28 = call noundef i32 @_ZNK4juce5ArrayIPNS_9ComponentENS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %27) #5
  store i32 %28, ptr %8, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %50, %26
  %30 = load i32, ptr %8, align 4, !tbaa !9
  %31 = add nsw i32 %30, -1
  store i32 %31, ptr %8, align 4, !tbaa !9
  %32 = icmp sge i32 %31, 0
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  store i32 2, ptr %9, align 4
  br label %51

34:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %35 = getelementptr inbounds %"class.juce::Component", ptr %13, i32 0, i32 7
  %36 = load i32, ptr %8, align 4, !tbaa !9
  %37 = call noundef ptr @_ZNK4juce5ArrayIPNS_9ComponentENS_20DummyCriticalSectionELi0EE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %35, i32 noundef %36)
  store ptr %37, ptr %10, align 8, !tbaa !5
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = call noundef zeroext i1 @_ZNK4juce9Component9isVisibleEv(ptr noundef nonnull align 8 dereferenceable(197) %38) #5
  br i1 %39, label %40, label %47

40:                                               ; preds = %34
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = load i32, ptr %6, align 4, !tbaa !9
  %44 = load i32, ptr %7, align 4, !tbaa !9
  call void @_ZN4juce5PointIiEC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %12, i32 noundef %43, i32 noundef %44) #5
  call void @_ZN4juce9Component16ComponentHelpers22convertFromParentSpaceINS_5PointIiEEEET_RKS0_S5_(ptr dead_on_unwind writable sret(%"class.juce::Point") align 4 %11, ptr noundef nonnull align 8 dereferenceable(197) %42, ptr noundef %12)
  %45 = call noundef zeroext i1 @_ZN4juce9Component16ComponentHelpers7hitTestERS0_NS_5PointIiEE(ptr noundef nonnull align 8 dereferenceable(197) %41, ptr noundef %11)
  br i1 %45, label %46, label %47

46:                                               ; preds = %40
  store i1 true, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %48

47:                                               ; preds = %40, %34
  store i32 0, ptr %9, align 4
  br label %48

48:                                               ; preds = %47, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %49 = load i32, ptr %9, align 4
  switch i32 %49, label %51 [
    i32 0, label %50
  ]

50:                                               ; preds = %48
  br label %29, !llvm.loop !11

51:                                               ; preds = %48, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %52 = load i32, ptr %9, align 4
  switch i32 %52, label %57 [
    i32 2, label %53
    i32 1, label %55
  ]

53:                                               ; preds = %51
  br label %54

54:                                               ; preds = %53, %20
  store i1 false, ptr %4, align 1
  br label %55

55:                                               ; preds = %54, %51, %19
  %56 = load i1, ptr %4, align 1
  ret i1 %56

57:                                               ; preds = %51
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4juce9Component16ComponentHelpers7hitTestERS0_NS_5PointIiEE(ptr noundef nonnull align 8 dereferenceable(197), ptr noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce9Component16ComponentHelpers22convertFromParentSpaceINS_5PointIiEEEET_RKS0_S5_(ptr dead_on_unwind noalias writable sret(%"class.juce::Point") align 4, ptr noundef nonnull align 8 dereferenceable(197), ptr noundef) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce5PointIiEC2Eii(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef, i32 noundef) unnamed_addr #2 align 2

attributes #0 = { inlinehint 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #3 = { 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 #4 = { 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" }
attributes #5 = { 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"}


; 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.juce::Point" = type { i32, i32 }

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce5ArrayIPNS_9ComponentENS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4juce9Component9isVisibleEv(ptr noundef nonnull align 8 dereferenceable(197)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce9Component7hitTestEii(ptr noundef nonnull align 8 dereferenceable(197) %0, i32 noundef %1, i32 noundef %2) unnamed_addr #2 align 2 {
  %4 = alloca %"class.juce::Point", align 4
  %5 = alloca %"class.juce::Point", align 4
  %6 = getelementptr inbounds i8, ptr %0, i64 192
  %7 = load i16, ptr %6, align 8
  %8 = and i16 %7, 8
  %.not = icmp eq i16 %8, 0
  br i1 %.not, label %.thread, label %9

9:                                                ; preds = %3
  %10 = and i16 %7, 16
  %.not14 = icmp eq i16 %10, 0
  br i1 %.not14, label %.thread, label %11

11:                                               ; preds = %9
  %12 = getelementptr inbounds i8, ptr %0, i64 64
  %13 = tail call noundef i32 @_ZNK4juce5ArrayIPNS_9ComponentENS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %12) #4
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph, label %.thread

.lr.ph:                                           ; preds = %11, %.critedge
  %.in = phi i32 [ %15, %.critedge ], [ %13, %11 ]
  %15 = add nsw i32 %.in, -1
  %16 = call noundef ptr @_ZNK4juce5ArrayIPNS_9ComponentENS_20DummyCriticalSectionELi0EE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %12, i32 noundef %15)
  %17 = call noundef zeroext i1 @_ZNK4juce9Component9isVisibleEv(ptr noundef nonnull align 8 dereferenceable(197) %16) #4
  br i1 %17, label %18, label %.critedge

18:                                               ; preds = %.lr.ph
  call void @_ZN4juce5PointIiEC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %5, i32 noundef %1, i32 noundef %2) #4
  call void @_ZN4juce9Component16ComponentHelpers22convertFromParentSpaceINS_5PointIiEEEET_RKS0_S5_(ptr dead_on_unwind nonnull writable sret(%"class.juce::Point") align 4 %4, ptr noundef nonnull align 8 dereferenceable(197) %16, ptr noundef nonnull %5)
  %19 = call noundef zeroext i1 @_ZN4juce9Component16ComponentHelpers7hitTestERS0_NS_5PointIiEE(ptr noundef nonnull align 8 dereferenceable(197) %16, ptr noundef nonnull %4)
  br i1 %19, label %.thread, label %.critedge, !llvm.loop !5

.critedge:                                        ; preds = %18, %.lr.ph
  %20 = icmp ugt i32 %.in, 1
  br i1 %20, label %.lr.ph, label %.thread

.thread:                                          ; preds = %.critedge, %18, %11, %9, %3
  %.3 = phi i1 [ true, %3 ], [ false, %9 ], [ false, %11 ], [ false, %.critedge ], [ true, %18 ]
  ret i1 %.3
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4juce9Component16ComponentHelpers7hitTestERS0_NS_5PointIiEE(ptr noundef nonnull align 8 dereferenceable(197), ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce9Component16ComponentHelpers22convertFromParentSpaceINS_5PointIiEEEET_RKS0_S5_(ptr dead_on_unwind noalias writable sret(%"class.juce::Point") align 4, ptr noundef nonnull align 8 dereferenceable(197), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce5PointIiEC2Eii(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef, i32 noundef) unnamed_addr #1 align 2

attributes #0 = { inlinehint 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 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 = { 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" }
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass