float simple_atan(float x) {
  if (x > 0)
    return (3.141592653589793 / 2) * (0.596227 * x + x * x) /
           (1 + 2 * 0.596227 * x + x * x);
  else
    return -(simple_atan(-x));
}


x86 assembly (clang, -O0):
<simple_atan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    11a6 <simple_atan+0x96>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xecb(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xeb3(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe8e(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe8a(%rip),%xmm2
addsd  %xmm2,%xmm1
movss  -0x8(%rbp),%xmm2
mulss  -0x8(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11cf <simple_atan+0xbf>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1030 <simple_atan@plt>
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simple_atan>:
push   %rax
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1161 <simple_atan+0x51>
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee0(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
mulsd  0xed8(%rip),%xmm2
mulsd  0xed8(%rip),%xmm1
addsd  0xed8(%rip),%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
pop    %rax
ret
xorps  0xe98(%rip),%xmm0
call   1030 <simple_atan@plt>
xorps  0xe8c(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @simple_atan(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fcmp ogt float %4, 0.000000e+00
br i1 %5, label %6, label %25
6: ; preds = %1
%7 = load float, float* %3
%8 = fpext float %7 to double
%9 = load float, float* %3
%10 = load float, float* %3
%11 = fmul float %9, %10
%12 = fpext float %11 to double
%13 = call double @llvm.fmuladd.f64(double 5.962270e-01, double %8, double %12)
%14 = fmul double 0x3FF921FB54442D18, %13
%15 = load float, float* %3
%16 = fpext float %15 to double
%17 = call double @llvm.fmuladd.f64(double 0x3FF3144AA53FC009, double %16, double 1.000000e+00)
%18 = load float, float* %3
%19 = load float, float* %3
%20 = fmul float %18, %19
%21 = fpext float %20 to double
%22 = fadd double %17, %21
%23 = fdiv double %14, %22
%24 = fptrunc double %23 to float
store float %24, float* %2
br label %30
25: ; preds = %1
%26 = load float, float* %3
%27 = fneg float %26
%28 = call float @simple_atan(float %27)
%29 = fneg float %28
store float %29, float* %2
br label %30
30: ; preds = %25, %6
%31 = load float, float* %2
ret float %31
}

LLVM IR (-O2):
define float @simple_atan(float %0) {
%2 = fcmp ogt float %0, 0.000000e+00
br i1 %2, label %3, label %15
3: ; preds = %1
%4 = fpext float %0 to double
%5 = fmul float %0, %0
%6 = fpext float %5 to double
%7 = tail call double @llvm.fmuladd.f64(double %4, double 5.962270e-01, double %6)
%8 = fmul double %7, 0x3FF921FB54442D18
%9 = tail call double @llvm.fmuladd.f64(double %4, double 0x3FF3144AA53FC009, double 1.000000e+00)
%10 = fadd double %9, %6
%11 = fdiv double %8, %10
%12 = fptrunc double %11 to float
br label %13
13: ; preds = %3, %15
%14 = phi float [ %18, %15 ], [ %12, %3 ]
ret float %14
15: ; preds = %1
%16 = fneg float %0
%17 = tail call float @simple_atan(float %16)
%18 = fneg float %17
br label %13
}