; 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::ComponentAnimator" = type <{ %"class.juce::ChangeBroadcaster", %"class.juce::Timer", %"class.juce::OwnedArray", i32, [4 x i8] }>
%"class.juce::ChangeBroadcaster" = type { ptr, %"class.juce::ChangeBroadcaster::ChangeBroadcasterCallback", %"class.juce::ListenerList.39" }
%"class.juce::ChangeBroadcaster::ChangeBroadcasterCallback" = type { %"class.juce::AsyncUpdater", ptr }
%"class.juce::AsyncUpdater" = type { ptr, %"class.juce::ReferenceCountedObjectPtr.15" }
%"class.juce::ReferenceCountedObjectPtr.15" = type { ptr }
%"class.juce::ListenerList.39" = type { %"class.juce::Array.40" }
%"class.juce::Array.40" = type { %"class.juce::ArrayAllocationBase.41", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.41" = type <{ %"class.juce::HeapBlock.42", i32, [4 x i8] }>
%"class.juce::HeapBlock.42" = type { ptr }
%"class.juce::Timer" = type { ptr, i32, i32, ptr, ptr }
%"class.juce::OwnedArray" = type { %"class.juce::ArrayAllocationBase.45", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.45" = type <{ %"class.juce::HeapBlock.46", i32, [4 x i8] }>
%"class.juce::HeapBlock.46" = 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 uwtable
define dso_local void @_ZN4juce17ComponentAnimator19cancelAllAnimationsEb(ptr noundef nonnull align 8 dereferenceable(116) %0, i1 noundef zeroext %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %6 = zext i1 %1 to i8
  store i8 %6, ptr %4, align 1, !tbaa !9
  %7 = load ptr, ptr %3, align 8
  %8 = getelementptr inbounds %"class.juce::ComponentAnimator", ptr %7, i32 0, i32 2
  %9 = call noundef i32 @_ZNK4juce10OwnedArrayINS_17ComponentAnimator13AnimationTaskENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %8) #4
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %11, label %29

11:                                               ; preds = %2
  %12 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %13 = trunc i8 %12 to i1
  br i1 %13, label %14, label %27

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

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

21:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %26

22:                                               ; preds = %17
  %23 = getelementptr inbounds %"class.juce::ComponentAnimator", ptr %7, i32 0, i32 2
  %24 = load i32, ptr %5, align 4, !tbaa !13
  %25 = call noundef ptr @_ZNK4juce10OwnedArrayINS_17ComponentAnimator13AnimationTaskENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %23, i32 noundef %24) #4
  call void @_ZN4juce17ComponentAnimator13AnimationTask22moveToFinalDestinationEv(ptr noundef nonnull align 8 dereferenceable(122) %25)
  br label %17, !llvm.loop !15

26:                                               ; preds = %21
  br label %27

27:                                               ; preds = %26, %11
  %28 = getelementptr inbounds %"class.juce::ComponentAnimator", ptr %7, i32 0, i32 2
  call void @_ZN4juce10OwnedArrayINS_17ComponentAnimator13AnimationTaskENS_20DummyCriticalSectionEE5clearEb(ptr noundef nonnull align 8 dereferenceable(20) %28, i1 noundef zeroext true)
  call void @_ZN4juce17ChangeBroadcaster17sendChangeMessageEv(ptr noundef nonnull align 8 dereferenceable(56) %7)
  br label %29

29:                                               ; preds = %27, %2
  ret void
}

declare void @_ZN4juce17ChangeBroadcaster17sendChangeMessageEv(ptr noundef nonnull align 8 dereferenceable(56)) #2

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

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

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

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

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 = { "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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"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 uwtable
define dso_local void @_ZN4juce17ComponentAnimator19cancelAllAnimationsEb(ptr noundef nonnull align 8 dereferenceable(116) %0, i1 noundef zeroext %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 88
  %4 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_17ComponentAnimator13AnimationTaskENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %3) #3
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %6, label %13

6:                                                ; preds = %2
  br i1 %1, label %7, label %.loopexit

7:                                                ; preds = %6
  %8 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_17ComponentAnimator13AnimationTaskENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %3) #3
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %7, %.lr.ph
  %.04 = phi i32 [ %10, %.lr.ph ], [ %8, %7 ]
  %10 = add nsw i32 %.04, -1
  %11 = tail call noundef ptr @_ZNK4juce10OwnedArrayINS_17ComponentAnimator13AnimationTaskENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %3, i32 noundef %10) #3
  tail call void @_ZN4juce17ComponentAnimator13AnimationTask22moveToFinalDestinationEv(ptr noundef nonnull align 8 dereferenceable(122) %11)
  %12 = icmp ugt i32 %.04, 1
  br i1 %12, label %.lr.ph, label %.loopexit, !llvm.loop !5

.loopexit:                                        ; preds = %.lr.ph, %7, %6
  tail call void @_ZN4juce10OwnedArrayINS_17ComponentAnimator13AnimationTaskENS_20DummyCriticalSectionEE5clearEb(ptr noundef nonnull align 8 dereferenceable(20) %3, i1 noundef zeroext true)
  tail call void @_ZN4juce17ChangeBroadcaster17sendChangeMessageEv(ptr noundef nonnull align 8 dereferenceable(56) %0)
  br label %13

13:                                               ; preds = %.loopexit, %2
  ret void
}

declare void @_ZN4juce17ChangeBroadcaster17sendChangeMessageEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce10OwnedArrayINS_17ComponentAnimator13AnimationTaskENS_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_17ComponentAnimator13AnimationTaskENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce17ComponentAnimator13AnimationTask22moveToFinalDestinationEv(ptr noundef nonnull align 8 dereferenceable(122)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce10OwnedArrayINS_17ComponentAnimator13AnimationTaskENS_20DummyCriticalSectionEE5clearEb(ptr noundef nonnull align 8 dereferenceable(20), i1 noundef zeroext) local_unnamed_addr #0 align 2

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


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