double dddsp_calc_iir_gain_high_double(double a[], double b[], int poles) {
  int i;
  double sa = 0, sb = 0;
  for (i = 0; i <= poles; i++) {
    sa += *a++ * (1.0 - 2.0 * (i & 1));
    sb += *b++ * (1.0 - 2.0 * (i & 1));
  }
  double gain = sa / (1.0 - sb);
  return gain;
}


x86 assembly (clang, -O0):
<dddsp_calc_iir_gain_high_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11be <dddsp_calc_iir_gain_high_double+0xbe>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%eax
and    $0x1,%eax
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm1
movsd  0xea5(%rip),%xmm2
subsd  %xmm1,%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%eax
and    $0x1,%eax
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm1
movsd  0xe66(%rip),%xmm2
subsd  %xmm1,%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1126 <dddsp_calc_iir_gain_high_double+0x26>
movsd  -0x20(%rbp),%xmm0
movsd  0xe35(%rip),%xmm1
subsd  -0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dddsp_calc_iir_gain_high_double>:
test   %edx,%edx
js     1160 <dddsp_calc_iir_gain_high_double+0x60>
lea    0x1(%rdx),%r8d
test   %edx,%edx
je     1166 <dddsp_calc_iir_gain_high_double+0x66>
mov    %r8d,%ecx
and    $0xfffffffe,%ecx
xorpd  %xmm1,%xmm1
xor    %eax,%eax
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
movsd  (%rdi,%rax,8),%xmm0
movhpd (%rsi,%rax,8),%xmm0
movsd  0x8(%rdi,%rax,8),%xmm2
addpd  %xmm1,%xmm0
movhpd 0x8(%rsi,%rax,8),%xmm2
movapd %xmm0,%xmm1
subpd  %xmm2,%xmm1
add    $0xfffffffffffffff0,%rdx
add    $0x2,%rax
cmp    %eax,%ecx
jne    1120 <dddsp_calc_iir_gain_high_double+0x20>
subpd  %xmm2,%xmm0
sub    %rdx,%rdi
sub    %rdx,%rsi
test   $0x1,%r8b
jne    1170 <dddsp_calc_iir_gain_high_double+0x70>
jmp    117c <dddsp_calc_iir_gain_high_double+0x7c>
xorpd  %xmm0,%xmm0
jmp    117c <dddsp_calc_iir_gain_high_double+0x7c>
xorpd  %xmm1,%xmm1
test   $0x1,%r8b
je     117c <dddsp_calc_iir_gain_high_double+0x7c>
movsd  (%rdi),%xmm0
movhpd (%rsi),%xmm0
addpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
movsd  0xe74(%rip),%xmm2
subsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @dddsp_calc_iir_gain_high_double(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
store double 0.000000e+00, double* %8
store double 0.000000e+00, double* %9
store i32 0, i32* %7
br label %11
11: ; preds = %34, %3
%12 = load i32, i32* %7
%13 = load i32, i32* %6
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %37
15: ; preds = %11
%16 = load double*, double** %4
%17 = getelementptr inbounds double, double* %16, i32 1
store double* %17, double** %4
%18 = load double, double* %16
%19 = load i32, i32* %7
%20 = and i32 %19, 1
%21 = sitofp i32 %20 to double
%22 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %21, double 1.000000e+00)
%23 = load double, double* %8
%24 = call double @llvm.fmuladd.f64(double %18, double %22, double %23)
store double %24, double* %8
%25 = load double*, double** %5
%26 = getelementptr inbounds double, double* %25, i32 1
store double* %26, double** %5
%27 = load double, double* %25
%28 = load i32, i32* %7
%29 = and i32 %28, 1
%30 = sitofp i32 %29 to double
%31 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %30, double 1.000000e+00)
%32 = load double, double* %9
%33 = call double @llvm.fmuladd.f64(double %27, double %31, double %32)
store double %33, double* %9
br label %34
34: ; preds = %15
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %11
37: ; preds = %11
%38 = load double, double* %8
%39 = load double, double* %9
%40 = fsub double 1.000000e+00, %39
%41 = fdiv double %38, %40
store double %41, double* %10
%42 = load double, double* %10
ret double %42
}

LLVM IR (-O2):
define double @dddsp_calc_iir_gain_high_double(double* nocapture %0, double* nocapture %1, i32 %2) {
%4 = icmp slt i32 %2, 0
br i1 %4, label %46, label %5
5: ; preds = %3
%6 = add i32 %2, 1
%7 = and i32 %6, 1
%8 = icmp eq i32 %2, 0
br i1 %8, label %34, label %9
9: ; preds = %5
%10 = and i32 %6, -2
br label %11
11: ; preds = %11, %9
%12 = phi double* [ %0, %9 ], [ %23, %11 ]
%13 = phi double* [ %1, %9 ], [ %25, %11 ]
%14 = phi <2 x double> [ zeroinitializer, %9 ], [ %29, %11 ]
%15 = phi i32 [ 0, %9 ], [ %30, %11 ]
%16 = getelementptr inbounds double, double* %12, i64 1
%17 = load double, double* %12
%18 = getelementptr inbounds double, double* %13, i64 1
%19 = load double, double* %13
%20 = insertelement <2 x double> poison, double %17, i64 0
%21 = insertelement <2 x double> %20, double %19, i64 1
%22 = fadd <2 x double> %21, %14
%23 = getelementptr inbounds double, double* %12, i64 2
%24 = load double, double* %16
%25 = getelementptr inbounds double, double* %13, i64 2
%26 = load double, double* %18
%27 = insertelement <2 x double> poison, double %24, i64 0
%28 = insertelement <2 x double> %27, double %26, i64 1
%29 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %28, <2 x double> <double -1.000000e+00, double -1.000000e+00>, <2 x double> %22)
%30 = add i32 %15, 2
%31 = icmp eq i32 %30, %10
br i1 %31, label %32, label %11
32: ; preds = %11
%33 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %28, <2 x double> <double -1.000000e+00, double -1.000000e+00>, <2 x double> %22)
br label %34
34: ; preds = %32, %5
%35 = phi <2 x double> [ undef, %5 ], [ %33, %32 ]
%36 = phi double* [ %0, %5 ], [ %23, %32 ]
%37 = phi double* [ %1, %5 ], [ %25, %32 ]
%38 = phi <2 x double> [ zeroinitializer, %5 ], [ %29, %32 ]
%39 = icmp eq i32 %7, 0
br i1 %39, label %46, label %40
40: ; preds = %34
%41 = load double, double* %36
%42 = load double, double* %37
%43 = insertelement <2 x double> poison, double %41, i64 0
%44 = insertelement <2 x double> %43, double %42, i64 1
%45 = fadd <2 x double> %44, %38
br label %46
46: ; preds = %40, %34, %3
%47 = phi <2 x double> [ zeroinitializer, %3 ], [ %35, %34 ], [ %45, %40 ]
%48 = extractelement <2 x double> %47, i64 1
%49 = fsub double 1.000000e+00, %48
%50 = extractelement <2 x double> %47, i64 0
%51 = fdiv double %50, %49
ret double %51
}