; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode (juce_audio_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::IIRFilterAudioSource" = type { %"class.juce::AudioSource", %"class.juce::OptionalScopedPointer.85", %"class.juce::OwnedArray.94" }
%"class.juce::AudioSource" = type { ptr }
%"class.juce::OptionalScopedPointer.85" = type <{ %"class.juce::ScopedPointer.86", i8, [7 x i8] }>
%"class.juce::ScopedPointer.86" = type { ptr }
%"class.juce::OwnedArray.94" = type { %"class.juce::ArrayAllocationBase.95", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.95" = type <{ %"class.juce::HeapBlock.96", i32, [4 x i8] }>
%"class.juce::HeapBlock.96" = type { ptr }
%"struct.juce::AudioSourceChannelInfo" = type { ptr, 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 nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce11AudioBufferIfE14getNumChannelsEv(ptr noundef nonnull align 8 dereferenceable(289)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce9IIRFilter14processSamplesEPfi(ptr noundef nonnull align 8 dereferenceable(37), ptr noundef, i32 noundef) #1 align 2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce20IIRFilterAudioSource17getNextAudioBlockERKNS_22AudioSourceChannelInfoE(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) unnamed_addr #4 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  %8 = getelementptr inbounds %"class.juce::IIRFilterAudioSource", ptr %7, i32 0, i32 1
  %9 = call noundef ptr @_ZNK4juce21OptionalScopedPointerINS_11AudioSourceEEptEv(ptr noundef nonnull align 8 dereferenceable(9) %8) #5
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = load ptr, ptr %9, align 8, !tbaa !9
  %12 = getelementptr inbounds ptr, ptr %11, i64 4
  %13 = load ptr, ptr %12, align 8
  call void %13(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(16) %10)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %"struct.juce::AudioSourceChannelInfo", ptr %14, i32 0, i32 0
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = call noundef i32 @_ZNK4juce11AudioBufferIfE14getNumChannelsEv(ptr noundef nonnull align 8 dereferenceable(289) %16) #5
  store i32 %17, ptr %5, align 4, !tbaa !14
  br label %18

18:                                               ; preds = %23, %2
  %19 = load i32, ptr %5, align 4, !tbaa !14
  %20 = getelementptr inbounds %"class.juce::IIRFilterAudioSource", ptr %7, i32 0, i32 2
  %21 = call noundef i32 @_ZNK4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %20) #5
  %22 = icmp sgt i32 %19, %21
  br i1 %22, label %23, label %29

23:                                               ; preds = %18
  %24 = getelementptr inbounds %"class.juce::IIRFilterAudioSource", ptr %7, i32 0, i32 2
  %25 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 40) #6
  %26 = getelementptr inbounds %"class.juce::IIRFilterAudioSource", ptr %7, i32 0, i32 2
  %27 = call noundef ptr @_ZNK4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %26, i32 noundef 0) #5
  call void @_ZN4juce9IIRFilterC1ERKS0_(ptr noundef nonnull align 8 dereferenceable(37) %25, ptr noundef nonnull align 8 dereferenceable(37) %27) #5
  %28 = call noundef ptr @_ZN4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEE3addEPS1_(ptr noundef nonnull align 8 dereferenceable(20) %24, ptr noundef %25) #5
  br label %18, !llvm.loop !15

29:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !14
  br label %30

30:                                               ; preds = %50, %29
  %31 = load i32, ptr %6, align 4, !tbaa !14
  %32 = load i32, ptr %5, align 4, !tbaa !14
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %53

35:                                               ; preds = %30
  %36 = getelementptr inbounds %"class.juce::IIRFilterAudioSource", ptr %7, i32 0, i32 2
  %37 = load i32, ptr %6, align 4, !tbaa !14
  %38 = call noundef ptr @_ZNK4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %36, i32 noundef %37) #5
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.juce::AudioSourceChannelInfo", ptr %39, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8, !tbaa !11
  %42 = load i32, ptr %6, align 4, !tbaa !14
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %"struct.juce::AudioSourceChannelInfo", ptr %43, i32 0, i32 1
  %45 = load i32, ptr %44, align 8, !tbaa !17
  %46 = call noundef ptr @_ZN4juce11AudioBufferIfE15getWritePointerEii(ptr noundef nonnull align 8 dereferenceable(289) %41, i32 noundef %42, i32 noundef %45) #5
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %"struct.juce::AudioSourceChannelInfo", ptr %47, i32 0, i32 2
  %49 = load i32, ptr %48, align 4, !tbaa !18
  call void @_ZN4juce9IIRFilter14processSamplesEPfi(ptr noundef nonnull align 8 dereferenceable(37) %38, ptr noundef %46, i32 noundef %49) #5
  br label %50

