; 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::IIRFilter" = type <{ %"class.juce::SpinLock", %"class.juce::IIRCoefficients", float, float, i8, [3 x i8] }>
%"class.juce::SpinLock" = type { %"class.juce::Atomic" }
%"class.juce::Atomic" = type { i32, [4 x i8] }
%"class.juce::IIRCoefficients" = type { [5 x float] }

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef float @_ZN4juce9IIRFilter22processSingleSampleRawEf(ptr noundef nonnull align 8 dereferenceable(37) %0, float noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !9
  %6 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %7 = getelementptr inbounds %"class.juce::IIRFilter", ptr %6, i32 0, i32 1
  %8 = getelementptr inbounds %"class.juce::IIRCoefficients", ptr %7, i32 0, i32 0
  %9 = getelementptr inbounds [5 x float], ptr %8, i64 0, i64 0
  %10 = load float, ptr %9, align 8, !tbaa !9
  %11 = load float, ptr %4, align 4, !tbaa !9
  %12 = getelementptr inbounds %"class.juce::IIRFilter", ptr %6, i32 0, i32 2
  %13 = load float, ptr %12, align 4, !tbaa !11
  %14 = call float @llvm.fmuladd.f32(float %10, float %11, float %13)
  store float %14, ptr %5, align 4, !tbaa !9
  %15 = load float, ptr %5, align 4, !tbaa !9
  %16 = fcmp olt float %15, 0xBE45798EE0000000
  br i1 %16, label %21, label %17

17:                                               ; preds = %2
  %18 = load float, ptr %5, align 4, !tbaa !9
  %19 = fcmp ogt float %18, 0x3E45798EE0000000
  br i1 %19, label %21, label %20

20:                                               ; preds = %17
  store float 0.000000e+00, ptr %5, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %20, %17, %2
  %22 = getelementptr inbounds %"class.juce::IIRFilter", ptr %6, i32 0, i32 1
  %23 = getelementptr inbounds %"class.juce::IIRCoefficients", ptr %22, i32 0, i32 0
  %24 = getelementptr inbounds [5 x float], ptr %23, i64 0, i64 1
  %25 = load float, ptr %24, align 4, !tbaa !9
  %26 = load float, ptr %4, align 4, !tbaa !9
  %27 = getelementptr inbounds %"class.juce::IIRFilter", ptr %6, i32 0, i32 1
  %28 = getelementptr inbounds %"class.juce::IIRCoefficients", ptr %27, i32 0, i32 0
  %29 = getelementptr inbounds [5 x float], ptr %28, i64 0, i64 3
  %30 = load float, ptr %29, align 4, !tbaa !9
  %31 = load float, ptr %5, align 4, !tbaa !9
  %32 = fmul float %30, %31
  %33 = fneg float %32
  %34 = call float @llvm.fmuladd.f32(float %25, float %26, float %33)
  %35 = getelementptr inbounds %"class.juce::IIRFilter", ptr %6, i32 0, i32 3
  %36 = load float, ptr %35, align 8, !tbaa !18
  %37 = fadd float %34, %36
  %38 = getelementptr inbounds %"class.juce::IIRFilter", ptr %6, i32 0, i32 2
  store float %37, ptr %38, align 4, !tbaa !11
  %39 = getelementptr inbounds %"class.juce::IIRFilter", ptr %6, i32 0, i32 1
  %40 = getelementptr inbounds %"class.juce::IIRCoefficients", ptr %39, i32 0, i32 0
  %41 = getelementptr inbounds [5 x float], ptr %40, i64 0, i64 2
  %42 = load float, ptr %41, align 8, !tbaa !9
  %43 = load float, ptr %4, align 4, !tbaa !9
  %44 = getelementptr inbounds %"class.juce::IIRFilter", ptr %6, i32 0, i32 1
  %45 = getelementptr inbounds %"class.juce::IIRCoefficients", ptr %44, i32 0, i32 0
  %46 = getelementptr inbounds [5 x float], ptr %45, i64 0, i64 4
  %47 = load float, ptr %46, align 8, !tbaa !9
  %48 = load float, ptr %5, align 4, !tbaa !9
  %49 = fmul float %47, %48
  %50 = fneg float %49
  %51 = call float @llvm.fmuladd.f32(float %42, float %43, float %50)
  %52 = getelementptr inbounds %"class.juce::IIRFilter", ptr %6, i32 0, i32 3
  store float %51, ptr %52, align 8, !tbaa !18
  %53 = load float, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret float %53
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 28}
!12 = !{!"_ZTSN4juce9IIRFilterE", !13, i64 0, !16, i64 8, !10, i64 28, !10, i64 32, !17, i64 36}
!13 = !{!"_ZTSN4juce8SpinLockE", !14, i64 0}
!14 = !{!"_ZTSN4juce6AtomicIiEE", !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_ZTSN4juce15IIRCoefficientsE", !7, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!12, !10, i64 32}


; 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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local noundef float @_ZN4juce9IIRFilter22processSingleSampleRawEf(ptr nocapture noundef nonnull align 8 dereferenceable(37) %0, float noundef %1) local_unnamed_addr #1 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load float, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 28
  %6 = load float, ptr %5, align 4, !tbaa !9
  %7 = tail call float @llvm.fmuladd.f32(float %4, float %1, float %6)
  %8 = tail call float @llvm.fabs.f32(float %7)
  %or.cond = fcmp ogt float %8, 0x3E45798EE0000000
  %spec.store.select = select i1 %or.cond, float %7, float 0.000000e+00
  %9 = getelementptr inbounds i8, ptr %0, i64 12
  %10 = load float, ptr %9, align 4, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 20
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = fneg float %12
  %14 = fmul float %spec.store.select, %13
  %15 = tail call float @llvm.fmuladd.f32(float %10, float %1, float %14)
  %16 = getelementptr inbounds i8, ptr %0, i64 32
  %17 = load float, ptr %16, align 8, !tbaa !16
  %18 = fadd float %17, %15
  store float %18, ptr %5, align 4, !tbaa !9
  %19 = getelementptr inbounds i8, ptr %0, i64 16
  %20 = load float, ptr %19, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %0, i64 24
  %22 = load float, ptr %21, align 8, !tbaa !5
  %23 = fneg float %22
  %24 = fmul float %spec.store.select, %23
  %25 = tail call float @llvm.fmuladd.f32(float %20, float %1, float %24)
  store float %25, ptr %16, align 8, !tbaa !16
  ret float %spec.store.select
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 28}
!10 = !{!"_ZTSN4juce9IIRFilterE", !11, i64 0, !14, i64 8, !6, i64 28, !6, i64 32, !15, i64 36}
!11 = !{!"_ZTSN4juce8SpinLockE", !12, i64 0}
!12 = !{!"_ZTSN4juce6AtomicIiEE", !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSN4juce15IIRCoefficientsE", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!10, !6, i64 32}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass