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


x86 assembly (clang, -O0):
<seno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x1,-0x24(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x24(%rbp),%ecx
mov    %ecx,%eax
lea    -0x1(%rax,%rax,1),%eax
cvtsi2sd %eax,%xmm1
movsd  0xea9(%rip),%xmm0
call   1030 <power@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mov    -0x24(%rbp),%edx
mov    %edx,%eax
add    %eax,%eax
mov    %edx,%ecx
lea    0x1(%rcx,%rcx,1),%ecx
imul   %ecx,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
fldl   -0x10(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
fldz
fucomip %st(1),%st
fstp   %st(0)
jbe    11c7 <seno+0xb7>
jmp    11bf <seno+0xaf>
fldt   -0x20(%rbp)
fchs
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
fldl   0xe38(%rip)
fucomip %st(1),%st
fstp   %st(0)
jbe    11ea <seno+0xda>
jmp    11df <seno+0xcf>
movsd  -0x30(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1138 <seno+0x28>

x86 assembly (clang, -O2):
<seno>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
movapd %xmm0,%xmm1
mov    $0x3,%ebx
fldl   0xee3(%rip)
fstpt  0x2c(%rsp)
movapd %xmm0,%xmm2
movsd  %xmm0,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x18(%rsp)
lea    -0x1(%rbx),%ebp
lea    -0x2(%rbx),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0xe9f(%rip),%xmm0
call   1030 <power@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
imul   %ebx,%ebp
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
fldl   0x20(%rsp)
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
movsd  0x18(%rsp),%xmm1
fld    %st(0)
fchs
fxch   %st(1)
fcmovnbe %st(1),%st
fstp   %st(1)
addsd  %xmm0,%xmm1
add    $0x2,%ebx
fldt   0x2c(%rsp)
fucomip %st(1),%st
fstp   %st(0)
movapd %xmm0,%xmm2
jbe    1140 <seno+0x30>
movapd %xmm1,%xmm0
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define double @seno(double %0) {
br label %2
2: ; preds = %2, %1
%3 = phi double [ %0, %1 ], [ %16, %2 ]
%4 = phi i32 [ 1, %1 ], [ %23, %2 ]
%5 = phi double [ %0, %1 ], [ %17, %2 ]
%6 = shl nuw nsw i32 %4, 1
%7 = add nsw i32 %6, -1
%8 = sitofp i32 %7 to double
%9 = tail call double @power(double -1.000000e+00, double %8)
%10 = fmul double %3, %9
%11 = fmul double %10, %0
%12 = fmul double %11, %0
%13 = or i32 %6, 1
%14 = mul nsw i32 %13, %6
%15 = sitofp i32 %14 to double
%16 = fdiv double %12, %15
%17 = fadd double %5, %16
%18 = fpext double %16 to x86_fp80
%19 = fcmp olt double %16, 0.000000e+00
%20 = fneg x86_fp80 %18
%21 = select i1 %19, x86_fp80 %20, x86_fp80 %18
%22 = fcmp olt x86_fp80 %21, 0xK3FE7D6BF94D5E57A4000
%23 = add nuw nsw i32 %4, 1
br i1 %22, label %24, label %2
24: ; preds = %2
ret double %17
}