void biquad_highshelf(struct biquad *bq, double frequency, double db_gain) {
  frequency = ({
    __typeof__(0.0) _a = (0.0);
    __typeof__(({
      __typeof__(frequency) _a = (frequency);
      __typeof__(1.0) _b = (1.0);
      _a < _b ? _a : _b;
    })) _b = (({
      __typeof__(frequency) _a = (frequency);
      __typeof__(1.0) _b = (1.0);
      _a < _b ? _a : _b;
    }));
    _a > _b ? _a : _b;
  });
  double A = pow(10.0, db_gain / 40);
  if (frequency == 1) {
    set_coefficient(bq, 1, 0, 0, 1, 0, 0);
  } else if (frequency > 0) {
    double w0 = 3.14159265358979323846 * frequency;
    double S = 1;
    double alpha = 0.5 * sin(w0) * sqrt((A + 1 / A) * (1 / S - 1) + 2);
    double k = cos(w0);
    double k2 = 2 * sqrt(A) * alpha;
    double a_plus_one = A + 1;
    double a_minus_one = A - 1;
    double b0 = A * (a_plus_one + a_minus_one * k + k2);
    double b1 = -2 * A * (a_minus_one + a_plus_one * k);
    double b2 = A * (a_plus_one + a_minus_one * k - k2);
    double a0 = a_plus_one - a_minus_one * k + k2;
    double a1 = 2 * (a_minus_one - a_plus_one * k);
    double a2 = a_plus_one - a_minus_one * k - k2;
    set_coefficient(bq, b0, b1, b2, a0, a1, a2);
  } else {
    set_coefficient(bq, A * A, 0, 0, 1, 0, 0);
  }
}


