#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 dpow(double, int);
scalar_t__ ffact(int);
double arcsin(double n) {
  double sum = n;
  int i;
  for (i = 1; i < 30; i++) {
    sum += (double)ffact(2 * i - 1) * (dpow(n, 2 * i + 1)) /
           ((double)ffact(2 * i) * (2 * i + 1));
  }
  return sum;
}


x86 assembly (clang, -O0):
<arcsin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x1e,-0x14(%rbp)
jge    11c6 <arcsin+0xa6>
mov    -0x14(%rbp),%edi
shl    $0x1,%edi
sub    $0x1,%edi
call   1030 <ffact@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x14(%rbp),%edi
shl    $0x1,%edi
add    $0x1,%edi
call   1040 <dpow@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%edi
shl    $0x1,%edi
call   1030 <ffact@plt>
movsd  -0x20(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113e <arcsin+0x1e>
movsd  -0x10(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arcsin>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    $0x3,%ebx
movsd  %xmm0,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x10(%rsp)
lea    -0x1(%rbx),%ebp
lea    -0x2(%rbx),%edi
call   1030 <ffact@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
mov    %ebx,%edi
call   1040 <dpow@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %ebp,%edi
call   1030 <ffact@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
mulsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm2
divsd  %xmm1,%xmm2
addsd  %xmm2,%xmm0
add    $0x2,%ebx
cmp    $0x3d,%ebx
jne    1140 <arcsin+0x20>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @arcsin(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca i32
store double %0, double* %2
%5 = load double, double* %2
store double %5, double* %3
store i32 1, i32* %4
br label %6
6: ; preds = %33, %1
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 30
br i1 %8, label %9, label %36
9: ; preds = %6
%10 = load i32, i32* %4
%11 = mul nsw i32 2, %10
%12 = sub nsw i32 %11, 1
%13 = call i64 @ffact(i32 %12)
%14 = sitofp i64 %13 to double
%15 = load double, double* %2
%16 = load i32, i32* %4
%17 = mul nsw i32 2, %16
%18 = add nsw i32 %17, 1
%19 = call double @dpow(double %15, i32 %18)
%20 = fmul double %14, %19
%21 = load i32, i32* %4
%22 = mul nsw i32 2, %21
%23 = call i64 @ffact(i32 %22)
%24 = sitofp i64 %23 to double
%25 = load i32, i32* %4
%26 = mul nsw i32 2, %25
%27 = add nsw i32 %26, 1
%28 = sitofp i32 %27 to double
%29 = fmul double %24, %28
%30 = fdiv double %20, %29
%31 = load double, double* %3
%32 = fadd double %31, %30
store double %32, double* %3
br label %33
33: ; preds = %9
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %6
36: ; preds = %6
%37 = load double, double* %3
ret double %37
}

LLVM IR (-O2):
define double @arcsin(double %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 1, %1 ], [ %18, %2 ]
%4 = phi double [ %0, %1 ], [ %17, %2 ]
%5 = shl nuw nsw i32 %3, 1
%6 = add nsw i32 %5, -1
%7 = tail call i64 @ffact(i32 %6)
%8 = sitofp i64 %7 to double
%9 = or i32 %5, 1
%10 = tail call double @dpow(double %0, i32 %9)
%11 = fmul double %10, %8
%12 = tail call i64 @ffact(i32 %5)
%13 = sitofp i64 %12 to double
%14 = sitofp i32 %9 to double
%15 = fmul double %14, %13
%16 = fdiv double %11, %15
%17 = fadd double %4, %16
%18 = add nuw nsw i32 %3, 1
%19 = icmp eq i32 %18, 30
br i1 %19, label %20, label %2
20: ; preds = %2
ret double %17
}