double calc_polynomial(double x) {
  double polynomial = 3 * (x * x * x * x * x) + 2 * (x * x * x * x) -
                      5 * (x * x * x) - x * x + 7 * x - 6;
  return polynomial;
}


x86 assembly (clang, -O0):
<calc_polynomial>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
mulsd  -0x8(%rbp),%xmm2
mulsd  -0x8(%rbp),%xmm2
mulsd  -0x8(%rbp),%xmm2
movsd  0xee2(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  0xece(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xea7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xe61(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe49(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_polynomial>:
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm2,%xmm3
mulsd  %xmm0,%xmm3
movapd %xmm3,%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm3,%xmm3
mulsd  0xed4(%rip),%xmm4
mulsd  0xed4(%rip),%xmm2
addsd  %xmm3,%xmm4
addsd  %xmm4,%xmm2
mulsd  0xecc(%rip),%xmm0
subsd  %xmm1,%xmm2
addsd  %xmm2,%xmm0
addsd  0xec4(%rip),%xmm0
ret

LLVM IR (-O0):
define double @calc_polynomial(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = load double, double* %2
%6 = fmul double %4, %5
%7 = load double, double* %2
%8 = fmul double %6, %7
%9 = load double, double* %2
%10 = fmul double %8, %9
%11 = load double, double* %2
%12 = fmul double %10, %11
%13 = load double, double* %2
%14 = load double, double* %2
%15 = fmul double %13, %14
%16 = load double, double* %2
%17 = fmul double %15, %16
%18 = load double, double* %2
%19 = fmul double %17, %18
%20 = fmul double 2.000000e+00, %19
%21 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %12, double %20)
%22 = load double, double* %2
%23 = load double, double* %2
%24 = fmul double %22, %23
%25 = load double, double* %2
%26 = fmul double %24, %25
%27 = call double @llvm.fmuladd.f64(double -5.000000e+00, double %26, double %21)
%28 = load double, double* %2
%29 = load double, double* %2
%30 = fneg double %28
%31 = call double @llvm.fmuladd.f64(double %30, double %29, double %27)
%32 = load double, double* %2
%33 = call double @llvm.fmuladd.f64(double 7.000000e+00, double %32, double %31)
%34 = fsub double %33, 6.000000e+00
store double %34, double* %3
%35 = load double, double* %3
ret double %35
}

LLVM IR (-O2):
define double @calc_polynomial(double %0) {
%2 = fmul double %0, %0
%3 = fmul double %2, %0
%4 = fmul double %3, %0
%5 = fmul double %4, %0
%6 = fmul double %4, 2.000000e+00
%7 = tail call double @llvm.fmuladd.f64(double %5, double 3.000000e+00, double %6)
%8 = tail call double @llvm.fmuladd.f64(double %3, double -5.000000e+00, double %7)
%9 = fneg double %0
%10 = tail call double @llvm.fmuladd.f64(double %9, double %0, double %8)
%11 = tail call double @llvm.fmuladd.f64(double %0, double 7.000000e+00, double %10)
%12 = fadd double %11, -6.000000e+00
ret double %12
}