; LLVM IR from glaretechnologies/substrata :: resonance-audio/resonance_audio/dsp (filter_coefficient_generators)

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

%"struct.vraudio::BiquadCoefficients" = type { %"struct.std::array", %"struct.std::array" }
%"struct.std::array" = type { [3 x float] }
%class.NullLogger = type { i8 }

@_ZN7vraudio12_GLOBAL__N_123kPolynomialCoefficientsE = external hidden constant [5 x float], align 16

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3cosf(float noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3sinf(float noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7vraudio18BiquadCoefficientsC2Effffff(ptr noundef nonnull align 4 dereferenceable(24), float noundef, float noundef, float noundef, float noundef, float noundef, float noundef) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7vraudio32ComputeLowPassBiquadCoefficientsEiff(ptr dead_on_unwind noalias writable sret(%"struct.vraudio::BiquadCoefficients") align 4 %0, i32 noundef %1, float noundef %2, float noundef %3) #1 {
  %5 = alloca i32, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca %class.NullLogger, align 1
  %9 = alloca %class.NullLogger, align 1
  %10 = alloca %class.NullLogger, align 1
  %11 = alloca %class.NullLogger, align 1
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca i32, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca float, align 4
  %21 = alloca float, align 4
  %22 = alloca float, align 4
  store i32 %1, ptr %5, align 4, !tbaa !5
  store float %2, ptr %6, align 4, !tbaa !9
  store float %3, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #5
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %8)
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #5
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %9)
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #5
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %10)
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #5
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %11)
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %27 = load float, ptr %6, align 4, !tbaa !9
  %28 = fmul float 0x401921FB60000000, %27
  %29 = load i32, ptr %5, align 4, !tbaa !5
  %30 = sitofp i32 %29 to float
  %31 = fdiv float %28, %30
  store float %31, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store float 0.000000e+00, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store float 1.000000e+00, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 4, ptr %15, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %47, %4
  %33 = load i32, ptr %15, align 4, !tbaa !5
  %34 = icmp sge i32 %33, 0
  br i1 %34, label %36, label %35

35:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %50

36:                                               ; preds = %32
  %37 = load i32, ptr %15, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [5 x float], ptr @_ZN7vraudio12_GLOBAL__N_123kPolynomialCoefficientsE, i64 0, i64 %38
  %40 = load float, ptr %39, align 4, !tbaa !9
  %41 = load float, ptr %14, align 4, !tbaa !9
  %42 = load float, ptr %13, align 4, !tbaa !9
  %43 = call float @llvm.fmuladd.f32(float %40, float %41, float %42)
  store float %43, ptr %13, align 4, !tbaa !9
  %44 = load float, ptr %7, align 4, !tbaa !9
  %45 = load float, ptr %14, align 4, !tbaa !9
  %46 = fmul float %45, %44
  store float %46, ptr %14, align 4, !tbaa !9
  br label %47

47:                                               ; preds = %36
  %48 = load i32, ptr %15, align 4, !tbaa !5
  %49 = add nsw i32 %48, -1
  store i32 %49, ptr %15, align 4, !tbaa !5
  br label %32, !llvm.loop !11

50:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %51 = load float, ptr %12, align 4, !tbaa !9
  %52 = call noundef float @_ZSt3sinf(float noundef %51)
  %53 = load float, ptr %13, align 4, !tbaa !9
  %54 = fmul float 2.000000e+00, %53
  %55 = fdiv float %52, %54
  store float %55, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %56 = load float, ptr %12, align 4, !tbaa !9
  %57 = call noundef float @_ZSt3cosf(float noundef %56)
  store float %57, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %58 = load float, ptr %16, align 4, !tbaa !9
  %59 = fadd float 1.000000e+00, %58
  store float %59, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %60 = load float, ptr %17, align 4, !tbaa !9
  %61 = fmul float -2.000000e+00, %60
  store float %61, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  %62 = load float, ptr %16, align 4, !tbaa !9
  %63 = fsub float 1.000000e+00, %62
  store float %63, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  %64 = load float, ptr %17, align 4, !tbaa !9
  %65 = fsub float 1.000000e+00, %64
  %66 = fdiv float %65, 2.000000e+00
  store float %66, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  %67 = load float, ptr %17, align 4, !tbaa !9
  %68 = fsub float 1.000000e+00, %67
  store float %68, ptr %22, align 4, !tbaa !9
  %69 = load float, ptr %18, align 4, !tbaa !9
  %70 = load float, ptr %19, align 4, !tbaa !9
  %71 = load float, ptr %20, align 4, !tbaa !9
  %72 = load float, ptr %21, align 4, !tbaa !9
  %73 = load float, ptr %22, align 4, !tbaa !9
  %74 = load float, ptr %21, align 4, !tbaa !9
  call void @_ZN7vraudio18BiquadCoefficientsC2Effffff(ptr noundef nonnull align 4 dereferenceable(24) %0, float noundef %69, float noundef %70, float noundef %71, float noundef %72, float noundef %73, float noundef %74)
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  ret void
}

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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

%"struct.vraudio::BiquadCoefficients" = type { %"struct.std::array", %"struct.std::array" }
%"struct.std::array" = type { [3 x float] }
%class.NullLogger = type { i8 }

@_ZN7vraudio12_GLOBAL__N_123kPolynomialCoefficientsE = external hidden local_unnamed_addr constant [5 x float], align 16

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3cosf(float noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3sinf(float noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7vraudio18BiquadCoefficientsC2Effffff(ptr noundef nonnull align 4 dereferenceable(24), float noundef, float noundef, float noundef, float noundef, float noundef, float noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7vraudio32ComputeLowPassBiquadCoefficientsEiff(ptr dead_on_unwind noalias writable sret(%"struct.vraudio::BiquadCoefficients") align 4 %0, i32 noundef %1, float noundef %2, float noundef %3) local_unnamed_addr #1 {
  %5 = alloca %class.NullLogger, align 1
  %6 = alloca %class.NullLogger, align 1
  %7 = alloca %class.NullLogger, align 1
  %8 = alloca %class.NullLogger, align 1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #5
  %9 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %5)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #5
  %10 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %6)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #5
  %11 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %7)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #5
  %12 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %8)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #5
  %13 = load float, ptr getelementptr inbounds (i8, ptr @_ZN7vraudio12_GLOBAL__N_123kPolynomialCoefficientsE, i64 16), align 16, !tbaa !5
  %14 = fadd float %13, 0.000000e+00
  %15 = load float, ptr getelementptr inbounds (i8, ptr @_ZN7vraudio12_GLOBAL__N_123kPolynomialCoefficientsE, i64 12), align 4, !tbaa !5
  %16 = call float @llvm.fmuladd.f32(float %15, float %3, float %14)
  %17 = fmul float %3, %3
  %18 = load float, ptr getelementptr inbounds (i8, ptr @_ZN7vraudio12_GLOBAL__N_123kPolynomialCoefficientsE, i64 8), align 8, !tbaa !5
  %19 = call float @llvm.fmuladd.f32(float %18, float %17, float %16)
  %20 = fmul float %17, %3
  %21 = load float, ptr getelementptr inbounds (i8, ptr @_ZN7vraudio12_GLOBAL__N_123kPolynomialCoefficientsE, i64 4), align 4, !tbaa !5
  %22 = call float @llvm.fmuladd.f32(float %21, float %20, float %19)
  %23 = fmul float %20, %3
  %24 = load float, ptr @_ZN7vraudio12_GLOBAL__N_123kPolynomialCoefficientsE, align 16, !tbaa !5
  %25 = call float @llvm.fmuladd.f32(float %24, float %23, float %22)
  %26 = fmul float %2, 0x401921FB60000000
  %27 = sitofp i32 %1 to float
  %28 = fdiv float %26, %27
  %29 = call noundef float @_ZSt3sinf(float noundef %28)
  %30 = fmul float %25, 2.000000e+00
  %31 = fdiv float %29, %30
  %32 = call noundef float @_ZSt3cosf(float noundef %28)
  %33 = fadd float %31, 1.000000e+00
  %34 = fmul float %32, -2.000000e+00
  %35 = fsub float 1.000000e+00, %31
  %36 = fsub float 1.000000e+00, %32
  %37 = fmul float %36, 5.000000e-01
  call void @_ZN7vraudio18BiquadCoefficientsC2Effffff(ptr noundef nonnull align 4 dereferenceable(24) %0, float noundef %33, float noundef %34, float noundef %35, float noundef %37, float noundef %36, float noundef %37)
  ret void
}

attributes #0 = { mustprogress 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 = { 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LoopRotatePass,ReassociatePass,SROAPass,SimplifyCFGPass