#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 *);
void ComputeFactorial() {
  int input, i, original, output;
  printf("Enter Number\n\n>>");
  scanf("%d", &input);
  original = input;
  for (i = 1; i <= input; i++) {
    output *= i;
  }
  printf("%d! = %d", original, output);
}


x86 assembly (clang, -O0):
<ComputeFactorial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1177 <ComputeFactorial+0x57>
mov    -0x8(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1153 <ComputeFactorial+0x33>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ComputeFactorial>:
push   %rax
lea    0xf88(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf91(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
cmp    $0x8,%esi
jae    1153 <ComputeFactorial+0x33>
mov    $0x1,%eax
jmp    1374 <ComputeFactorial+0x254>
mov    %esi,%eax
and    $0x7ffffff8,%eax
lea    -0x8(%rax),%edi
mov    %edi,%edx
shr    $0x3,%edx
add    $0x1,%edx
mov    %edx,%ecx
and    $0x3,%ecx
cmp    $0x18,%edi
jae    118c <ComputeFactorial+0x6c>
movdqa 0xe89(%rip),%xmm0
movdqa 0xe91(%rip),%xmm2
movdqa 0xe99(%rip),%xmm1
jmp    12d1 <ComputeFactorial+0x1b1>
and    $0xfffffffc,%edx
movdqa 0xe69(%rip),%xmm0
movdqa 0xe71(%rip),%xmm2
movdqa 0xe79(%rip),%xmm1
movdqa 0xe90(%rip),%xmm9
movdqa 0xe97(%rip),%xmm10
movdqa 0xe9e(%rip),%xmm11
movdqa 0xea5(%rip),%xmm12
movdqa 0xeac(%rip),%xmm13
movdqa 0xeb3(%rip),%xmm14
movdqa 0xeba(%rip),%xmm15
cs nopw 0x0(%rax,%rax,1)
movdqa %xmm0,%xmm6
paddd  0xe34(%rip),%xmm6
pshufd $0xf5,%xmm0,%xmm7
pshufd $0xf5,%xmm1,%xmm3
pmuludq %xmm7,%xmm3
pmuludq %xmm0,%xmm1
pshufd $0xf5,%xmm2,%xmm7
pshufd $0xf5,%xmm6,%xmm4
pmuludq %xmm7,%xmm4
pmuludq %xmm2,%xmm6
movdqa %xmm0,%xmm2
paddd  %xmm9,%xmm2
movdqa %xmm0,%xmm7
paddd  %xmm10,%xmm7
pmuludq %xmm2,%xmm1
pshufd $0xf5,%xmm2,%xmm2
pmuludq %xmm3,%xmm2
pmuludq %xmm7,%xmm6
pshufd $0xf5,%xmm7,%xmm3
pmuludq %xmm4,%xmm3
movdqa %xmm0,%xmm4
paddd  %xmm11,%xmm4
movdqa %xmm0,%xmm7
paddd  %xmm12,%xmm7
pshufd $0xf5,%xmm4,%xmm5
pmuludq %xmm2,%xmm5
pmuludq %xmm1,%xmm4
pshufd $0xf5,%xmm7,%xmm8
pmuludq %xmm3,%xmm8
pmuludq %xmm6,%xmm7
movdqa %xmm0,%xmm2
paddd  %xmm13,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm14,%xmm3
pmuludq %xmm2,%xmm4
pshufd $0xe8,%xmm4,%xmm1
pshufd $0xf5,%xmm2,%xmm2
pmuludq %xmm5,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
pmuludq %xmm3,%xmm7
pshufd $0xe8,%xmm7,%xmm2
pshufd $0xf5,%xmm3,%xmm3
pmuludq %xmm8,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm2
paddd  %xmm15,%xmm0
add    $0xfffffffc,%edx
jne    11f0 <ComputeFactorial+0xd0>
test   %ecx,%ecx
je     1341 <ComputeFactorial+0x221>
movdqa 0xd53(%rip),%xmm3
movdqa 0xd5b(%rip),%xmm4
cs nopw 0x0(%rax,%rax,1)
nop
movdqa %xmm0,%xmm5
paddd  %xmm3,%xmm5
pshufd $0xf5,%xmm1,%xmm6
pmuludq %xmm0,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pshufd $0xf5,%xmm0,%xmm7
pmuludq %xmm6,%xmm7
pshufd $0xe8,%xmm7,%xmm6
punpckldq %xmm6,%xmm1
pshufd $0xf5,%xmm2,%xmm6
pmuludq %xmm5,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pshufd $0xf5,%xmm5,%xmm5
pmuludq %xmm6,%xmm5
pshufd $0xe8,%xmm5,%xmm5
punpckldq %xmm5,%xmm2
paddd  %xmm4,%xmm0
add    $0xffffffff,%ecx
jne    12f0 <ComputeFactorial+0x1d0>
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,%edx
cmp    %eax,%esi
je     138a <ComputeFactorial+0x26a>
or     $0x1,%eax
lea    0x1(%rsi),%ecx
nopw   0x0(%rax,%rax,1)
imul   %eax,%edx
add    $0x1,%eax
cmp    %eax,%ecx
jne    1380 <ComputeFactorial+0x260>
lea    0xd30(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter Number\0A\0A>>\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"%d! = %d\00"
define void @ComputeFactorial() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 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* %1)
%7 = load i32, i32* %1
store i32 %7, i32* %3
store i32 1, i32* %2
br label %8
8: ; preds = %16, %0
%9 = load i32, i32* %2
%10 = load i32, i32* %1
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = load i32, i32* %2
%14 = load i32, i32* %4
%15 = mul nsw i32 %14, %13
store i32 %15, i32* %4
br label %16
16: ; preds = %12
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %8
19: ; preds = %8
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %20, i32 %21)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter Number\0A\0A>>\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"%d! = %d\00"
define void @ComputeFactorial() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 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
%7 = icmp ult i32 %5, 8
br i1 %7, label %65, label %8
8: ; preds = %0
%9 = and i32 %5, 2147483640
%10 = or i32 %9, 1
%11 = add nsw i32 %9, -8
%12 = lshr exact i32 %11, 3
%13 = add nuw nsw i32 %12, 1
%14 = and i32 %13, 3
%15 = icmp ult i32 %11, 24
br i1 %15, label %41, label %16
16: ; preds = %8
%17 = and i32 %13, 1073741820
br label %18
18: ; preds = %18, %16
%19 = phi <4 x i32> [ <i32 undef, i32 1, i32 1, i32 1>, %16 ], [ %36, %18 ]
%20 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %16 ], [ %37, %18 ]
%21 = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %16 ], [ %38, %18 ]
%22 = phi i32 [ 0, %16 ], [ %39, %18 ]
%23 = add <4 x i32> %21, <i32 4, i32 4, i32 4, i32 4>
%24 = mul <4 x i32> %19, %21
%25 = mul <4 x i32> %20, %23
%26 = add <4 x i32> %21, <i32 8, i32 8, i32 8, i32 8>
%27 = add <4 x i32> %21, <i32 12, i32 12, i32 12, i32 12>
%28 = mul <4 x i32> %24, %26
%29 = mul <4 x i32> %25, %27
%30 = add <4 x i32> %21, <i32 16, i32 16, i32 16, i32 16>
%31 = add <4 x i32> %21, <i32 20, i32 20, i32 20, i32 20>
%32 = mul <4 x i32> %28, %30
%33 = mul <4 x i32> %29, %31
%34 = add <4 x i32> %21, <i32 24, i32 24, i32 24, i32 24>
%35 = add <4 x i32> %21, <i32 28, i32 28, i32 28, i32 28>
%36 = mul <4 x i32> %32, %34
%37 = mul <4 x i32> %33, %35
%38 = add <4 x i32> %21, <i32 32, i32 32, i32 32, i32 32>
%39 = add i32 %22, 4
%40 = icmp eq i32 %39, %17
br i1 %40, label %41, label %18
41: ; preds = %18, %8
%42 = phi <4 x i32> [ undef, %8 ], [ %36, %18 ]
%43 = phi <4 x i32> [ undef, %8 ], [ %37, %18 ]
%44 = phi <4 x i32> [ <i32 undef, i32 1, i32 1, i32 1>, %8 ], [ %36, %18 ]
%45 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %8 ], [ %37, %18 ]
%46 = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %8 ], [ %38, %18 ]
%47 = icmp eq i32 %14, 0
br i1 %47, label %59, label %48
48: ; preds = %41, %48
%49 = phi <4 x i32> [ %54, %48 ], [ %44, %41 ]
%50 = phi <4 x i32> [ %55, %48 ], [ %45, %41 ]
%51 = phi <4 x i32> [ %56, %48 ], [ %46, %41 ]
%52 = phi i32 [ %57, %48 ], [ 0, %41 ]
%53 = add <4 x i32> %51, <i32 4, i32 4, i32 4, i32 4>
%54 = mul <4 x i32> %49, %51
%55 = mul <4 x i32> %50, %53
%56 = add <4 x i32> %51, <i32 8, i32 8, i32 8, i32 8>
%57 = add i32 %52, 1
%58 = icmp eq i32 %57, %14
br i1 %58, label %59, label %48
59: ; preds = %48, %41
%60 = phi <4 x i32> [ %42, %41 ], [ %54, %48 ]
%61 = phi <4 x i32> [ %43, %41 ], [ %55, %48 ]
%62 = mul <4 x i32> %61, %60
%63 = call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %62)
%64 = icmp eq i32 %5, %9
br i1 %64, label %74, label %65
65: ; preds = %0, %59
%66 = phi i32 [ undef, %0 ], [ %63, %59 ]
%67 = phi i32 [ 1, %0 ], [ %10, %59 ]
br label %68
68: ; preds = %65, %68
%69 = phi i32 [ %71, %68 ], [ %66, %65 ]
%70 = phi i32 [ %72, %68 ], [ %67, %65 ]
%71 = mul nsw i32 %69, %70
%72 = add nuw i32 %70, 1
%73 = icmp eq i32 %70, %5
br i1 %73, label %74, label %68
74: ; preds = %68, %59
%75 = phi i32 [ %63, %59 ], [ %71, %68 ]
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %75)
ret void
}