; 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 }

@_ZTVN4juce20IIRFilterAudioSourceE = external dso_local unnamed_addr constant { [7 x ptr] }, align 8

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce21OptionalScopedPointerINS_11AudioSourceEEC2EPS1_b(ptr noundef nonnull align 8 dereferenceable(9), ptr noundef, i1 noundef zeroext) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce20IIRFilterAudioSourceC2EPNS_11AudioSourceEb(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef %1, i1 noundef zeroext %2) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %10 = zext i1 %2 to i8
  store i8 %10, ptr %6, align 1, !tbaa !9
  %11 = load ptr, ptr %4, align 8
  call void @_ZN4juce11AudioSourceC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #4
  store ptr getelementptr inbounds inrange(-16, 40) ({ [7 x ptr] }, ptr @_ZTVN4juce20IIRFilterAudioSourceE, i32 0, i32 0, i32 2), ptr %11, align 8, !tbaa !11
  %12 = getelementptr inbounds %"class.juce::IIRFilterAudioSource", ptr %11, i32 0, i32 1
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = load i8, ptr %6, align 1, !tbaa !9, !range !13, !noundef !14
  %15 = trunc i8 %14 to i1
  invoke void @_ZN4juce21OptionalScopedPointerINS_11AudioSourceEEC2EPS1_b(ptr noundef nonnull align 8 dereferenceable(9) %12, ptr noundef %13, i1 noundef zeroext %15)
          to label %16 unwind label %26

16:                                               ; preds = %3
  %17 = getelementptr inbounds %"class.juce::IIRFilterAudioSource", ptr %11, i32 0, i32 2
  call void @_ZN4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEEC2Ev(ptr noundef nonnull align 8 dereferenceable(20) %17) #4
  br label %18

18:                                               ; preds = %16
  br label %19

19:                                               ; preds = %18
  br label %20

20:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 2, ptr %9, align 4, !tbaa !15
  br label %21

21:                                               ; preds = %33, %20
  %22 = load i32, ptr %9, align 4, !tbaa !15
  %23 = add nsw i32 %22, -1
  store i32 %23, ptr %9, align 4, !tbaa !15
  %24 = icmp sge i32 %23, 0
  br i1 %24, label %30, label %25

25:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %39

26:                                               ; preds = %3
  %27 = landingpad { ptr, i32 }
          cleanup
  %28 = extractvalue { ptr, i32 } %27, 0
  store ptr %28, ptr %7, align 8
  %29 = extractvalue { ptr, i32 } %27, 1
  store i32 %29, ptr %8, align 4
  br label %40

30:                                               ; preds = %21
  %31 = getelementptr inbounds %"class.juce::IIRFilterAudioSource", ptr %11, i32 0, i32 2
  %32 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 40) #5
          to label %33 unwind label %35

33:                                               ; preds = %30
  call void @_ZN4juce9IIRFilterC1Ev(ptr noundef nonnull align 8 dereferenceable(37) %32) #4
  %34 = call noundef ptr @_ZN4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEE3addEPS1_(ptr noundef nonnull align 8 dereferenceable(20) %31, ptr noundef %32) #4
  br label %21, !llvm.loop !17

35:                                               ; preds = %30
  %36 = landingpad { ptr, i32 }
          cleanup
  %37 = extractvalue { ptr, i32 } %36, 0
  store ptr %37, ptr %7, align 8
  %38 = extractvalue { ptr, i32 } %36, 1
  store i32 %38, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @_ZN4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %17) #4
  call void @_ZN4juce21OptionalScopedPointerINS_11AudioSourceEED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %12) #4
  br label %40

39:                                               ; preds = %25
  ret void

40:                                               ; preds = %35, %26
  call void @_ZN4juce11AudioSourceD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #4
  br label %41

41:                                               ; preds = %40
  %42 = load ptr, ptr %7, align 8
  %43 = load i32, ptr %8, align 4
  %44 = insertvalue { ptr, i32 } poison, ptr %42, 0
  %45 = insertvalue { ptr, i32 } %44, i32 %43, 1
  resume { ptr, i32 } %45
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEEC2Ev(ptr noundef nonnull align 8 dereferenceable(20)) 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) #2 align 2

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

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

declare void @_ZN4juce9IIRFilterC1Ev(ptr)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!"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 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"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"

@_ZTVN4juce20IIRFilterAudioSourceE = external dso_local unnamed_addr constant { [7 x ptr] }, align 8

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce20IIRFilterAudioSourceC2EPNS_11AudioSourceEb(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef %1, i1 noundef zeroext %2) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN4juce11AudioSourceC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #3
  store ptr getelementptr inbounds inrange(-16, 40) (i8, ptr @_ZTVN4juce20IIRFilterAudioSourceE, i64 16), ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @_ZN4juce21OptionalScopedPointerINS_11AudioSourceEEC2EPS1_b(ptr noundef nonnull align 8 dereferenceable(9) %4, ptr noundef %1, i1 noundef zeroext %2)
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @_ZN4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEEC2Ev(ptr noundef nonnull align 8 dereferenceable(20) %5) #3
  %6 = invoke noalias noundef nonnull dereferenceable(40) ptr @_Znwm(i64 noundef 40) #4
          to label %7 unwind label %12

7:                                                ; preds = %3
  tail call void @_ZN4juce9IIRFilterC1Ev(ptr noundef nonnull align 8 dereferenceable(37) %6) #3
  %8 = tail call noundef ptr @_ZN4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEE3addEPS1_(ptr noundef nonnull align 8 dereferenceable(20) %5, ptr noundef nonnull %6) #3
  %9 = invoke noalias noundef nonnull dereferenceable(40) ptr @_Znwm(i64 noundef 40) #4
          to label %10 unwind label %12

10:                                               ; preds = %7
  tail call void @_ZN4juce9IIRFilterC1Ev(ptr noundef nonnull align 8 dereferenceable(37) %9) #3
  %11 = tail call noundef ptr @_ZN4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEE3addEPS1_(ptr noundef nonnull align 8 dereferenceable(20) %5, ptr noundef nonnull %9) #3
  ret void

12:                                               ; preds = %7, %3
  %13 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %5) #3
  tail call void @_ZN4juce21OptionalScopedPointerINS_11AudioSourceEED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %4) #3
  tail call void @_ZN4juce11AudioSourceD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #3
  resume { ptr, i32 } %13
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4juce10OwnedArrayINS_9IIRFilterENS_20DummyCriticalSectionEEC2Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #1 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 #1 align 2

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

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

declare void @_ZN4juce9IIRFilterC1Ev(ptr) local_unnamed_addr

attributes #0 = { 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 #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 = { 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 #3 = { nounwind }
attributes #4 = { 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"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass