#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 fabs(double);
double square(double);
double my_asin(double x) {
  unsigned long i = 1;
  double member = x;
  double squareX = square(x);
  double result = member;
  if (x < -1.0 || x > 1.0) {
    return 0.0 / 0.0;
  }
  while (fabs(member) > 1e-12 * fabs(result)) {
    i += 2;
    member = member * ((i - 2.0) * (i - 2.0) * squareX) / ((i - 1.0) * i);
    result += member;
  }
  return result;
}


x86 assembly (clang, -O0):
<my_asin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <square@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xea0(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
ja     1182 <my_asin+0x62>
movsd  -0x10(%rbp),%xmm0
movsd  0xe90(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1194 <my_asin+0x74>
movsd  0xe96(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1267 <my_asin+0x147>
jmp    1199 <my_asin+0x79>
movsd  -0x20(%rbp),%xmm0
call   1040 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <fabs@plt>
movsd  -0x38(%rbp),%xmm0
cvtsi2sd %eax,%xmm2
movsd  0xe49(%rip),%xmm1
mulsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    125d <my_asin+0x13d>
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
movaps 0xe43(%rip),%xmm1
movq   -0x18(%rbp),%xmm2
punpckldq %xmm1,%xmm2
movapd 0xe42(%rip),%xmm1
subpd  %xmm1,%xmm2
movaps %xmm2,%xmm1
unpckhpd %xmm2,%xmm2
addsd  %xmm1,%xmm2
movsd  0xe03(%rip),%xmm3
movaps %xmm2,%xmm1
addsd  %xmm3,%xmm1
mulsd  %xmm1,%xmm1
movsd  -0x28(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdcb(%rip),%xmm3
movaps %xmm2,%xmm1
addsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1199 <my_asin+0x79>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_asin>:
push   %rbx
sub    $0x30,%rsp
movsd  %xmm0,0x8(%rsp)
call   1030 <square@plt>
movsd  0x8(%rsp),%xmm2
movsd  0xec2(%rip),%xmm1
ucomisd %xmm2,%xmm1
movsd  0xebe(%rip),%xmm3
ja     1273 <my_asin+0x153>
ucomisd 0xeb8(%rip),%xmm2
ja     1273 <my_asin+0x153>
movsd  %xmm0,0x20(%rsp)
movapd %xmm2,%xmm0
call   1040 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe84(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    126d <my_asin+0x14d>
mov    $0x3,%ebx
movsd  0x8(%rsp),%xmm2
movapd %xmm2,%xmm3
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movq   %rbx,%xmm0
punpckldq 0xe63(%rip),%xmm0
subpd  0xe6b(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
addsd  0xe13(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe27(%rip),%xmm1
mulsd  %xmm1,%xmm1
mulsd  0x20(%rsp),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
addsd  %xmm1,%xmm3
movsd  %xmm3,0x8(%rsp)
movapd %xmm1,%xmm0
call   1040 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <fabs@plt>
movsd  0x8(%rsp),%xmm3
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xdc7(%rip),%xmm0
add    $0x2,%rbx
movsd  0x28(%rsp),%xmm1
ucomisd %xmm0,%xmm1
movapd 0x10(%rsp),%xmm2
ja     11c0 <my_asin+0xa0>
jmp    1273 <my_asin+0x153>
movsd  0x8(%rsp),%xmm3
movapd %xmm3,%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @my_asin(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca i64
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %3
store i64 1, i64* %4
%8 = load double, double* %3
store double %8, double* %5
%9 = load double, double* %3
%10 = call double @square(double %9)
store double %10, double* %6
%11 = load double, double* %5
store double %11, double* %7
%12 = load double, double* %3
%13 = fcmp olt double %12, -1.000000e+00
br i1 %13, label %17, label %14
14: ; preds = %1
%15 = load double, double* %3
%16 = fcmp ogt double %15, 1.000000e+00
br i1 %16, label %17, label %18
17: ; preds = %14, %1
store double 0x7FF8000000000000, double* %2
br label %54
18: ; preds = %14
br label %19
19: ; preds = %28, %18
%20 = load double, double* %5
%21 = call i32 @fabs(double %20)
%22 = sitofp i32 %21 to double
%23 = load double, double* %7
%24 = call i32 @fabs(double %23)
%25 = sitofp i32 %24 to double
%26 = fmul double 0x3D719799812DEA11, %25
%27 = fcmp ogt double %22, %26
br i1 %27, label %28, label %52
28: ; preds = %19
%29 = load i64, i64* %4
%30 = add i64 %29, 2
store i64 %30, i64* %4
%31 = load double, double* %5
%32 = load i64, i64* %4
%33 = uitofp i64 %32 to double
%34 = fsub double %33, 2.000000e+00
%35 = load i64, i64* %4
%36 = uitofp i64 %35 to double
%37 = fsub double %36, 2.000000e+00
%38 = fmul double %34, %37
%39 = load double, double* %6
%40 = fmul double %38, %39
%41 = fmul double %31, %40
%42 = load i64, i64* %4
%43 = uitofp i64 %42 to double
%44 = fsub double %43, 1.000000e+00
%45 = load i64, i64* %4
%46 = uitofp i64 %45 to double
%47 = fmul double %44, %46
%48 = fdiv double %41, %47
store double %48, double* %5
%49 = load double, double* %5
%50 = load double, double* %7
%51 = fadd double %50, %49
store double %51, double* %7
br label %19
52: ; preds = %19
%53 = load double, double* %7
store double %53, double* %2
br label %54
54: ; preds = %52, %17
%55 = load double, double* %2
ret double %55
}

LLVM IR (-O2):
define double @my_asin(double %0) {
%2 = tail call double @square(double %0)
%3 = fcmp olt double %0, -1.000000e+00
%4 = fcmp ogt double %0, 1.000000e+00
%5 = or i1 %3, %4
br i1 %5, label %33, label %6
6: ; preds = %1
%7 = tail call i32 @fabs(double %0)
%8 = sitofp i32 %7 to double
%9 = tail call i32 @fabs(double %0)
%10 = sitofp i32 %9 to double
%11 = fmul double %10, 0x3D719799812DEA11
%12 = fcmp olt double %11, %8
br i1 %12, label %13, label %33
13: ; preds = %6, %13
%14 = phi double [ %26, %13 ], [ %0, %6 ]
%15 = phi double [ %25, %13 ], [ %0, %6 ]
%16 = phi i64 [ %17, %13 ], [ 1, %6 ]
%17 = add i64 %16, 2
%18 = uitofp i64 %17 to double
%19 = fadd double %18, -2.000000e+00
%20 = fmul double %19, %19
%21 = fmul double %2, %20
%22 = fmul double %15, %21
%23 = fadd double %18, -1.000000e+00
%24 = fmul double %23, %18
%25 = fdiv double %22, %24
%26 = fadd double %14, %25
%27 = tail call i32 @fabs(double %25)
%28 = sitofp i32 %27 to double
%29 = tail call i32 @fabs(double %26)
%30 = sitofp i32 %29 to double
%31 = fmul double %30, 0x3D719799812DEA11
%32 = fcmp olt double %31, %28
br i1 %32, label %13, label %33
33: ; preds = %13, %6, %1
%34 = phi double [ 0x7FF8000000000000, %1 ], [ %0, %6 ], [ %26, %13 ]
ret double %34
}