#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 */
int fabsfk(float);
float mlaf(float, float, float);
float mulsignf(float, float);
int sqrtf(float);
__attribute__((visibility("default"))) const float xasinf(float d) {
  int o = fabsfk(d) < 0.5f;
  float x2 = o ? (d * d) : ((1 - fabsfk(d)) * 0.5f),
        x = o ? fabsfk(d) : sqrtf(x2), u;
  u = +0.4197454825e-1;
  u = mlaf(u, x2, +0.2424046025e-1);
  u = mlaf(u, x2, +0.4547423869e-1);
  u = mlaf(u, x2, +0.7495029271e-1);
  u = mlaf(u, x2, +0.1666677296e+0);
  u = mlaf(u, x * x2, x);
  float r =
      o ? u : (((float)3.141592653589793238462643383279502884) / 2 - 2 * u);
  r = mulsignf(r, d);
  return r;
}


x86 assembly (clang, -O0):
<xasinf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1060 <fabsfk@plt>
cvtsi2ss %eax,%xmm1
movss  0xe9d(%rip),%xmm0
ucomiss %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     118f <xasinf+0x4f>
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    11b7 <xasinf+0x77>
movss  -0x4(%rbp),%xmm0
call   1060 <fabsfk@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  0xe52(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11dd <xasinf+0x9d>
movss  -0x4(%rbp),%xmm0
call   1060 <fabsfk@plt>
mov    %eax,-0x20(%rbp)
jmp    11ea <xasinf+0xaa>
movss  -0xc(%rbp),%xmm0
call   1040 <sqrtf@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe16(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  0xdfb(%rip),%xmm2
call   1030 <mlaf@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  0xddb(%rip),%xmm2
call   1030 <mlaf@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  0xdbb(%rip),%xmm2
call   1030 <mlaf@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  0xd9b(%rip),%xmm2
call   1030 <mlaf@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
call   1030 <mlaf@plt>
movss  %xmm0,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     12aa <xasinf+0x16a>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    12c4 <xasinf+0x184>
movss  -0x14(%rbp),%xmm1
addss  %xmm1,%xmm1
movss  0xd5d(%rip),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
call   1050 <mulsignf@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xasinf>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0x8(%rsp)
call   1060 <fabsfk@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    1184 <xasinf+0x44>
movss  0x8(%rsp),%xmm0
call   1060 <fabsfk@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm0
mulss  0xe89(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
call   1040 <sqrtf@plt>
jmp    119c <xasinf+0x5c>
movss  0x8(%rsp),%xmm0
movaps %xmm0,%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
call   1060 <fabsfk@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0xc(%rsp)
movss  0xe53(%rip),%xmm0
movss  0xe4f(%rip),%xmm2
movss  0x4(%rsp),%xmm1
call   1030 <mlaf@plt>
movss  0xe40(%rip),%xmm2
movss  0x4(%rsp),%xmm1
call   1030 <mlaf@plt>
movss  0xe31(%rip),%xmm2
movss  0x4(%rsp),%xmm1
call   1030 <mlaf@plt>
movss  0xe22(%rip),%xmm2
movss  0x4(%rsp),%xmm1
call   1030 <mlaf@plt>
movss  0xc(%rsp),%xmm2
movss  0x4(%rsp),%xmm1
mulss  %xmm2,%xmm1
call   1030 <mlaf@plt>
test   %ebx,%ebx
jle    1229 <xasinf+0xe9>
addss  %xmm0,%xmm0
movss  0xdf6(%rip),%xmm1
subss  %xmm0,%xmm1
movaps %xmm1,%xmm0
movss  0x8(%rsp),%xmm1
add    $0x10,%rsp
pop    %rbx
jmp    1050 <mulsignf@plt>

LLVM IR (-O0):
define float @xasinf(float %0) {
%2 = alloca float
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %2
%8 = load float, float* %2
%9 = call i32 @fabsfk(float %8)
%10 = sitofp i32 %9 to float
%11 = fcmp olt float %10, 5.000000e-01
%12 = zext i1 %11 to i32
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %1
%16 = load float, float* %2
%17 = load float, float* %2
%18 = fmul float %16, %17
br label %25
19: ; preds = %1
%20 = load float, float* %2
%21 = call i32 @fabsfk(float %20)
%22 = sub nsw i32 1, %21
%23 = sitofp i32 %22 to float
%24 = fmul float %23, 5.000000e-01
br label %25
25: ; preds = %19, %15
%26 = phi float [ %18, %15 ], [ %24, %19 ]
store float %26, float* %4
%27 = load i32, i32* %3
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = load float, float* %2
%31 = call i32 @fabsfk(float %30)
br label %35
32: ; preds = %25
%33 = load float, float* %4
%34 = call i32 @sqrtf(float %33)
br label %35
35: ; preds = %32, %29
%36 = phi i32 [ %31, %29 ], [ %34, %32 ]
%37 = sitofp i32 %36 to float
store float %37, float* %5
store float 0x3FA57DB020000000, float* %6
%38 = load float, float* %6
%39 = load float, float* %4
%40 = call float @mlaf(float %38, float %39, float 0x3F98D27DC0000000)
store float %40, float* %6
%41 = load float, float* %6
%42 = load float, float* %4
%43 = call float @mlaf(float %41, float %42, float 0x3FA7486640000000)
store float %43, float* %6
%44 = load float, float* %6
%45 = load float, float* %4
%46 = call float @mlaf(float %44, float %45, float 0x3FB32FF140000000)
store float %46, float* %6
%47 = load float, float* %6
%48 = load float, float* %4
%49 = call float @mlaf(float %47, float %48, float 0x3FC5555E40000000)
store float %49, float* %6
%50 = load float, float* %6
%51 = load float, float* %5
%52 = load float, float* %4
%53 = fmul float %51, %52
%54 = load float, float* %5
%55 = call float @mlaf(float %50, float %53, float %54)
store float %55, float* %6
%56 = load i32, i32* %3
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %35
%59 = load float, float* %6
br label %63
60: ; preds = %35
%61 = load float, float* %6
%62 = call float @llvm.fmuladd.f32(float -2.000000e+00, float %61, float 0x3FF921FB60000000)
br label %63
63: ; preds = %60, %58
%64 = phi float [ %59, %58 ], [ %62, %60 ]
store float %64, float* %7
%65 = load float, float* %7
%66 = load float, float* %2
%67 = call float @mulsignf(float %65, float %66)
store float %67, float* %7
%68 = load float, float* %7
ret float %68
}

LLVM IR (-O2):
define float @xasinf(float %0) {
%2 = tail call i32 @fabsfk(float %0)
%3 = icmp slt i32 %2, 1
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = fmul float %0, %0
%6 = tail call i32 @fabsfk(float %0)
br label %13
7: ; preds = %1
%8 = tail call i32 @fabsfk(float %0)
%9 = sub nsw i32 1, %8
%10 = sitofp i32 %9 to float
%11 = fmul float %10, 5.000000e-01
%12 = tail call i32 @sqrtf(float %11)
br label %13
13: ; preds = %7, %4
%14 = phi float [ %5, %4 ], [ %11, %7 ]
%15 = phi i32 [ %6, %4 ], [ %12, %7 ]
%16 = sitofp i32 %15 to float
%17 = tail call float @mlaf(float 0x3FA57DB020000000, float %14, float 0x3F98D27DC0000000)
%18 = tail call float @mlaf(float %17, float %14, float 0x3FA7486640000000)
%19 = tail call float @mlaf(float %18, float %14, float 0x3FB32FF140000000)
%20 = tail call float @mlaf(float %19, float %14, float 0x3FC5555E40000000)
%21 = fmul float %14, %16
%22 = tail call float @mlaf(float %20, float %21, float %16)
%23 = tail call float @llvm.fmuladd.f32(float %22, float -2.000000e+00, float 0x3FF921FB60000000)
%24 = select i1 %3, float %22, float %23
%25 = tail call float @mulsignf(float %24, float %0)
ret float %25
}