#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double sqrt(double);
float S_LowpassCoeff(float gain, float cw) {
  float a = 0.0;
  float g = gain;
  g = ((g) > (0.01) ? (g) : (0.01));
  if (g < 0.9999f)
    a = (1.0 - g * cw - sqrt(2.0 * g * (1.0 - cw) - g * g * (1.0 - cw * cw))) /
        (1.0 - g);
  return a;
}


x86 assembly (clang, -O0):
<S_LowpassCoeff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xebb(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1162 <S_LowpassCoeff+0x52>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1174 <S_LowpassCoeff+0x64>
movsd  0xe96(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1174 <S_LowpassCoeff+0x64>
movsd  -0x18(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe8e(%rip),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    125b <S_LowpassCoeff+0x14b>
movss  -0x10(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe5e(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe4c(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe2f(%rip),%xmm2
subsd  %xmm1,%xmm2
movss  -0x10(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x8(%rbp),%xmm3
mulss  -0x8(%rbp),%xmm3
cvtss2sd %xmm3,%xmm4
movsd  0xe07(%rip),%xmm3
subsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xdbe(%rip),%xmm1
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<S_LowpassCoeff>:
sub    $0x18,%rsp
cvtss2sd %xmm0,%xmm2
ucomisd 0xee0(%rip),%xmm2
ja     112a <S_LowpassCoeff+0x1a>
movss  0xee6(%rip),%xmm0
xorps  %xmm2,%xmm2
movss  0xedf(%rip),%xmm3
ucomiss %xmm0,%xmm3
jbe    11e3 <S_LowpassCoeff+0xd3>
movaps %xmm0,%xmm2
mulss  %xmm1,%xmm2
cvtss2sd %xmm2,%xmm2
movsd  0xeb7(%rip),%xmm6
movapd %xmm6,%xmm5
subsd  %xmm2,%xmm5
cvtss2sd %xmm0,%xmm7
movaps %xmm7,%xmm3
addsd  %xmm7,%xmm3
cvtss2sd %xmm1,%xmm4
movapd %xmm6,%xmm2
subsd  %xmm4,%xmm2
mulsd  %xmm3,%xmm2
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mulss  %xmm1,%xmm1
cvtss2sd %xmm1,%xmm1
movapd %xmm6,%xmm3
subsd  %xmm1,%xmm3
mulsd  %xmm0,%xmm3
subsd  %xmm3,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jb     11a7 <S_LowpassCoeff+0x97>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    11d0 <S_LowpassCoeff+0xc0>
movapd %xmm2,%xmm0
movsd  %xmm5,0x10(%rsp)
movsd  %xmm7,0x8(%rsp)
call   1030 <sqrt@plt>
movsd  0x8(%rsp),%xmm7
movsd  0xe3e(%rip),%xmm6
movsd  0x10(%rsp),%xmm5
subsd  %xmm0,%xmm5
subsd  %xmm7,%xmm6
divsd  %xmm6,%xmm5
xorps  %xmm2,%xmm2
cvtsd2ss %xmm5,%xmm2
movaps %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @S_LowpassCoeff(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %3
store float %1, float* %4
store float 0.000000e+00, float* %5
%7 = load float, float* %3
store float %7, float* %6
%8 = load float, float* %6
%9 = fpext float %8 to double
%10 = fcmp ogt double %9, 1.000000e-02
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load float, float* %6
%13 = fpext float %12 to double
br label %15
14: ; preds = %2
br label %15
15: ; preds = %14, %11
%16 = phi double [ %13, %11 ], [ 1.000000e-02, %14 ]
%17 = fptrunc double %16 to float
store float %17, float* %6
%18 = load float, float* %6
%19 = fcmp olt float %18, 0x3FEFFF2E40000000
br i1 %19, label %20, label %51
20: ; preds = %15
%21 = load float, float* %6
%22 = load float, float* %4
%23 = fmul float %21, %22
%24 = fpext float %23 to double
%25 = fsub double 1.000000e+00, %24
%26 = load float, float* %6
%27 = fpext float %26 to double
%28 = fmul double 2.000000e+00, %27
%29 = load float, float* %4
%30 = fpext float %29 to double
%31 = fsub double 1.000000e+00, %30
%32 = load float, float* %6
%33 = load float, float* %6
%34 = fmul float %32, %33
%35 = fpext float %34 to double
%36 = load float, float* %4
%37 = load float, float* %4
%38 = fmul float %36, %37
%39 = fpext float %38 to double
%40 = fsub double 1.000000e+00, %39
%41 = fmul double %35, %40
%42 = fneg double %41
%43 = call double @llvm.fmuladd.f64(double %28, double %31, double %42)
%44 = call double @sqrt(double %43)
%45 = fsub double %25, %44
%46 = load float, float* %6
%47 = fpext float %46 to double
%48 = fsub double 1.000000e+00, %47
%49 = fdiv double %45, %48
%50 = fptrunc double %49 to float
store float %50, float* %5
br label %51
51: ; preds = %20, %15
%52 = load float, float* %5
ret float %52
}

LLVM IR (-O2):
define float @S_LowpassCoeff(float %0, float %1) {
%3 = fpext float %0 to double
%4 = fcmp ogt double %3, 1.000000e-02
%5 = select i1 %4, float %0, float 0x3F847AE140000000
%6 = fcmp olt float %5, 0x3FEFFF2E40000000
br i1 %6, label %7, label %28
7: ; preds = %2
%8 = fmul float %5, %1
%9 = fpext float %8 to double
%10 = fsub double 1.000000e+00, %9
%11 = fpext float %5 to double
%12 = fmul double %11, 2.000000e+00
%13 = fpext float %1 to double
%14 = fsub double 1.000000e+00, %13
%15 = fmul float %5, %5
%16 = fpext float %15 to double
%17 = fmul float %1, %1
%18 = fpext float %17 to double
%19 = fsub double 1.000000e+00, %18
%20 = fneg double %19
%21 = fmul double %20, %16
%22 = tail call double @llvm.fmuladd.f64(double %12, double %14, double %21)
%23 = tail call double @sqrt(double %22)
%24 = fsub double %10, %23
%25 = fsub double 1.000000e+00, %11
%26 = fdiv double %24, %25
%27 = fptrunc double %26 to float
br label %28
28: ; preds = %7, %2
%29 = phi float [ %27, %7 ], [ 0.000000e+00, %2 ]
ret float %29
}