void poly_5_value(const double r, const double *p, double *f) {
  double dr = (r - 1.0) * (r - 1.0);
  *f = p[0] + 0.5 * p[1] * dr + p[2] * (r - 1.0) * dr + p[3] * (dr * dr) +
       p[4] * (dr * dr) * (r - 1.0);
}


x86 assembly (clang, -O0):
<poly_5_value>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xed1(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0xeb8(%rip),%xmm1
mulsd  0x8(%rax),%xmm1
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xe88(%rip),%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm1
movsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xe34(%rip),%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @poly_5_value(double %0, double* %1, double* %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
store double %0, double* %4
store double* %1, double** %5
store double* %2, double** %6
%8 = load double, double* %4
%9 = fsub double %8, 1.000000e+00
%10 = load double, double* %4
%11 = fsub double %10, 1.000000e+00
%12 = fmul double %9, %11
store double %12, double* %7
%13 = load double*, double** %5
%14 = getelementptr inbounds double, double* %13, i64 0
%15 = load double, double* %14
%16 = load double*, double** %5
%17 = getelementptr inbounds double, double* %16, i64 1
%18 = load double, double* %17
%19 = fmul double 5.000000e-01, %18
%20 = load double, double* %7
%21 = call double @llvm.fmuladd.f64(double %19, double %20, double %15)
%22 = load double*, double** %5
%23 = getelementptr inbounds double, double* %22, i64 2
%24 = load double, double* %23
%25 = load double, double* %4
%26 = fsub double %25, 1.000000e+00
%27 = fmul double %24, %26
%28 = load double, double* %7
%29 = call double @llvm.fmuladd.f64(double %27, double %28, double %21)
%30 = load double*, double** %5
%31 = getelementptr inbounds double, double* %30, i64 3
%32 = load double, double* %31
%33 = load double, double* %7
%34 = load double, double* %7
%35 = fmul double %33, %34
%36 = call double @llvm.fmuladd.f64(double %32, double %35, double %29)
%37 = load double*, double** %5
%38 = getelementptr inbounds double, double* %37, i64 4
%39 = load double, double* %38
%40 = load double, double* %7
%41 = load double, double* %7
%42 = fmul double %40, %41
%43 = fmul double %39, %42
%44 = load double, double* %4
%45 = fsub double %44, 1.000000e+00
%46 = call double @llvm.fmuladd.f64(double %43, double %45, double %36)
%47 = load double*, double** %6
store double %46, double* %47
ret void
}

LLVM IR (-O2):
define void @poly_5_value(double %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = fadd double %0, -1.000000e+00
%5 = fmul double %4, %4
%6 = load double, double* %1
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = fmul double %8, 5.000000e-01
%10 = tail call double @llvm.fmuladd.f64(double %9, double %5, double %6)
%11 = getelementptr inbounds double, double* %1, i64 2
%12 = load double, double* %11
%13 = fmul double %4, %12
%14 = tail call double @llvm.fmuladd.f64(double %13, double %5, double %10)
%15 = getelementptr inbounds double, double* %1, i64 3
%16 = load double, double* %15
%17 = fmul double %5, %5
%18 = tail call double @llvm.fmuladd.f64(double %16, double %17, double %14)
%19 = getelementptr inbounds double, double* %1, i64 4
%20 = load double, double* %19
%21 = fmul double %17, %20
%22 = tail call double @llvm.fmuladd.f64(double %21, double %4, double %18)
store double %22, double* %2
ret void
}