float mySin(float x) {
  float y = 1.27323954474 * x - 0.40528473456 * x * (x > 0 ? x : -x);
  return 0.225 * (y * (y > 0 ? y : -y) - y) + y;
}


x86 assembly (clang, -O0):
<mySin>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xed8(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1151 <mySin+0x51>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    1168 <mySin+0x68>
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xe6a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    11d9 <mySin+0xd9>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    11f0 <mySin+0xf0>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x20(%rbp),%xmm0
movss  -0x24(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xde7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mySin>:
cvtss2sd %xmm0,%xmm1
movaps 0xef5(%rip),%xmm2
xorps  %xmm3,%xmm3
cmpltss %xmm0,%xmm3
movaps %xmm3,%xmm4
andps  %xmm0,%xmm3
xorps  %xmm2,%xmm0
xorps  %xmm5,%xmm5
andnps %xmm0,%xmm4
orps   %xmm4,%xmm3
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
movsd  0xedc(%rip),%xmm3
mulsd  %xmm1,%xmm3
mulsd  %xmm0,%xmm3
mulsd  0xed4(%rip),%xmm1
addsd  %xmm3,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
xorps  %xmm0,%xmm2
cmpltss %xmm0,%xmm5
movaps %xmm5,%xmm1
andps  %xmm0,%xmm1
andnps %xmm2,%xmm5
orps   %xmm1,%xmm5
mulss  %xmm0,%xmm5
subss  %xmm0,%xmm5
xorps  %xmm1,%xmm1
cvtss2sd %xmm5,%xmm1
mulsd  0xea6(%rip),%xmm1
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @mySin(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = fpext float %4 to double
%6 = load float, float* %2
%7 = fpext float %6 to double
%8 = fmul double 0x3FD9F02F6220351A, %7
%9 = load float, float* %2
%10 = fcmp ogt float %9, 0.000000e+00
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = load float, float* %2
br label %16
13: ; preds = %1
%14 = load float, float* %2
%15 = fneg float %14
br label %16
16: ; preds = %13, %11
%17 = phi float [ %12, %11 ], [ %15, %13 ]
%18 = fpext float %17 to double
%19 = fmul double %8, %18
%20 = fneg double %19
%21 = call double @llvm.fmuladd.f64(double 0x3FF45F306DCA1D9C, double %5, double %20)
%22 = fptrunc double %21 to float
store float %22, float* %3
%23 = load float, float* %3
%24 = load float, float* %3
%25 = fcmp ogt float %24, 0.000000e+00
br i1 %25, label %26, label %28
26: ; preds = %16
%27 = load float, float* %3
br label %31
28: ; preds = %16
%29 = load float, float* %3
%30 = fneg float %29
br label %31
31: ; preds = %28, %26
%32 = phi float [ %27, %26 ], [ %30, %28 ]
%33 = load float, float* %3
%34 = fneg float %33
%35 = call float @llvm.fmuladd.f32(float %23, float %32, float %34)
%36 = fpext float %35 to double
%37 = load float, float* %3
%38 = fpext float %37 to double
%39 = call double @llvm.fmuladd.f64(double 2.250000e-01, double %36, double %38)
%40 = fptrunc double %39 to float
ret float %40
}

LLVM IR (-O2):
define float @mySin(float %0) {
%2 = fpext float %0 to double
%3 = fcmp ogt float %0, 0.000000e+00
%4 = fneg float %0
%5 = select i1 %3, float %0, float %4
%6 = fpext float %5 to double
%7 = fmul double %2, 0xBFD9F02F6220351A
%8 = fmul double %7, %6
%9 = tail call double @llvm.fmuladd.f64(double %2, double 0x3FF45F306DCA1D9C, double %8)
%10 = fptrunc double %9 to float
%11 = fcmp ogt float %10, 0.000000e+00
%12 = fneg float %10
%13 = select i1 %11, float %10, float %12
%14 = tail call float @llvm.fmuladd.f32(float %10, float %13, float %12)
%15 = fpext float %14 to double
%16 = fpext float %10 to double
%17 = tail call double @llvm.fmuladd.f64(double %15, double 2.250000e-01, double %16)
%18 = fptrunc double %17 to float
ret float %18
}