double ZeroPoleFilter(double *pFa, double *pFb, int nCoeff, double fInput) {
  double fOut = 0;
  int iSection;
  static double pD[5] = {0, 0, 0, 0, 0};
  pD[0] = fInput;
  for (iSection = nCoeff - 1; iSection > 0; iSection--) {
    fOut = fOut + pFa[iSection] * pD[iSection];
    pD[0] = pD[0] - pFb[iSection] * pD[iSection];
    pD[iSection] = pD[iSection - 1];
  }
  fOut = fOut + pFa[0] * pD[0];
  return (double)fOut;
}


x86 assembly (clang, -O0):
<ZeroPoleFilter>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,0x2f07(%rip)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jle    11ea <ZeroPoleFilter+0xea>
movsd  -0x28(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x2c(%rbp),%rcx
lea    0x2ed7(%rip),%rax
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0x2ebd(%rip),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x2c(%rbp),%rcx
lea    0x2ea5(%rip),%rax
movsd  (%rax,%rcx,8),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2e79(%rip)
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    0x2e69(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
movslq -0x2c(%rbp),%rcx
lea    0x2e59(%rip),%rax
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
jmp    1132 <ZeroPoleFilter+0x32>
movsd  -0x28(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0x2e31(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ZeroPoleFilter>:
movsd  %xmm0,0x2f28(%rip)
xorpd  %xmm1,%xmm1
cmp    $0x2,%edx
jl     1186 <ZeroPoleFilter+0x86>
mov    %edx,%eax
mov    $0xfffffffe,%r9d
add    %rax,%r9
add    $0xffffffffffffffff,%rax
xorpd  %xmm1,%xmm1
lea    0x2f05(%rip),%r8
nopl   0x0(%rax,%rax,1)
mov    %eax,%edx
shl    $0x3,%rdx
movsd  (%rdx,%r8,1),%xmm2
movsd  (%rdi,%rdx,1),%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm3,%xmm1
mulsd  (%rsi,%rdx,1),%xmm2
subsd  %xmm2,%xmm0
movsd  %xmm0,0x2ed6(%rip)
mov    %r9d,%ecx
movsd  (%r8,%rcx,8),%xmm0
movsd  %xmm0,(%rdx,%r8,1)
movsd  0x2ebf(%rip),%xmm0
add    $0xffffffffffffffff,%r9
lea    -0x1(%rax),%rcx
add    $0x1,%rax
cmp    $0x2,%rax
mov    %rcx,%rax
jg     1130 <ZeroPoleFilter+0x30>
mulsd  (%rdi),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
@ZeroPoleFilter.pD = internal global [5 x double] zeroinitializer
define double @ZeroPoleFilter(double* %0, double* %1, i32 %2, double %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca i32
store double* %0, double** %5
store double* %1, double** %6
store i32 %2, i32* %7
store double %3, double* %8
store double 0.000000e+00, double* %9
%11 = load double, double* %8
store double %11, double* getelementptr inbounds ([5 x double], [5 x double]* @ZeroPoleFilter.pD, i64 0, i64 0)
%12 = load i32, i32* %7
%13 = sub nsw i32 %12, 1
store i32 %13, i32* %10
br label %14
14: ; preds = %49, %4
%15 = load i32, i32* %10
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %52
17: ; preds = %14
%18 = load double, double* %9
%19 = load double*, double** %5
%20 = load i32, i32* %10
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
%23 = load double, double* %22
%24 = load i32, i32* %10
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [5 x double], [5 x double]* @ZeroPoleFilter.pD, i64 0, i64 %25
%27 = load double, double* %26
%28 = call double @llvm.fmuladd.f64(double %23, double %27, double %18)
store double %28, double* %9
%29 = load double, double* getelementptr inbounds ([5 x double], [5 x double]* @ZeroPoleFilter.pD, i64 0, i64 0)
%30 = load double*, double** %6
%31 = load i32, i32* %10
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
%34 = load double, double* %33
%35 = load i32, i32* %10
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [5 x double], [5 x double]* @ZeroPoleFilter.pD, i64 0, i64 %36
%38 = load double, double* %37
%39 = fneg double %34
%40 = call double @llvm.fmuladd.f64(double %39, double %38, double %29)
store double %40, double* getelementptr inbounds ([5 x double], [5 x double]* @ZeroPoleFilter.pD, i64 0, i64 0)
%41 = load i32, i32* %10
%42 = sub nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [5 x double], [5 x double]* @ZeroPoleFilter.pD, i64 0, i64 %43
%45 = load double, double* %44
%46 = load i32, i32* %10
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [5 x double], [5 x double]* @ZeroPoleFilter.pD, i64 0, i64 %47
store double %45, double* %48
br label %49
49: ; preds = %17
%50 = load i32, i32* %10
%51 = add nsw i32 %50, -1
store i32 %51, i32* %10
br label %14
52: ; preds = %14
%53 = load double, double* %9
%54 = load double*, double** %5
%55 = getelementptr inbounds double, double* %54, i64 0
%56 = load double, double* %55
%57 = load double, double* getelementptr inbounds ([5 x double], [5 x double]* @ZeroPoleFilter.pD, i64 0, i64 0)
%58 = call double @llvm.fmuladd.f64(double %56, double %57, double %53)
store double %58, double* %9
%59 = load double, double* %9
ret double %59
}

LLVM IR (-O2):
@ZeroPoleFilter.pD = internal unnamed_addr global [5 x double] zeroinitializer
define double @ZeroPoleFilter(double* nocapture %0, double* nocapture %1, i32 %2, double %3) {
store double %3, double* getelementptr inbounds ([5 x double], [5 x double]* @ZeroPoleFilter.pD, i64 0, i64 0)
%5 = icmp sgt i32 %2, 1
br i1 %5, label %6, label %29
6: ; preds = %4
%7 = zext i32 %2 to i64
br label %8
8: ; preds = %8, %6
%9 = phi double [ %3, %6 ], [ %28, %8 ]
%10 = phi i64 [ %7, %6 ], [ %12, %8 ]
%11 = phi double [ 0.000000e+00, %6 ], [ %18, %8 ]
%12 = add nsw i64 %10, -1
%13 = and i64 %12, 4294967295
%14 = getelementptr inbounds double, double* %0, i64 %13
%15 = load double, double* %14
%16 = getelementptr inbounds [5 x double], [5 x double]* @ZeroPoleFilter.pD, i64 0, i64 %13
%17 = load double, double* %16
%18 = tail call double @llvm.fmuladd.f64(double %15, double %17, double %11)
%19 = getelementptr inbounds double, double* %1, i64 %13
%20 = load double, double* %19
%21 = fneg double %20
%22 = tail call double @llvm.fmuladd.f64(double %21, double %17, double %9)
store double %22, double* getelementptr inbounds ([5 x double], [5 x double]* @ZeroPoleFilter.pD, i64 0, i64 0)
%23 = add i64 %10, 4294967294
%24 = and i64 %23, 4294967295
%25 = getelementptr inbounds [5 x double], [5 x double]* @ZeroPoleFilter.pD, i64 0, i64 %24
%26 = load double, double* %25
store double %26, double* %16
%27 = icmp sgt i64 %10, 2
%28 = load double, double* getelementptr inbounds ([5 x double], [5 x double]* @ZeroPoleFilter.pD, i64 0, i64 0)
br i1 %27, label %8, label %29
29: ; preds = %8, %4
%30 = phi double [ %3, %4 ], [ %28, %8 ]
%31 = phi double [ 0.000000e+00, %4 ], [ %18, %8 ]
%32 = load double, double* %0
%33 = tail call double @llvm.fmuladd.f64(double %32, double %30, double %31)
ret double %33
}