; 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::ScopedPointer.95" = type { ptr }
%"class.juce::ModalComponentManager" = type { %"class.juce::AsyncUpdater", %"class.juce::DeletedAtShutdown", %"class.juce::OwnedArray.61" }
%"class.juce::AsyncUpdater" = type { ptr, %"class.juce::ReferenceCountedObjectPtr.15" }
%"class.juce::ReferenceCountedObjectPtr.15" = type { ptr }
%"class.juce::DeletedAtShutdown" = type { ptr }
%"class.juce::OwnedArray.61" = type { %"class.juce::ArrayAllocationBase.62", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.62" = type <{ %"class.juce::HeapBlock.63", i32, [4 x i8] }>
%"class.juce::HeapBlock.63" = type { ptr }
%"class.juce::ModalComponentManager::ModalItem" = type <{ %"class.juce::ComponentMovementWatcher.base", [4 x i8], ptr, %"class.juce::OwnedArray.90", i32, i8, i8, [2 x i8] }>
%"class.juce::ComponentMovementWatcher.base" = type <{ %"class.juce::ComponentListener", %"class.juce::WeakReference", i32, [4 x i8], %"class.juce::Array", i8, i8, [2 x i8], %"class.juce::Rectangle" }>
%"class.juce::ComponentListener" = type { ptr }
%"class.juce::WeakReference" = type { %"class.juce::ReferenceCountedObjectPtr" }
%"class.juce::ReferenceCountedObjectPtr" = 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::Rectangle" = type { %"class.juce::Point", i32, i32 }
%"class.juce::Point" = type { i32, i32 }
%"class.juce::OwnedArray.90" = type { %"class.juce::ArrayAllocationBase.91", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.91" = type <{ %"class.juce::HeapBlock.92", i32, [4 x i8] }>
%"class.juce::HeapBlock.92" = 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
define dso_local void @_ZN4juce21ModalComponentManager14attachCallbackEPNS_9ComponentEPNS0_8CallbackE(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef %1, ptr noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"class.juce::ScopedPointer.95", align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %11 = load ptr, ptr %4, align 8
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %44

14:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN4juce13ScopedPointerINS_21ModalComponentManager8CallbackEEC2EPS2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %16 = getelementptr inbounds %"class.juce::ModalComponentManager", ptr %11, i32 0, i32 2
  %17 = call noundef i32 @_ZNK4juce10OwnedArrayINS_21ModalComponentManager9ModalItemENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %16) #3
  store i32 %17, ptr %8, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %41, %14
  %19 = load i32, ptr %8, align 4, !tbaa !9
  %20 = add nsw i32 %19, -1
  store i32 %20, ptr %8, align 4, !tbaa !9
  %21 = icmp sge i32 %20, 0
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  store i32 2, ptr %9, align 4
  br label %42

23:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %24 = getelementptr inbounds %"class.juce::ModalComponentManager", ptr %11, i32 0, i32 2
  %25 = load i32, ptr %8, align 4, !tbaa !9
  %26 = call noundef ptr @_ZNK4juce10OwnedArrayINS_21ModalComponentManager9ModalItemENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %24, i32 noundef %25) #3
  store ptr %26, ptr %10, align 8, !tbaa !5
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  %28 = getelementptr inbounds %"class.juce::ModalComponentManager::ModalItem", ptr %27, i32 0, i32 2
  %29 = load ptr, ptr %28, align 8, !tbaa !11
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = icmp eq ptr %29, %30
  br i1 %31, label %32, label %38

32:                                               ; preds = %23
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = getelementptr inbounds %"class.juce::ModalComponentManager::ModalItem", ptr %33, i32 0, i32 3
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = call noundef ptr @_ZN4juce10OwnedArrayINS_21ModalComponentManager8CallbackENS_20DummyCriticalSectionEE3addEPS2_(ptr noundef nonnull align 8 dereferenceable(20) %34, ptr noundef %35) #3
  %37 = call noundef ptr @_ZN4juce13ScopedPointerINS_21ModalComponentManager8CallbackEE7releaseEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #3
  store i32 2, ptr %9, align 4
  br label %39

38:                                               ; preds = %23
  store i32 0, ptr %9, align 4
  br label %39

39:                                               ; preds = %38, %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %40 = load i32, ptr %9, align 4
  switch i32 %40, label %42 [
    i32 0, label %41
  ]

41:                                               ; preds = %39
  br label %18, !llvm.loop !26

42:                                               ; preds = %39, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %43

43:                                               ; preds = %42
  call void @_ZN4juce13ScopedPointerINS_21ModalComponentManager8CallbackEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %44

44:                                               ; preds = %43, %3
  ret void
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4juce13ScopedPointerINS_21ModalComponentManager8CallbackEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 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 = { 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, !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, !6, i64 72}
!12 = !{!"_ZTSN4juce21ModalComponentManager9ModalItemE", !13, i64 0, !6, i64 72, !23, i64 80, !10, i64 104, !20, i64 108, !20, i64 109}
!13 = !{!"_ZTSN4juce24ComponentMovementWatcherE", !14, i64 0, !15, i64 8, !10, i64 16, !17, i64 24, !20, i64 48, !20, i64 49, !21, i64 52}
!14 = !{!"_ZTSN4juce17ComponentListenerE"}
!15 = !{!"_ZTSN4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEEE", !16, i64 0}
!16 = !{!"_ZTSN4juce25ReferenceCountedObjectPtrINS_13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEE13SharedPointerEEE", !6, i64 0}
!17 = !{!"_ZTSN4juce5ArrayIPNS_9ComponentENS_20DummyCriticalSectionELi0EEE", !18, i64 0, !10, i64 16}
!18 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_9ComponentENS_20DummyCriticalSectionEEE", !19, i64 0, !10, i64 8}
!19 = !{!"_ZTSN4juce9HeapBlockIPNS_9ComponentELb0EEE", !6, i64 0}
!20 = !{!"bool", !7, i64 0}
!21 = !{!"_ZTSN4juce9RectangleIiEE", !22, i64 0, !10, i64 8, !10, i64 12}
!22 = !{!"_ZTSN4juce5PointIiEE", !10, i64 0, !10, i64 4}
!23 = !{!"_ZTSN4juce10OwnedArrayINS_21ModalComponentManager8CallbackENS_20DummyCriticalSectionEEE", !24, i64 0, !10, i64 16}
!24 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_21ModalComponentManager8CallbackENS_20DummyCriticalSectionEEE", !25, i64 0, !10, i64 8}
!25 = !{!"_ZTSN4juce9HeapBlockIPNS_21ModalComponentManager8CallbackELb0EEE", !6, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"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::ScopedPointer.95" = type { ptr }

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4juce21ModalComponentManager14attachCallbackEPNS_9ComponentEPNS0_8CallbackE(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef readnone %1, ptr noundef %2) local_unnamed_addr #1 align 2 {
  %4 = alloca %"class.juce::ScopedPointer.95", align 8
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %18, label %5

5:                                                ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  call void @_ZN4juce13ScopedPointerINS_21ModalComponentManager8CallbackEEC2EPS2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull %2) #3
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = call noundef i32 @_ZNK4juce10OwnedArrayINS_21ModalComponentManager9ModalItemENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %6) #3
  br label %.critedge

