float adgold_lowpass_iir(int i, float NewSample) {
  float ACoef[2 + 1] = {0.00009159473951071446, 0.00018318947902142891,
                        0.00009159473951071446};
  float BCoef[2 + 1] = {1.00000000000000000000, -1.97223372919526560000,
                        0.97261396931306277000};
  static float y[2][2 + 1];
  static float x[2][2 + 1];
  int n;
  for (n = 2; n > 0; n--) {
    x[i][n] = x[i][n - 1];
    y[i][n] = y[i][n - 1];
  }
  x[i][0] = NewSample;
  y[i][0] = ACoef[0] * x[i][0];
  for (n = 1; n <= 2; n++)
    y[i][0] += ACoef[n] * x[i][n] - BCoef[n] * y[i][n];
  return y[i][0];
}


x86 assembly (clang, -O0):
<adgold_lowpass_iir>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    0xeed(%rip),%rax
mov    %rax,-0x14(%rbp)
mov    0xeeb(%rip),%eax
mov    %eax,-0xc(%rbp)
mov    0xee5(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xee3(%rip),%eax
mov    %eax,-0x18(%rbp)
movl   $0x2,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    11c9 <adgold_lowpass_iir+0xc9>
movslq -0x4(%rbp),%rcx
lea    0x2f00(%rip),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movslq -0x4(%rbp),%rcx
lea    0x2ee0(%rip),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movslq -0x4(%rbp),%rcx
lea    0x2ea5(%rip),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movslq -0x4(%rbp),%rcx
lea    0x2e85(%rip),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    113b <adgold_lowpass_iir+0x3b>
movss  -0x8(%rbp),%xmm0
movslq -0x4(%rbp),%rcx
lea    0x2e77(%rip),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movss  %xmm0,(%rax)
movss  -0x14(%rbp),%xmm0
movslq -0x4(%rbp),%rcx
lea    0x2e5c(%rip),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mulss  (%rax),%xmm0
movslq -0x4(%rbp),%rcx
lea    0x2e26(%rip),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movss  %xmm0,(%rax)
movl   $0x1,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jg     12ad <adgold_lowpass_iir+0x1ad>
movslq -0x24(%rbp),%rax
movss  -0x14(%rbp,%rax,4),%xmm0
movslq -0x4(%rbp),%rcx
lea    0x2e15(%rip),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
movslq -0x24(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm1
movslq -0x4(%rbp),%rcx
lea    0x2dd0(%rip),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
mulss  (%rax,%rcx,4),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movslq -0x4(%rbp),%rcx
lea    0x2da0(%rip),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
addss  (%rax),%xmm0
movss  %xmm0,(%rax)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    121c <adgold_lowpass_iir+0x11c>
movslq -0x4(%rbp),%rcx
lea    0x2d78(%rip),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movss  (%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<adgold_lowpass_iir>:
movslq %edi,%rax
shl    $0x2,%rax
lea    (%rax,%rax,2),%rax
lea    0x2f3e(%rip),%rcx
movss  0x4(%rcx,%rax,1),%xmm1
movss  %xmm1,0x8(%rcx,%rax,1)
lea    0x2f0b(%rip),%rdx
movss  0x4(%rdx,%rax,1),%xmm2
movss  %xmm2,0x8(%rdx,%rax,1)
movss  (%rcx,%rax,1),%xmm3
movss  %xmm3,0x4(%rcx,%rax,1)
movss  (%rdx,%rax,1),%xmm4
movss  %xmm4,0x4(%rdx,%rax,1)
movss  %xmm0,(%rcx,%rax,1)
movss  0xeac(%rip),%xmm5
mulss  %xmm5,%xmm0
mulss  0xea4(%rip),%xmm4
mulss  0xea0(%rip),%xmm3
addss  %xmm4,%xmm3
addss  %xmm3,%xmm0
mulss  0xe94(%rip),%xmm2
mulss  %xmm5,%xmm1
addss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,(%rdx,%rax,1)
ret

LLVM IR (-O0):
@__const.adgold_lowpass_iir.ACoef = [3 x float] [float 0x3F1802D1A0000000, float 0x3F2802D1A0000000, float 0x3F1802D1A0000000]
@__const.adgold_lowpass_iir.BCoef = [3 x float] [float 1.000000e+00, float 0xBFFF8E4500000000, float 0x3FEF1FA760000000]
@adgold_lowpass_iir.y = internal global [2 x [3 x float]] zeroinitializer
@adgold_lowpass_iir.x = internal global [2 x [3 x float]] zeroinitializer
define float @adgold_lowpass_iir(i32 %0, float %1) {
%3 = alloca i32
%4 = alloca float
%5 = alloca [3 x float]
%6 = alloca [3 x float]
%7 = alloca i32
store i32 %0, i32* %3
store float %1, float* %4
%8 = bitcast [3 x float]* %5 to i8*
%9 = bitcast [3 x float]* %6 to i8*
store i32 2, i32* %7
br label %10
10: ; preds = %42, %2
%11 = load i32, i32* %7
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %45
13: ; preds = %10
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.x, i64 0, i64 %15
%17 = load i32, i32* %7
%18 = sub nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [3 x float], [3 x float]* %16, i64 0, i64 %19
%21 = load float, float* %20
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.x, i64 0, i64 %23
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [3 x float], [3 x float]* %24, i64 0, i64 %26
store float %21, float* %27
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.y, i64 0, i64 %29
%31 = load i32, i32* %7
%32 = sub nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [3 x float], [3 x float]* %30, i64 0, i64 %33
%35 = load float, float* %34
%36 = load i32, i32* %3
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.y, i64 0, i64 %37
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [3 x float], [3 x float]* %38, i64 0, i64 %40
store float %35, float* %41
br label %42
42: ; preds = %13
%43 = load i32, i32* %7
%44 = add nsw i32 %43, -1
store i32 %44, i32* %7
br label %10
45: ; preds = %10
%46 = load float, float* %4
%47 = load i32, i32* %3
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.x, i64 0, i64 %48
%50 = getelementptr inbounds [3 x float], [3 x float]* %49, i64 0, i64 0
store float %46, float* %50
%51 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 0
%52 = load float, float* %51
%53 = load i32, i32* %3
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.x, i64 0, i64 %54
%56 = getelementptr inbounds [3 x float], [3 x float]* %55, i64 0, i64 0
%57 = load float, float* %56
%58 = fmul float %52, %57
%59 = load i32, i32* %3
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.y, i64 0, i64 %60
%62 = getelementptr inbounds [3 x float], [3 x float]* %61, i64 0, i64 0
store float %58, float* %62
store i32 1, i32* %7
br label %63
63: ; preds = %98, %45
%64 = load i32, i32* %7
%65 = icmp sle i32 %64, 2
br i1 %65, label %66, label %101
66: ; preds = %63
%67 = load i32, i32* %7
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 %68
%70 = load float, float* %69
%71 = load i32, i32* %3
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.x, i64 0, i64 %72
%74 = load i32, i32* %7
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [3 x float], [3 x float]* %73, i64 0, i64 %75
%77 = load float, float* %76
%78 = load i32, i32* %7
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 %79
%81 = load float, float* %80
%82 = load i32, i32* %3
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.y, i64 0, i64 %83
%85 = load i32, i32* %7
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [3 x float], [3 x float]* %84, i64 0, i64 %86
%88 = load float, float* %87
%89 = fmul float %81, %88
%90 = fneg float %89
%91 = call float @llvm.fmuladd.f32(float %70, float %77, float %90)
%92 = load i32, i32* %3
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.y, i64 0, i64 %93
%95 = getelementptr inbounds [3 x float], [3 x float]* %94, i64 0, i64 0
%96 = load float, float* %95
%97 = fadd float %96, %91
store float %97, float* %95
br label %98
98: ; preds = %66
%99 = load i32, i32* %7
%100 = add nsw i32 %99, 1
store i32 %100, i32* %7
br label %63
101: ; preds = %63
%102 = load i32, i32* %3
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.y, i64 0, i64 %103
%105 = getelementptr inbounds [3 x float], [3 x float]* %104, i64 0, i64 0
%106 = load float, float* %105
ret float %106
}

LLVM IR (-O2):
@adgold_lowpass_iir.y = internal unnamed_addr global [2 x [3 x float]] zeroinitializer
@adgold_lowpass_iir.x = internal unnamed_addr global [2 x [3 x float]] zeroinitializer
define float @adgold_lowpass_iir(i32 %0, float %1) {
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.x, i64 0, i64 %3, i64 1
%5 = load float, float* %4
%6 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.x, i64 0, i64 %3, i64 2
store float %5, float* %6
%7 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.y, i64 0, i64 %3, i64 1
%8 = load float, float* %7
%9 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.y, i64 0, i64 %3, i64 2
store float %8, float* %9
%10 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.x, i64 0, i64 %3, i64 0
%11 = load float, float* %10
store float %11, float* %4
%12 = getelementptr inbounds [2 x [3 x float]], [2 x [3 x float]]* @adgold_lowpass_iir.y, i64 0, i64 %3, i64 0
%13 = load float, float* %12
store float %13, float* %7
store float %1, float* %10
%14 = fmul float %1, 0x3F1802D1A0000000
%15 = fmul float %13, 0x3FFF8E4500000000
%16 = tail call float @llvm.fmuladd.f32(float %11, float 0x3F2802D1A0000000, float %15)
%17 = fadd float %14, %16
%18 = fmul float %8, 0xBFEF1FA760000000
%19 = tail call float @llvm.fmuladd.f32(float %5, float 0x3F1802D1A0000000, float %18)
%20 = fadd float %17, %19
store float %20, float* %12
ret float %20
}