#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 *);
main() {
  int N;
  int Cont;
  int Fat;
  Fat = 1;
  printf("inserisci un numero ");
  scanf("%d", &N);
  for (Cont = 0; Cont < N; Cont++) {
    Fat = Fat * (N - Cont);
  }
  printf("il numero fattoriale e' %d", Fat);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf34(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf51(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    $0x1,%esi
test   %eax,%eax
jle    12e8 <main+0x1c8>
cmp    $0x8,%eax
jb     12da <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     12fe <main+0x1de>
mov    %ecx,%edx
and    $0xfffffffe,%edx
movdqa 0xe71(%rip),%xmm3
movdqa 0xe79(%rip),%xmm1
movdqa 0xe80(%rip),%xmm8
movdqa 0xe87(%rip),%xmm9
movdqa 0xe8e(%rip),%xmm10
movdqa 0xe95(%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    11c0 <main+0xa0>
test   $0x1,%cl
je     12aa <main+0x18a>
psubd  %xmm3,%xmm12
movdqa %xmm12,%xmm0
psubd  0xdc1(%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     12e8 <main+0x1c8>
sub    %ebx,%eax
nopl   0x0(%rax)
imul   %eax,%esi
add    $0xffffffff,%eax
jne    12e0 <main+0x1c0>
lea    0xd86(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
movdqa 0xcfa(%rip),%xmm3
movdqa 0xd02(%rip),%xmm1
movdqa %xmm1,%xmm2
test   $0x1,%cl
jne    124d <main+0x12d>
jmp    12aa <main+0x18a>

LLVM IR (-O0):
@.str = [21 x i8] c"inserisci un numero \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"il numero fattoriale e' %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 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 0, i32* %3
br label %7
7: ; preds = %17, %0
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = load i32, i32* %4
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = sub nsw i32 %13, %14
%16 = mul nsw i32 %12, %15
store i32 %16, i32* %4
br label %17
17: ; preds = %11
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %7
20: ; preds = %7
%21 = load i32, i32* %4
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [21 x i8] c"inserisci un numero \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"il numero fattoriale e' %d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 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 1, i32 1, i32 1, i32 1>, %20 ], [ %36, %22 ]
%24 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %20 ], [ %37, %22 ]
%25 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %20 ], [ %38, %22 ]
%26 = phi i32 [ 0, %20 ], [ %39, %22 ]
%27 = add <4 x i32> %25, <i32 4, i32 4, i32 4, i32 4>
%28 = sub nsw <4 x i32> %12, %25
%29 = sub nsw <4 x i32> %14, %27
%30 = mul <4 x i32> %28, %23
%31 = mul <4 x i32> %29, %24
%32 = add <4 x i32> %25, <i32 8, i32 8, i32 8, i32 8>
%33 = add <4 x i32> %25, <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> %25, <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 1, i32 1, i32 1, i32 1>, %9 ], [ %36, %22 ]
%45 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %9 ], [ %37, %22 ]
%46 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %9 ], [ %38, %22 ]
%47 = icmp eq i32 %18, 0
br i1 %47, label %54, label %48
48: ; preds = %41
%49 = add <4 x i32> %46, <i32 4, i32 4, i32 4, i32 4>
%50 = sub nsw <4 x i32> %12, %46
%51 = sub nsw <4 x i32> %14, %49
%52 = mul <4 x i32> %50, %44
%53 = mul <4 x i32> %51, %45
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 [ 1, %7 ], [ %58, %54 ]
%62 = phi i32 [ 0, %7 ], [ %10, %54 ]
br label %63
63: ; preds = %60, %63
%64 = phi i32 [ %67, %63 ], [ %61, %60 ]
%65 = phi i32 [ %68, %63 ], [ %62, %60 ]
%66 = sub nsw i32 %5, %65
%67 = mul nsw i32 %66, %64
%68 = add nuw nsw i32 %65, 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)
ret i32 0
}