float binary_act_filter(const float bin, const float threshold,
                        const float bin_old, const float cutoff_hz) {
  if (bin < threshold)
    return (1 - cutoff_hz *
                    (((((float)1024) / ((float)44100)) * 6.283185307179586) /
                     (1 + ((((float)1024) / ((float)44100)) *
                           6.283185307179586)))) *
           bin_old;
  return (((((float)1024) / ((float)44100)) * 6.283185307179586) /
          (1 + ((((float)1024) / ((float)44100)) * 6.283185307179586))) *
             cutoff_hz +
         (1 -
          cutoff_hz *
              (((((float)1024) / ((float)44100)) * 6.283185307179586) /
               (1 + ((((float)1024) / ((float)44100)) * 6.283185307179586)))) *
             bin_old;
}


x86 assembly (clang, -O0):
<binary_act_filter>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  %xmm3,-0x14(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    117e <binary_act_filter+0x7e>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xead(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea9(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e5 <binary_act_filter+0xe5>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xe51(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe4d(%rip),%xmm2
addsd  %xmm2,%xmm1
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe2c(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<binary_act_filter>:
ucomiss %xmm0,%xmm1
xorps  %xmm1,%xmm1
cvtss2sd %xmm3,%xmm1
mulsd  0xeee(%rip),%xmm1
movsd  0xeee(%rip),%xmm3
subsd  %xmm1,%xmm3
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
mulsd  %xmm3,%xmm0
ja     112f <binary_act_filter+0x2f>
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @binary_act_filter(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
%10 = load float, float* %6
%11 = load float, float* %7
%12 = fcmp olt float %10, %11
br i1 %12, label %13, label %22
13: ; preds = %4
%14 = load float, float* %9
%15 = fpext float %14 to double
%16 = fneg double %15
%17 = call double @llvm.fmuladd.f64(double %16, double 0x3FC04C04C199F2CE, double 1.000000e+00)
%18 = load float, float* %8
%19 = fpext float %18 to double
%20 = fmul double %17, %19
%21 = fptrunc double %20 to float
store float %21, float* %5
br label %34
22: ; preds = %4
%23 = load float, float* %9
%24 = fpext float %23 to double
%25 = load float, float* %9
%26 = fpext float %25 to double
%27 = fneg double %26
%28 = call double @llvm.fmuladd.f64(double %27, double 0x3FC04C04C199F2CE, double 1.000000e+00)
%29 = load float, float* %8
%30 = fpext float %29 to double
%31 = fmul double %28, %30
%32 = call double @llvm.fmuladd.f64(double 0x3FC04C04C199F2CE, double %24, double %31)
%33 = fptrunc double %32 to float
store float %33, float* %5
br label %34
34: ; preds = %22, %13
%35 = load float, float* %5
ret float %35
}

LLVM IR (-O2):
define float @binary_act_filter(float %0, float %1, float %2, float %3) {
%5 = fcmp olt float %0, %1
%6 = fpext float %3 to double
%7 = fneg double %6
%8 = tail call double @llvm.fmuladd.f64(double %7, double 0x3FC04C04C199F2CE, double 1.000000e+00)
%9 = fpext float %2 to double
%10 = fmul double %8, %9
%11 = tail call double @llvm.fmuladd.f64(double %6, double 0x3FC04C04C199F2CE, double %10)
%12 = select i1 %5, double %10, double %11
%13 = fptrunc double %12 to float
ret float %13
}