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

; 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::MenuBarComponent" = type <{ %"class.juce::Component.base", [3 x i8], %"class.juce::MenuBarModel::Listener", %"class.juce::Timer", ptr, %"class.juce::StringArray", %"class.juce::Array.288", %"class.juce::Point", i32, i32, i32, [4 x i8] }>
%"class.juce::Component.base" = 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 }>
%"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 }
%"class.juce::MenuBarModel::Listener" = type { ptr }
%"class.juce::Timer" = type { ptr, i32, i32, ptr, ptr }
%"class.juce::StringArray" = type { %"class.juce::Array.150" }
%"class.juce::Array.150" = type { %"class.juce::ArrayAllocationBase.151", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.151" = type <{ %"class.juce::HeapBlock.152", i32, [4 x i8] }>
%"class.juce::HeapBlock.152" = type { ptr }
%"class.juce::Array.288" = type { %"class.juce::ArrayAllocationBase.289", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.289" = type <{ %"class.juce::HeapBlock.290", i32, [4 x i8] }>
%"class.juce::HeapBlock.290" = 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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN4juce16MenuBarComponent9getItemAtENS_5PointIiEE(ptr noundef nonnull align 8 dereferenceable(316) %0, ptr noundef %1) #2 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.juce::Point", align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %39, %2
  %11 = load i32, ptr %6, align 4, !tbaa !9
  %12 = getelementptr inbounds %"class.juce::MenuBarComponent", ptr %9, i32 0, i32 6
  %13 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %12) #4
  %14 = icmp slt i32 %11, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %10
  store i32 2, ptr %7, align 4
  br label %42

16:                                               ; preds = %10
  %17 = getelementptr inbounds %"class.juce::Point", ptr %1, i32 0, i32 0
  %18 = load i32, ptr %17, align 4, !tbaa !11
  %19 = getelementptr inbounds %"class.juce::MenuBarComponent", ptr %9, i32 0, i32 6
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EEixEi(ptr noundef nonnull align 8 dereferenceable(20) %19, i32 noundef %20)
  %22 = icmp sge i32 %18, %21
  br i1 %22, label %23, label %38

23:                                               ; preds = %16
  %24 = getelementptr inbounds %"class.juce::Point", ptr %1, i32 0, i32 0
  %25 = load i32, ptr %24, align 4, !tbaa !11
  %26 = getelementptr inbounds %"class.juce::MenuBarComponent", ptr %9, i32 0, i32 6
  %27 = load i32, ptr %6, align 4, !tbaa !9
  %28 = add nsw i32 %27, 1
  %29 = call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EEixEi(ptr noundef nonnull align 8 dereferenceable(20) %26, i32 noundef %28)
  %30 = icmp slt i32 %25, %29
  br i1 %30, label %31, label %38

31:                                               ; preds = %23
  call void @_ZN4juce5PointIiEC2ERKS1_(ptr noundef nonnull align 4 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(8) %1) #4
  %32 = call noundef zeroext i1 @_ZN4juce9Component14reallyContainsENS_5PointIiEEb(ptr noundef nonnull align 8 dereferenceable(197) %9, ptr noundef %8, i1 noundef zeroext true)
  br i1 %32, label %33, label %35

33:                                               ; preds = %31
  %34 = load i32, ptr %6, align 4, !tbaa !9
  br label %36

35:                                               ; preds = %31
  br label %36

36:                                               ; preds = %35, %33
  %37 = phi i32 [ %34, %33 ], [ -1, %35 ]
  store i32 %37, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %42

38:                                               ; preds = %23, %16
  br label %39

39:                                               ; preds = %38
  %40 = load i32, ptr %6, align 4, !tbaa !9
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %6, align 4, !tbaa !9
  br label %10, !llvm.loop !13

42:                                               ; preds = %36, %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %43 = load i32, ptr %7, align 4
  switch i32 %43, label %47 [
    i32 2, label %44
    i32 1, label %45
  ]

44:                                               ; preds = %42
  store i32 -1, ptr %3, align 4
  br label %45

45:                                               ; preds = %44, %42
  %46 = load i32, ptr %3, align 4
  ret i32 %46

47:                                               ; preds = %42
  unreachable
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTSN4juce5PointIiEE", !10, i64 0, !10, i64 4}
!13 = distinct !{!13, !14}
!14 = !{!"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: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce5PointIiEC2ERKS1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN4juce16MenuBarComponent9getItemAtENS_5PointIiEE(ptr noundef nonnull align 8 dereferenceable(316) %0, ptr noundef %1) local_unnamed_addr #1 align 2 {
  %3 = alloca %"class.juce::Point", align 4
  %4 = getelementptr inbounds i8, ptr %0, i64 272
  %5 = tail call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %4) #3
  %.not911 = icmp sgt i32 %5, 0
  br i1 %.not911, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %2, %16
  %.0712 = phi i32 [ %.pre-phi, %16 ], [ 0, %2 ]
  %6 = load i32, ptr %1, align 4, !tbaa !5
  %7 = tail call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EEixEi(ptr noundef nonnull align 8 dereferenceable(20) %4, i32 noundef %.0712)
  %.not = icmp slt i32 %6, %7
  br i1 %.not, label %.lr.ph._crit_edge, label %8

.lr.ph._crit_edge:                                ; preds = %.lr.ph
  %.pre = add nuw nsw i32 %.0712, 1
  br label %16

8:                                                ; preds = %.lr.ph
  %9 = load i32, ptr %1, align 4, !tbaa !5
  %10 = add nuw nsw i32 %.0712, 1
  %11 = tail call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EEixEi(ptr noundef nonnull align 8 dereferenceable(20) %4, i32 noundef %10)
  %12 = icmp slt i32 %9, %11
  br i1 %12, label %13, label %16

13:                                               ; preds = %8
  call void @_ZN4juce5PointIiEC2ERKS1_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %1) #3
  %14 = call noundef zeroext i1 @_ZN4juce9Component14reallyContainsENS_5PointIiEEb(ptr noundef nonnull align 8 dereferenceable(197) %0, ptr noundef nonnull %3, i1 noundef zeroext true)
  %15 = select i1 %14, i32 %.0712, i32 -1
  br label %.loopexit

16:                                               ; preds = %.lr.ph._crit_edge, %8
  %.pre-phi = phi i32 [ %.pre, %.lr.ph._crit_edge ], [ %10, %8 ]
  %17 = tail call noundef i32 @_ZNK4juce5ArrayIiNS_20DummyCriticalSectionELi0EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %4) #3
  %.not9 = icmp slt i32 %.pre-phi, %17
  br i1 %.not9, label %.lr.ph, label %.loopexit, !llvm.loop !10

.loopexit:                                        ; preds = %16, %2, %13
  %spec.select = phi i32 [ %15, %13 ], [ -1, %2 ], [ -1, %16 ]
  ret i32 %spec.select
}

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

attributes #0 = { 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 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 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 = { 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, !7, i64 0}
!6 = !{!"_ZTSN4juce5PointIiEE", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


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