; 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::ComponentMovementWatcher" = type <{ %"class.juce::ComponentListener", %"class.juce::WeakReference", i32, [4 x i8], %"class.juce::Array", i8, i8, [2 x i8], %"class.juce::Rectangle", [4 x i8] }>
%"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 }

; 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 uwtable
declare dso_local void @_ZN4juce9Component20addComponentListenerEPNS_17ComponentListenerE(ptr noundef nonnull align 8 dereferenceable(197), ptr noundef) #1 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce24ComponentMovementWatcher23registerWithParentCompsEv(ptr noundef nonnull align 8 dereferenceable(68) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %5 = getelementptr inbounds %"class.juce::ComponentMovementWatcher", ptr %4, i32 0, i32 1
  %6 = call noundef ptr @_ZN4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  %7 = call noundef ptr @_ZNK4juce9Component18getParentComponentEv(ptr noundef nonnull align 8 dereferenceable(197) %6) #3
  store ptr %7, ptr %3, align 8, !tbaa !5
  br label %8

8:                                                ; preds = %15, %1
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %12, label %11

11:                                               ; preds = %8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  br label %18

12:                                               ; preds = %8
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN4juce9Component20addComponentListenerEPNS_17ComponentListenerE(ptr noundef nonnull align 8 dereferenceable(197) %13, ptr noundef %4)
  %14 = getelementptr inbounds %"class.juce::ComponentMovementWatcher", ptr %4, i32 0, i32 4
  call void @_ZN4juce5ArrayIPNS_9ComponentENS_20DummyCriticalSectionELi0EE3addERKS2_(ptr noundef nonnull align 8 dereferenceable(20) %14, ptr noundef nonnull align 8 dereferenceable(8) %3)
  br label %15

15:                                               ; preds = %12
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = call noundef ptr @_ZNK4juce9Component18getParentComponentEv(ptr noundef nonnull align 8 dereferenceable(197) %16) #3
  store ptr %17, ptr %3, align 8, !tbaa !5
  br label %8, !llvm.loop !9

18:                                               ; preds = %11
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = distinct !{!9, !10}
!10 = !{!"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"

; 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 uwtable
declare dso_local void @_ZN4juce9Component20addComponentListenerEPNS_17ComponentListenerE(ptr noundef nonnull align 8 dereferenceable(197), ptr noundef) local_unnamed_addr #1 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce24ComponentMovementWatcher23registerWithParentCompsEv(ptr noundef nonnull align 8 dereferenceable(68) %0) local_unnamed_addr #1 align 2 {
  %2 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = tail call noundef ptr @_ZN4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  %5 = tail call noundef ptr @_ZNK4juce9Component18getParentComponentEv(ptr noundef nonnull align 8 dereferenceable(197) %4) #3
  store ptr %5, ptr %2, align 8, !tbaa !5
  %.not1 = icmp eq ptr %5, null
  br i1 %.not1, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  br label %7

._crit_edge:                                      ; preds = %7, %1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  ret void

7:                                                ; preds = %.lr.ph, %7
  %storemerge2 = phi ptr [ %5, %.lr.ph ], [ %9, %7 ]
  call void @_ZN4juce9Component20addComponentListenerEPNS_17ComponentListenerE(ptr noundef nonnull align 8 dereferenceable(197) %storemerge2, ptr noundef nonnull %0)
  call void @_ZN4juce5ArrayIPNS_9ComponentENS_20DummyCriticalSectionELi0EE3addERKS2_(ptr noundef nonnull align 8 dereferenceable(20) %6, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = call noundef ptr @_ZNK4juce9Component18getParentComponentEv(ptr noundef nonnull align 8 dereferenceable(197) %8) #3
  store ptr %9, ptr %2, align 8, !tbaa !5
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %._crit_edge, label %7, !llvm.loop !9
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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