double oof2_filter(double *oof2_state, double x2) {
  const double y2 = (oof2_state[0]) * x2 + (oof2_state[1]) * (oof2_state[3]) +
                    (oof2_state[2]) * (oof2_state[4]);
  (oof2_state[3]) = x2;
  (oof2_state[4]) = y2;
  return y2;
}


x86 assembly (clang, -O0):
<oof2_filter>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x10(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x18(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<oof2_filter>:
movsd  0x8(%rdi),%xmm2
movsd  0x10(%rdi),%xmm1
mulsd  0x18(%rdi),%xmm2
movsd  (%rdi),%xmm3
mulsd  %xmm0,%xmm3
mulsd  0x20(%rdi),%xmm1
addsd  %xmm2,%xmm3
addsd  %xmm3,%xmm1
movsd  %xmm0,0x18(%rdi)
movsd  %xmm1,0x20(%rdi)
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @oof2_filter(double* %0, double %1) {
%3 = alloca double*
%4 = alloca double
%5 = alloca double
store double* %0, double** %3
store double %1, double* %4
%6 = load double*, double** %3
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = load double, double* %4
%10 = load double*, double** %3
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = load double*, double** %3
%14 = getelementptr inbounds double, double* %13, i64 3
%15 = load double, double* %14
%16 = fmul double %12, %15
%17 = call double @llvm.fmuladd.f64(double %8, double %9, double %16)
%18 = load double*, double** %3
%19 = getelementptr inbounds double, double* %18, i64 2
%20 = load double, double* %19
%21 = load double*, double** %3
%22 = getelementptr inbounds double, double* %21, i64 4
%23 = load double, double* %22
%24 = call double @llvm.fmuladd.f64(double %20, double %23, double %17)
store double %24, double* %5
%25 = load double, double* %4
%26 = load double*, double** %3
%27 = getelementptr inbounds double, double* %26, i64 3
store double %25, double* %27
%28 = load double, double* %5
%29 = load double*, double** %3
%30 = getelementptr inbounds double, double* %29, i64 4
store double %28, double* %30
%31 = load double, double* %5
ret double %31
}

LLVM IR (-O2):
define double @oof2_filter(double* nocapture %0, double %1) {
%3 = load double, double* %0
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %0, i64 3
%7 = load double, double* %6
%8 = fmul double %5, %7
%9 = tail call double @llvm.fmuladd.f64(double %3, double %1, double %8)
%10 = getelementptr inbounds double, double* %0, i64 2
%11 = load double, double* %10
%12 = getelementptr inbounds double, double* %0, i64 4
%13 = load double, double* %12
%14 = tail call double @llvm.fmuladd.f64(double %11, double %13, double %9)
store double %1, double* %6
store double %14, double* %12
ret double %14
}