#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int /*<<< orphan*/ system(char *);
main() {
  float N;
  float Fat;
  float E;
  float K;
  float I;
  do {
    printf("Inserire la quantita dei numeri");
    scanf("%f", &N);
  } while ((N > 10) || (N <= 0));
  E = 1;
  I = 1;
  while (I <= N) {
    Fat = 1;
    K = I;
    while (K > 0) {
      Fat = Fat * (K--);
    }
    E = E + (1 / Fat);
    I++;
  }
  printf("%f", E);
  system("PAUSE");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x8(%rbp),%xmm0
mov    $0x1,%al
movss  0xe94(%rip),%xmm1
ucomiss %xmm1,%xmm0
mov    %al,-0x19(%rbp)
ja     1185 <main+0x55>
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
setae  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    113f <main+0xf>
movss  0xe6c(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe5f(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     1243 <main+0x113>
movss  0xe3f(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1211 <main+0xe1>
movss  -0xc(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
movss  0xe11(%rip),%xmm3
movaps %xmm1,%xmm2
addss  %xmm3,%xmm2
movss  %xmm2,-0x14(%rbp)
mulss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11d4 <main+0xa4>
movss  -0x10(%rbp),%xmm0
movss  0xde6(%rip),%xmm1
divss  -0xc(%rbp),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xdd0(%rip),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    11aa <main+0x7a>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdd9(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xdce(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed8(%rip),%r14
lea    0xef1(%rip),%r15
lea    0xc(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xe8e(%rip),%xmm0
ja     1150 <main+0x20>
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jae    1150 <main+0x20>
ucomiss 0xe81(%rip),%xmm0
jae    118f <main+0x5f>
movsd  0xe83(%rip),%xmm0
jmp    11f6 <main+0xc6>
movss  0xe6d(%rip),%xmm1
xorps  %xmm2,%xmm2
movss  0xe66(%rip),%xmm3
movaps %xmm1,%xmm5
movaps %xmm1,%xmm4
jmp    11c4 <main+0x94>
nopw   0x0(%rax,%rax,1)
movaps %xmm1,%xmm7
divss  %xmm6,%xmm7
addss  %xmm7,%xmm4
addss  %xmm1,%xmm5
ucomiss %xmm5,%xmm0
jb     11ef <main+0xbf>
ucomiss %xmm2,%xmm5
movaps %xmm1,%xmm6
jbe    11b0 <main+0x80>
movaps %xmm5,%xmm7
movaps %xmm1,%xmm6
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mulss  %xmm7,%xmm6
addss  %xmm3,%xmm7
ucomiss %xmm2,%xmm7
ja     11e0 <main+0xb0>
jmp    11b0 <main+0x80>
xorps  %xmm0,%xmm0
cvtss2sd %xmm4,%xmm0
lea    0xe3b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe30(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Inserire la quantita dei numeri\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
br label %7
7: ; preds = %16, %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
br label %10
10: ; preds = %7
%11 = load float, float* %2
%12 = fcmp ogt float %11, 1.000000e+01
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load float, float* %2
%15 = fcmp ole float %14, 0.000000e+00
br label %16
16: ; preds = %13, %10
%17 = phi i1 [ true, %10 ], [ %15, %13 ]
br i1 %17, label %7, label %18
18: ; preds = %16
store float 1.000000e+00, float* %4
store float 1.000000e+00, float* %6
br label %19
19: ; preds = %33, %18
%20 = load float, float* %6
%21 = load float, float* %2
%22 = fcmp ole float %20, %21
br i1 %22, label %23, label %40
23: ; preds = %19
store float 1.000000e+00, float* %3
%24 = load float, float* %6
store float %24, float* %5
br label %25
25: ; preds = %28, %23
%26 = load float, float* %5
%27 = fcmp ogt float %26, 0.000000e+00
br i1 %27, label %28, label %33
28: ; preds = %25
%29 = load float, float* %3
%30 = load float, float* %5
%31 = fadd float %30, -1.000000e+00
store float %31, float* %5
%32 = fmul float %29, %30
store float %32, float* %3
br label %25
33: ; preds = %25
%34 = load float, float* %4
%35 = load float, float* %3
%36 = fdiv float 1.000000e+00, %35
%37 = fadd float %34, %36
store float %37, float* %4
%38 = load float, float* %6
%39 = fadd float %38, 1.000000e+00
store float %39, float* %6
br label %19
40: ; preds = %19
%41 = load float, float* %4
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %42)
%44 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
@.str = [32 x i8] c"Inserire la quantita dei numeri\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%6 = load float, float* %1
%7 = fcmp ogt float %6, 1.000000e+01
%8 = fcmp ole float %6, 0.000000e+00
%9 = or i1 %7, %8
br i1 %9, label %3, label %10
10: ; preds = %3
%11 = fcmp ult float %6, 1.000000e+00
br i1 %11, label %30, label %12
12: ; preds = %10, %22
%13 = phi float [ %26, %22 ], [ 1.000000e+00, %10 ]
%14 = phi float [ %25, %22 ], [ 1.000000e+00, %10 ]
%15 = fcmp ogt float %13, 0.000000e+00
br i1 %15, label %16, label %22
16: ; preds = %12, %16
%17 = phi float [ %19, %16 ], [ %13, %12 ]
%18 = phi float [ %20, %16 ], [ 1.000000e+00, %12 ]
%19 = fadd float %17, -1.000000e+00
%20 = fmul float %18, %17
%21 = fcmp ogt float %19, 0.000000e+00
br i1 %21, label %16, label %22
22: ; preds = %16, %12
%23 = phi float [ 1.000000e+00, %12 ], [ %20, %16 ]
%24 = fdiv float 1.000000e+00, %23
%25 = fadd float %14, %24
%26 = fadd float %13, 1.000000e+00
%27 = fcmp ugt float %26, %6
br i1 %27, label %28, label %12
28: ; preds = %22
%29 = fpext float %25 to double
br label %30
30: ; preds = %28, %10
%31 = phi double [ 1.000000e+00, %10 ], [ %29, %28 ]
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %31)
%33 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}