float iir(float NewSample) {
  float ACoef[4 + 1] = {0.00018539265053394222, 0.00074157060213576886,
                        0.00111235590320365330, 0.00074157060213576886,
                        0.00018539265053394222};
  float BCoef[4 + 1] = {1.00000000000000000000, -3.34406783771187310000,
                        4.23886395088406330000, -2.40934285658631710000,
                        0.51747819978804011000};
  static float y[4 + 1];
  static float x[4 + 1];
  int n;
  for (n = 4; n > 0; n--) {
    x[n] = x[n - 1];
    y[n] = y[n - 1];
  }
  x[0] = NewSample;
  y[0] = ACoef[0] * x[0];
  for (n = 1; n <= 4; n++)
    y[0] += ACoef[n] * x[n] - BCoef[n] * y[n];
  return y[0];
}


x86 assembly (clang, -O0):
<iir>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    0xef0(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeed(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeeb(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xef1(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeee(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xeec(%rip),%eax
mov    %eax,-0x30(%rbp)
movl   $0x4,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jle    11b0 <iir+0xb0>
mov    -0x44(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    0x2ee8(%rip),%rax
movss  (%rax,%rcx,4),%xmm0
movslq -0x44(%rbp),%rcx
lea    0x2ed8(%rip),%rax
movss  %xmm0,(%rax,%rcx,4)
mov    -0x44(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    0x2ea3(%rip),%rax
movss  (%rax,%rcx,4),%xmm0
movslq -0x44(%rbp),%rcx
lea    0x2e93(%rip),%rax
movss  %xmm0,(%rax,%rcx,4)
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
jmp    114e <iir+0x4e>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,0x2e93(%rip)
movss  -0x20(%rbp),%xmm0
mulss  0x2e86(%rip),%xmm0
movss  %xmm0,0x2e5e(%rip)
movl   $0x1,-0x44(%rbp)
cmpl   $0x4,-0x44(%rbp)
jg     124a <iir+0x14a>
movslq -0x44(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
movslq -0x44(%rbp),%rcx
lea    0x2e58(%rip),%rax
movss  (%rax,%rcx,4),%xmm2
movslq -0x44(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm1
movslq -0x44(%rbp),%rcx
lea    0x2e1e(%rip),%rax
mulss  (%rax,%rcx,4),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
addss  0x2dfc(%rip),%xmm0
movss  %xmm0,0x2df4(%rip)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11d9 <iir+0xd9>
movss  0x2dde(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<iir>:
movaps 0x2f49(%rip),%xmm1
movups %xmm1,0x2f46(%rip)
movaps 0x2f1b(%rip),%xmm1
movups %xmm1,0x2f18(%rip)
movss  %xmm0,0x2f2c(%rip)
movss  0xed4(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0x2efc(%rip),%xmm2
mulss  0xec4(%rip),%xmm2
movss  0xec0(%rip),%xmm3
movss  0x2f04(%rip),%xmm4
mulss  %xmm3,%xmm4
addss  %xmm2,%xmm4
addss  %xmm4,%xmm0
movss  0x2ed4(%rip),%xmm2
mulss  0xea0(%rip),%xmm2
movss  0x2ee4(%rip),%xmm4
mulss  0xe94(%rip),%xmm4
addss  %xmm2,%xmm4
addss  %xmm4,%xmm0
movss  0x2eb0(%rip),%xmm2
mulss  0xe80(%rip),%xmm2
mulss  0x2ec0(%rip),%xmm3
addss  %xmm2,%xmm3
movss  0x2e98(%rip),%xmm2
mulss  0xe68(%rip),%xmm2
mulss  0x2ea8(%rip),%xmm1
addss  %xmm3,%xmm0
addss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,0x2e64(%rip)
ret

LLVM IR (-O0):
@__const.iir.ACoef = [5 x float] [float 0x3F284CBEC0000000, float 0x3F484CBEC0000000, float 0x3F52398F00000000, float 0x3F484CBEC0000000, float 0x3F284CBEC0000000]
@__const.iir.BCoef = [5 x float] [float 1.000000e+00, float 0xC00AC0A6A0000000, float 0x4010F498C0000000, float 0xC003465580000000, float 0x3FE08F2E80000000]
@iir.y = internal global [5 x float] zeroinitializer
@iir.x = internal global [5 x float] zeroinitializer
define float @iir(float %0) {
%2 = alloca float
%3 = alloca [5 x float]
%4 = alloca [5 x float]
%5 = alloca i32
store float %0, float* %2
%6 = bitcast [5 x float]* %3 to i8*
%7 = bitcast [5 x float]* %4 to i8*
store i32 4, i32* %5
br label %8
8: ; preds = %28, %1
%9 = load i32, i32* %5
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %31
11: ; preds = %8
%12 = load i32, i32* %5
%13 = sub nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [5 x float], [5 x float]* @iir.x, i64 0, i64 %14
%16 = load float, float* %15
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [5 x float], [5 x float]* @iir.x, i64 0, i64 %18
store float %16, float* %19
%20 = load i32, i32* %5
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [5 x float], [5 x float]* @iir.y, i64 0, i64 %22
%24 = load float, float* %23
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [5 x float], [5 x float]* @iir.y, i64 0, i64 %26
store float %24, float* %27
br label %28
28: ; preds = %11
%29 = load i32, i32* %5
%30 = add nsw i32 %29, -1
store i32 %30, i32* %5
br label %8
31: ; preds = %8
%32 = load float, float* %2
store float %32, float* getelementptr inbounds ([5 x float], [5 x float]* @iir.x, i64 0, i64 0)
%33 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 0
%34 = load float, float* %33
%35 = load float, float* getelementptr inbounds ([5 x float], [5 x float]* @iir.x, i64 0, i64 0)
%36 = fmul float %34, %35
store float %36, float* getelementptr inbounds ([5 x float], [5 x float]* @iir.y, i64 0, i64 0)
store i32 1, i32* %5
br label %37
37: ; preds = %62, %31
%38 = load i32, i32* %5
%39 = icmp sle i32 %38, 4
br i1 %39, label %40, label %65
40: ; preds = %37
%41 = load i32, i32* %5
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 %42
%44 = load float, float* %43
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [5 x float], [5 x float]* @iir.x, i64 0, i64 %46
%48 = load float, float* %47
%49 = load i32, i32* %5
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [5 x float], [5 x float]* %4, i64 0, i64 %50
%52 = load float, float* %51
%53 = load i32, i32* %5
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [5 x float], [5 x float]* @iir.y, i64 0, i64 %54
%56 = load float, float* %55
%57 = fmul float %52, %56
%58 = fneg float %57
%59 = call float @llvm.fmuladd.f32(float %44, float %48, float %58)
%60 = load float, float* getelementptr inbounds ([5 x float], [5 x float]* @iir.y, i64 0, i64 0)
%61 = fadd float %60, %59
store float %61, float* getelementptr inbounds ([5 x float], [5 x float]* @iir.y, i64 0, i64 0)
br label %62
62: ; preds = %40
%63 = load i32, i32* %5
%64 = add nsw i32 %63, 1
store i32 %64, i32* %5
br label %37
65: ; preds = %37
%66 = load float, float* getelementptr inbounds ([5 x float], [5 x float]* @iir.y, i64 0, i64 0)
ret float %66
}

LLVM IR (-O2):
@iir.y = internal unnamed_addr global [5 x float] zeroinitializer
@iir.x = internal unnamed_addr global [5 x float] zeroinitializer
define float @iir(float %0) {
store float %0, float* getelementptr inbounds ([5 x float], [5 x float]* @iir.x, i64 0, i64 0)
%2 = fmul float %0, 0x3F284CBEC0000000
%3 = load float, float* getelementptr inbounds ([5 x float], [5 x float]* @iir.x, i64 0, i64 1)
%4 = load float, float* getelementptr inbounds ([5 x float], [5 x float]* @iir.y, i64 0, i64 1)
%5 = fmul float %4, 0x400AC0A6A0000000
%6 = tail call float @llvm.fmuladd.f32(float %3, float 0x3F484CBEC0000000, float %5)
%7 = fadd float %2, %6
%8 = load float, float* getelementptr inbounds ([5 x float], [5 x float]* @iir.x, i64 0, i64 2)
%9 = load float, float* getelementptr inbounds ([5 x float], [5 x float]* @iir.y, i64 0, i64 2)
%10 = fmul float %9, 0xC010F498C0000000
%11 = tail call float @llvm.fmuladd.f32(float %8, float 0x3F52398F00000000, float %10)
%12 = fadd float %7, %11
%13 = load float, float* getelementptr inbounds ([5 x float], [5 x float]* @iir.x, i64 0, i64 3)
%14 = load float, float* getelementptr inbounds ([5 x float], [5 x float]* @iir.y, i64 0, i64 3)
%15 = fmul float %14, 0x4003465580000000
%16 = tail call float @llvm.fmuladd.f32(float %13, float 0x3F484CBEC0000000, float %15)
%17 = fadd float %12, %16
%18 = load float, float* getelementptr inbounds ([5 x float], [5 x float]* @iir.x, i64 0, i64 4)
%19 = load float, float* getelementptr inbounds ([5 x float], [5 x float]* @iir.y, i64 0, i64 4)
%20 = fmul float %19, 0xBFE08F2E80000000
%21 = tail call float @llvm.fmuladd.f32(float %18, float 0x3F284CBEC0000000, float %20)
%22 = fadd float %17, %21
store float %22, float* getelementptr inbounds ([5 x float], [5 x float]* @iir.y, i64 0, i64 0)
ret float %22
}