double _cos_kernel(double x) {
  const double c1 = 0.99999999999925182;
  const double c2 = -0.49999999997024012;
  const double c3 = 0.041666666473384543;
  const double c4 = -0.001388888418000423;
  const double c5 = 0.0000248010406484558;
  const double c6 = -0.0000002752469638432;
  const double c7 = 0.0000000019907856854;
  double x2;
  x2 = x * x;
  return (c1 +
          x2 * (c2 + x2 * (c3 + x2 * (c4 + x2 * (c5 + x2 * (c6 + c7 * x2))))));
}


x86 assembly (clang, -O0):
<_cos_kernel>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeea(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xee5(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xee0(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xedb(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xede(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm3
movsd  -0x48(%rbp),%xmm4
movsd  -0x48(%rbp),%xmm5
movsd  0xe8f(%rip),%xmm6
mulsd  %xmm6,%xmm5
movsd  0xe8b(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xe6b(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xe53(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe3b(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe23(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe0b(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cos_kernel>:
mulsd  %xmm0,%xmm0
movsd  0xef4(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xef0(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xeec(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xee8(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xee4(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xee0(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  0xedc(%rip),%xmm0
ret

LLVM IR (-O0):
define double @_cos_kernel(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %2
store double 0x3FEFFFFFFFFFE5AD, double* %3
store double 0xBFDFFFFFFFF7D1D6, double* %4
store double 0x3FA5555553AC4D2C, double* %5
store double 0xBF56C16B9551979C, double* %6
store double 0x3EFA017A892EC93C, double* %7
store double 0xBE9278B4F2F32463, double* %8
store double 0x3E2119C8B5785B45, double* %9
%11 = load double, double* %2
%12 = load double, double* %2
%13 = fmul double %11, %12
store double %13, double* %10
%14 = load double, double* %10
%15 = load double, double* %10
%16 = load double, double* %10
%17 = load double, double* %10
%18 = load double, double* %10
%19 = load double, double* %10
%20 = call double @llvm.fmuladd.f64(double 0x3E2119C8B5785B45, double %19, double 0xBE9278B4F2F32463)
%21 = call double @llvm.fmuladd.f64(double %18, double %20, double 0x3EFA017A892EC93C)
%22 = call double @llvm.fmuladd.f64(double %17, double %21, double 0xBF56C16B9551979C)
%23 = call double @llvm.fmuladd.f64(double %16, double %22, double 0x3FA5555553AC4D2C)
%24 = call double @llvm.fmuladd.f64(double %15, double %23, double 0xBFDFFFFFFFF7D1D6)
%25 = call double @llvm.fmuladd.f64(double %14, double %24, double 0x3FEFFFFFFFFFE5AD)
ret double %25
}

LLVM IR (-O2):
define double @_cos_kernel(double %0) {
%2 = fmul double %0, %0
%3 = tail call double @llvm.fmuladd.f64(double %2, double 0x3E2119C8B5785B45, double 0xBE9278B4F2F32463)
%4 = tail call double @llvm.fmuladd.f64(double %2, double %3, double 0x3EFA017A892EC93C)
%5 = tail call double @llvm.fmuladd.f64(double %2, double %4, double 0xBF56C16B9551979C)
%6 = tail call double @llvm.fmuladd.f64(double %2, double %5, double 0x3FA5555553AC4D2C)
%7 = tail call double @llvm.fmuladd.f64(double %2, double %6, double 0xBFDFFFFFFFF7D1D6)
%8 = tail call double @llvm.fmuladd.f64(double %2, double %7, double 0x3FEFFFFFFFFFE5AD)
ret double %8
}