; 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::WeakReference" = type { %"class.juce::ReferenceCountedObjectPtr" }
%"class.juce::ReferenceCountedObjectPtr" = type { ptr }

declare i32 @__gxx_personality_v0(...)

; 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 @_ZN4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce9Component27sendEnablementChangeMessageEv(ptr noundef nonnull align 8 dereferenceable(197) %0) #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.juce::WeakReference", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %9 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @_ZN4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef %9)
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds ptr, ptr %10, i64 22
  %12 = load ptr, ptr %11, align 8
  invoke void %12(ptr noundef nonnull align 8 dereferenceable(197) %9)
          to label %13 unwind label %16

13:                                               ; preds = %1
  %14 = call noundef zeroext i1 @_ZNK4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEEeqEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef null) #4
  br i1 %14, label %15, label %20

15:                                               ; preds = %13
  store i32 1, ptr %6, align 4
  br label %49

16:                                               ; preds = %1
  %17 = landingpad { ptr, i32 }
          cleanup
  %18 = extractvalue { ptr, i32 } %17, 0
  store ptr %18, ptr %4, align 8
  %19 = extractvalue { ptr, i32 } %17, 1
  store i32 %19, ptr %5, align 4
  br label %52

20:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %21 = call noundef i32 @_ZNK4juce9Component21getNumChildComponentsEv(ptr noundef nonnull align 8 dereferenceable(197) %9) #4
  store i32 %21, ptr %7, align 4, !tbaa !11
  br label %22

22:                                               ; preds = %45, %20
  %23 = load i32, ptr %7, align 4, !tbaa !11
  %24 = add nsw i32 %23, -1
  store i32 %24, ptr %7, align 4, !tbaa !11
  %25 = icmp sge i32 %24, 0
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  store i32 2, ptr %6, align 4
  br label %46

27:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %28 = load i32, ptr %7, align 4, !tbaa !11
  %29 = call noundef ptr @_ZNK4juce9Component17getChildComponentEi(ptr noundef nonnull align 8 dereferenceable(197) %9, i32 noundef %28) #4
  store ptr %29, ptr %8, align 8, !tbaa !5
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %42

32:                                               ; preds = %27
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @_ZN4juce9Component27sendEnablementChangeMessageEv(ptr noundef nonnull align 8 dereferenceable(197) %33)
          to label %34 unwind label %37

34:                                               ; preds = %32
  %35 = call noundef zeroext i1 @_ZNK4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEEeqEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef null) #4
  br i1 %35, label %36, label %41

36:                                               ; preds = %34
  store i32 1, ptr %6, align 4
  br label %43

37:                                               ; preds = %32
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %4, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %52

41:                                               ; preds = %34
  br label %42

42:                                               ; preds = %41, %27
  store i32 0, ptr %6, align 4
  br label %43

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

45:                                               ; preds = %43
  br label %22, !llvm.loop !13

46:                                               ; preds = %43, %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  %47 = load i32, ptr %6, align 4
  switch i32 %47, label %49 [
    i32 2, label %48
  ]

48:                                               ; preds = %46
  store i32 0, ptr %6, align 4
  br label %49

49:                                               ; preds = %48, %46, %15
  call void @_ZN4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  %50 = load i32, ptr %6, align 4
  switch i32 %50, label %58 [
    i32 0, label %51
    i32 1, label %51
  ]

51:                                               ; preds = %49, %49
  ret void

52:                                               ; preds = %37, %16
  call void @_ZN4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %53

53:                                               ; preds = %52
  %54 = load ptr, ptr %4, align 8
  %55 = load i32, ptr %5, align 4
  %56 = insertvalue { ptr, i32 } poison, ptr %54, 0
  %57 = insertvalue { ptr, i32 } %56, i32 %55, 1
  resume { ptr, i32 } %57

58:                                               ; preds = %49
  unreachable
}

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 = { 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 = { 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!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::WeakReference" = type { %"class.juce::ReferenceCountedObjectPtr" }
%"class.juce::ReferenceCountedObjectPtr" = type { ptr }

declare i32 @__gxx_personality_v0(...)

; 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 @_ZN4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce9Component27sendEnablementChangeMessageEv(ptr noundef nonnull align 8 dereferenceable(197) %0) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.juce::WeakReference", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  call void @_ZN4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull %0)
  %3 = load ptr, ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 176
  %5 = load ptr, ptr %4, align 8
  invoke void %5(ptr noundef nonnull align 8 dereferenceable(197) %0)
          to label %6 unwind label %8

6:                                                ; preds = %1
  %7 = call noundef zeroext i1 @_ZNK4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEEeqEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef null) #4
  br i1 %7, label %.loopexit, label %10

8:                                                ; preds = %1
  %9 = landingpad { ptr, i32 }
          cleanup
  br label %21

10:                                               ; preds = %6
  %11 = call noundef i32 @_ZNK4juce9Component21getNumChildComponentsEv(ptr noundef nonnull align 8 dereferenceable(197) %0) #4
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %10, %.lr.ph.backedge
  %.in = phi i32 [ %13, %.lr.ph.backedge ], [ %11, %10 ]
  %13 = add nsw i32 %.in, -1
  %14 = call noundef ptr @_ZNK4juce9Component17getChildComponentEi(ptr noundef nonnull align 8 dereferenceable(197) %0, i32 noundef %13) #4
  %.not = icmp eq ptr %14, null
  br i1 %.not, label %.critedge, label %15

15:                                               ; preds = %.lr.ph
  invoke void @_ZN4juce9Component27sendEnablementChangeMessageEv(ptr noundef nonnull align 8 dereferenceable(197) %14)
          to label %16 unwind label %19

16:                                               ; preds = %15
  %17 = call noundef zeroext i1 @_ZNK4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEEeqEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef null) #4
  %18 = icmp ult i32 %.in, 2
  %or.cond.not = or i1 %18, %17
  br i1 %or.cond.not, label %.loopexit, label %.lr.ph.backedge

19:                                               ; preds = %15
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %21

.critedge:                                        ; preds = %.lr.ph
  %.old17 = icmp ugt i32 %.in, 1
  br i1 %.old17, label %.lr.ph.backedge, label %.loopexit

.lr.ph.backedge:                                  ; preds = %.critedge, %16
  br label %.lr.ph, !llvm.loop !8

.loopexit:                                        ; preds = %16, %.critedge, %10, %6
  call void @_ZN4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  ret void

21:                                               ; preds = %19, %8
  %.pn = phi { ptr, i32 } [ %20, %19 ], [ %9, %8 ]
  call void @_ZN4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  resume { ptr, i32 } %.pn
}

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 = { 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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


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