float second_order_IIR_direct_form_I_float(const float input,
                                           const float *coeff,
                                           const float *gain) {
  float temp;
  static float x[3] = {0.0};
  static float y[3] = {0.0};
  x[0] = input * gain[0];
  temp = ((float)*(coeff + 0) * x[0]);
  temp += ((float)*(coeff + 1) * x[1]);
  temp += ((float)*(coeff + 2) * x[2]);
  temp -= ((float)*(coeff + 4) * y[1]);
  temp -= ((float)*(coeff + 5) * y[2]);
  y[0] = temp * gain[1];
  y[2] = y[1];
  y[1] = y[0];
  x[2] = x[1];
  x[1] = x[0];
  return (temp);
}


x86 assembly (clang, -O0):
<second_order_IIR_direct_form_I_float>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulss  (%rax),%xmm0
movss  %xmm0,0x2efe(%rip)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mulss  0x2eee(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  0x2edc(%rip),%xmm2
movss  -0x1c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  0x2ebd(%rip),%xmm2
movss  -0x1c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x10(%rax),%xmm0
movss  0x2ea2(%rip),%xmm2
movss  -0x1c(%rbp),%xmm1
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x14(%rax),%xmm0
movss  0x2e76(%rip),%xmm2
movss  -0x1c(%rbp),%xmm1
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulss  0x4(%rax),%xmm0
movss  %xmm0,0x2e39(%rip)
movss  0x2e35(%rip),%xmm0
movss  %xmm0,0x2e31(%rip)
movss  0x2e21(%rip),%xmm0
movss  %xmm0,0x2e1d(%rip)
movss  0x2e09(%rip),%xmm0
movss  %xmm0,0x2e05(%rip)
movss  0x2df5(%rip),%xmm0
movss  %xmm0,0x2df1(%rip)
movss  -0x1c(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<second_order_IIR_direct_form_I_float>:
mulss  (%rsi),%xmm0
movss  (%rdi),%xmm1
mulss  %xmm0,%xmm1
movss  0x2f10(%rip),%xmm2
movss  0x4(%rdi),%xmm3
mulss  %xmm2,%xmm3
addss  %xmm1,%xmm3
movss  0x8(%rdi),%xmm1
movss  0x14(%rdi),%xmm4
mulss  0x2ef5(%rip),%xmm1
addss  %xmm3,%xmm1
movss  0x2eed(%rip),%xmm3
movss  0x10(%rdi),%xmm5
mulss  %xmm3,%xmm5
mulss  0x2ee0(%rip),%xmm4
subss  %xmm5,%xmm1
subss  %xmm4,%xmm1
movss  0x4(%rsi),%xmm4
mulss  %xmm1,%xmm4
movss  %xmm3,0x2ec7(%rip)
movss  %xmm4,0x2ebb(%rip)
movss  %xmm2,0x2eaf(%rip)
movss  %xmm0,0x2ea3(%rip)
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
@second_order_IIR_direct_form_I_float.x = internal global [3 x float] zeroinitializer
@second_order_IIR_direct_form_I_float.y = internal global [3 x float] zeroinitializer
define float @second_order_IIR_direct_form_I_float(float %0, float* %1, float* %2) {
%4 = alloca float
%5 = alloca float*
%6 = alloca float*
%7 = alloca float
store float %0, float* %4
store float* %1, float** %5
store float* %2, float** %6
%8 = load float, float* %4
%9 = load float*, float** %6
%10 = getelementptr inbounds float, float* %9, i64 0
%11 = load float, float* %10
%12 = fmul float %8, %11
store float %12, float* getelementptr inbounds ([3 x float], [3 x float]* @second_order_IIR_direct_form_I_float.x, i64 0, i64 0)
%13 = load float*, float** %5
%14 = getelementptr inbounds float, float* %13, i64 0
%15 = load float, float* %14
%16 = load float, float* getelementptr inbounds ([3 x float], [3 x float]* @second_order_IIR_direct_form_I_float.x, i64 0, i64 0)
%17 = fmul float %15, %16
store float %17, float* %7
%18 = load float*, float** %5
%19 = getelementptr inbounds float, float* %18, i64 1
%20 = load float, float* %19
%21 = load float, float* getelementptr inbounds ([3 x float], [3 x float]* @second_order_IIR_direct_form_I_float.x, i64 0, i64 1)
%22 = load float, float* %7
%23 = call float @llvm.fmuladd.f32(float %20, float %21, float %22)
store float %23, float* %7
%24 = load float*, float** %5
%25 = getelementptr inbounds float, float* %24, i64 2
%26 = load float, float* %25
%27 = load float, float* getelementptr inbounds ([3 x float], [3 x float]* @second_order_IIR_direct_form_I_float.x, i64 0, i64 2)
%28 = load float, float* %7
%29 = call float @llvm.fmuladd.f32(float %26, float %27, float %28)
store float %29, float* %7
%30 = load float*, float** %5
%31 = getelementptr inbounds float, float* %30, i64 4
%32 = load float, float* %31
%33 = load float, float* getelementptr inbounds ([3 x float], [3 x float]* @second_order_IIR_direct_form_I_float.y, i64 0, i64 1)
%34 = load float, float* %7
%35 = fneg float %32
%36 = call float @llvm.fmuladd.f32(float %35, float %33, float %34)
store float %36, float* %7
%37 = load float*, float** %5
%38 = getelementptr inbounds float, float* %37, i64 5
%39 = load float, float* %38
%40 = load float, float* getelementptr inbounds ([3 x float], [3 x float]* @second_order_IIR_direct_form_I_float.y, i64 0, i64 2)
%41 = load float, float* %7
%42 = fneg float %39
%43 = call float @llvm.fmuladd.f32(float %42, float %40, float %41)
store float %43, float* %7
%44 = load float, float* %7
%45 = load float*, float** %6
%46 = getelementptr inbounds float, float* %45, i64 1
%47 = load float, float* %46
%48 = fmul float %44, %47
store float %48, float* getelementptr inbounds ([3 x float], [3 x float]* @second_order_IIR_direct_form_I_float.y, i64 0, i64 0)
%49 = load float, float* getelementptr inbounds ([3 x float], [3 x float]* @second_order_IIR_direct_form_I_float.y, i64 0, i64 1)
store float %49, float* getelementptr inbounds ([3 x float], [3 x float]* @second_order_IIR_direct_form_I_float.y, i64 0, i64 2)
%50 = load float, float* getelementptr inbounds ([3 x float], [3 x float]* @second_order_IIR_direct_form_I_float.y, i64 0, i64 0)
store float %50, float* getelementptr inbounds ([3 x float], [3 x float]* @second_order_IIR_direct_form_I_float.y, i64 0, i64 1)
%51 = load float, float* getelementptr inbounds ([3 x float], [3 x float]* @second_order_IIR_direct_form_I_float.x, i64 0, i64 1)
store float %51, float* getelementptr inbounds ([3 x float], [3 x float]* @second_order_IIR_direct_form_I_float.x, i64 0, i64 2)
%52 = load float, float* getelementptr inbounds ([3 x float], [3 x float]* @second_order_IIR_direct_form_I_float.x, i64 0, i64 0)
store float %52, float* getelementptr inbounds ([3 x float], [3 x float]* @second_order_IIR_direct_form_I_float.x, i64 0, i64 1)
%53 = load float, float* %7
ret float %53
}

LLVM IR (-O2):
@second_order_IIR_direct_form_I_float.x.1 = internal unnamed_addr global float 0.000000e+00
@second_order_IIR_direct_form_I_float.x.2 = internal unnamed_addr global float 0.000000e+00
@second_order_IIR_direct_form_I_float.y.1 = internal unnamed_addr global float 0.000000e+00
@second_order_IIR_direct_form_I_float.y.2 = internal unnamed_addr global float 0.000000e+00
define float @second_order_IIR_direct_form_I_float(float %0, float* nocapture %1, float* nocapture %2) {
%4 = load float, float* %2
%5 = fmul float %4, %0
%6 = load float, float* %1
%7 = fmul float %5, %6
%8 = getelementptr inbounds float, float* %1, i64 1
%9 = load float, float* %8
%10 = load float, float* @second_order_IIR_direct_form_I_float.x.1
%11 = tail call float @llvm.fmuladd.f32(float %9, float %10, float %7)
%12 = getelementptr inbounds float, float* %1, i64 2
%13 = load float, float* %12
%14 = load float, float* @second_order_IIR_direct_form_I_float.x.2
%15 = tail call float @llvm.fmuladd.f32(float %13, float %14, float %11)
%16 = getelementptr inbounds float, float* %1, i64 4
%17 = load float, float* %16
%18 = load float, float* @second_order_IIR_direct_form_I_float.y.1
%19 = fneg float %17
%20 = tail call float @llvm.fmuladd.f32(float %19, float %18, float %15)
%21 = getelementptr inbounds float, float* %1, i64 5
%22 = load float, float* %21
%23 = load float, float* @second_order_IIR_direct_form_I_float.y.2
%24 = fneg float %22
%25 = tail call float @llvm.fmuladd.f32(float %24, float %23, float %20)
%26 = getelementptr inbounds float, float* %2, i64 1
%27 = load float, float* %26
%28 = fmul float %25, %27
store float %18, float* @second_order_IIR_direct_form_I_float.y.2
store float %28, float* @second_order_IIR_direct_form_I_float.y.1
store float %10, float* @second_order_IIR_direct_form_I_float.x.2
store float %5, float* @second_order_IIR_direct_form_I_float.x.1
ret float %25
}