#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 fabsk(double);
double mla(double, double, double);
double mulsign(double, double);
int sqrt(double);
__attribute__((visibility("default"))) const double xasin(double d) {
  int o = fabsk(d) < 0.5;
  double x2 = o ? (d * d) : ((1 - fabsk(d)) * 0.5), x = o ? fabsk(d) : sqrt(x2),
         u;
  double x4 = x2 * x2, x8 = x4 * x4, x16 = x8 * x8;
  u = mla(
      x16,
      mla(x4, mla(x2, (+0.3161587650653934628e-1), (-0.1581918243329996643e-1)),
          mla(x2, (+0.1929045477267910674e-1), (+0.6606077476277170610e-2))),
      mla(x8,
          mla(x4,
              mla(x2, (+0.1215360525577377331e-1), (+0.1388715184501609218e-1)),
              mla(x2, (+0.1735956991223614604e-1),
                  (+0.2237176181932048341e-1))),
          mla(x4,
              mla(x2, (+0.3038195928038132237e-1), (+0.4464285681377102438e-1)),
              mla(x2, (+0.7500000000378581611e-1),
                  (+0.1666666666666497543e+0)))));
  u = mla(u, x * x2, x);
  double r = o ? u : (3.141592653589793238462643383279502884 / 2 - 2 * u);
  r = mulsign(r, d);
  return r;
}


