float fast_atanf(float xx) {
  float x, y, z;
  int sign;
  x = xx;
  if (xx < 0.0f) {
    sign = -1;
    x = -xx;
  } else {
    sign = 1;
    x = xx;
  }
  if (x > 2.414213562373095f) {
    y = 1.57079632f;
    x = -(1.0f / x);
  } else if (x > 0.4142135623730950f) {
    y = 0.78539816f;
    x = (x - 1.0f) / (x + 1.0f);
  } else
    y = 0.0f;
  z = x * x;
  y += (((8.05374449538e-2f * z - 1.38776856032E-1f) * z + 1.99777106478E-1f) *
            z -
        3.33329491539E-1f) *
           z * x +
       x;
  if (sign < 0)
    y = -y;
  return (y);
}


x86 assembly (clang, -O0):
<fast_atanf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1143 <fast_atanf+0x43>
movl   $0xffffffff,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1154 <fast_atanf+0x54>
movl   $0x1,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xe9f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    119b <fast_atanf+0x9b>
movss  0xe9e(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe89(%rip),%xmm0
divss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11f7 <fast_atanf+0xf7>
movss  -0x8(%rbp),%xmm0
movss  0xe5c(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11ea <fast_atanf+0xea>
movss  0xe53(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xe3d(%rip),%xmm1
subss  %xmm1,%xmm0
movss  0xe31(%rip),%xmm1
addss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11f2 <fast_atanf+0xf2>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11f7 <fast_atanf+0xf7>
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xe09(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe01(%rip),%xmm1
addss  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xde4(%rip),%xmm1
addss  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xdcb(%rip),%xmm1
addss  %xmm1,%xmm0
mulss  -0x10(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    128f <fast_atanf+0x18f>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fast_atanf>:
movaps 0xef9(%rip),%xmm3
xorps  %xmm0,%xmm3
xorps  %xmm2,%xmm2
movaps %xmm0,%xmm1
cmpltss %xmm2,%xmm1
andps  %xmm1,%xmm3
andnps %xmm0,%xmm1
orps   %xmm3,%xmm1
ucomiss 0xeeb(%rip),%xmm1
jbe    113d <fast_atanf+0x3d>
movss  0xee9(%rip),%xmm3
divss  %xmm1,%xmm3
movss  0xee9(%rip),%xmm2
jmp    116a <fast_atanf+0x6a>
ucomiss 0xed0(%rip),%xmm1
jbe    116d <fast_atanf+0x6d>
movss  0xeca(%rip),%xmm3
addss  %xmm1,%xmm3
movss  0xec2(%rip),%xmm2
addss  %xmm1,%xmm2
divss  %xmm2,%xmm3
movss  0xeb6(%rip),%xmm2
movaps %xmm3,%xmm1
movaps %xmm1,%xmm3
mulss  %xmm1,%xmm3
movss  0xeac(%rip),%xmm4
mulss  %xmm3,%xmm4
addss  0xea4(%rip),%xmm4
mulss  %xmm3,%xmm4
addss  0xe9c(%rip),%xmm4
mulss  %xmm3,%xmm4
addss  0xe94(%rip),%xmm4
mulss  %xmm3,%xmm4
mulss  %xmm1,%xmm4
addss  %xmm1,%xmm4
addss  %xmm2,%xmm4
movaps 0xe49(%rip),%xmm1
xorps  %xmm4,%xmm1
xorps  %xmm2,%xmm2
cmpltss %xmm2,%xmm0
movaps %xmm0,%xmm2
andnps %xmm4,%xmm2
andps  %xmm1,%xmm0
orps   %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @fast_atanf(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
store float %0, float* %2
%7 = load float, float* %2
store float %7, float* %3
%8 = load float, float* %2
%9 = fcmp olt float %8, 0.000000e+00
br i1 %9, label %10, label %13
10: ; preds = %1
store i32 -1, i32* %6
%11 = load float, float* %2
%12 = fneg float %11
store float %12, float* %3
br label %15
13: ; preds = %1
store i32 1, i32* %6
%14 = load float, float* %2
store float %14, float* %3
br label %15
15: ; preds = %13, %10
%16 = load float, float* %3
%17 = fcmp ogt float %16, 0x4003504F40000000
br i1 %17, label %18, label %22
18: ; preds = %15
store float 0x3FF921FB60000000, float* %4
%19 = load float, float* %3
%20 = fdiv float 1.000000e+00, %19
%21 = fneg float %20
store float %21, float* %3
br label %33
22: ; preds = %15
%23 = load float, float* %3
%24 = fcmp ogt float %23, 0x3FDA8279A0000000
br i1 %24, label %25, label %31
25: ; preds = %22
store float 0x3FE921FB60000000, float* %4
%26 = load float, float* %3
%27 = fsub float %26, 1.000000e+00
%28 = load float, float* %3
%29 = fadd float %28, 1.000000e+00
%30 = fdiv float %27, %29
store float %30, float* %3
br label %32
31: ; preds = %22
store float 0.000000e+00, float* %4
br label %32
32: ; preds = %31, %25
br label %33
33: ; preds = %32, %18
%34 = load float, float* %3
%35 = load float, float* %3
%36 = fmul float %34, %35
store float %36, float* %5
%37 = load float, float* %5
%38 = call float @llvm.fmuladd.f32(float 0x3FB49E1A20000000, float %37, float 0xBFC1C370A0000000)
%39 = load float, float* %5
%40 = call float @llvm.fmuladd.f32(float %38, float %39, float 0x3FC9924BE0000000)
%41 = load float, float* %5
%42 = call float @llvm.fmuladd.f32(float %40, float %41, float 0xBFD5554540000000)
%43 = load float, float* %5
%44 = fmul float %42, %43
%45 = load float, float* %3
%46 = load float, float* %3
%47 = call float @llvm.fmuladd.f32(float %44, float %45, float %46)
%48 = load float, float* %4
%49 = fadd float %48, %47
store float %49, float* %4
%50 = load i32, i32* %6
%51 = icmp slt i32 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %33
%53 = load float, float* %4
%54 = fneg float %53
store float %54, float* %4
br label %55
55: ; preds = %52, %33
%56 = load float, float* %4
ret float %56
}

LLVM IR (-O2):
define float @fast_atanf(float %0) {
%2 = fcmp olt float %0, 0.000000e+00
%3 = fneg float %0
%4 = select i1 %2, float %3, float %0
%5 = fcmp ogt float %4, 0x4003504F40000000
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = fdiv float -1.000000e+00, %4
br label %14
8: ; preds = %1
%9 = fcmp ogt float %4, 0x3FDA8279A0000000
br i1 %9, label %10, label %14
10: ; preds = %8
%11 = fadd float %4, -1.000000e+00
%12 = fadd float %4, 1.000000e+00
%13 = fdiv float %11, %12
br label %14
14: ; preds = %8, %10, %6
%15 = phi float [ 0x3FF921FB60000000, %6 ], [ 0x3FE921FB60000000, %10 ], [ 0.000000e+00, %8 ]
%16 = phi float [ %7, %6 ], [ %13, %10 ], [ %4, %8 ]
%17 = fmul float %16, %16
%18 = tail call float @llvm.fmuladd.f32(float %17, float 0x3FB49E1A20000000, float 0xBFC1C370A0000000)
%19 = tail call float @llvm.fmuladd.f32(float %18, float %17, float 0x3FC9924BE0000000)
%20 = tail call float @llvm.fmuladd.f32(float %19, float %17, float 0xBFD5554540000000)
%21 = fmul float %17, %20
%22 = tail call float @llvm.fmuladd.f32(float %21, float %16, float %16)
%23 = fadd float %15, %22
%24 = fneg float %23
%25 = select i1 %2, float %24, float %23
ret float %25
}