#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 */
float faktorijel(int);
float pow(float, int);
float e_na_x(float x, int n) {
  float suma = 0;
  int i;
  for (i = 0; i <= n; i++) {
    suma += pow(x, i) / faktorijel(i);
  }
  return suma;
}


x86 assembly (clang, -O0):
<e_na_x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1189 <e_na_x+0x69>
movss  -0x4(%rbp),%xmm0
mov    -0x10(%rbp),%edi
call   1040 <pow@plt>
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <faktorijel@plt>
movaps %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
divss  %xmm1,%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113f <e_na_x+0x1f>
movss  -0xc(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<e_na_x>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
test   %edi,%edi
js     117d <e_na_x+0x5d>
mov    %edi,%ebx
add    $0x1,%ebx
xorps  %xmm1,%xmm1
xor    %ebp,%ebp
movss  %xmm0,0xc(%rsp)
nopw   0x0(%rax,%rax,1)
movss  %xmm1,0x14(%rsp)
movss  0xc(%rsp),%xmm0
mov    %ebp,%edi
call   1040 <pow@plt>
movss  %xmm0,0x10(%rsp)
mov    %ebp,%edi
call   1030 <faktorijel@plt>
movss  0x14(%rsp),%xmm1
movss  0x10(%rsp),%xmm2
divss  %xmm0,%xmm2
addss  %xmm2,%xmm1
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1140 <e_na_x+0x20>
jmp    1180 <e_na_x+0x60>
xorps  %xmm1,%xmm1
movaps %xmm1,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define float @e_na_x(float %0, i32 %1) {
%3 = icmp slt i32 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %11, %4 ], [ 0, %2 ]
%6 = phi float [ %10, %4 ], [ 0.000000e+00, %2 ]
%7 = tail call float @pow(float %0, i32 %5)
%8 = tail call float @faktorijel(i32 %5)
%9 = fdiv float %7, %8
%10 = fadd float %6, %9
%11 = add nuw i32 %5, 1
%12 = icmp eq i32 %5, %1
br i1 %12, label %13, label %4
13: ; preds = %4, %2
%14 = phi float [ 0.000000e+00, %2 ], [ %10, %4 ]
ret float %14
}