#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);
float sqrtf(float);
float acosf(float x) {
  float xa = fabsf(x);
  float result = sqrtf(1.0f - xa) *
                 (1.5707288f +
                  xa * (-0.2121144f + xa * (0.0742610f + (-0.0187293f * xa))));
  if (x < 0.0f)
    return 3.14159265358979323846f - result;
  else
    return result;
}


x86 assembly (clang, -O0):
<acosf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movaps 0xef7(%rip),%xmm1
pand   %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xed6(%rip),%xmm0
subss  -0xc(%rbp),%xmm0
call   1030 <sqrtf@plt>
movss  -0xc(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0xc(%rbp),%xmm3
movss  0xead(%rip),%xmm4
mulss  %xmm4,%xmm3
movss  0xea5(%rip),%xmm4
addss  %xmm4,%xmm3
mulss  %xmm3,%xmm2
movss  0xe8d(%rip),%xmm3
addss  %xmm3,%xmm2
mulss  %xmm2,%xmm1
movss  0xe79(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    11b8 <acosf+0xa8>
movss  0xe6b(%rip),%xmm0
subss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11c2 <acosf+0xb2>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<acosf>:
sub    $0x28,%rsp
movaps %xmm0,%xmm3
movaps 0xee2(%rip),%xmm4
andps  %xmm0,%xmm4
movss  0xee7(%rip),%xmm0
subss  %xmm4,%xmm0
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm0
jb     113b <acosf+0x2b>
sqrtss %xmm0,%xmm0
jmp    1155 <acosf+0x45>
movaps %xmm3,0x10(%rsp)
movaps %xmm4,(%rsp)
call   1030 <sqrtf@plt>
movaps (%rsp),%xmm4
xorps  %xmm2,%xmm2
movaps 0x10(%rsp),%xmm3
movss  0xeb7(%rip),%xmm1
mulss  %xmm4,%xmm1
addss  0xeaf(%rip),%xmm1
mulss  %xmm4,%xmm1
addss  0xea7(%rip),%xmm1
mulss  %xmm4,%xmm1
addss  0xe9f(%rip),%xmm1
mulss  %xmm0,%xmm1
movss  0xe97(%rip),%xmm0
subss  %xmm1,%xmm0
cmpltss %xmm2,%xmm3
movaps %xmm3,%xmm2
andnps %xmm1,%xmm2
andps  %xmm0,%xmm3
orps   %xmm2,%xmm3
movaps %xmm3,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @acosf(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
%6 = load float, float* %3
%7 = call float @llvm.fabs.f32(float %6)
store float %7, float* %4
%8 = load float, float* %4
%9 = fsub float 1.000000e+00, %8
%10 = call float @sqrtf(float %9)
%11 = load float, float* %4
%12 = load float, float* %4
%13 = load float, float* %4
%14 = call float @llvm.fmuladd.f32(float 0xBF932DC600000000, float %13, float 0x3FB302C4E0000000)
%15 = call float @llvm.fmuladd.f32(float %12, float %14, float 0xBFCB269080000000)
%16 = call float @llvm.fmuladd.f32(float %11, float %15, float 0x3FF921B480000000)
%17 = fmul float %10, %16
store float %17, float* %5
%18 = load float, float* %3
%19 = fcmp olt float %18, 0.000000e+00
br i1 %19, label %20, label %23
20: ; preds = %1
%21 = load float, float* %5
%22 = fsub float 0x400921FB60000000, %21
store float %22, float* %2
br label %25
23: ; preds = %1
%24 = load float, float* %5
store float %24, float* %2
br label %25
25: ; preds = %23, %20
%26 = load float, float* %2
ret float %26
}

LLVM IR (-O2):
define float @acosf(float %0) {
%2 = tail call float @llvm.fabs.f32(float %0)
%3 = fsub float 1.000000e+00, %2
%4 = tail call float @sqrtf(float %3)
%5 = tail call float @llvm.fmuladd.f32(float %2, float 0xBF932DC600000000, float 0x3FB302C4E0000000)
%6 = tail call float @llvm.fmuladd.f32(float %2, float %5, float 0xBFCB269080000000)
%7 = tail call float @llvm.fmuladd.f32(float %2, float %6, float 0x3FF921B480000000)
%8 = fmul float %7, %4
%9 = fcmp olt float %0, 0.000000e+00
%10 = fsub float 0x400921FB60000000, %8
%11 = select i1 %9, float %10, float %8
ret float %11
}