50:                                               ; preds = %35
  %51 = load i32, ptr %6, align 4, !tbaa !14
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %6, align 4, !tbaa !14
  br label %30, !llvm.loop !19

53:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret void
}

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

declare void @_ZN4juce9IIRFilterC1ERKS0_(ptr, ptr)

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 = { nobuiltin allocsize(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 = { 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 = { 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 #5 = { nounwind }
attributes #6 = { builtin allocsize(0) }

!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, !6, i64 0}
!12 = !{!"_ZTSN4juce22AudioSourceChannelInfoE", !6, i64 0, !13, i64 8, !13, i64 12}
!13 = !{!"int", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!12, !13, i64 8}
!18 = !{!12, !13, i64 12}
!19 = distinct !{!19, !16}


; 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 nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce11AudioBufferIfE14getNumChannelsEv(ptr noundef nonnull align 8 dereferenceable(289)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce9IIRFilter14processSamplesEPfi(ptr noundef nonnull align 8 dereferenceable(37), ptr noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce20IIRFilterAudioSource17getNextAudioBlockERKNS_22AudioSourceChannelInfoE(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) unnamed_addr #3 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = tail call noundef ptr @_ZNK4juce21OptionalScopedPointerINS_11AudioSourceEEptEv(ptr noundef nonnull align 8 dereferenceable(9) %3) #4
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %5, i64 32
  %7 = load ptr, ptr %6, align 8
  tail call void %7(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %8 = load ptr, ptr %1, align 8, !tbaa !8
  %9 = tail call noundef i32 @_ZNK4juce11AudioBufferIfE14getNumChannelsEv(ptr noundef nonnull align 8 dereferenceable(289) %8) #4
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  %11 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %10) #4
  %12 = icmp sgt i32 %9, %11
  br i1 %12, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %.lr.ph, %2
  %13 = icmp sgt i32 %9, 0
  br i1 %13, label %.lr.ph13, label %._crit_edge

.lr.ph13:                                         ; preds = %.preheader
  %14 = getelementptr inbounds i8, ptr %1, i64 8
  %15 = getelementptr inbounds i8, ptr %1, i64 12
  br label %21

.lr.ph:                                           ; preds = %2, %.lr.ph
  %16 = tail call noalias noundef nonnull dereferenceable(40) ptr @_Znwm(i64 noundef 40) #5
  %17 = tail call noundef ptr @_ZNK4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %10, i32 noundef 0) #4
  tail call void @_ZN4juce9IIRFilterC1ERKS0_(ptr noundef nonnull align 8 dereferenceable(37) %16, ptr noundef nonnull align 8 dereferenceable(37) %17) #4
  %18 = tail call noundef ptr @_ZN4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEE3addEPS1_(ptr noundef nonnull align 8 dereferenceable(20) %10, ptr noundef nonnull %16) #4
  %19 = tail call noundef i32 @_ZNK4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %10) #4
  %20 = icmp sgt i32 %9, %19
  br i1 %20, label %.lr.ph, label %.preheader, !llvm.loop !13

._crit_edge:                                      ; preds = %21, %.preheader
  ret void

21:                                               ; preds = %.lr.ph13, %21
  %.012 = phi i32 [ 0, %.lr.ph13 ], [ %27, %21 ]
  %22 = tail call noundef ptr @_ZNK4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %10, i32 noundef %.012) #4
  %23 = load ptr, ptr %1, align 8, !tbaa !8
  %24 = load i32, ptr %14, align 8, !tbaa !15
  %25 = tail call noundef ptr @_ZN4juce11AudioBufferIfE15getWritePointerEii(ptr noundef nonnull align 8 dereferenceable(289) %23, i32 noundef %.012, i32 noundef %24) #4
  %26 = load i32, ptr %15, align 4, !tbaa !16
  tail call void @_ZN4juce9IIRFilter14processSamplesEPfi(ptr noundef nonnull align 8 dereferenceable(37) %22, ptr noundef %25, i32 noundef %26) #4
  %27 = add nuw nsw i32 %.012, 1
  %exitcond.not = icmp eq i32 %27, %9
  br i1 %exitcond.not, label %._crit_edge, label %21, !llvm.loop !17
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4juce11AudioBufferIfE15getWritePointerEii(ptr noundef nonnull align 8 dereferenceable(289), i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

declare void @_ZN4juce9IIRFilterC1ERKS0_(ptr, ptr) local_unnamed_addr

attributes #0 = { 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 #1 = { nobuiltin allocsize(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 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 }
attributes #5 = { builtin allocsize(0) }

!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 = !{!9, !10, i64 0}
!9 = !{!"_ZTSN4juce22AudioSourceChannelInfoE", !10, i64 0, !12, i64 8, !12, i64 12}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"int", !11, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!9, !12, i64 8}
!16 = !{!9, !12, i64 12}
!17 = distinct !{!17, !14}


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