double fast_exp(double x) {
  x = 1.0 + x * 0.000244140625;
  x *= x;
  x *= x;
  x *= x;
  x *= x;
  x *= x;
  x *= x;
  x *= x;
  x *= x;
  x *= x;
  x *= x;
  x *= x;
  x *= x;
  return x;
}


x86 assembly (clang, -O0):
<fast_exp>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee6(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fast_exp>:
mulsd  0xef8(%rip),%xmm0
addsd  0xef8(%rip),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
ret

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

LLVM IR (-O2):
define double @fast_exp(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double 0x3F30000000000000, double 1.000000e+00)
%3 = fmul double %2, %2
%4 = fmul double %3, %3
%5 = fmul double %4, %4
%6 = fmul double %5, %5
%7 = fmul double %6, %6
%8 = fmul double %7, %7
%9 = fmul double %8, %8
%10 = fmul double %9, %9
%11 = fmul double %10, %10
%12 = fmul double %11, %11
%13 = fmul double %12, %12
%14 = fmul double %13, %13
ret double %14
}