#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 factorial(int);
double potencia(double, int);
double elevar_e(int x) {
  int i, suma;
  double elevado = 1.0;
  for (i = 0; i <= 10; i++) {
    elevado = elevado + potencia((double)x, i) / factorial(i);
  }
  return elevado;
}


x86 assembly (clang, -O0):
<elevar_e>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movsd  0xecd(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jg     1195 <elevar_e+0x75>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
mov    -0x8(%rbp),%edi
call   1040 <potencia@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <factorial@plt>
movsd  -0x28(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113f <elevar_e+0x1f>
movsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<elevar_e>:
sub    $0x58,%rsp
cvtsi2sd %edi,%xmm0
movsd  %xmm0,(%rsp)
xor    %edi,%edi
call   1040 <potencia@plt>
movsd  %xmm0,0x10(%rsp)
xor    %edi,%edi
call   1030 <factorial@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
addsd  0xead(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  (%rsp),%xmm0
mov    $0x1,%edi
call   1040 <potencia@plt>
movaps %xmm0,0x30(%rsp)
mov    $0x1,%edi
call   1030 <factorial@plt>
movaps %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
mov    $0x2,%edi
call   1040 <potencia@plt>
movapd %xmm0,0x40(%rsp)
mov    $0x2,%edi
call   1030 <factorial@plt>
movapd 0x30(%rsp),%xmm1
unpcklpd 0x40(%rsp),%xmm1
movapd 0x20(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm1
movsd  0x10(%rsp),%xmm0
addsd  %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,0x30(%rsp)
movsd  (%rsp),%xmm0
mov    $0x3,%edi
call   1040 <potencia@plt>
movaps %xmm0,0x10(%rsp)
mov    $0x3,%edi
call   1030 <factorial@plt>
movaps %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
mov    $0x4,%edi
call   1040 <potencia@plt>
movapd %xmm0,0x40(%rsp)
mov    $0x4,%edi
call   1030 <factorial@plt>
movapd 0x10(%rsp),%xmm1
unpcklpd 0x40(%rsp),%xmm1
movapd 0x20(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm1
movapd 0x30(%rsp),%xmm0
addsd  %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
movsd  (%rsp),%xmm0
mov    $0x5,%edi
call   1040 <potencia@plt>
movaps %xmm0,0x30(%rsp)
mov    $0x5,%edi
call   1030 <factorial@plt>
movaps %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
mov    $0x6,%edi
call   1040 <potencia@plt>
movapd %xmm0,0x40(%rsp)
mov    $0x6,%edi
call   1030 <factorial@plt>
movapd 0x30(%rsp),%xmm1
unpcklpd 0x40(%rsp),%xmm1
movapd 0x20(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm1
movapd 0x10(%rsp),%xmm0
addsd  %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,0x30(%rsp)
movsd  (%rsp),%xmm0
mov    $0x7,%edi
call   1040 <potencia@plt>
movaps %xmm0,0x10(%rsp)
mov    $0x7,%edi
call   1030 <factorial@plt>
movaps %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
mov    $0x8,%edi
call   1040 <potencia@plt>
movapd %xmm0,0x40(%rsp)
mov    $0x8,%edi
call   1030 <factorial@plt>
movapd 0x10(%rsp),%xmm1
unpcklpd 0x40(%rsp),%xmm1
movapd 0x20(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm1
movapd 0x30(%rsp),%xmm0
addsd  %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
movsd  (%rsp),%xmm0
mov    $0x9,%edi
call   1040 <potencia@plt>
movaps %xmm0,0x30(%rsp)
mov    $0x9,%edi
call   1030 <factorial@plt>
movaps %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
mov    $0xa,%edi
call   1040 <potencia@plt>
movapd %xmm0,(%rsp)
mov    $0xa,%edi
call   1030 <factorial@plt>
movapd 0x30(%rsp),%xmm1
unpcklpd (%rsp),%xmm1
movapd 0x20(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm1
movapd 0x10(%rsp),%xmm0
addsd  %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x58,%rsp
ret

LLVM IR (-O0):
define double @elevar_e(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 %0, i32* %2
store double 1.000000e+00, double* %5
store i32 0, i32* %3
br label %6
6: ; preds = %19, %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 10
br i1 %8, label %9, label %22
9: ; preds = %6
%10 = load double, double* %5
%11 = load i32, i32* %2
%12 = sitofp i32 %11 to double
%13 = load i32, i32* %3
%14 = call double @potencia(double %12, i32 %13)
%15 = load i32, i32* %3
%16 = call double @factorial(i32 %15)
%17 = fdiv double %14, %16
%18 = fadd double %10, %17
store double %18, double* %5
br label %19
19: ; preds = %9
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %6
22: ; preds = %6
%23 = load double, double* %5
ret double %23
}

LLVM IR (-O2):
define double @elevar_e(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = tail call double @potencia(double %2, i32 0)
%4 = tail call double @factorial(i32 0)
%5 = fdiv double %3, %4
%6 = fadd double %5, 1.000000e+00
%7 = tail call double @potencia(double %2, i32 1)
%8 = tail call double @factorial(i32 1)
%9 = tail call double @potencia(double %2, i32 2)
%10 = tail call double @factorial(i32 2)
%11 = insertelement <2 x double> poison, double %7, i64 0
%12 = insertelement <2 x double> %11, double %9, i64 1
%13 = insertelement <2 x double> poison, double %8, i64 0
%14 = insertelement <2 x double> %13, double %10, i64 1
%15 = fdiv <2 x double> %12, %14
%16 = extractelement <2 x double> %15, i64 0
%17 = fadd double %6, %16
%18 = extractelement <2 x double> %15, i64 1
%19 = fadd double %17, %18
%20 = tail call double @potencia(double %2, i32 3)
%21 = tail call double @factorial(i32 3)
%22 = tail call double @potencia(double %2, i32 4)
%23 = tail call double @factorial(i32 4)
%24 = insertelement <2 x double> poison, double %20, i64 0
%25 = insertelement <2 x double> %24, double %22, i64 1
%26 = insertelement <2 x double> poison, double %21, i64 0
%27 = insertelement <2 x double> %26, double %23, i64 1
%28 = fdiv <2 x double> %25, %27
%29 = extractelement <2 x double> %28, i64 0
%30 = fadd double %19, %29
%31 = extractelement <2 x double> %28, i64 1
%32 = fadd double %30, %31
%33 = tail call double @potencia(double %2, i32 5)
%34 = tail call double @factorial(i32 5)
%35 = tail call double @potencia(double %2, i32 6)
%36 = tail call double @factorial(i32 6)
%37 = insertelement <2 x double> poison, double %33, i64 0
%38 = insertelement <2 x double> %37, double %35, i64 1
%39 = insertelement <2 x double> poison, double %34, i64 0
%40 = insertelement <2 x double> %39, double %36, i64 1
%41 = fdiv <2 x double> %38, %40
%42 = extractelement <2 x double> %41, i64 0
%43 = fadd double %32, %42
%44 = extractelement <2 x double> %41, i64 1
%45 = fadd double %43, %44
%46 = tail call double @potencia(double %2, i32 7)
%47 = tail call double @factorial(i32 7)
%48 = tail call double @potencia(double %2, i32 8)
%49 = tail call double @factorial(i32 8)
%50 = insertelement <2 x double> poison, double %46, i64 0
%51 = insertelement <2 x double> %50, double %48, i64 1
%52 = insertelement <2 x double> poison, double %47, i64 0
%53 = insertelement <2 x double> %52, double %49, i64 1
%54 = fdiv <2 x double> %51, %53
%55 = extractelement <2 x double> %54, i64 0
%56 = fadd double %45, %55
%57 = extractelement <2 x double> %54, i64 1
%58 = fadd double %56, %57
%59 = tail call double @potencia(double %2, i32 9)
%60 = tail call double @factorial(i32 9)
%61 = tail call double @potencia(double %2, i32 10)
%62 = tail call double @factorial(i32 10)
%63 = insertelement <2 x double> poison, double %59, i64 0
%64 = insertelement <2 x double> %63, double %61, i64 1
%65 = insertelement <2 x double> poison, double %60, i64 0
%66 = insertelement <2 x double> %65, double %62, i64 1
%67 = fdiv <2 x double> %64, %66
%68 = extractelement <2 x double> %67, i64 0
%69 = fadd double %58, %68
%70 = extractelement <2 x double> %67, i64 1
%71 = fadd double %69, %70
ret double %71
}