#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 FastSqrt(float);
float FastAsin(float x) {
  float y, g;
  float num, den, result;
  long i;
  float sign = 1.0;
  y = x;
  if (y < (float)0.0) {
    y = -y;
    sign = -sign;
  }
  if (y > (float)0.5) {
    i = 1;
    if (y > (float)1.0) {
      result = 0.0;
      return result;
    }
    g = (1.0f - y) * 0.5f;
    y = -2.0f * FastSqrt(g);
  } else {
    i = 0;
    if (y < (float)(+3.452669830012e-4f)) {
      result = y;
      if (sign < (float)0.0) {
        result = -result;
      }
      return result;
    }
    g = y * y;
  }
  num = (((-5.9450144193246e-1f) * g + (+2.9058762374859f)) * g +
         (-2.7516555290596f)) *
        g;
  den = ((g + (-1.0333867072113e+1f)) * g + (+2.4864728969164e+1f)) * g +
        (-1.6509933202424e+1f);
  result = num / den;
  result = result * y + y;
  if (i == 1) {
    result = result + (float)(1.5707963267948966192313216916398f);
  }
  if (sign < (float)0.0) {
    result = -result;
  }
  return result;
}


x86 assembly (clang, -O0):
<FastAsin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x8(%rbp)
movss  0xedb(%rip),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    116f <FastAsin+0x5f>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x2c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xe88(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11fb <FastAsin+0xeb>
movq   $0x1,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xe66(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11ba <FastAsin+0xaa>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    134f <FastAsin+0x23f>
movss  0xe3e(%rip),%xmm0
subss  -0xc(%rbp),%xmm0
movss  0xe35(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <FastSqrt@plt>
movaps %xmm0,%xmm1
movss  0xe1f(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1261 <FastAsin+0x151>
movq   $0x0,-0x28(%rbp)
movss  0xdfd(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1252 <FastAsin+0x142>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x2c(%rbp),%xmm0
jbe    1243 <FastAsin+0x133>
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    134f <FastAsin+0x23f>
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xdb2(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xdaa(%rip),%xmm1
addss  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xd8d(%rip),%xmm1
addss  %xmm1,%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xd73(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xd59(%rip),%xmm1
addss  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xd40(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
divss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
cmpq   $0x1,-0x28(%rbp)
jne    1321 <FastAsin+0x211>
movss  0xd11(%rip),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x2c(%rbp),%xmm0
jbe    1345 <FastAsin+0x235>
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FastAsin>:
sub    $0x38,%rsp
movaps %xmm0,%xmm4
movaps 0xee2(%rip),%xmm1
xorps  %xmm0,%xmm1
xorps  %xmm0,%xmm0
movaps %xmm4,%xmm3
cmpltss %xmm0,%xmm3
andps  %xmm3,%xmm1
andnps %xmm4,%xmm3
orps   %xmm1,%xmm3
ucomiss 0xed4(%rip),%xmm3
jbe    118a <FastAsin+0x7a>
ucomiss 0xed3(%rip),%xmm3
ja     125e <FastAsin+0x14e>
movss  0xec5(%rip),%xmm0
subss  %xmm3,%xmm0
mulss  0xeb1(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps %xmm4,0x20(%rsp)
movaps %xmm3,0x10(%rsp)
call   1030 <FastSqrt@plt>
movaps (%rsp),%xmm5
movaps 0x10(%rsp),%xmm3
movaps 0x20(%rsp),%xmm4
mulss  0xe94(%rip),%xmm0
jmp    11c4 <FastAsin+0xb4>
movss  0xe82(%rip),%xmm0
ucomiss %xmm3,%xmm0
jbe    11ba <FastAsin+0xaa>
movaps 0xe62(%rip),%xmm1
xorps  %xmm3,%xmm1
xorps  %xmm2,%xmm2
movaps %xmm4,%xmm0
cmpltss %xmm2,%xmm0
andps  %xmm0,%xmm1
andnps %xmm4,%xmm0
orps   %xmm1,%xmm0
add    $0x38,%rsp
ret
movaps %xmm3,%xmm5
mulss  %xmm3,%xmm5
movaps %xmm3,%xmm0
movss  0xe54(%rip),%xmm1
mulss  %xmm5,%xmm1
addss  0xe4c(%rip),%xmm1
mulss  %xmm5,%xmm1
addss  0xe44(%rip),%xmm1
mulss  %xmm5,%xmm1
movss  0xe3c(%rip),%xmm2
addss  %xmm5,%xmm2
mulss  %xmm5,%xmm2
addss  0xe30(%rip),%xmm2
mulss  %xmm5,%xmm2
addss  0xe28(%rip),%xmm2
divss  %xmm2,%xmm1
mulss  %xmm0,%xmm1
addss  %xmm0,%xmm1
movss  0xe18(%rip),%xmm0
addss  %xmm1,%xmm0
movss  0xde4(%rip),%xmm2
cmpltss %xmm3,%xmm2
movaps %xmm2,%xmm3
andnps %xmm1,%xmm3
andps  %xmm0,%xmm2
orps   %xmm3,%xmm2
movaps 0xdbc(%rip),%xmm0
xorps  %xmm2,%xmm0
xorps  %xmm1,%xmm1
cmpltss %xmm1,%xmm4
movaps %xmm4,%xmm1
andnps %xmm2,%xmm1
andps  %xmm0,%xmm4
orps   %xmm1,%xmm4
movaps %xmm4,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define float @FastAsin(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca i64
%10 = alloca float
store float %0, float* %3
store float 1.000000e+00, float* %10
%11 = load float, float* %3
store float %11, float* %4
%12 = load float, float* %4
%13 = fcmp olt float %12, 0.000000e+00
br i1 %13, label %14, label %19
14: ; preds = %1
%15 = load float, float* %4
%16 = fneg float %15
store float %16, float* %4
%17 = load float, float* %10
%18 = fneg float %17
store float %18, float* %10
br label %19
19: ; preds = %14, %1
%20 = load float, float* %4
%21 = fcmp ogt float %20, 5.000000e-01
br i1 %21, label %22, label %34
22: ; preds = %19
store i64 1, i64* %9
%23 = load float, float* %4
%24 = fcmp ogt float %23, 1.000000e+00
br i1 %24, label %25, label %27
25: ; preds = %22
store float 0.000000e+00, float* %8
%26 = load float, float* %8
store float %26, float* %2
br label %83
27: ; preds = %22
%28 = load float, float* %4
%29 = fsub float 1.000000e+00, %28
%30 = fmul float %29, 5.000000e-01
store float %30, float* %5
%31 = load float, float* %5
%32 = call float @FastSqrt(float %31)
%33 = fmul float -2.000000e+00, %32
store float %33, float* %4
br label %50
34: ; preds = %19
store i64 0, i64* %9
%35 = load float, float* %4
%36 = fcmp olt float %35, 0x3F36A09E60000000
br i1 %36, label %37, label %46
37: ; preds = %34
%38 = load float, float* %4
store float %38, float* %8
%39 = load float, float* %10
%40 = fcmp olt float %39, 0.000000e+00
br i1 %40, label %41, label %44
41: ; preds = %37
%42 = load float, float* %8
%43 = fneg float %42
store float %43, float* %8
br label %44
44: ; preds = %41, %37
%45 = load float, float* %8
store float %45, float* %2
br label %83
46: ; preds = %34
%47 = load float, float* %4
%48 = load float, float* %4
%49 = fmul float %47, %48
store float %49, float* %5
br label %50
50: ; preds = %46, %27
%51 = load float, float* %5
%52 = call float @llvm.fmuladd.f32(float 0xBFE30627E0000000, float %51, float 0x40073F3C00000000)
%53 = load float, float* %5
%54 = call float @llvm.fmuladd.f32(float %52, float %53, float 0xC006036400000000)
%55 = load float, float* %5
%56 = fmul float %54, %55
store float %56, float* %6
%57 = load float, float* %5
%58 = fadd float %57, 0xC024AAF0A0000000
%59 = load float, float* %5
%60 = call float @llvm.fmuladd.f32(float %58, float %59, float 0x4038DD5EE0000000)
%61 = load float, float* %5
%62 = call float @llvm.fmuladd.f32(float %60, float %61, float 0xC030828B00000000)
store float %62, float* %7
%63 = load float, float* %6
%64 = load float, float* %7
%65 = fdiv float %63, %64
store float %65, float* %8
%66 = load float, float* %8
%67 = load float, float* %4
%68 = load float, float* %4
%69 = call float @llvm.fmuladd.f32(float %66, float %67, float %68)
store float %69, float* %8
%70 = load i64, i64* %9
%71 = icmp eq i64 %70, 1
br i1 %71, label %72, label %75
72: ; preds = %50
%73 = load float, float* %8
%74 = fadd float %73, 0x3FF921FB60000000
store float %74, float* %8
br label %75
75: ; preds = %72, %50
%76 = load float, float* %10
%77 = fcmp olt float %76, 0.000000e+00
br i1 %77, label %78, label %81
78: ; preds = %75
%79 = load float, float* %8
%80 = fneg float %79
store float %80, float* %8
br label %81
81: ; preds = %78, %75
%82 = load float, float* %8
store float %82, float* %2
br label %83
83: ; preds = %81, %44, %25
%84 = load float, float* %2
ret float %84
}

LLVM IR (-O2):
define float @FastAsin(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, 5.000000e-01
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = fcmp ogt float %4, 1.000000e+00
br i1 %7, label %35, label %8
8: ; preds = %6
%9 = fsub float 1.000000e+00, %4
%10 = fmul float %9, 5.000000e-01
%11 = tail call float @FastSqrt(float %10)
%12 = fmul float %11, -2.000000e+00
br label %20
13: ; preds = %1
%14 = fcmp olt float %4, 0x3F36A09E60000000
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = fneg float %4
%17 = select i1 %2, float %16, float %0
br label %35
18: ; preds = %13
%19 = fmul float %4, %4
br label %20
20: ; preds = %18, %8
%21 = phi float [ %10, %8 ], [ %19, %18 ]
%22 = phi float [ %12, %8 ], [ %4, %18 ]
%23 = tail call float @llvm.fmuladd.f32(float %21, float 0xBFE30627E0000000, float 0x40073F3C00000000)
%24 = tail call float @llvm.fmuladd.f32(float %23, float %21, float 0xC006036400000000)
%25 = fmul float %21, %24
%26 = fadd float %21, 0xC024AAF0A0000000
%27 = tail call float @llvm.fmuladd.f32(float %26, float %21, float 0x4038DD5EE0000000)
%28 = tail call float @llvm.fmuladd.f32(float %27, float %21, float 0xC030828B00000000)
%29 = fdiv float %25, %28
%30 = tail call float @llvm.fmuladd.f32(float %29, float %22, float %22)
%31 = fadd float %30, 0x3FF921FB60000000
%32 = select i1 %5, float %31, float %30
%33 = fneg float %32
%34 = select i1 %2, float %33, float %32
br label %35
35: ; preds = %6, %20, %15
%36 = phi float [ %34, %20 ], [ %17, %15 ], [ 0.000000e+00, %6 ]
ret float %36
}