x86 assembly (clang, -O0):
<biquad_highshelf>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe7d(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ae <biquad_highshelf+0x5e>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
jmp    11bb <biquad_highshelf+0x6b>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11f4 <biquad_highshelf+0xa4>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
jmp    1201 <biquad_highshelf+0xb1>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
movsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  0xdeb(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xdd7(%rip),%xmm0
call   1060 <pow@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xdb8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1281 <biquad_highshelf+0x131>
jp     1281 <biquad_highshelf+0x131>
mov    -0x8(%rbp),%rdi
mov    $0x1,%r8d
xor    %r9d,%r9d
mov    %r8d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
movl   $0x0,(%rsp)
mov    $0x0,%al
call   1040 <set_coefficient@plt>
jmp    1547 <biquad_highshelf+0x3f7>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    151c <biquad_highshelf+0x3cc>
movsd  0xd95(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xd53(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xd61(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  0xd20(%rip),%xmm1
divsd  -0x50(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  0xd0f(%rip),%xmm1
divsd  -0x60(%rbp),%xmm1
movsd  0xd02(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd0a(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xcc9(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xc9b(%rip),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xc84(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm2
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x70(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
addsd  -0x78(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xc60(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  -0x88(%rbp),%xmm2
ff
movsd  -0x80(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm2
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x70(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
subsd  -0x78(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x80(%rbp),%xmm1
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x70(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x80(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xb86(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x80(%rbp),%xmm1
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x70(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x8(%rbp),%rdi
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0xa0(%rbp),%xmm2
ff
movsd  -0xa8(%rbp),%xmm3
ff
movsd  -0xb0(%rbp),%xmm4
ff
movsd  -0xb8(%rbp),%xmm5
ff
mov    $0x6,%al
call   1040 <set_coefficient@plt>
jmp    1542 <biquad_highshelf+0x3f2>
mov    -0x8(%rbp),%rdi
movsd  -0x50(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
xor    %r9d,%r9d
mov    $0x1,%ecx
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%r8d
mov    $0x1,%al
call   1040 <set_coefficient@plt>
jmp    1547 <biquad_highshelf+0x3f7>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<biquad_highshelf>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
minsd  0xea0(%rip),%xmm0
xorpd  %xmm2,%xmm2
maxsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
divsd  0xe92(%rip),%xmm1
movsd  0xe92(%rip),%xmm0
call   1060 <pow@plt>
movapd %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
ucomisd 0xe6b(%rip),%xmm0
jne    11c2 <biquad_highshelf+0x72>
jp     11c2 <biquad_highshelf+0x72>
movl   $0x0,(%rsp)
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
xor    %r9d,%r9d
xor    %eax,%eax
call   1040 <set_coefficient@plt>
add    $0x20,%rsp
pop    %rbx
ret
ucomisd 0xe76(%rip),%xmm0
jbe    1223 <biquad_highshelf+0xd3>
mulsd  0xe44(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  %xmm1,0x18(%rsp)
call   1030 <sin@plt>
movapd %xmm0,%xmm1
mulsd  0xe2f(%rip),%xmm1
movsd  0xe07(%rip),%xmm0
movsd  0x18(%rsp),%xmm2
divsd  %xmm2,%xmm0
addsd  %xmm2,%xmm0
xorpd  %xmm2,%xmm2
mulsd  %xmm2,%xmm0
addsd  0xe11(%rip),%xmm0
ucomisd %xmm2,%xmm0
jb     1249 <biquad_highshelf+0xf9>
sqrtsd %xmm0,%xmm0
jmp    125a <biquad_highshelf+0x10a>
mulsd  %xmm1,%xmm1
mov    %rbx,%rdi
movapd %xmm1,%xmm0
xor    %esi,%esi
xor    %edx,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
mov    $0x1,%al
add    $0x20,%rsp
pop    %rbx
jmp    1040 <set_coefficient@plt>
movsd  %xmm1,0x10(%rsp)
call   1070 <sqrt@plt>
movsd  0x10(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <cos@plt>
movapd %xmm0,%xmm9
movsd  0x18(%rsp),%xmm7
ucomisd 0xdbe(%rip),%xmm7
jb     128d <biquad_highshelf+0x13d>
xorps  %xmm0,%xmm0
sqrtsd %xmm7,%xmm0
jmp    12aa <biquad_highshelf+0x15a>
movapd %xmm7,%xmm0
movsd  %xmm9,0x8(%rsp)
call   1070 <sqrt@plt>
movsd  0x8(%rsp),%xmm9
movsd  0x18(%rsp),%xmm7
addsd  %xmm0,%xmm0
movsd  0x10(%rsp),%xmm8
mulsd  %xmm0,%xmm8
movsd  0xd3e(%rip),%xmm5
addsd  %xmm7,%xmm5
movsd  0xd62(%rip),%xmm4
addsd  %xmm7,%xmm4
movapd %xmm4,%xmm3
mulsd  %xmm9,%xmm3
movapd %xmm3,%xmm2
addsd  %xmm5,%xmm2
movapd %xmm2,%xmm0
addsd  %xmm8,%xmm0
mulsd  %xmm7,%xmm0
movsd  0xd40(%rip),%xmm6
mulsd  %xmm7,%xmm6
mulsd  %xmm5,%xmm9
movapd %xmm9,%xmm1
addsd  %xmm4,%xmm1
mulsd  %xmm6,%xmm1
subsd  %xmm8,%xmm2
mulsd  %xmm7,%xmm2
subsd  %xmm3,%xmm5
movapd %xmm5,%xmm3
addsd  %xmm8,%xmm3
subsd  %xmm9,%xmm4
addsd  %xmm4,%xmm4
subsd  %xmm8,%xmm5
mov    %rbx,%rdi
mov    $0x6,%al
add    $0x20,%rsp
pop    %rbx
jmp    1040 <set_coefficient@plt>

LLVM IR (-O0):
%struct.biquad = type opaque
define void @biquad_highshelf(%struct.biquad* %0, double %1, double %2) {
%4 = alloca %struct.biquad*
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
store %struct.biquad* %0, %struct.biquad** %4
store double %1, double* %5
store double %2, double* %6
store double 0.000000e+00, double* %7
%27 = load double, double* %5
store double %27, double* %9
store double 1.000000e+00, double* %10
%28 = load double, double* %9
%29 = load double, double* %10
%30 = fcmp olt double %28, %29
br i1 %30, label %31, label %33
31: ; preds = %3
%32 = load double, double* %9
br label %35
33: ; preds = %3
%34 = load double, double* %10
br label %35
35: ; preds = %33, %31
%36 = phi double [ %32, %31 ], [ %34, %33 ]
store double %36, double* %11
%37 = load double, double* %11
store double %37, double* %8
%38 = load double, double* %7
%39 = load double, double* %8
%40 = fcmp ogt double %38, %39
br i1 %40, label %41, label %43
41: ; preds = %35
%42 = load double, double* %7
br label %45
43: ; preds = %35
%44 = load double, double* %8
br label %45
45: ; preds = %43, %41
%46 = phi double [ %42, %41 ], [ %44, %43 ]
store double %46, double* %12
%47 = load double, double* %12
store double %47, double* %5
%48 = load double, double* %6
%49 = fdiv double %48, 4.000000e+01
%50 = call double @pow(double 1.000000e+01, double %49)
store double %50, double* %13
%51 = load double, double* %5
%52 = fcmp oeq double %51, 1.000000e+00
br i1 %52, label %53, label %56
53: ; preds = %45
%54 = load %struct.biquad*, %struct.biquad** %4
%55 = call i32 (%struct.biquad*, i32, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @set_coefficient to i32 (%struct.biquad*, i32, i32, i32, i32, i32, i32, ...)*)(%struct.biquad* %54, i32 1, i32 0, i32 0, i32 1, i32 0, i32 0)
br label %144
56: ; preds = %45
%57 = load double, double* %5
%58 = fcmp ogt double %57, 0.000000e+00
br i1 %58, label %59, label %137
59: ; preds = %56
%60 = load double, double* %5
%61 = fmul double 0x400921FB54442D18, %60
store double %61, double* %14
store double 1.000000e+00, double* %15
%62 = load double, double* %14
%63 = call double @sin(double %62)
%64 = fmul double 5.000000e-01, %63
%65 = load double, double* %13
%66 = load double, double* %13
%67 = fdiv double 1.000000e+00, %66
%68 = fadd double %65, %67
%69 = load double, double* %15
%70 = fdiv double 1.000000e+00, %69
%71 = fsub double %70, 1.000000e+00
%72 = call double @llvm.fmuladd.f64(double %68, double %71, double 2.000000e+00)
%73 = call double @sqrt(double %72)
%74 = fmul double %64, %73
store double %74, double* %16
%75 = load double, double* %14
%76 = call double @cos(double %75)
store double %76, double* %17
%77 = load double, double* %13
%78 = call double @sqrt(double %77)
%79 = fmul double 2.000000e+00, %78
%80 = load double, double* %16
%81 = fmul double %79, %80
store double %81, double* %18
%82 = load double, double* %13
%83 = fadd double %82, 1.000000e+00
store double %83, double* %19
%84 = load double, double* %13
%85 = fsub double %84, 1.000000e+00
store double %85, double* %20
%86 = load double, double* %13
%87 = load double, double* %19
%88 = load double, double* %20
%89 = load double, double* %17
%90 = call double @llvm.fmuladd.f64(double %88, double %89, double %87)
%91 = load double, double* %18
%92 = fadd double %90, %91
%93 = fmul double %86, %92
store double %93, double* %21
%94 = load double, double* %13
%95 = fmul double -2.000000e+00, %94
%96 = load double, double* %20
%97 = load double, double* %19
%98 = load double, double* %17
%99 = call double @llvm.fmuladd.f64(double %97, double %98, double %96)
%100 = fmul double %95, %99
store double %100, double* %22
%101 = load double, double* %13
%102 = load double, double* %19
%103 = load double, double* %20
%104 = load double, double* %17
%105 = call double @llvm.fmuladd.f64(double %103, double %104, double %102)
%106 = load double, double* %18
%107 = fsub double %105, %106
%108 = fmul double %101, %107
store double %108, double* %23
%109 = load double, double* %19
%110 = load double, double* %20
%111 = load double, double* %17
%112 = fneg double %110
%113 = call double @llvm.fmuladd.f64(double %112, double %111, double %109)
%114 = load double, double* %18
%115 = fadd double %113, %114
store double %115, double* %24
%116 = load double, double* %20
%117 = load double, double* %19
%118 = load double, double* %17
%119 = fneg double %117
%120 = call double @llvm.fmuladd.f64(double %119, double %118, double %116)
%121 = fmul double 2.000000e+00, %120
store double %121, double* %25
%122 = load double, double* %19
%123 = load double, double* %20
%124 = load double, double* %17
%125 = fneg double %123
%126 = call double @llvm.fmuladd.f64(double %125, double %124, double %122)
%127 = load double, double* %18
%128 = fsub double %126, %127
store double %128, double* %26
%129 = load %struct.biquad*, %struct.biquad** %4
%130 = load double, double* %21
%131 = load double, double* %22
%132 = load double, double* %23
%133 = load double, double* %24
%134 = load double, double* %25
%135 = load double, double* %26
%136 = call i32 (%struct.biquad*, double, double, double, double, double, double, ...) bitcast (i32 (...)* @set_coefficient to i32 (%struct.biquad*, double, double, double, double, double, double, ...)*)(%struct.biquad* %129, double %130, double %131, double %132, double %133, double %134, double %135)
br label %143
137: ; preds = %56
%138 = load %struct.biquad*, %struct.biquad** %4
%139 = load double, double* %13
%140 = load double, double* %13
%141 = fmul double %139, %140
%142 = call i32 (%struct.biquad*, double, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @set_coefficient to i32 (%struct.biquad*, double, i32, i32, i32, i32, i32, ...)*)(%struct.biquad* %138, double %141, i32 0, i32 0, i32 1, i32 0, i32 0)
br label %143
143: ; preds = %137, %59
br label %144
144: ; preds = %143, %53
ret void
}

LLVM IR (-O2):
%struct.biquad = type opaque
define void @biquad_highshelf(%struct.biquad* %0, double %1, double %2) {
%4 = fcmp olt double %1, 1.000000e+00
%5 = select i1 %4, double %1, double 1.000000e+00
%6 = fcmp olt double %5, 0.000000e+00
%7 = select i1 %6, double 0.000000e+00, double %5
%8 = fdiv double %2, 4.000000e+01
%9 = tail call double @pow(double 1.000000e+01, double %8)
%10 = fcmp oeq double %7, 1.000000e+00
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = tail call i32 (%struct.biquad*, i32, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @set_coefficient to i32 (%struct.biquad*, i32, i32, i32, i32, i32, i32, ...)*)(%struct.biquad* %0, i32 1, i32 0, i32 0, i32 1, i32 0, i32 0)
br label %49
13: ; preds = %3
%14 = fcmp ogt double %7, 0.000000e+00
br i1 %14, label %15, label %46
15: ; preds = %13
%16 = fmul double %7, 0x400921FB54442D18
%17 = tail call double @sin(double %16)
%18 = fmul double %17, 5.000000e-01
%19 = fdiv double 1.000000e+00, %9
%20 = fadd double %9, %19
%21 = tail call double @llvm.fmuladd.f64(double %20, double 0.000000e+00, double 2.000000e+00)
%22 = tail call double @sqrt(double %21)
%23 = fmul double %18, %22
%24 = tail call double @cos(double %16)
%25 = tail call double @sqrt(double %9)
%26 = fmul double %25, 2.000000e+00
%27 = fmul double %23, %26
%28 = fadd double %9, 1.000000e+00
%29 = fadd double %9, -1.000000e+00
%30 = tail call double @llvm.fmuladd.f64(double %29, double %24, double %28)
%31 = fadd double %30, %27
%32 = fmul double %9, %31
%33 = fmul double %9, -2.000000e+00
%34 = tail call double @llvm.fmuladd.f64(double %28, double %24, double %29)
%35 = fmul double %33, %34
%36 = fsub double %30, %27
%37 = fmul double %9, %36
%38 = fneg double %29
%39 = tail call double @llvm.fmuladd.f64(double %38, double %24, double %28)
%40 = fadd double %39, %27
%41 = fneg double %28
%42 = tail call double @llvm.fmuladd.f64(double %41, double %24, double %29)
%43 = fmul double %42, 2.000000e+00
%44 = fsub double %39, %27
%45 = tail call i32 (%struct.biquad*, double, double, double, double, double, double, ...) bitcast (i32 (...)* @set_coefficient to i32 (%struct.biquad*, double, double, double, double, double, double, ...)*)(%struct.biquad* %0, double %32, double %35, double %37, double %40, double %43, double %44)
br label %49
46: ; preds = %13
%47 = fmul double %9, %9
%48 = tail call i32 (%struct.biquad*, double, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @set_coefficient to i32 (%struct.biquad*, double, i32, i32, i32, i32, i32, ...)*)(%struct.biquad* %0, double %47, i32 0, i32 0, i32 1, i32 0, i32 0)
br label %49
49: ; preds = %15, %46, %11
ret void
}