.critedge:                                        ; preds = %9, %5
  %.0 = phi i32 [ %7, %5 ], [ %10, %9 ]
  %8 = icmp sgt i32 %.0, 0
  br i1 %8, label %9, label %.loopexit

9:                                                ; preds = %.critedge
  %10 = add nsw i32 %.0, -1
  %11 = call noundef ptr @_ZNK4juce10OwnedArrayINS_21ModalComponentManager9ModalItemENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %6, i32 noundef %10) #3
  %12 = getelementptr inbounds i8, ptr %11, i64 72
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  %.not12 = icmp eq ptr %13, %1
  br i1 %.not12, label %14, label %.critedge

14:                                               ; preds = %9
  %15 = getelementptr inbounds i8, ptr %11, i64 80
  %16 = call noundef ptr @_ZN4juce10OwnedArrayINS_21ModalComponentManager8CallbackENS_20DummyCriticalSectionEE3addEPS2_(ptr noundef nonnull align 8 dereferenceable(20) %15, ptr noundef nonnull %2) #3
  %17 = call noundef ptr @_ZN4juce13ScopedPointerINS_21ModalComponentManager8CallbackEE7releaseEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  br label %.loopexit, !llvm.loop !24

.loopexit:                                        ; preds = %.critedge, %14
  call void @_ZN4juce13ScopedPointerINS_21ModalComponentManager8CallbackEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  br label %18

18:                                               ; preds = %.loopexit, %3
  ret void
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4juce13ScopedPointerINS_21ModalComponentManager8CallbackEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

attributes #0 = { mustprogress 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 = { 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, !11, i64 72}
!6 = !{!"_ZTSN4juce21ModalComponentManager9ModalItemE", !7, i64 0, !11, i64 72, !21, i64 80, !14, i64 104, !18, i64 108, !18, i64 109}
!7 = !{!"_ZTSN4juce24ComponentMovementWatcherE", !8, i64 0, !9, i64 8, !14, i64 16, !15, i64 24, !18, i64 48, !18, i64 49, !19, i64 52}
!8 = !{!"_ZTSN4juce17ComponentListenerE"}
!9 = !{!"_ZTSN4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEEE", !10, i64 0}
!10 = !{!"_ZTSN4juce25ReferenceCountedObjectPtrINS_13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEE13SharedPointerEEE", !11, i64 0}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"int", !12, i64 0}
!15 = !{!"_ZTSN4juce5ArrayIPNS_9ComponentENS_20DummyCriticalSectionELi0EEE", !16, i64 0, !14, i64 16}
!16 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_9ComponentENS_20DummyCriticalSectionEEE", !17, i64 0, !14, i64 8}
!17 = !{!"_ZTSN4juce9HeapBlockIPNS_9ComponentELb0EEE", !11, i64 0}
!18 = !{!"bool", !12, i64 0}
!19 = !{!"_ZTSN4juce9RectangleIiEE", !20, i64 0, !14, i64 8, !14, i64 12}
!20 = !{!"_ZTSN4juce5PointIiEE", !14, i64 0, !14, i64 4}
!21 = !{!"_ZTSN4juce10OwnedArrayINS_21ModalComponentManager8CallbackENS_20DummyCriticalSectionEEE", !22, i64 0, !14, i64 16}
!22 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_21ModalComponentManager8CallbackENS_20DummyCriticalSectionEEE", !23, i64 0, !14, i64 8}
!23 = !{!"_ZTSN4juce9HeapBlockIPNS_21ModalComponentManager8CallbackELb0EEE", !11, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass