; LLVM IR from Overload-Technologies/Overload :: Dependencies/soloud/src/filter (soloud_biquadresonantfilter)

; 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.SoLoud::BiquadResonantFilterInstance" = type { %"class.SoLoud::FilterInstance", [8 x %"struct.SoLoud::BQRStateData"], float, float, float, float, float, i32, float, ptr }
%"class.SoLoud::FilterInstance" = type { ptr, i32, i32, ptr, ptr }
%"struct.SoLoud::BQRStateData" = type { float, float, float, float }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6SoLoud28BiquadResonantFilterInstance13calcBQRParamsEv(ptr noundef nonnull align 8 dereferenceable(200) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca float, align 4
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %8 = load ptr, ptr %2, align 8
  %9 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 7
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %10 = getelementptr inbounds %"class.SoLoud::FilterInstance", ptr %8, i32 0, i32 3
  %11 = load ptr, ptr %10, align 8, !tbaa !14
  %12 = getelementptr inbounds float, ptr %11, i64 2
  %13 = load float, ptr %12, align 4, !tbaa !15
  %14 = fpext float %13 to double
  %15 = fmul double 0x401921FB54442D18, %14
  %16 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 8
  %17 = load float, ptr %16, align 8, !tbaa !16
  %18 = fpext float %17 to double
  %19 = fdiv double %15, %18
  %20 = fptrunc double %19 to float
  store float %20, ptr %3, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %21 = load float, ptr %3, align 4, !tbaa !15
  %22 = call noundef float @_ZSt3sinf(float noundef %21)
  store float %22, ptr %4, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %23 = load float, ptr %3, align 4, !tbaa !15
  %24 = call noundef float @_ZSt3cosf(float noundef %23)
  store float %24, ptr %5, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %25 = load float, ptr %4, align 4, !tbaa !15
  %26 = getelementptr inbounds %"class.SoLoud::FilterInstance", ptr %8, i32 0, i32 3
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  %28 = getelementptr inbounds float, ptr %27, i64 3
  %29 = load float, ptr %28, align 4, !tbaa !15
  %30 = fmul float 2.000000e+00, %29
  %31 = fdiv float %25, %30
  store float %31, ptr %6, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %32 = load float, ptr %6, align 4, !tbaa !15
  %33 = fadd float 1.000000e+00, %32
  %34 = fdiv float 1.000000e+00, %33
  store float %34, ptr %7, align 4, !tbaa !15
  %35 = getelementptr inbounds %"class.SoLoud::FilterInstance", ptr %8, i32 0, i32 3
  %36 = load ptr, ptr %35, align 8, !tbaa !14
  %37 = getelementptr inbounds float, ptr %36, i64 1
  %38 = load float, ptr %37, align 4, !tbaa !15
  %39 = fptosi float %38 to i32
  switch i32 %39, label %40 [
    i32 0, label %41
    i32 1, label %66
    i32 2, label %92
  ]

40:                                               ; preds = %1
  br label %41

41:                                               ; preds = %40, %1
  %42 = load float, ptr %5, align 4, !tbaa !15
  %43 = fsub float 1.000000e+00, %42
  %44 = fmul float 5.000000e-01, %43
  %45 = load float, ptr %7, align 4, !tbaa !15
  %46 = fmul float %44, %45
  %47 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 2
  store float %46, ptr %47, align 8, !tbaa !17
  %48 = load float, ptr %5, align 4, !tbaa !15
  %49 = fsub float 1.000000e+00, %48
  %50 = load float, ptr %7, align 4, !tbaa !15
  %51 = fmul float %49, %50
  %52 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 3
  store float %51, ptr %52, align 4, !tbaa !18
  %53 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 2
  %54 = load float, ptr %53, align 8, !tbaa !17
  %55 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 4
  store float %54, ptr %55, align 8, !tbaa !19
  %56 = load float, ptr %5, align 4, !tbaa !15
  %57 = fmul float -2.000000e+00, %56
  %58 = load float, ptr %7, align 4, !tbaa !15
  %59 = fmul float %57, %58
  %60 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 5
  store float %59, ptr %60, align 4, !tbaa !20
  %61 = load float, ptr %6, align 4, !tbaa !15
  %62 = fsub float 1.000000e+00, %61
  %63 = load float, ptr %7, align 4, !tbaa !15
  %64 = fmul float %62, %63
  %65 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 6
  store float %64, ptr %65, align 8, !tbaa !21
  br label %112

66:                                               ; preds = %1
  %67 = load float, ptr %5, align 4, !tbaa !15
  %68 = fadd float 1.000000e+00, %67
  %69 = fmul float 5.000000e-01, %68
  %70 = load float, ptr %7, align 4, !tbaa !15
  %71 = fmul float %69, %70
  %72 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 2
  store float %71, ptr %72, align 8, !tbaa !17
  %73 = load float, ptr %5, align 4, !tbaa !15
  %74 = fadd float 1.000000e+00, %73
  %75 = fneg float %74
  %76 = load float, ptr %7, align 4, !tbaa !15
  %77 = fmul float %75, %76
  %78 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 3
  store float %77, ptr %78, align 4, !tbaa !18
  %79 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 2
  %80 = load float, ptr %79, align 8, !tbaa !17
  %81 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 4
  store float %80, ptr %81, align 8, !tbaa !19
  %82 = load float, ptr %5, align 4, !tbaa !15
  %83 = fmul float -2.000000e+00, %82
  %84 = load float, ptr %7, align 4, !tbaa !15
  %85 = fmul float %83, %84
  %86 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 5
  store float %85, ptr %86, align 4, !tbaa !20
  %87 = load float, ptr %6, align 4, !tbaa !15
  %88 = fsub float 1.000000e+00, %87
  %89 = load float, ptr %7, align 4, !tbaa !15
  %90 = fmul float %88, %89
  %91 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 6
  store float %90, ptr %91, align 8, !tbaa !21
  br label %112

92:                                               ; preds = %1
  %93 = load float, ptr %6, align 4, !tbaa !15
  %94 = load float, ptr %7, align 4, !tbaa !15
  %95 = fmul float %93, %94
  %96 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 2
  store float %95, ptr %96, align 8, !tbaa !17
  %97 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 3
  store float 0.000000e+00, ptr %97, align 4, !tbaa !18
  %98 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 2
  %99 = load float, ptr %98, align 8, !tbaa !17
  %100 = fneg float %99
  %101 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 4
  store float %100, ptr %101, align 8, !tbaa !19
  %102 = load float, ptr %5, align 4, !tbaa !15
  %103 = fmul float -2.000000e+00, %102
  %104 = load float, ptr %7, align 4, !tbaa !15
  %105 = fmul float %103, %104
  %106 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 5
  store float %105, ptr %106, align 4, !tbaa !20
  %107 = load float, ptr %6, align 4, !tbaa !15
  %108 = fsub float 1.000000e+00, %107
  %109 = load float, ptr %7, align 4, !tbaa !15
  %110 = fmul float %108, %109
  %111 = getelementptr inbounds %"class.SoLoud::BiquadResonantFilterInstance", ptr %8, i32 0, i32 6
  store float %110, ptr %111, align 8, !tbaa !21
  br label %112

112:                                              ; preds = %92, %66, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

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

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

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !12, i64 180}
!10 = !{!"_ZTSN6SoLoud28BiquadResonantFilterInstanceE", !11, i64 0, !7, i64 32, !13, i64 160, !13, i64 164, !13, i64 168, !13, i64 172, !13, i64 176, !12, i64 180, !13, i64 184, !6, i64 192}
!11 = !{!"_ZTSN6SoLoud14FilterInstanceE", !12, i64 8, !12, i64 12, !6, i64 16, !6, i64 24}
!12 = !{!"int", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!11, !6, i64 16}
!15 = !{!13, !13, i64 0}
!16 = !{!10, !13, i64 184}
!17 = !{!10, !13, i64 160}
!18 = !{!10, !13, i64 164}
!19 = !{!10, !13, i64 168}
!20 = !{!10, !13, i64 172}
!21 = !{!10, !13, i64 176}


; 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
define dso_local void @_ZN6SoLoud28BiquadResonantFilterInstance13calcBQRParamsEv(ptr nocapture noundef nonnull align 8 dereferenceable(200) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 180
  store i32 0, ptr %2, align 4, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = load ptr, ptr %3, align 8, !tbaa !13
  %5 = getelementptr inbounds i8, ptr %4, i64 8
  %6 = load float, ptr %5, align 4, !tbaa !14
  %7 = fpext float %6 to double
  %8 = fmul double %7, 0x401921FB54442D18
  %9 = getelementptr inbounds i8, ptr %0, i64 184
  %10 = load float, ptr %9, align 8, !tbaa !15
  %11 = fpext float %10 to double
  %12 = fdiv double %8, %11
  %13 = fptrunc double %12 to float
  %14 = tail call noundef float @_ZSt3sinf(float noundef %13)
  %15 = tail call noundef float @_ZSt3cosf(float noundef %13)
  %16 = load ptr, ptr %3, align 8, !tbaa !13
  %17 = getelementptr inbounds i8, ptr %16, i64 12
  %18 = load float, ptr %17, align 4, !tbaa !14
  %19 = fmul float %18, 2.000000e+00
  %20 = fdiv float %14, %19
  %21 = fadd float %20, 1.000000e+00
  %22 = fdiv float 1.000000e+00, %21
  %23 = getelementptr inbounds i8, ptr %16, i64 4
  %24 = load float, ptr %23, align 4, !tbaa !14
  %25 = fptosi float %24 to i32
  switch i32 %25, label %26 [
    i32 2, label %47
    i32 1, label %36
  ]

26:                                               ; preds = %1
  %27 = fsub float 1.000000e+00, %15
  %28 = fmul float %27, 5.000000e-01
  %29 = getelementptr inbounds i8, ptr %0, i64 160
  %30 = insertelement <2 x float> poison, float %28, i64 0
  %31 = insertelement <2 x float> %30, float %27, i64 1
  %32 = insertelement <2 x float> poison, float %22, i64 0
  %33 = shufflevector <2 x float> %32, <2 x float> poison, <2 x i32> zeroinitializer
  %34 = fmul <2 x float> %31, %33
  store <2 x float> %34, ptr %29, align 8, !tbaa !14
  %35 = extractelement <2 x float> %34, i64 0
  br label %52

36:                                               ; preds = %1
  %37 = fadd float %15, 1.000000e+00
  %38 = fmul float %37, 5.000000e-01
  %39 = getelementptr inbounds i8, ptr %0, i64 160
  %40 = fneg float %37
  %41 = insertelement <2 x float> poison, float %38, i64 0
  %42 = insertelement <2 x float> %41, float %40, i64 1
  %43 = insertelement <2 x float> poison, float %22, i64 0
  %44 = shufflevector <2 x float> %43, <2 x float> poison, <2 x i32> zeroinitializer
  %45 = fmul <2 x float> %42, %44
  store <2 x float> %45, ptr %39, align 8, !tbaa !14
  %46 = extractelement <2 x float> %45, i64 0
  br label %52

47:                                               ; preds = %1
  %48 = fmul float %20, %22
  %49 = getelementptr inbounds i8, ptr %0, i64 160
  store float %48, ptr %49, align 8, !tbaa !16
  %50 = getelementptr inbounds i8, ptr %0, i64 164
  store float 0.000000e+00, ptr %50, align 4, !tbaa !17
  %51 = fneg float %48
  br label %52

52:                                               ; preds = %47, %36, %26
  %.sink = phi float [ %51, %47 ], [ %46, %36 ], [ %35, %26 ]
  %53 = getelementptr inbounds i8, ptr %0, i64 168
  store float %.sink, ptr %53, align 8, !tbaa !18
  %54 = fmul float %15, -2.000000e+00
  %55 = fmul float %54, %22
  %56 = getelementptr inbounds i8, ptr %0, i64 172
  store float %55, ptr %56, align 4, !tbaa !19
  %57 = fsub float 1.000000e+00, %20
  %58 = fmul float %57, %22
  %59 = getelementptr inbounds i8, ptr %0, i64 176
  store float %58, ptr %59, align 8, !tbaa !20
  ret void
}

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

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

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 = { 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" }

!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, !8, i64 180}
!6 = !{!"_ZTSN6SoLoud28BiquadResonantFilterInstanceE", !7, i64 0, !9, i64 32, !12, i64 160, !12, i64 164, !12, i64 168, !12, i64 172, !12, i64 176, !8, i64 180, !12, i64 184, !11, i64 192}
!7 = !{!"_ZTSN6SoLoud14FilterInstanceE", !8, i64 8, !8, i64 12, !11, i64 16, !11, i64 24}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"float", !9, i64 0}
!13 = !{!7, !11, i64 16}
!14 = !{!12, !12, i64 0}
!15 = !{!6, !12, i64 184}
!16 = !{!6, !12, i64 160}
!17 = !{!6, !12, i64 164}
!18 = !{!6, !12, i64 168}
!19 = !{!6, !12, i64 172}
!20 = !{!6, !12, i64 176}


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