#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 fator(double);
int pow(double, double);
double seno(double x, int n) {
  if (n >= 0)
    return (pow(-1.0, n) * pow(x, 2.0 * n + 1.0)) / fator(2.0 * n + 1.0) +
           seno(x, n - 1.0);
  else
    return 0.0;
}


x86 assembly (clang, -O0):
<seno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11e9 <seno+0xb9>
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xeb1(%rip),%xmm0
call   1050 <pow@plt>
mov    %eax,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xe8b(%rip),%xmm2
addsd  %xmm2,%xmm1
call   1050 <pow@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x24(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xe66(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <fator@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xe3a(%rip),%xmm2
subsd  %xmm2,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <seno@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f1 <seno+0xc1>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seno>:
test   %edi,%edi
js     11cd <seno+0x9d>
push   %rbp
push   %rbx
sub    $0x18,%rsp
cvtsi2sd %edi,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xeb0(%rip),%xmm2
movsd  %xmm0,0x10(%rsp)
movaps %xmm2,%xmm0
call   1050 <pow@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm1
addsd  0xe96(%rip),%xmm1
movsd  %xmm1,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <pow@plt>
mov    %eax,%ebp
imul   %ebx,%ebp
movsd  (%rsp),%xmm0
call   1040 <fator@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xe4e(%rip),%xmm0
cvttsd2si %xmm0,%edi
movsd  0x10(%rsp),%xmm0
call   1030 <seno@plt>
addsd  (%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @seno(double %0, i32 %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store double %0, double* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %31
8: ; preds = %2
%9 = load i32, i32* %5
%10 = sitofp i32 %9 to double
%11 = call i32 @pow(double -1.000000e+00, double %10)
%12 = load double, double* %4
%13 = load i32, i32* %5
%14 = sitofp i32 %13 to double
%15 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %14, double 1.000000e+00)
%16 = call i32 @pow(double %12, double %15)
%17 = mul nsw i32 %11, %16
%18 = load i32, i32* %5
%19 = sitofp i32 %18 to double
%20 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %19, double 1.000000e+00)
%21 = call i32 @fator(double %20)
%22 = sdiv i32 %17, %21
%23 = sitofp i32 %22 to double
%24 = load double, double* %4
%25 = load i32, i32* %5
%26 = sitofp i32 %25 to double
%27 = fsub double %26, 1.000000e+00
%28 = fptosi double %27 to i32
%29 = call double @seno(double %24, i32 %28)
%30 = fadd double %23, %29
store double %30, double* %3
br label %32
31: ; preds = %2
store double 0.000000e+00, double* %3
br label %32
32: ; preds = %31, %8
%33 = load double, double* %3
ret double %33
}

LLVM IR (-O2):
define double @seno(double %0, i32 %1) {
%3 = icmp sgt i32 %1, -1
br i1 %3, label %6, label %4
4: ; preds = %2, %6
%5 = phi double [ %18, %6 ], [ 0.000000e+00, %2 ]
ret double %5
6: ; preds = %2
%7 = sitofp i32 %1 to double
%8 = tail call i32 @pow(double -1.000000e+00, double %7)
%9 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double 1.000000e+00)
%10 = tail call i32 @pow(double %0, double %9)
%11 = mul nsw i32 %10, %8
%12 = tail call i32 @fator(double %9)
%13 = sdiv i32 %11, %12
%14 = sitofp i32 %13 to double
%15 = fadd double %7, -1.000000e+00
%16 = fptosi double %15 to i32
%17 = tail call double @seno(double %0, i32 %16)
%18 = fadd double %17, %14
br label %4
}