#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 fabsf(float const);
float sqrtf(float);
float FAST_ACOS(const float x) {
  float poly;
  const float xa = fabsf(x);
  float one = (float)1.0;
  poly = (float)+7.1796493341480527e-04;
  poly = (float)-4.1160981058965262e-03 + poly * xa;
  poly = (float)+1.1272900916992512e-02 + poly * xa;
  poly = (float)-2.0949278766238422e-02 + poly * xa;
  poly = (float)+3.2683762943179318e-02 + poly * xa;
  poly = (float)-5.0625279962389413e-02 + poly * xa;
  poly = (float)+8.9034700107934128e-02 + poly * xa;
  poly = (float)-2.1460143648688035e-01 + poly * xa;
  poly = (float)+1.5707963267948966 + poly * xa;
  poly = poly * sqrtf(one - xa);
  return (x < 0.0f) ? (3.14159265358979323846264338327950288 - poly) : poly;
}


x86 assembly (clang, -O0):
<FAST_ACOS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movaps 0xf07(%rip),%xmm1
pand   %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xeea(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xed9(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xeba(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe97(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe74(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe51(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe2e(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe0b(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xde8(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xdc5(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
call   1030 <sqrtf@plt>
movaps %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    129a <FAST_ACOS+0x18a>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdb4(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    12a8 <FAST_ACOS+0x198>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FAST_ACOS>:
sub    $0x28,%rsp
movaps %xmm0,%xmm2
movaps 0xee2(%rip),%xmm1
andps  %xmm0,%xmm1
movss  0xee7(%rip),%xmm3
mulss  %xmm1,%xmm3
addss  0xedf(%rip),%xmm3
mulss  %xmm1,%xmm3
addss  0xed7(%rip),%xmm3
mulss  %xmm1,%xmm3
addss  0xecf(%rip),%xmm3
mulss  %xmm1,%xmm3
addss  0xec7(%rip),%xmm3
mulss  %xmm1,%xmm3
addss  0xebf(%rip),%xmm3
mulss  %xmm1,%xmm3
addss  0xeb7(%rip),%xmm3
mulss  %xmm1,%xmm3
addss  0xeaf(%rip),%xmm3
mulss  %xmm1,%xmm3
addss  0xea7(%rip),%xmm3
movss  0xea3(%rip),%xmm0
subss  %xmm1,%xmm0
xorps  %xmm4,%xmm4
ucomiss %xmm4,%xmm0
jb     11a3 <FAST_ACOS+0x93>
sqrtss %xmm0,%xmm0
jmp    11bd <FAST_ACOS+0xad>
movaps %xmm2,0x10(%rsp)
movaps %xmm3,(%rsp)
call   1030 <sqrtf@plt>
xorps  %xmm4,%xmm4
movaps (%rsp),%xmm3
movaps 0x10(%rsp),%xmm2
mulss  %xmm0,%xmm3
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
movsd  0xe68(%rip),%xmm1
subsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
cmpltss %xmm4,%xmm2
movaps %xmm2,%xmm1
andnps %xmm3,%xmm1
andps  %xmm0,%xmm2
orps   %xmm1,%xmm2
movaps %xmm2,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @FAST_ACOS(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 = call float @llvm.fabs.f32(float %6)
store float %7, float* %4
store float 1.000000e+00, float* %5
store float 0x3F4786BA00000000, float* %3
%8 = load float, float* %3
%9 = load float, float* %4
%10 = call float @llvm.fmuladd.f32(float %8, float %9, float 0xBF70DC0AA0000000)
store float %10, float* %3
%11 = load float, float* %3
%12 = load float, float* %4
%13 = call float @llvm.fmuladd.f32(float %11, float %12, float 0x3F87163F20000000)
store float %13, float* %3
%14 = load float, float* %3
%15 = load float, float* %4
%16 = call float @llvm.fmuladd.f32(float %14, float %15, float 0xBF9573BA40000000)
store float %16, float* %3
%17 = load float, float* %3
%18 = load float, float* %4
%19 = call float @llvm.fmuladd.f32(float %17, float %18, float 0x3FA0BBED20000000)
store float %19, float* %3
%20 = load float, float* %3
%21 = load float, float* %4
%22 = call float @llvm.fmuladd.f32(float %20, float %21, float 0xBFA9EB8E80000000)
store float %22, float* %3
%23 = load float, float* %3
%24 = load float, float* %4
%25 = call float @llvm.fmuladd.f32(float %23, float %24, float 0x3FB6CAFA60000000)
store float %25, float* %3
%26 = load float, float* %3
%27 = load float, float* %4
%28 = call float @llvm.fmuladd.f32(float %26, float %27, float 0xBFCB780F60000000)
store float %28, float* %3
%29 = load float, float* %3
%30 = load float, float* %4
%31 = call float @llvm.fmuladd.f32(float %29, float %30, float 0x3FF921FB60000000)
store float %31, float* %3
%32 = load float, float* %3
%33 = load float, float* %5
%34 = load float, float* %4
%35 = fsub float %33, %34
%36 = call float @sqrtf(float %35)
%37 = fmul float %32, %36
store float %37, float* %3
%38 = load float, float* %2
%39 = fcmp olt float %38, 0.000000e+00
br i1 %39, label %40, label %44
40: ; preds = %1
%41 = load float, float* %3
%42 = fpext float %41 to double
%43 = fsub double 0x400921FB54442D18, %42
br label %47
44: ; preds = %1
%45 = load float, float* %3
%46 = fpext float %45 to double
br label %47
47: ; preds = %44, %40
%48 = phi double [ %43, %40 ], [ %46, %44 ]
%49 = fptrunc double %48 to float
ret float %49
}

LLVM IR (-O2):
define float @FAST_ACOS(float %0) {
%2 = tail call float @llvm.fabs.f32(float %0)
%3 = tail call float @llvm.fmuladd.f32(float %2, float 0x3F4786BA00000000, float 0xBF70DC0AA0000000)
%4 = tail call float @llvm.fmuladd.f32(float %3, float %2, float 0x3F87163F20000000)
%5 = tail call float @llvm.fmuladd.f32(float %4, float %2, float 0xBF9573BA40000000)
%6 = tail call float @llvm.fmuladd.f32(float %5, float %2, float 0x3FA0BBED20000000)
%7 = tail call float @llvm.fmuladd.f32(float %6, float %2, float 0xBFA9EB8E80000000)
%8 = tail call float @llvm.fmuladd.f32(float %7, float %2, float 0x3FB6CAFA60000000)
%9 = tail call float @llvm.fmuladd.f32(float %8, float %2, float 0xBFCB780F60000000)
%10 = tail call float @llvm.fmuladd.f32(float %9, float %2, float 0x3FF921FB60000000)
%11 = fsub float 1.000000e+00, %2
%12 = tail call float @sqrtf(float %11)
%13 = fmul float %10, %12
%14 = fcmp olt float %0, 0.000000e+00
%15 = fpext float %13 to double
%16 = fsub double 0x400921FB54442D18, %15
%17 = fptrunc double %16 to float
%18 = select i1 %14, float %17, float %13
ret float %18
}