#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, float);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
void main() {
  int n;
  float i = 1, jc = 1;
  scanf("%d", &n);
  while (i <= n) {
    jc = jc * i;
    i = i + 1;
  }
  printf("%d! = %f\n", n, jc);
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  0xec0(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xeb3(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
lea    0xeab(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x8(%rbp),%xmm1
cvtsi2ssl -0x4(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     119b <main+0x6b>
movss  -0xc(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe74(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1162 <main+0x32>
mov    -0x4(%rbp),%esi
movss  -0xc(%rbp),%xmm0
lea    0xe5d(%rip),%rdi
call   1040 <printf@plt>
lea    0xe5b(%rip),%rdi
call   1030 <system@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xecc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    116f <main+0x3f>
cvtsi2ss %esi,%xmm1
movss  0xeaa(%rip),%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm3
nopl   0x0(%rax)
mulss  %xmm3,%xmm0
addss  %xmm2,%xmm3
ucomiss %xmm3,%xmm1
jae    1160 <main+0x30>
jmp    1177 <main+0x47>
movss  0xe89(%rip),%xmm0
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
lea    0xe87(%rip),%rdi
call   1030 <system@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [10 x i8] c"%d! = %f\0A\00"
@.str.2 = [6 x i8] c"pause\00"
define void @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store float 1.000000e+00, float* %2
store float 1.000000e+00, float* %3
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
br label %5
5: ; preds = %10, %0
%6 = load float, float* %2
%7 = load i32, i32* %1
%8 = sitofp i32 %7 to float
%9 = fcmp ole float %6, %8
br i1 %9, label %10, label %16
10: ; preds = %5
%11 = load float, float* %3
%12 = load float, float* %2
%13 = fmul float %11, %12
store float %13, float* %3
%14 = load float, float* %2
%15 = fadd float %14, 1.000000e+00
store float %15, float* %2
br label %5
16: ; preds = %5
%17 = load i32, i32* %1
%18 = load float, float* %3
%19 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %17, float %18)
%20 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [10 x i8] c"%d! = %f\0A\00"
@.str.2 = [6 x i8] c"pause\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = sitofp i32 %4 to float
%6 = icmp slt i32 %4, 1
br i1 %6, label %13, label %7
7: ; preds = %0, %7
%8 = phi float [ %10, %7 ], [ 1.000000e+00, %0 ]
%9 = phi float [ %11, %7 ], [ 1.000000e+00, %0 ]
%10 = fmul float %9, %8
%11 = fadd float %9, 1.000000e+00
%12 = fcmp ugt float %11, %5
br i1 %12, label %13, label %7
13: ; preds = %7, %0
%14 = phi float [ 1.000000e+00, %0 ], [ %10, %7 ]
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %4, float %14)
%16 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret void
}