float cos_core(const float x) {
  float x8, x4, x2;
  x2 = x * x;
  x4 = x2 * x2;
  x8 = x4 * x4;
  return (-2.7236370439787708e-7 * x2 + 2.4799852696610628e-5) * x8 +
         (-1.3888885054799695e-3 * x2 + 4.1666666636943683e-2) * x4 +
         (-4.9999999999963024e-1 * x2 + 1.0000000000000000e+0);
}


x86 assembly (clang, -O0):
<cos_core>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed9(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed5(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe9f(%rip),%xmm3
mulsd  %xmm3,%xmm1
movsd  0xe9b(%rip),%xmm3
addsd  %xmm3,%xmm1
movss  -0xc(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe59(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe55(%rip),%xmm2
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<cos_core>:
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm1
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm2
movsd  0xee8(%rip),%xmm3
mulsd  %xmm1,%xmm3
addsd  0xee4(%rip),%xmm3
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm3,%xmm0
movsd  0xed8(%rip),%xmm3
mulsd  %xmm1,%xmm3
addsd  0xed4(%rip),%xmm3
mulsd  %xmm2,%xmm3
mulsd  0xed0(%rip),%xmm1
addsd  0xed0(%rip),%xmm1
addsd  %xmm0,%xmm3
addsd  %xmm3,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @cos_core(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %2
%6 = load float, float* %2
%7 = load float, float* %2
%8 = fmul float %6, %7
store float %8, float* %5
%9 = load float, float* %5
%10 = load float, float* %5
%11 = fmul float %9, %10
store float %11, float* %4
%12 = load float, float* %4
%13 = load float, float* %4
%14 = fmul float %12, %13
store float %14, float* %3
%15 = load float, float* %5
%16 = fpext float %15 to double
%17 = call double @llvm.fmuladd.f64(double 0xBE92472C3D68AC7A, double %16, double 0x3EFA0128E6834C7F)
%18 = load float, float* %3
%19 = fpext float %18 to double
%20 = load float, float* %5
%21 = fpext float %20 to double
%22 = call double @llvm.fmuladd.f64(double 0xBF56C16BAD5D6B06, double %21, double 0x3FA555555513F8C8)
%23 = load float, float* %4
%24 = fpext float %23 to double
%25 = fmul double %22, %24
%26 = call double @llvm.fmuladd.f64(double %17, double %19, double %25)
%27 = load float, float* %5
%28 = fpext float %27 to double
%29 = call double @llvm.fmuladd.f64(double 0xBFDFFFFFFFFFE5FB, double %28, double 1.000000e+00)
%30 = fadd double %26, %29
%31 = fptrunc double %30 to float
ret float %31
}

LLVM IR (-O2):
define float @cos_core(float %0) {
%2 = fmul float %0, %0
%3 = fmul float %2, %2
%4 = fmul float %3, %3
%5 = fpext float %2 to double
%6 = tail call double @llvm.fmuladd.f64(double %5, double 0xBE92472C3D68AC7A, double 0x3EFA0128E6834C7F)
%7 = fpext float %4 to double
%8 = tail call double @llvm.fmuladd.f64(double %5, double 0xBF56C16BAD5D6B06, double 0x3FA555555513F8C8)
%9 = fpext float %3 to double
%10 = fmul double %8, %9
%11 = tail call double @llvm.fmuladd.f64(double %6, double %7, double %10)
%12 = tail call double @llvm.fmuladd.f64(double %5, double 0xBFDFFFFFFFFFE5FB, double 1.000000e+00)
%13 = fadd double %12, %11
%14 = fptrunc double %13 to float
ret float %14
}