double eval_pol20_dz(double c[20], double x, double y, double z) {
  double m[20] = {0, 0, 0,         z,     0,     x,        y,
                  0, 0, 2 * z,     x * y, 0,     0,        x * 2 * z,
                  0, 0, y * 2 * z, x * x, y * y, 3 * z * z};
  double r = 0;
  for (int i = 0; i < 20; i++)
    r += c[i] * m[i];
  return r;
}


x86 assembly (clang, -O0):
<eval_pol20_dz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xe7f(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe4e(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe27(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xdea(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movl   $0x0,-0xcc(%rbp)
cmpl   $0x14,-0xcc(%rbp)
jge    1293 <eval_pol20_dz+0x193>
mov    -0x8(%rbp),%rax
movslq -0xcc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0xcc(%rbp),%rax
movsd  -0xc0(%rbp,%rax,8),%xmm2
ff ff
movsd  -0xc8(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    123a <eval_pol20_dz+0x13a>
movsd  -0xc8(%rbp),%xmm0
ff
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eval_pol20_dz>:
movapd %xmm2,%xmm11
addsd  %xmm2,%xmm11
movapd %xmm0,%xmm10
mulsd  %xmm1,%xmm10
movapd %xmm0,%xmm7
addsd  %xmm0,%xmm7
mulsd  %xmm2,%xmm7
movapd %xmm1,%xmm4
addsd  %xmm1,%xmm4
mulsd  %xmm2,%xmm4
movapd %xmm0,%xmm9
mulsd  %xmm0,%xmm9
movapd %xmm1,%xmm8
mulsd  %xmm1,%xmm8
movsd  0xeb7(%rip),%xmm12
mulsd  %xmm2,%xmm12
mulsd  %xmm2,%xmm12
xorpd  %xmm5,%xmm5
movsd  (%rdi),%xmm6
mulsd  %xmm5,%xmm6
addsd  %xmm5,%xmm6
movsd  0x8(%rdi),%xmm3
mulsd  %xmm5,%xmm3
addsd  %xmm6,%xmm3
movsd  0x10(%rdi),%xmm6
mulsd  %xmm5,%xmm6
addsd  %xmm3,%xmm6
mulsd  0x18(%rdi),%xmm2
addsd  %xmm2,%xmm6
movsd  0x20(%rdi),%xmm2
mulsd  %xmm5,%xmm2
mulsd  0x28(%rdi),%xmm0
addsd  %xmm6,%xmm2
addsd  %xmm2,%xmm0
mulsd  0x30(%rdi),%xmm1
addsd  %xmm1,%xmm0
movsd  0x38(%rdi),%xmm1
mulsd  %xmm5,%xmm1
addsd  %xmm1,%xmm0
movsd  0x40(%rdi),%xmm1
mulsd  %xmm5,%xmm1
mulsd  0x48(%rdi),%xmm11
addsd  %xmm1,%xmm0
addsd  %xmm11,%xmm0
mulsd  0x50(%rdi),%xmm10
addsd  %xmm10,%xmm0
movsd  0x58(%rdi),%xmm1
mulsd  %xmm5,%xmm1
addsd  %xmm1,%xmm0
movsd  0x60(%rdi),%xmm1
mulsd  %xmm5,%xmm1
mulsd  0x68(%rdi),%xmm7
addsd  %xmm1,%xmm0
addsd  %xmm7,%xmm0
movsd  0x70(%rdi),%xmm1
mulsd  %xmm5,%xmm1
addsd  %xmm1,%xmm0
mulsd  0x78(%rdi),%xmm5
addsd  %xmm5,%xmm0
mulsd  0x80(%rdi),%xmm4
mulsd  0x88(%rdi),%xmm9
addsd  %xmm4,%xmm0
addsd  %xmm9,%xmm0
mulsd  0x90(%rdi),%xmm8
addsd  %xmm8,%xmm0
mulsd  0x98(%rdi),%xmm12
addsd  %xmm12,%xmm0
ret

LLVM IR (-O0):
define double @eval_pol20_dz(double* %0, double %1, double %2, double %3) {
%5 = alloca double*
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca [20 x double]
%10 = alloca double
%11 = alloca i32
store double* %0, double** %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%12 = getelementptr inbounds [20 x double], [20 x double]* %9, i64 0, i64 0
store double 0.000000e+00, double* %12
%13 = getelementptr inbounds double, double* %12, i64 1
store double 0.000000e+00, double* %13
%14 = getelementptr inbounds double, double* %13, i64 1
store double 0.000000e+00, double* %14
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %8
store double %16, double* %15
%17 = getelementptr inbounds double, double* %15, i64 1
store double 0.000000e+00, double* %17
%18 = getelementptr inbounds double, double* %17, i64 1
%19 = load double, double* %6
store double %19, double* %18
%20 = getelementptr inbounds double, double* %18, i64 1
%21 = load double, double* %7
store double %21, double* %20
%22 = getelementptr inbounds double, double* %20, i64 1
store double 0.000000e+00, double* %22
%23 = getelementptr inbounds double, double* %22, i64 1
store double 0.000000e+00, double* %23
%24 = getelementptr inbounds double, double* %23, i64 1
%25 = load double, double* %8
%26 = fmul double 2.000000e+00, %25
store double %26, double* %24
%27 = getelementptr inbounds double, double* %24, i64 1
%28 = load double, double* %6
%29 = load double, double* %7
%30 = fmul double %28, %29
store double %30, double* %27
%31 = getelementptr inbounds double, double* %27, i64 1
store double 0.000000e+00, double* %31
%32 = getelementptr inbounds double, double* %31, i64 1
store double 0.000000e+00, double* %32
%33 = getelementptr inbounds double, double* %32, i64 1
%34 = load double, double* %6
%35 = fmul double %34, 2.000000e+00
%36 = load double, double* %8
%37 = fmul double %35, %36
store double %37, double* %33
%38 = getelementptr inbounds double, double* %33, i64 1
store double 0.000000e+00, double* %38
%39 = getelementptr inbounds double, double* %38, i64 1
store double 0.000000e+00, double* %39
%40 = getelementptr inbounds double, double* %39, i64 1
%41 = load double, double* %7
%42 = fmul double %41, 2.000000e+00
%43 = load double, double* %8
%44 = fmul double %42, %43
store double %44, double* %40
%45 = getelementptr inbounds double, double* %40, i64 1
%46 = load double, double* %6
%47 = load double, double* %6
%48 = fmul double %46, %47
store double %48, double* %45
%49 = getelementptr inbounds double, double* %45, i64 1
%50 = load double, double* %7
%51 = load double, double* %7
%52 = fmul double %50, %51
store double %52, double* %49
%53 = getelementptr inbounds double, double* %49, i64 1
%54 = load double, double* %8
%55 = fmul double 3.000000e+00, %54
%56 = load double, double* %8
%57 = fmul double %55, %56
store double %57, double* %53
store double 0.000000e+00, double* %10
store i32 0, i32* %11
br label %58
58: ; preds = %73, %4
%59 = load i32, i32* %11
%60 = icmp slt i32 %59, 20
br i1 %60, label %61, label %76
61: ; preds = %58
%62 = load double*, double** %5
%63 = load i32, i32* %11
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double, double* %62, i64 %64
%66 = load double, double* %65
%67 = load i32, i32* %11
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [20 x double], [20 x double]* %9, i64 0, i64 %68
%70 = load double, double* %69
%71 = load double, double* %10
%72 = call double @llvm.fmuladd.f64(double %66, double %70, double %71)
store double %72, double* %10
br label %73
73: ; preds = %61
%74 = load i32, i32* %11
%75 = add nsw i32 %74, 1
store i32 %75, i32* %11
br label %58
76: ; preds = %58
%77 = load double, double* %10
ret double %77
}

LLVM IR (-O2):
define double @eval_pol20_dz(double* nocapture %0, double %1, double %2, double %3) {
%5 = fmul double %3, 2.000000e+00
%6 = fmul double %1, %2
%7 = fmul double %1, 2.000000e+00
%8 = fmul double %7, %3
%9 = fmul double %2, 2.000000e+00
%10 = fmul double %9, %3
%11 = fmul double %1, %1
%12 = fmul double %2, %2
%13 = fmul double %3, 3.000000e+00
%14 = fmul double %13, %3
%15 = load double, double* %0
%16 = tail call double @llvm.fmuladd.f64(double %15, double 0.000000e+00, double 0.000000e+00)
%17 = getelementptr inbounds double, double* %0, i64 1
%18 = load double, double* %17
%19 = tail call double @llvm.fmuladd.f64(double %18, double 0.000000e+00, double %16)
%20 = getelementptr inbounds double, double* %0, i64 2
%21 = load double, double* %20
%22 = tail call double @llvm.fmuladd.f64(double %21, double 0.000000e+00, double %19)
%23 = getelementptr inbounds double, double* %0, i64 3
%24 = load double, double* %23
%25 = tail call double @llvm.fmuladd.f64(double %24, double %3, double %22)
%26 = getelementptr inbounds double, double* %0, i64 4
%27 = load double, double* %26
%28 = tail call double @llvm.fmuladd.f64(double %27, double 0.000000e+00, double %25)
%29 = getelementptr inbounds double, double* %0, i64 5
%30 = load double, double* %29
%31 = tail call double @llvm.fmuladd.f64(double %30, double %1, double %28)
%32 = getelementptr inbounds double, double* %0, i64 6
%33 = load double, double* %32
%34 = tail call double @llvm.fmuladd.f64(double %33, double %2, double %31)
%35 = getelementptr inbounds double, double* %0, i64 7
%36 = load double, double* %35
%37 = tail call double @llvm.fmuladd.f64(double %36, double 0.000000e+00, double %34)
%38 = getelementptr inbounds double, double* %0, i64 8
%39 = load double, double* %38
%40 = tail call double @llvm.fmuladd.f64(double %39, double 0.000000e+00, double %37)
%41 = getelementptr inbounds double, double* %0, i64 9
%42 = load double, double* %41
%43 = tail call double @llvm.fmuladd.f64(double %42, double %5, double %40)
%44 = getelementptr inbounds double, double* %0, i64 10
%45 = load double, double* %44
%46 = tail call double @llvm.fmuladd.f64(double %45, double %6, double %43)
%47 = getelementptr inbounds double, double* %0, i64 11
%48 = load double, double* %47
%49 = tail call double @llvm.fmuladd.f64(double %48, double 0.000000e+00, double %46)
%50 = getelementptr inbounds double, double* %0, i64 12
%51 = load double, double* %50
%52 = tail call double @llvm.fmuladd.f64(double %51, double 0.000000e+00, double %49)
%53 = getelementptr inbounds double, double* %0, i64 13
%54 = load double, double* %53
%55 = tail call double @llvm.fmuladd.f64(double %54, double %8, double %52)
%56 = getelementptr inbounds double, double* %0, i64 14
%57 = load double, double* %56
%58 = tail call double @llvm.fmuladd.f64(double %57, double 0.000000e+00, double %55)
%59 = getelementptr inbounds double, double* %0, i64 15
%60 = load double, double* %59
%61 = tail call double @llvm.fmuladd.f64(double %60, double 0.000000e+00, double %58)
%62 = getelementptr inbounds double, double* %0, i64 16
%63 = load double, double* %62
%64 = tail call double @llvm.fmuladd.f64(double %63, double %10, double %61)
%65 = getelementptr inbounds double, double* %0, i64 17
%66 = load double, double* %65
%67 = tail call double @llvm.fmuladd.f64(double %66, double %11, double %64)
%68 = getelementptr inbounds double, double* %0, i64 18
%69 = load double, double* %68
%70 = tail call double @llvm.fmuladd.f64(double %69, double %12, double %67)
%71 = getelementptr inbounds double, double* %0, i64 19
%72 = load double, double* %71
%73 = tail call double @llvm.fmuladd.f64(double %72, double %14, double %70)
ret double %73
}