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


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

x86 assembly (clang, -O2):
<elevar_e>:
push   %rbx
sub    $0x40,%rsp
mov    %edi,%ebx
mov    $0x1,%esi
call   1040 <potencia@plt>
movapd %xmm0,0x20(%rsp)
mov    $0x1,%edi
call   1030 <factorial@plt>
movapd %xmm0,0x10(%rsp)
mov    %ebx,%edi
mov    $0x2,%esi
call   1040 <potencia@plt>
movapd %xmm0,(%rsp)
mov    $0x2,%edi
call   1030 <factorial@plt>
movapd 0x20(%rsp),%xmm1
unpcklpd (%rsp),%xmm1
movapd 0x10(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm1
movsd  0xe7d(%rip),%xmm0
addsd  %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
mov    %ebx,%edi
mov    $0x3,%esi
call   1040 <potencia@plt>
movapd %xmm0,0x10(%rsp)
mov    $0x3,%edi
call   1030 <factorial@plt>
movapd %xmm0,(%rsp)
mov    %ebx,%edi
mov    $0x4,%esi
call   1040 <potencia@plt>
movapd %xmm0,0x30(%rsp)
mov    $0x4,%edi
call   1030 <factorial@plt>
movapd 0x10(%rsp),%xmm1
unpcklpd 0x30(%rsp),%xmm1
movapd (%rsp),%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm1
movapd 0x20(%rsp),%xmm0
addsd  %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
mov    %ebx,%edi
mov    $0x5,%esi
call   1040 <potencia@plt>
movapd %xmm0,0x20(%rsp)
mov    $0x5,%edi
call   1030 <factorial@plt>
movapd %xmm0,(%rsp)
mov    %ebx,%edi
mov    $0x6,%esi
call   1040 <potencia@plt>
movapd %xmm0,0x30(%rsp)
mov    $0x6,%edi
call   1030 <factorial@plt>
movapd 0x20(%rsp),%xmm1
unpcklpd 0x30(%rsp),%xmm1
movapd (%rsp),%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm1
movapd 0x10(%rsp),%xmm0
addsd  %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
mov    %ebx,%edi
mov    $0x7,%esi
call   1040 <potencia@plt>
movapd %xmm0,0x10(%rsp)
mov    $0x7,%edi
call   1030 <factorial@plt>
movapd %xmm0,(%rsp)
mov    %ebx,%edi
mov    $0x8,%esi
call   1040 <potencia@plt>
movapd %xmm0,0x30(%rsp)
mov    $0x8,%edi
call   1030 <factorial@plt>
movapd 0x10(%rsp),%xmm1
unpcklpd 0x30(%rsp),%xmm1
movapd (%rsp),%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm1
movapd 0x20(%rsp),%xmm0
addsd  %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
mov    %ebx,%edi
mov    $0x9,%esi
call   1040 <potencia@plt>
movapd %xmm0,0x20(%rsp)
mov    $0x9,%edi
call   1030 <factorial@plt>
movapd %xmm0,(%rsp)
mov    %ebx,%edi
mov    $0xa,%esi
call   1040 <potencia@plt>
movapd %xmm0,0x30(%rsp)
mov    $0xa,%edi
call   1030 <factorial@plt>
movapd 0x20(%rsp),%xmm1
unpcklpd 0x30(%rsp),%xmm1
movapd (%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    $0x40,%rsp
pop    %rbx
ret

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

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