void biquad_allpass(struct biquad *bq, double frequency, double Q) {
  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;
  });
  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;
      double b1 = -2 * k;
      double b2 = 1 + 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, 1, 0, 0, 1, 0, 0);
  }
}


x86 assembly (clang, -O0):
<biquad_allpass>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%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  0xe9d(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    118e <biquad_allpass+0x5e>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
jmp    119b <biquad_allpass+0x6b>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11d4 <biquad_allpass+0xa4>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
jmp    11e1 <biquad_allpass+0xb1>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
ucomisd -0x58(%rbp),%xmm0
jbe    122c <biquad_allpass+0xfc>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
jmp    1239 <biquad_allpass+0x109>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13ab <biquad_allpass+0x27b>
movsd  0xd96(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    13ab <biquad_allpass+0x27b>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1380 <biquad_allpass+0x250>
movsd  0xd89(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1030 <sin@plt>
movsd  0xd65(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  0xd30(%rip),%xmm0
subsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xd26(%rip),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xd09(%rip),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xcf4(%rip),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xce7(%rip),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xcca(%rip),%xmm0
subsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0x8(%rbp),%rdi
movsd  -0x80(%rbp),%xmm0
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0x98(%rbp),%xmm3
ff
movsd  -0xa0(%rbp),%xmm4
ff
movsd  -0xa8(%rbp),%xmm5
ff
mov    $0x6,%al
call   1040 <set_coefficient@plt>
jmp    13a6 <biquad_allpass+0x276>
mov    -0x8(%rbp),%rdi
mov    $0xffffffff,%esi
xor    %r9d,%r9d
mov    $0x1,%r8d
mov    %r9d,%edx
mov    %r9d,%ecx
movl   $0x0,(%rsp)
mov    $0x0,%al
call   1040 <set_coefficient@plt>
jmp    13cf <biquad_allpass+0x29f>
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    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<biquad_allpass>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
minsd  0xec0(%rip),%xmm0
xorpd  %xmm4,%xmm4
xorpd  %xmm2,%xmm2
maxsd  %xmm0,%xmm2
ucomisd %xmm4,%xmm2
jbe    11f7 <biquad_allpass+0xc7>
movsd  0xea2(%rip),%xmm0
ucomisd %xmm2,%xmm0
jbe    11f7 <biquad_allpass+0xc7>
maxsd  %xmm1,%xmm4
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
jbe    1208 <biquad_allpass+0xd8>
mulsd  0xe86(%rip),%xmm2
movsd  %xmm2,0x18(%rsp)
movapd %xmm2,%xmm0
movsd  %xmm4,0x10(%rsp)
call   1030 <sin@plt>
movsd  0x10(%rsp),%xmm1
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
call   1050 <cos@plt>
movapd %xmm0,%xmm1
movsd  0xe3e(%rip),%xmm3
movapd %xmm3,%xmm0
movsd  0x10(%rsp),%xmm2
subsd  %xmm2,%xmm0
mulsd  0xe38(%rip),%xmm1
addsd  %xmm3,%xmm2
mov    %rbx,%rdi
movapd %xmm2,%xmm3
movapd %xmm1,%xmm4
movapd %xmm0,%xmm5
mov    $0x6,%al
add    $0x20,%rsp
pop    %rbx
jmp    1040 <set_coefficient@plt>
movl   $0x0,(%rsp)
mov    %rbx,%rdi
mov    $0x1,%esi
jmp    1217 <biquad_allpass+0xe7>
movl   $0x0,(%rsp)
mov    %rbx,%rdi
mov    $0xffffffff,%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

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

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