#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
float _atanf(float);
float pspFpuAtan(float x) {
  int sign = 1;
  if (x != x) {
    return x;
  }
  if (x < 0.0f) {
    x = -x;
    sign = -1;
  }
  if (x >= 1.0f) {
    x = 1.0f / x;
    x = ((float)(3.14159265358979323846 / 2)) - _atanf(x);
  } else {
    x = _atanf(x);
  }
  return x * (float)sign;
}


x86 assembly (clang, -O0):
<pspFpuAtan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jne    113e <pspFpuAtan+0x2e>
jp     113e <pspFpuAtan+0x2e>
jmp    114d <pspFpuAtan+0x3d>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e5 <pspFpuAtan+0xd5>
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1178 <pspFpuAtan+0x68>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xe7b(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     11c3 <pspFpuAtan+0xb3>
movss  0xe6a(%rip),%xmm0
divss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <_atanf@plt>
movaps %xmm0,%xmm1
movss  0xe4f(%rip),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11d2 <pspFpuAtan+0xc2>
movss  -0x8(%rbp),%xmm0
call   1030 <_atanf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pspFpuAtan>:
movaps %xmm0,%xmm3
ucomiss %xmm0,%xmm0
jp     1194 <pspFpuAtan+0x84>
sub    $0x18,%rsp
movaps 0xedd(%rip),%xmm1
xorps  %xmm3,%xmm1
xorps  %xmm2,%xmm2
movaps %xmm3,%xmm0
cmpltss %xmm2,%xmm0
andps  %xmm0,%xmm1
movaps %xmm3,(%rsp)
andnps %xmm3,%xmm0
orps   %xmm1,%xmm0
ucomiss 0xecb(%rip),%xmm0
jae    114e <pspFpuAtan+0x3e>
call   1030 <_atanf@plt>
jmp    1171 <pspFpuAtan+0x61>
movss  0xeba(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
call   1030 <_atanf@plt>
movaps %xmm0,%xmm1
movss  0xea7(%rip),%xmm0
subss  %xmm1,%xmm0
movaps 0xe88(%rip),%xmm1
xorps  %xmm0,%xmm1
xorps  %xmm2,%xmm2
movaps (%rsp),%xmm3
cmpltss %xmm2,%xmm3
andps  %xmm3,%xmm1
andnps %xmm0,%xmm3
orps   %xmm1,%xmm3
add    $0x18,%rsp
movaps %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @pspFpuAtan(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca i32
store float %0, float* %3
store i32 1, i32* %4
%5 = load float, float* %3
%6 = load float, float* %3
%7 = fcmp une float %5, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load float, float* %3
store float %9, float* %2
br label %33
10: ; preds = %1
%11 = load float, float* %3
%12 = fcmp olt float %11, 0.000000e+00
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load float, float* %3
%15 = fneg float %14
store float %15, float* %3
store i32 -1, i32* %4
br label %16
16: ; preds = %13, %10
%17 = load float, float* %3
%18 = fcmp oge float %17, 1.000000e+00
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load float, float* %3
%21 = fdiv float 1.000000e+00, %20
store float %21, float* %3
%22 = load float, float* %3
%23 = call float @_atanf(float %22)
%24 = fsub float 0x3FF921FB60000000, %23
store float %24, float* %3
br label %28
25: ; preds = %16
%26 = load float, float* %3
%27 = call float @_atanf(float %26)
store float %27, float* %3
br label %28
28: ; preds = %25, %19
%29 = load float, float* %3
%30 = load i32, i32* %4
%31 = sitofp i32 %30 to float
%32 = fmul float %29, %31
store float %32, float* %2
br label %33
33: ; preds = %28, %8
%34 = load float, float* %2
ret float %34
}

LLVM IR (-O2):
define float @pspFpuAtan(float %0) {
%2 = fcmp uno float %0, 0.000000e+00
br i1 %2, label %18, label %3
3: ; preds = %1
%4 = fcmp olt float %0, 0.000000e+00
%5 = fneg float %0
%6 = select i1 %4, float %5, float %0
%7 = fcmp ult float %6, 1.000000e+00
br i1 %7, label %12, label %8
8: ; preds = %3
%9 = fdiv float 1.000000e+00, %6
%10 = tail call float @_atanf(float %9)
%11 = fsub float 0x3FF921FB60000000, %10
br label %14
12: ; preds = %3
%13 = tail call float @_atanf(float %6)
br label %14
14: ; preds = %12, %8
%15 = phi float [ %11, %8 ], [ %13, %12 ]
%16 = fneg float %15
%17 = select i1 %4, float %16, float %15
br label %18
18: ; preds = %1, %14
%19 = phi float [ %17, %14 ], [ %0, %1 ]
ret float %19
}