#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 _pow(double, int);
double fac(unsigned int);
double asin(double x) {
  double y = 0;
  for (unsigned int i = 0; i != 8; i++)
    y += fac(2 * i) / (_pow(4.0, i) * _pow(fac(i), 2) * (2 * i + 1)) *
         _pow(x, 2 * i + 1);
  return y;
}


x86 assembly (clang, -O0):
<asin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
je     11dd <asin+0xbd>
mov    -0x14(%rbp),%edi
add    %edi,%edi
call   1040 <fac@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x14(%rbp),%edi
movsd  0xea0(%rip),%xmm0
call   1030 <_pow@plt>
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <fac@plt>
mov    $0x2,%edi
call   1030 <_pow@plt>
movsd  -0x30(%rbp),%xmm0
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
imul   %ecx,%eax
mov    -0x14(%rbp),%edx
mov    %edx,%ecx
lea    0x1(%rcx,%rcx,1),%ecx
imul   %ecx,%eax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x14(%rbp),%edi
shl    $0x1,%edi
add    $0x1,%edi
call   1030 <_pow@plt>
movsd  -0x20(%rbp),%xmm0
cvtsi2sd %eax,%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113c <asin+0x1c>
movsd  -0x10(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asin>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
movsd  %xmm0,0x18(%rsp)
xorps  %xmm0,%xmm0
xor    %ebx,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm0,0x10(%rsp)
mov    %ebx,%edi
call   1040 <fac@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xea5(%rip),%xmm0
mov    %ebp,%edi
call   1030 <_pow@plt>
mov    %eax,%r14d
mov    %ebp,%edi
call   1040 <fac@plt>
mov    $0x2,%edi
call   1030 <_pow@plt>
lea    0x1(%rbx),%edi
imul   %edi,%eax
imul   %r14d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <_pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x10(%rsp),%xmm0
add    $0x1,%ebp
add    $0x2,%ebx
cmp    $0x8,%ebp
jne    1140 <asin+0x20>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double @asin(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca i32
store double %0, double* %2
store double 0.000000e+00, double* %3
store i32 0, i32* %4
br label %5
5: ; preds = %32, %1
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 8
br i1 %7, label %8, label %35
8: ; preds = %5
%9 = load i32, i32* %4
%10 = mul i32 2, %9
%11 = call double @fac(i32 %10)
%12 = load i32, i32* %4
%13 = call i32 @_pow(double 4.000000e+00, i32 %12)
%14 = load i32, i32* %4
%15 = call double @fac(i32 %14)
%16 = call i32 @_pow(double %15, i32 2)
%17 = mul nsw i32 %13, %16
%18 = load i32, i32* %4
%19 = mul i32 2, %18
%20 = add i32 %19, 1
%21 = mul i32 %17, %20
%22 = uitofp i32 %21 to double
%23 = fdiv double %11, %22
%24 = load double, double* %2
%25 = load i32, i32* %4
%26 = mul i32 2, %25
%27 = add i32 %26, 1
%28 = call i32 @_pow(double %24, i32 %27)
%29 = sitofp i32 %28 to double
%30 = load double, double* %3
%31 = call double @llvm.fmuladd.f64(double %23, double %29, double %30)
store double %31, double* %3
br label %32
32: ; preds = %8
%33 = load i32, i32* %4
%34 = add i32 %33, 1
store i32 %34, i32* %4
br label %5
35: ; preds = %5
%36 = load double, double* %3
ret double %36
}

LLVM IR (-O2):
define double @asin(double %0) {
br label %3
2: ; preds = %3
ret double %18
3: ; preds = %1, %3
%4 = phi i32 [ 0, %1 ], [ %19, %3 ]
%5 = phi double [ 0.000000e+00, %1 ], [ %18, %3 ]
%6 = shl nuw i32 %4, 1
%7 = tail call double @fac(i32 %6)
%8 = tail call i32 @_pow(double 4.000000e+00, i32 %4)
%9 = tail call double @fac(i32 %4)
%10 = tail call i32 @_pow(double %9, i32 2)
%11 = or i32 %6, 1
%12 = mul i32 %8, %11
%13 = mul i32 %12, %10
%14 = uitofp i32 %13 to double
%15 = fdiv double %7, %14
%16 = tail call i32 @_pow(double %0, i32 %11)
%17 = sitofp i32 %16 to double
%18 = tail call double @llvm.fmuladd.f64(double %15, double %17, double %5)
%19 = add nuw nsw i32 %4, 1
%20 = icmp eq i32 %19, 8
br i1 %20, label %2, label %3
}