x86 assembly (clang, -O0):
<xasin>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <fabsk@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe9a(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1193 <xasin+0x53>
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    11bb <xasin+0x7b>
movsd  -0x8(%rbp),%xmm0
call   1040 <fabsk@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe4e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11e1 <xasin+0xa1>
movsd  -0x8(%rbp),%xmm0
call   1040 <fabsk@plt>
mov    %eax,-0x54(%rbp)
jmp    11ee <xasin+0xae>
movsd  -0x18(%rbp),%xmm0
call   1050 <sqrt@plt>
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  0xe0d(%rip),%xmm1
movsd  0xe0d(%rip),%xmm2
call   1060 <mla@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  0xddb(%rip),%xmm1
movsd  0xddb(%rip),%xmm2
call   1060 <mla@plt>
movsd  -0xa8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa0(%rbp),%xmm0
ff
call   1060 <mla@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  0xd7d(%rip),%xmm1
movsd  0xd7d(%rip),%xmm2
call   1060 <mla@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  0xd4b(%rip),%xmm1
movsd  0xd4b(%rip),%xmm2
call   1060 <mla@plt>
movsd  -0x98(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x90(%rbp),%xmm0
ff
call   1060 <mla@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xcfa(%rip),%xmm1
movsd  0xcfa(%rip),%xmm2
call   1060 <mla@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  0xcc8(%rip),%xmm1
movsd  0xcc8(%rip),%xmm2
call   1060 <mla@plt>
movsd  -0x88(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x80(%rbp),%xmm0
call   1060 <mla@plt>
movsd  -0x78(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x70(%rbp),%xmm0
call   1060 <mla@plt>
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
call   1060 <mla@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1060 <mla@plt>
movsd  %xmm0,-0x28(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     13c5 <xasin+0x285>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
jmp    13e2 <xasin+0x2a2>
movsd  -0x28(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xc92(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
call   1030 <mulsign@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xasin>:
push   %rbx
sub    $0x50,%rsp
movsd  %xmm0,0x10(%rsp)
call   1040 <fabsk@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    1184 <xasin+0x44>
movsd  0x10(%rsp),%xmm0
call   1040 <fabsk@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mulsd  0xe89(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1050 <sqrt@plt>
jmp    119d <xasin+0x5d>
movsd  0x10(%rsp),%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
call   1040 <fabsk@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x48(%rsp)
movsd  0x8(%rsp),%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x28(%rsp)
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x38(%rsp)
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x40(%rsp)
movsd  0xe2e(%rip),%xmm1
movsd  0xe2e(%rip),%xmm2
call   1060 <mla@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0xe23(%rip),%xmm1
movsd  0xe23(%rip),%xmm2
movsd  0x8(%rsp),%xmm0
call   1060 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1060 <mla@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0xdfe(%rip),%xmm1
movsd  0xdfe(%rip),%xmm2
movsd  0x8(%rsp),%xmm0
call   1060 <mla@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0xded(%rip),%xmm1
movsd  0xded(%rip),%xmm2
movsd  0x8(%rsp),%xmm0
call   1060 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x28(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
call   1060 <mla@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0xdc8(%rip),%xmm1
movsd  0xdc8(%rip),%xmm2
movsd  0x8(%rsp),%xmm0
call   1060 <mla@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0xdb7(%rip),%xmm1
movsd  0xdb7(%rip),%xmm2
movsd  0x8(%rsp),%xmm0
call   1060 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x28(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
call   1060 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x38(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
call   1060 <mla@plt>
movaps %xmm0,%xmm2
movsd  0x40(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1060 <mla@plt>
movsd  0x48(%rsp),%xmm2
movsd  0x8(%rsp),%xmm1
mulsd  %xmm2,%xmm1
call   1060 <mla@plt>
test   %ebx,%ebx
jle    131d <xasin+0x1dd>
addsd  %xmm0,%xmm0
movsd  0xd53(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd  0x10(%rsp),%xmm1
add    $0x50,%rsp
pop    %rbx
jmp    1030 <mulsign@plt>

LLVM IR (-O0):
define double @xasin(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %2
%11 = load double, double* %2
%12 = call i32 @fabsk(double %11)
%13 = sitofp i32 %12 to double
%14 = fcmp olt double %13, 5.000000e-01
%15 = zext i1 %14 to i32
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %1
%19 = load double, double* %2
%20 = load double, double* %2
%21 = fmul double %19, %20
br label %28
22: ; preds = %1
%23 = load double, double* %2
%24 = call i32 @fabsk(double %23)
%25 = sub nsw i32 1, %24
%26 = sitofp i32 %25 to double
%27 = fmul double %26, 5.000000e-01
br label %28
28: ; preds = %22, %18
%29 = phi double [ %21, %18 ], [ %27, %22 ]
store double %29, double* %4
%30 = load i32, i32* %3
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %28
%33 = load double, double* %2
%34 = call i32 @fabsk(double %33)
br label %38
35: ; preds = %28
%36 = load double, double* %4
%37 = call i32 @sqrt(double %36)
br label %38
38: ; preds = %35, %32
%39 = phi i32 [ %34, %32 ], [ %37, %35 ]
%40 = sitofp i32 %39 to double
store double %40, double* %5
%41 = load double, double* %4
%42 = load double, double* %4
%43 = fmul double %41, %42
store double %43, double* %7
%44 = load double, double* %7
%45 = load double, double* %7
%46 = fmul double %44, %45
store double %46, double* %8
%47 = load double, double* %8
%48 = load double, double* %8
%49 = fmul double %47, %48
store double %49, double* %9
%50 = load double, double* %9
%51 = load double, double* %7
%52 = load double, double* %4
%53 = call double @mla(double %52, double 0x3FA02FF4C7428A47, double 0xBF9032E75CCD4AE8)
%54 = load double, double* %4
%55 = call double @mla(double %54, double 0x3F93C0E0817E9742, double 0x3F7B0EF96B727E7E)
%56 = call double @mla(double %51, double %53, double %55)
%57 = load double, double* %8
%58 = load double, double* %7
%59 = load double, double* %4
%60 = call double @mla(double %59, double 0x3F88E3FD48D0FB6F, double 0x3F8C70DDF81249FC)
%61 = load double, double* %4
%62 = call double @mla(double %61, double 0x3F91C6B5042EC6B2, double 0x3F96E89F8578B64E)
%63 = call double @mla(double %58, double %60, double %62)
%64 = load double, double* %7
%65 = load double, double* %4
%66 = call double @mla(double %65, double 0x3F9F1C72C5FD95BA, double 0x3FA6DB6DB407C2B3)
%67 = load double, double* %4
%68 = call double @mla(double %67, double 0x3FB3333333375CD0, double 0x3FC55555555552F4)
%69 = call double @mla(double %64, double %66, double %68)
%70 = call double @mla(double %57, double %63, double %69)
%71 = call double @mla(double %50, double %56, double %70)
store double %71, double* %6
%72 = load double, double* %6
%73 = load double, double* %5
%74 = load double, double* %4
%75 = fmul double %73, %74
%76 = load double, double* %5
%77 = call double @mla(double %72, double %75, double %76)
store double %77, double* %6
%78 = load i32, i32* %3
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %38
%81 = load double, double* %6
br label %85
82: ; preds = %38
%83 = load double, double* %6
%84 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %83, double 0x3FF921FB54442D18)
br label %85
85: ; preds = %82, %80
%86 = phi double [ %81, %80 ], [ %84, %82 ]
store double %86, double* %10
%87 = load double, double* %10
%88 = load double, double* %2
%89 = call double @mulsign(double %87, double %88)
store double %89, double* %10
%90 = load double, double* %10
ret double %90
}

LLVM IR (-O2):
define double @xasin(double %0) {
%2 = tail call i32 @fabsk(double %0)
%3 = icmp slt i32 %2, 1
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = fmul double %0, %0
%6 = tail call i32 @fabsk(double %0)
br label %13
7: ; preds = %1
%8 = tail call i32 @fabsk(double %0)
%9 = sub nsw i32 1, %8
%10 = sitofp i32 %9 to double
%11 = fmul double %10, 5.000000e-01
%12 = tail call i32 @sqrt(double %11)
br label %13
13: ; preds = %7, %4
%14 = phi double [ %5, %4 ], [ %11, %7 ]
%15 = phi i32 [ %6, %4 ], [ %12, %7 ]
%16 = sitofp i32 %15 to double
%17 = fmul double %14, %14
%18 = fmul double %17, %17
%19 = fmul double %18, %18
%20 = tail call double @mla(double %14, double 0x3FA02FF4C7428A47, double 0xBF9032E75CCD4AE8)
%21 = tail call double @mla(double %14, double 0x3F93C0E0817E9742, double 0x3F7B0EF96B727E7E)
%22 = tail call double @mla(double %17, double %20, double %21)
%23 = tail call double @mla(double %14, double 0x3F88E3FD48D0FB6F, double 0x3F8C70DDF81249FC)
%24 = tail call double @mla(double %14, double 0x3F91C6B5042EC6B2, double 0x3F96E89F8578B64E)
%25 = tail call double @mla(double %17, double %23, double %24)
%26 = tail call double @mla(double %14, double 0x3F9F1C72C5FD95BA, double 0x3FA6DB6DB407C2B3)
%27 = tail call double @mla(double %14, double 0x3FB3333333375CD0, double 0x3FC55555555552F4)
%28 = tail call double @mla(double %17, double %26, double %27)
%29 = tail call double @mla(double %18, double %25, double %28)
%30 = tail call double @mla(double %19, double %22, double %29)
%31 = fmul double %14, %16
%32 = tail call double @mla(double %30, double %31, double %16)
%33 = tail call double @llvm.fmuladd.f64(double %32, double -2.000000e+00, double 0x3FF921FB54442D18)
%34 = select i1 %3, double %32, double %33
%35 = tail call double @mulsign(double %34, double %0)
ret double %35
}