#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 power(double, int);
double arc_seno(double val_seno) {
  double prox = val_seno;
  int i = 1;
  double soma = val_seno;
  double condition = 0;
  if (val_seno == 0)
    return 0;
  while (i < 10000) {
    prox = prox * ((power(val_seno, 2) * (2 * i - 1) * (2 * i - 1)) /
                   ((2 * i) * (2 * i + 1)));
    soma = soma + prox;
    i++;
  }
  return soma;
}


x86 assembly (clang, -O0):
<arc_seno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1165 <arc_seno+0x55>
jp     1165 <arc_seno+0x55>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f6 <arc_seno+0xe6>
jmp    116a <arc_seno+0x5a>
cmpl   $0x2710,-0x1c(%rbp)
jge    11ec <arc_seno+0xdc>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <power@plt>
movsd  -0x38(%rbp),%xmm0
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
mov    -0x1c(%rbp),%edx
shl    $0x1,%edx
add    $0x1,%edx
imul   %edx,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116a <arc_seno+0x5a>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arc_seno>:
push   %rbx
sub    $0x20,%rsp
xorpd  %xmm1,%xmm1
movsd  %xmm0,0x10(%rsp)
ucomisd %xmm1,%xmm0
jne    1127 <arc_seno+0x17>
jnp    11a0 <arc_seno+0x90>
mov    $0x3,%ebx
movsd  0x10(%rsp),%xmm0
movapd %xmm0,%xmm1
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
movsd  %xmm1,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <power@plt>
movsd  0x18(%rsp),%xmm1
lea    -0x1(%rbx),%ecx
lea    -0x2(%rbx),%edx
imul   %edx,%edx
imul   %edx,%eax
imul   %ebx,%ecx
cltd
idiv   %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x8(%rsp),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm1
add    $0x2,%ebx
cmp    $0x4e21,%ebx
jne    1140 <arc_seno+0x30>
movapd %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @arc_seno(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca double
%7 = alloca double
store double %0, double* %3
%8 = load double, double* %3
store double %8, double* %4
store i32 1, i32* %5
%9 = load double, double* %3
store double %9, double* %6
store double 0.000000e+00, double* %7
%10 = load double, double* %3
%11 = fcmp oeq double %10, 0.000000e+00
br i1 %11, label %12, label %13
12: ; preds = %1
store double 0.000000e+00, double* %2
br label %45
13: ; preds = %1
br label %14
14: ; preds = %17, %13
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 10000
br i1 %16, label %17, label %43
17: ; preds = %14
%18 = load double, double* %4
%19 = load double, double* %3
%20 = call i32 @power(double %19, i32 2)
%21 = load i32, i32* %5
%22 = mul nsw i32 2, %21
%23 = sub nsw i32 %22, 1
%24 = mul nsw i32 %20, %23
%25 = load i32, i32* %5
%26 = mul nsw i32 2, %25
%27 = sub nsw i32 %26, 1
%28 = mul nsw i32 %24, %27
%29 = load i32, i32* %5
%30 = mul nsw i32 2, %29
%31 = load i32, i32* %5
%32 = mul nsw i32 2, %31
%33 = add nsw i32 %32, 1
%34 = mul nsw i32 %30, %33
%35 = sdiv i32 %28, %34
%36 = sitofp i32 %35 to double
%37 = fmul double %18, %36
store double %37, double* %4
%38 = load double, double* %6
%39 = load double, double* %4
%40 = fadd double %38, %39
store double %40, double* %6
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
store i32 %42, i32* %5
br label %14
43: ; preds = %14
%44 = load double, double* %6
store double %44, double* %2
br label %45
45: ; preds = %43, %12
%46 = load double, double* %2
ret double %46
}

LLVM IR (-O2):
define double @arc_seno(double %0) {
%2 = fcmp oeq double %0, 0.000000e+00
br i1 %2, label %20, label %3
3: ; preds = %1, %3
%4 = phi double [ %17, %3 ], [ %0, %1 ]
%5 = phi i32 [ %18, %3 ], [ 1, %1 ]
%6 = phi double [ %16, %3 ], [ %0, %1 ]
%7 = tail call i32 @power(double %0, i32 2)
%8 = shl nuw nsw i32 %5, 1
%9 = add nsw i32 %8, -1
%10 = mul i32 %9, %9
%11 = mul i32 %10, %7
%12 = or i32 %8, 1
%13 = mul nsw i32 %12, %8
%14 = sdiv i32 %11, %13
%15 = sitofp i32 %14 to double
%16 = fmul double %6, %15
%17 = fadd double %4, %16
%18 = add nuw nsw i32 %5, 1
%19 = icmp eq i32 %18, 10000
br i1 %19, label %20, label %3
20: ; preds = %3, %1
%21 = phi double [ 0.000000e+00, %1 ], [ %17, %3 ]
ret double %21
}