#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 *, int *);
int /*<<< orphan*/ system(char *);
main() {
  int N;
  int FAT;
  int I;
  printf("Inserisci il numero naturale");
  scanf("%d", &N);
  FAT = 1;
  I = 0;
  while (I < N) {
    FAT = FAT * (N - I);
    I++;
  }
  printf("il numero fattoriale è:%d", FAT);
  system("PAUSE");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1194 <main+0x64>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0x10(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116b <main+0x3b>
mov    -0xc(%rbp),%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8c(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf24(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf49(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    $0x1,%esi
test   %eax,%eax
jle    12f8 <main+0x1c8>
cmp    $0x8,%eax
jb     12ea <main+0x1ba>
mov    %eax,%ebx
and    $0xfffffff8,%ebx
movd   %eax,%xmm0
pshufd $0x0,%xmm0,%xmm12
lea    -0x8(%rbx),%edx
mov    %edx,%ecx
shr    $0x3,%ecx
add    $0x1,%ecx
test   %edx,%edx
je     131a <main+0x1ea>
mov    %ecx,%edx
and    $0xfffffffe,%edx
movdqa 0xe61(%rip),%xmm1
movdqa 0xe69(%rip),%xmm3
movdqa 0xe70(%rip),%xmm8
movdqa 0xe77(%rip),%xmm9
movdqa 0xe7e(%rip),%xmm10
movdqa 0xe85(%rip),%xmm11
movdqa %xmm1,%xmm2
nop
movdqa %xmm12,%xmm0
psubd  %xmm3,%xmm0
movdqa %xmm0,%xmm5
psubd  %xmm8,%xmm5
pshufd $0xf5,%xmm0,%xmm6
pshufd $0xf5,%xmm1,%xmm7
pmuludq %xmm6,%xmm7
pmuludq %xmm0,%xmm1
pshufd $0xf5,%xmm5,%xmm6
pshufd $0xf5,%xmm2,%xmm4
pmuludq %xmm6,%xmm4
pmuludq %xmm2,%xmm5
movdqa %xmm0,%xmm2
psubd  %xmm9,%xmm2
psubd  %xmm10,%xmm0
pmuludq %xmm2,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pshufd $0xf5,%xmm2,%xmm2
pmuludq %xmm7,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
pmuludq %xmm0,%xmm5
pshufd $0xe8,%xmm5,%xmm2
pshufd $0xf5,%xmm0,%xmm0
pmuludq %xmm4,%xmm0
pshufd $0xe8,%xmm0,%xmm0
punpckldq %xmm0,%xmm2
paddd  %xmm11,%xmm3
add    $0xfffffffe,%edx
jne    11d0 <main+0xa0>
test   $0x1,%cl
je     12ba <main+0x18a>
psubd  %xmm3,%xmm12
movdqa %xmm12,%xmm0
psubd  0xdb1(%rip),%xmm0
pshufd $0xf5,%xmm12,%xmm3
pmuludq %xmm1,%xmm12
pshufd $0xf5,%xmm1,%xmm1
pshufd $0xe8,%xmm12,%xmm4
pmuludq %xmm3,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm1,%xmm4
pshufd $0xf5,%xmm0,%xmm1
pmuludq %xmm2,%xmm0
pshufd $0xf5,%xmm2,%xmm2
pshufd $0xe8,%xmm0,%xmm0
pmuludq %xmm1,%xmm2
pshufd $0xe8,%xmm2,%xmm1
punpckldq %xmm1,%xmm0
movdqa %xmm4,%xmm1
movdqa %xmm0,%xmm2
pshufd $0xf5,%xmm1,%xmm0
pshufd $0xf5,%xmm2,%xmm3
pmuludq %xmm0,%xmm3
pmuludq %xmm1,%xmm2
pshufd $0xee,%xmm2,%xmm0
pmuludq %xmm2,%xmm0
pshufd $0xaa,%xmm3,%xmm1
pmuludq %xmm3,%xmm1
pmuludq %xmm0,%xmm1
movd   %xmm1,%esi
cmp    %ebx,%eax
je     12f8 <main+0x1c8>
sub    %ebx,%eax
nopl   0x0(%rax)
imul   %eax,%esi
add    $0xffffffff,%eax
jne    12f0 <main+0x1c0>
lea    0xd7e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd8b(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
movdqa 0xcde(%rip),%xmm1
movdqa 0xce6(%rip),%xmm3
movdqa %xmm1,%xmm2
test   $0x1,%cl
jne    125d <main+0x12d>
jmp    12ba <main+0x18a>

LLVM IR (-O0):
@.str = [29 x i8] c"Inserisci il numero naturale\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"il numero fattoriale \C3\A8:%d\00"
@.str.3 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
store i32 0, i32* %4
br label %7
7: ; preds = %11, %0
%8 = load i32, i32* %4
%9 = load i32, i32* %2
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %19
11: ; preds = %7
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = load i32, i32* %4
%15 = sub nsw i32 %13, %14
%16 = mul nsw i32 %12, %15
store i32 %16, i32* %3
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %7
19: ; preds = %7
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [29 x i8] c"Inserisci il numero naturale\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"il numero fattoriale \C3\A8:%d\00"
@.str.3 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %70
7: ; preds = %0
%8 = icmp ult i32 %5, 8
br i1 %8, label %60, label %9
9: ; preds = %7
%10 = and i32 %5, -8
%11 = insertelement <4 x i32> poison, i32 %5, i64 0
%12 = shufflevector <4 x i32> %11, <4 x i32> poison, <4 x i32> zeroinitializer
%13 = insertelement <4 x i32> poison, i32 %5, i64 0
%14 = shufflevector <4 x i32> %13, <4 x i32> poison, <4 x i32> zeroinitializer
%15 = add i32 %10, -8
%16 = lshr exact i32 %15, 3
%17 = add nuw nsw i32 %16, 1
%18 = and i32 %17, 1
%19 = icmp eq i32 %15, 0
br i1 %19, label %41, label %20
20: ; preds = %9
%21 = and i32 %17, 1073741822
br label %22
22: ; preds = %22, %20
%23 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %20 ], [ %38, %22 ]
%24 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %20 ], [ %36, %22 ]
%25 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %20 ], [ %37, %22 ]
%26 = phi i32 [ 0, %20 ], [ %39, %22 ]
%27 = add <4 x i32> %23, <i32 4, i32 4, i32 4, i32 4>
%28 = sub nsw <4 x i32> %12, %23
%29 = sub nsw <4 x i32> %14, %27
%30 = mul <4 x i32> %28, %24
%31 = mul <4 x i32> %29, %25
%32 = add <4 x i32> %23, <i32 8, i32 8, i32 8, i32 8>
%33 = add <4 x i32> %23, <i32 12, i32 12, i32 12, i32 12>
%34 = sub nsw <4 x i32> %12, %32
%35 = sub nsw <4 x i32> %14, %33
%36 = mul <4 x i32> %34, %30
%37 = mul <4 x i32> %35, %31
%38 = add <4 x i32> %23, <i32 16, i32 16, i32 16, i32 16>
%39 = add i32 %26, 2
%40 = icmp eq i32 %39, %21
br i1 %40, label %41, label %22
41: ; preds = %22, %9
%42 = phi <4 x i32> [ undef, %9 ], [ %36, %22 ]
%43 = phi <4 x i32> [ undef, %9 ], [ %37, %22 ]
%44 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %9 ], [ %38, %22 ]
%45 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %9 ], [ %36, %22 ]
%46 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %9 ], [ %37, %22 ]
%47 = icmp eq i32 %18, 0
br i1 %47, label %54, label %48
48: ; preds = %41
%49 = add <4 x i32> %44, <i32 4, i32 4, i32 4, i32 4>
%50 = sub nsw <4 x i32> %12, %44
%51 = sub nsw <4 x i32> %14, %49
%52 = mul <4 x i32> %50, %45
%53 = mul <4 x i32> %51, %46
br label %54
54: ; preds = %41, %48
%55 = phi <4 x i32> [ %42, %41 ], [ %52, %48 ]
%56 = phi <4 x i32> [ %43, %41 ], [ %53, %48 ]
%57 = mul <4 x i32> %56, %55
%58 = call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %57)
%59 = icmp eq i32 %5, %10
br i1 %59, label %70, label %60
60: ; preds = %7, %54
%61 = phi i32 [ 0, %7 ], [ %10, %54 ]
%62 = phi i32 [ 1, %7 ], [ %58, %54 ]
br label %63
63: ; preds = %60, %63
%64 = phi i32 [ %68, %63 ], [ %61, %60 ]
%65 = phi i32 [ %67, %63 ], [ %62, %60 ]
%66 = sub nsw i32 %5, %64
%67 = mul nsw i32 %66, %65
%68 = add nuw nsw i32 %64, 1
%69 = icmp eq i32 %68, %5
br i1 %69, label %70, label %63
70: ; preds = %63, %54, %0
%71 = phi i32 [ 1, %0 ], [ %58, %54 ], [ %67, %63 ]
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %71)
%73 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}