void biquad_peaking(struct biquad *bq, double frequency, double Q,
                    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;
  });
  Q = ({
    __typeof__(0.0) _a = (0.0);
    __typeof__(Q) _b = (Q);
    _a > _b ? _a : _b;
  });
  double A = pow(10.0, db_gain / 40);
  if (frequency > 0 && frequency < 1) {
    if (Q > 0) {
      double w0 = 3.14159265358979323846 * frequency;
      double alpha = sin(w0) / (2 * Q);
      double k = cos(w0);
      double b0 = 1 + alpha * A;
      double b1 = -2 * k;
      double b2 = 1 - alpha * A;
      double a0 = 1 + alpha / A;
      double a1 = -2 * k;
      double a2 = 1 - alpha / A;
      set_coefficient(bq, b0, b1, b2, a0, a1, a2);
    } else {
      set_coefficient(bq, A * A, 0, 0, 1, 0, 0);
    }
  } else {
    set_coefficient(bq, 1, 0, 0, 1, 0, 0);
  }
}


x86 assembly (clang, -O0):
<biquad_peaking>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe88(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a3 <biquad_peaking+0x63>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
jmp    11b0 <biquad_peaking+0x70>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    11e9 <biquad_peaking+0xa9>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
jmp    11f6 <biquad_peaking+0xb6>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    1241 <biquad_peaking+0x101>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
jmp    124e <biquad_peaking+0x10e>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  0xd9e(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xd8a(%rip),%xmm0
call   1060 <pow@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1435 <biquad_peaking+0x2f5>
movsd  0xd5e(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1435 <biquad_peaking+0x2f5>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    140a <biquad_peaking+0x2ca>
movsd  0xd61(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
call   1030 <sin@plt>
movsd  0xd3d(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xce7(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xceb(%rip),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xc96(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x80(%rbp),%xmm1
divsd  -0x70(%rbp),%xmm1
movsd  0xc78(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  0xc7c(%rip),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x80(%rbp),%xmm1
divsd  -0x70(%rbp),%xmm1
movsd  0xc42(%rip),%xmm0
subsd  %xmm1,%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    1430 <biquad_peaking+0x2f0>
mov    -0x8(%rbp),%rdi
movsd  -0x70(%rbp),%xmm0
mulsd  -0x70(%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    1459 <biquad_peaking+0x319>
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>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<biquad_peaking>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm1,0x10(%rsp)
mov    %rdi,%rbx
minsd  0xeaa(%rip),%xmm0
xorpd  %xmm1,%xmm1
maxsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
divsd  0xe9c(%rip),%xmm2
movsd  0xe9c(%rip),%xmm0
movapd %xmm2,%xmm1
call   1060 <pow@plt>
xorpd  %xmm4,%xmm4
movsd  0x18(%rsp),%xmm2
ucomisd %xmm4,%xmm2
jbe    1258 <biquad_peaking+0x118>
movapd %xmm0,%xmm1
movsd  0xe63(%rip),%xmm0
ucomisd %xmm2,%xmm0
jbe    1258 <biquad_peaking+0x118>
maxsd  0x10(%rsp),%xmm4
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
jbe    1281 <biquad_peaking+0x141>
mulsd  0xe55(%rip),%xmm2
movsd  %xmm2,0x18(%rsp)
movapd %xmm2,%xmm0
movsd  %xmm1,0x10(%rsp)
movsd  %xmm4,0x8(%rsp)
call   1030 <sin@plt>
movsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1050 <cos@plt>
movapd %xmm0,%xmm1
movsd  0x8(%rsp),%xmm5
movapd %xmm5,%xmm0
movsd  0x10(%rsp),%xmm3
mulsd  %xmm3,%xmm0
mulsd  0xe03(%rip),%xmm1
movsd  0xddb(%rip),%xmm4
movapd %xmm4,%xmm2
subsd  %xmm0,%xmm2
addsd  %xmm4,%xmm0
divsd  %xmm3,%xmm5
movapd %xmm5,%xmm3
addsd  %xmm4,%xmm3
subsd  %xmm5,%xmm4
movapd %xmm4,%xmm5
mov    %rbx,%rdi
movapd %xmm1,%xmm4
mov    $0x6,%al
add    $0x20,%rsp
pop    %rbx
jmp    1040 <set_coefficient@plt>
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
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>

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

LLVM IR (-O2):
%struct.biquad = type opaque
define void @biquad_peaking(%struct.biquad* %0, double %1, double %2, double %3) {
%5 = fcmp olt double %1, 1.000000e+00
%6 = select i1 %5, double %1, double 1.000000e+00
%7 = fcmp olt double %6, 0.000000e+00
%8 = select i1 %7, double 0.000000e+00, double %6
%9 = fcmp olt double %2, 0.000000e+00
%10 = select i1 %9, double 0.000000e+00, double %2
%11 = fdiv double %3, 4.000000e+01
%12 = tail call double @pow(double 1.000000e+01, double %11)
%13 = fcmp ogt double %8, 0.000000e+00
%14 = fcmp olt double %8, 1.000000e+00
%15 = and i1 %13, %14
br i1 %15, label %16, label %35
16: ; preds = %4
%17 = fcmp ogt double %10, 0.000000e+00
br i1 %17, label %18, label %32
18: ; preds = %16
%19 = fmul double %8, 0x400921FB54442D18
%20 = tail call double @sin(double %19)
%21 = fmul double %10, 2.000000e+00
%22 = fdiv double %20, %21
%23 = tail call double @cos(double %19)
%24 = tail call double @llvm.fmuladd.f64(double %22, double %12, double 1.000000e+00)
%25 = fmul double %23, -2.000000e+00
%26 = fneg double %22
%27 = tail call double @llvm.fmuladd.f64(double %26, double %12, double 1.000000e+00)
%28 = fdiv double %22, %12
%29 = fadd double %28, 1.000000e+00
%30 = fsub double 1.000000e+00, %28
%31 = 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 %24, double %25, double %27, double %29, double %25, double %30)
br label %37
32: ; preds = %16
%33 = fmul double %12, %12
%34 = 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 %33, i32 0, i32 0, i32 1, i32 0, i32 0)
br label %37
35: ; preds = %4
%36 = 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 %37
37: ; preds = %18, %32, %35
ret void
}