void biquad_bandpass(struct biquad *bq, double frequency, double Q) {
  frequency = ({
    __typeof__(0.0) _a = (0.0);
    __typeof__(frequency) _b = (frequency);
    _a > _b ? _a : _b;
  });
  Q = ({
    __typeof__(0.0) _a = (0.0);
    __typeof__(Q) _b = (Q);
    _a > _b ? _a : _b;
  });
  if (frequency > 0 && frequency < 1) {
    double w0 = 3.14159265358979323846 * frequency;
    if (Q > 0) {
      double alpha = sin(w0) / (2 * Q);
      double k = cos(w0);
      double b0 = alpha;
      double b1 = 0;
      double b2 = -alpha;
      double a0 = 1 + alpha;
      double a1 = -2 * k;
      double a2 = 1 - alpha;
      set_coefficient(bq, b0, b1, b2, a0, a1, a2);
    } else {
      set_coefficient(bq, 1, 0, 0, 1, 0, 0);
    }
  } else {
    set_coefficient(bq, 0, 0, 0, 1, 0, 0);
  }
}


x86 assembly (clang, -O0):
<biquad_bandpass>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%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,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    117d <biquad_bandpass+0x4d>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    118a <biquad_bandpass+0x5a>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    11d5 <biquad_bandpass+0xa5>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    11e2 <biquad_bandpass+0xb2>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    133d <biquad_bandpass+0x20d>
movsd  0xded(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    133d <biquad_bandpass+0x20d>
movsd  0xde2(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1314 <biquad_bandpass+0x1e4>
movsd  -0x50(%rbp),%xmm0
call   1030 <sin@plt>
movsd  0xdc4(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xd54(%rip),%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xd52(%rip),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xd2d(%rip),%xmm0
subsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x8(%rbp),%rdi
movsd  -0x68(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm3
movsd  -0x88(%rbp),%xmm4
ff
movsd  -0x90(%rbp),%xmm5
ff
mov    $0x6,%al
call   1040 <set_coefficient@plt>
jmp    1338 <biquad_bandpass+0x208>
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    1361 <biquad_bandpass+0x231>
mov    -0x8(%rbp),%rdi
xor    %r9d,%r9d
mov    $0x1,%r8d
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
movl   $0x0,(%rsp)
mov    $0x0,%al
call   1040 <set_coefficient@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<biquad_bandpass>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
xorpd  %xmm4,%xmm4
xorpd  %xmm2,%xmm2
maxsd  %xmm0,%xmm2
ucomisd %xmm4,%xmm2
jbe    11f3 <biquad_bandpass+0xc3>
movsd  0xeaa(%rip),%xmm0
ucomisd %xmm2,%xmm0
jbe    11f3 <biquad_bandpass+0xc3>
maxsd  %xmm1,%xmm4
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
jbe    1201 <biquad_bandpass+0xd1>
mulsd  0xe8e(%rip),%xmm2
movsd  %xmm2,0x28(%rsp)
movapd %xmm2,%xmm0
movsd  %xmm4,0x10(%rsp)
call   1030 <sin@plt>
movsd  0x10(%rsp),%xmm1
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
movapd %xmm0,0x10(%rsp)
movsd  0x28(%rsp),%xmm0
call   1050 <cos@plt>
movapd %xmm0,%xmm4
movapd 0xe66(%rip),%xmm2
movapd 0x10(%rsp),%xmm0
xorpd  %xmm0,%xmm2
movapd %xmm0,%xmm3
mulsd  0xe40(%rip),%xmm4
movsd  0xe28(%rip),%xmm5
addsd  %xmm5,%xmm3
subsd  %xmm0,%xmm5
xorpd  %xmm1,%xmm1
mov    %rbx,%rdi
mov    $0x6,%al
add    $0x30,%rsp
pop    %rbx
jmp    1040 <set_coefficient@plt>
movl   $0x0,(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
jmp    1210 <biquad_bandpass+0xe0>
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    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.biquad = type opaque
define void @biquad_bandpass(%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
store %struct.biquad* %0, %struct.biquad** %4
store double %1, double* %5
store double %2, double* %6
store double 0.000000e+00, double* %7
%22 = load double, double* %5
store double %22, double* %8
%23 = load double, double* %7
%24 = load double, double* %8
%25 = fcmp ogt double %23, %24
br i1 %25, label %26, label %28
26: ; preds = %3
%27 = load double, double* %7
br label %30
28: ; preds = %3
%29 = load double, double* %8
br label %30
30: ; preds = %28, %26
%31 = phi double [ %27, %26 ], [ %29, %28 ]
store double %31, double* %9
%32 = load double, double* %9
store double %32, double* %5
store double 0.000000e+00, double* %10
%33 = load double, double* %6
store double %33, double* %11
%34 = load double, double* %10
%35 = load double, double* %11
%36 = fcmp ogt double %34, %35
br i1 %36, label %37, label %39
37: ; preds = %30
%38 = load double, double* %10
br label %41
39: ; preds = %30
%40 = load double, double* %11
br label %41
41: ; preds = %39, %37
%42 = phi double [ %38, %37 ], [ %40, %39 ]
store double %42, double* %12
%43 = load double, double* %12
store double %43, double* %6
%44 = load double, double* %5
%45 = fcmp ogt double %44, 0.000000e+00
br i1 %45, label %46, label %83
46: ; preds = %41
%47 = load double, double* %5
%48 = fcmp olt double %47, 1.000000e+00
br i1 %48, label %49, label %83
49: ; preds = %46
%50 = load double, double* %5
%51 = fmul double 0x400921FB54442D18, %50
store double %51, double* %13
%52 = load double, double* %6
%53 = fcmp ogt double %52, 0.000000e+00
br i1 %53, label %54, label %79
54: ; preds = %49
%55 = load double, double* %13
%56 = call double @sin(double %55)
%57 = load double, double* %6
%58 = fmul double 2.000000e+00, %57
%59 = fdiv double %56, %58
store double %59, double* %14
%60 = load double, double* %13
%61 = call double @cos(double %60)
store double %61, double* %15
%62 = load double, double* %14
store double %62, double* %16
store double 0.000000e+00, double* %17
%63 = load double, double* %14
%64 = fneg double %63
store double %64, double* %18
%65 = load double, double* %14
%66 = fadd double 1.000000e+00, %65
store double %66, double* %19
%67 = load double, double* %15
%68 = fmul double -2.000000e+00, %67
store double %68, double* %20
%69 = load double, double* %14
%70 = fsub double 1.000000e+00, %69
store double %70, double* %21
%71 = load %struct.biquad*, %struct.biquad** %4
%72 = load double, double* %16
%73 = load double, double* %17
%74 = load double, double* %18
%75 = load double, double* %19
%76 = load double, double* %20
%77 = load double, double* %21
%78 = 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* %71, double %72, double %73, double %74, double %75, double %76, double %77)
br label %82
79: ; preds = %49
%80 = load %struct.biquad*, %struct.biquad** %4
%81 = 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* %80, i32 1, i32 0, i32 0, i32 1, i32 0, i32 0)
br label %82
82: ; preds = %79, %54
br label %86
83: ; preds = %46, %41
%84 = load %struct.biquad*, %struct.biquad** %4
%85 = 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* %84, i32 0, i32 0, i32 0, i32 1, i32 0, i32 0)
br label %86
86: ; preds = %83, %82
ret void
}

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