#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 */
double Sign(double);
double atan(double);
int fabs(double);
double sqrt(int);
double ArcSin(double arg) {
  if (fabs(arg) >= 1)
    return (Sign(arg) * 1.5707963267949);
  else
    return (atan(arg / sqrt(1 - arg * arg)));
}


x86 assembly (clang, -O0):
<ArcSin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <fabs@plt>
cmp    $0x1,%eax
jl     1180 <ArcSin+0x40>
movsd  -0x10(%rbp),%xmm0
call   1040 <Sign@plt>
movsd  0xe96(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11da <ArcSin+0x9a>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe49(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
call   1050 <atan@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ArcSin>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <fabs@plt>
test   %eax,%eax
jle    1163 <ArcSin+0x23>
movsd  (%rsp),%xmm0
call   1040 <Sign@plt>
mulsd  0xea7(%rip),%xmm0
pop    %rax
ret
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm0
movsd  0xe8c(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1060 <sqrt@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
jmp    1050 <atan@plt>

LLVM IR (-O0):
define double @ArcSin(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = call i32 @fabs(double %4)
%6 = icmp sge i32 %5, 1
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load double, double* %3
%9 = call double @Sign(double %8)
%10 = fmul double %9, 0x3FF921FB54442D28
store double %10, double* %2
br label %21
11: ; preds = %1
%12 = load double, double* %3
%13 = load double, double* %3
%14 = load double, double* %3
%15 = fneg double %13
%16 = call double @llvm.fmuladd.f64(double %15, double %14, double 1.000000e+00)
%17 = fptosi double %16 to i32
%18 = call double @sqrt(i32 %17)
%19 = fdiv double %12, %18
%20 = call double @atan(double %19)
store double %20, double* %2
br label %21
21: ; preds = %11, %7
%22 = load double, double* %2
ret double %22
}

LLVM IR (-O2):
define double @ArcSin(double %0) {
%2 = tail call i32 @fabs(double %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call double @Sign(double %0)
%6 = fmul double %5, 0x3FF921FB54442D28
br label %14
7: ; preds = %1
%8 = fneg double %0
%9 = tail call double @llvm.fmuladd.f64(double %8, double %0, double 1.000000e+00)
%10 = fptosi double %9 to i32
%11 = tail call double @sqrt(i32 %10)
%12 = fdiv double %0, %11
%13 = tail call double @atan(double %12)
br label %14
14: ; preds = %7, %4
%15 = phi double [ %6, %4 ], [ %13, %7 ]
ret double %15
}