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

; 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::AudioVisualiserComponent" = type { %"class.juce::Component.base", %"class.juce::Timer", %"class.juce::OwnedArray.148", i32, i32, %"class.juce::Colour", %"class.juce::Colour" }
%"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::Point" = type { 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::Timer" = type { ptr, i32, i32, ptr, ptr }
%"class.juce::OwnedArray.148" = type { %"class.juce::ArrayAllocationBase.149", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.149" = type <{ %"class.juce::HeapBlock.150", i32, [4 x i8] }>
%"class.juce::HeapBlock.150" = type { ptr }
%"class.juce::Colour" = type { %"class.juce::PixelARGB" }
%"class.juce::PixelARGB" = type { %union.anon.153 }
%union.anon.153 = type { 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
define dso_local void @_ZN4juce24AudioVisualiserComponent13setBufferSizeEi(ptr noundef nonnull align 8 dereferenceable(272) %0, i32 noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %6 = load ptr, ptr %3, align 8
  %7 = load i32, ptr %4, align 4, !tbaa !9
  %8 = getelementptr inbounds %"class.juce::AudioVisualiserComponent", ptr %6, i32 0, i32 3
  store i32 %7, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %9

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

14:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %23

15:                                               ; preds = %9
  %16 = getelementptr inbounds %"class.juce::AudioVisualiserComponent", ptr %6, i32 0, i32 2
  %17 = load i32, ptr %5, align 4, !tbaa !9
  %18 = call noundef ptr @_ZNK4juce10OwnedArrayINS_24AudioVisualiserComponent11ChannelInfoENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %16, i32 noundef %17) #3
  %19 = load i32, ptr %4, align 4, !tbaa !9
  call void @_ZN4juce24AudioVisualiserComponent11ChannelInfo13setBufferSizeEi(ptr noundef nonnull align 8 dereferenceable(48) %18, i32 noundef %19)
  br label %20

20:                                               ; preds = %15
  %21 = load i32, ptr %5, align 4, !tbaa !9
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %5, align 4, !tbaa !9
  br label %9, !llvm.loop !44

23:                                               ; preds = %14
  ret void
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce24AudioVisualiserComponent11ChannelInfo13setBufferSizeEi(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) #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 = { 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, !10, i64 256}
!12 = !{!"_ZTSN4juce24AudioVisualiserComponentE", !13, i64 0, !38, i64 200, !39, i64 232, !10, i64 256, !10, i64 260, !42, i64 264, !42, i64 268}
!13 = !{!"_ZTSN4juce9ComponentE", !14, i64 0, !15, i64 8, !15, i64 16, !6, i64 24, !17, i64 32, !19, i64 48, !20, i64 56, !21, i64 64, !6, i64 88, !24, i64 96, !6, i64 104, !25, i64 112, !26, i64 120, !27, i64 128, !28, i64 136, !32, i64 160, !36, i64 184, !7, i64 192, !7, i64 196}
!14 = !{!"_ZTSN4juce13MouseListenerE"}
!15 = !{!"_ZTSN4juce6StringE", !16, i64 0}
!16 = !{!"_ZTSN4juce16CharPointer_UTF8E", !6, i64 0}
!17 = !{!"_ZTSN4juce9RectangleIiEE", !18, i64 0, !10, i64 8, !10, i64 12}
!18 = !{!"_ZTSN4juce5PointIiEE", !10, i64 0, !10, i64 4}
!19 = !{!"_ZTSN4juce13ScopedPointerINS_9Component10PositionerEEE", !6, i64 0}
!20 = !{!"_ZTSN4juce13ScopedPointerINS_15AffineTransformEEE", !6, i64 0}
!21 = !{!"_ZTSN4juce5ArrayIPNS_9ComponentENS_20DummyCriticalSectionELi0EEE", !22, i64 0, !10, i64 16}
!22 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_9ComponentENS_20DummyCriticalSectionEEE", !23, i64 0, !10, i64 8}
!23 = !{!"_ZTSN4juce9HeapBlockIPNS_9ComponentELb0EEE", !6, i64 0}
!24 = !{!"_ZTSN4juce11MouseCursorE", !6, i64 0}
!25 = !{!"_ZTSN4juce13ScopedPointerINS_20CachedComponentImageEEE", !6, i64 0}
!26 = !{!"_ZTSN4juce13ScopedPointerINS_9Component17MouseListenerListEEE", !6, i64 0}
!27 = !{!"_ZTSN4juce13ScopedPointerINS_5ArrayIPNS_11KeyListenerENS_20DummyCriticalSectionELi0EEEEE", !6, i64 0}
!28 = !{!"_ZTSN4juce12ListenerListINS_17ComponentListenerENS_5ArrayIPS1_NS_20DummyCriticalSectionELi0EEEEE", !29, i64 0}
!29 = !{!"_ZTSN4juce5ArrayIPNS_17ComponentListenerENS_20DummyCriticalSectionELi0EEE", !30, i64 0, !10, i64 16}
!30 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_17ComponentListenerENS_20DummyCriticalSectionEEE", !31, i64 0, !10, i64 8}
!31 = !{!"_ZTSN4juce9HeapBlockIPNS_17ComponentListenerELb0EEE", !6, i64 0}
!32 = !{!"_ZTSN4juce13NamedValueSetE", !33, i64 0}
!33 = !{!"_ZTSN4juce5ArrayINS_13NamedValueSet10NamedValueENS_20DummyCriticalSectionELi0EEE", !34, i64 0, !10, i64 16}
!34 = !{!"_ZTSN4juce19ArrayAllocationBaseINS_13NamedValueSet10NamedValueENS_20DummyCriticalSectionEEE", !35, i64 0, !10, i64 8}
!35 = !{!"_ZTSN4juce9HeapBlockINS_13NamedValueSet10NamedValueELb0EEE", !6, i64 0}
!36 = !{!"_ZTSN4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEE6MasterE", !37, i64 0}
!37 = !{!"_ZTSN4juce25ReferenceCountedObjectPtrINS_13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEE13SharedPointerEEE", !6, i64 0}
!38 = !{!"_ZTSN4juce5TimerE", !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24}
!39 = !{!"_ZTSN4juce10OwnedArrayINS_24AudioVisualiserComponent11ChannelInfoENS_20DummyCriticalSectionEEE", !40, i64 0, !10, i64 16}
!40 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_24AudioVisualiserComponent11ChannelInfoENS_20DummyCriticalSectionEEE", !41, i64 0, !10, i64 8}
!41 = !{!"_ZTSN4juce9HeapBlockIPNS_24AudioVisualiserComponent11ChannelInfoELb0EEE", !6, i64 0}
!42 = !{!"_ZTSN4juce6ColourE", !43, i64 0}
!43 = !{!"_ZTSN4juce9PixelARGBE", !7, i64 0}
!44 = distinct !{!44, !45}
!45 = !{!"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 @_ZN4juce24AudioVisualiserComponent13setBufferSizeEi(ptr noundef nonnull align 8 dereferenceable(272) %0, i32 noundef %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 256
  store i32 %1, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 232
  %5 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_24AudioVisualiserComponent11ChannelInfoENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %4) #2
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %2
  ret void

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.05 = phi i32 [ %8, %.lr.ph ], [ 0, %2 ]
  %7 = tail call noundef ptr @_ZNK4juce10OwnedArrayINS_24AudioVisualiserComponent11ChannelInfoENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %4, i32 noundef %.05) #2
  tail call void @_ZN4juce24AudioVisualiserComponent11ChannelInfo13setBufferSizeEi(ptr noundef nonnull align 8 dereferenceable(48) %7, i32 noundef %1)
  %8 = add nuw nsw i32 %.05, 1
  %9 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_24AudioVisualiserComponent11ChannelInfoENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %4) #2
  %10 = icmp slt i32 %8, %9
  br i1 %10, label %.lr.ph, label %._crit_edge, !llvm.loop !42
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce24AudioVisualiserComponent11ChannelInfo13setBufferSizeEi(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) 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 = { 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 #2 = { 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, !16, i64 256}
!6 = !{!"_ZTSN4juce24AudioVisualiserComponentE", !7, i64 0, !36, i64 200, !37, i64 232, !16, i64 256, !16, i64 260, !40, i64 264, !40, i64 268}
!7 = !{!"_ZTSN4juce9ComponentE", !8, i64 0, !9, i64 8, !9, i64 16, !11, i64 24, !14, i64 32, !17, i64 48, !18, i64 56, !19, i64 64, !11, i64 88, !22, i64 96, !11, i64 104, !23, i64 112, !24, i64 120, !25, i64 128, !26, i64 136, !30, i64 160, !34, i64 184, !12, i64 192, !12, i64 196}
!8 = !{!"_ZTSN4juce13MouseListenerE"}
!9 = !{!"_ZTSN4juce6StringE", !10, i64 0}
!10 = !{!"_ZTSN4juce16CharPointer_UTF8E", !11, i64 0}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"_ZTSN4juce9RectangleIiEE", !15, i64 0, !16, i64 8, !16, i64 12}
!15 = !{!"_ZTSN4juce5PointIiEE", !16, i64 0, !16, i64 4}
!16 = !{!"int", !12, i64 0}
!17 = !{!"_ZTSN4juce13ScopedPointerINS_9Component10PositionerEEE", !11, i64 0}
!18 = !{!"_ZTSN4juce13ScopedPointerINS_15AffineTransformEEE", !11, i64 0}
!19 = !{!"_ZTSN4juce5ArrayIPNS_9ComponentENS_20DummyCriticalSectionELi0EEE", !20, i64 0, !16, i64 16}
!20 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_9ComponentENS_20DummyCriticalSectionEEE", !21, i64 0, !16, i64 8}
!21 = !{!"_ZTSN4juce9HeapBlockIPNS_9ComponentELb0EEE", !11, i64 0}
!22 = !{!"_ZTSN4juce11MouseCursorE", !11, i64 0}
!23 = !{!"_ZTSN4juce13ScopedPointerINS_20CachedComponentImageEEE", !11, i64 0}
!24 = !{!"_ZTSN4juce13ScopedPointerINS_9Component17MouseListenerListEEE", !11, i64 0}
!25 = !{!"_ZTSN4juce13ScopedPointerINS_5ArrayIPNS_11KeyListenerENS_20DummyCriticalSectionELi0EEEEE", !11, i64 0}
!26 = !{!"_ZTSN4juce12ListenerListINS_17ComponentListenerENS_5ArrayIPS1_NS_20DummyCriticalSectionELi0EEEEE", !27, i64 0}
!27 = !{!"_ZTSN4juce5ArrayIPNS_17ComponentListenerENS_20DummyCriticalSectionELi0EEE", !28, i64 0, !16, i64 16}
!28 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_17ComponentListenerENS_20DummyCriticalSectionEEE", !29, i64 0, !16, i64 8}
!29 = !{!"_ZTSN4juce9HeapBlockIPNS_17ComponentListenerELb0EEE", !11, i64 0}
!30 = !{!"_ZTSN4juce13NamedValueSetE", !31, i64 0}
!31 = !{!"_ZTSN4juce5ArrayINS_13NamedValueSet10NamedValueENS_20DummyCriticalSectionELi0EEE", !32, i64 0, !16, i64 16}
!32 = !{!"_ZTSN4juce19ArrayAllocationBaseINS_13NamedValueSet10NamedValueENS_20DummyCriticalSectionEEE", !33, i64 0, !16, i64 8}
!33 = !{!"_ZTSN4juce9HeapBlockINS_13NamedValueSet10NamedValueELb0EEE", !11, i64 0}
!34 = !{!"_ZTSN4juce13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEE6MasterE", !35, i64 0}
!35 = !{!"_ZTSN4juce25ReferenceCountedObjectPtrINS_13WeakReferenceINS_9ComponentENS_22ReferenceCountedObjectEE13SharedPointerEEE", !11, i64 0}
!36 = !{!"_ZTSN4juce5TimerE", !16, i64 8, !16, i64 12, !11, i64 16, !11, i64 24}
!37 = !{!"_ZTSN4juce10OwnedArrayINS_24AudioVisualiserComponent11ChannelInfoENS_20DummyCriticalSectionEEE", !38, i64 0, !16, i64 16}
!38 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_24AudioVisualiserComponent11ChannelInfoENS_20DummyCriticalSectionEEE", !39, i64 0, !16, i64 8}
!39 = !{!"_ZTSN4juce9HeapBlockIPNS_24AudioVisualiserComponent11ChannelInfoELb0EEE", !11, i64 0}
!40 = !{!"_ZTSN4juce6ColourE", !41, i64 0}
!41 = !{!"_ZTSN4juce9PixelARGBE", !12, i64 0}
!42 = distinct !{!42, !43}
!43 = !{!"llvm.loop.mustprogress"}


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