#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 *, double);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int valor;
  double fatorial = 1;
  scanf("%d", &valor);
  printf("%d!=", valor);
  while (valor >= 1) {
    printf("%d*", valor);
    fatorial *= valor;
    valor--;
  }
  printf("\b=%.0lf\n", fatorial);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
jl     1195 <main+0x75>
cvtsi2sdl -0x8(%rbp),%xmm0
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    115d <main+0x3d>
movsd  -0x10(%rbp),%xmm0
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xedc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cvtsi2sdl 0x4(%rsp),%xmm0
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
movsd  0xeac(%rip),%xmm0
test   %eax,%eax
jle    11a2 <main+0x82>
lea    0xeb1(%rip),%rbx
nop
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
lea    -0x1(%rcx),%eax
mov    %eax,0x4(%rsp)
cmp    $0x1,%ecx
jg     1160 <main+0x40>
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d!=\00"
@.str.2 = [4 x i8] c"%d*\00"
@.str.3 = [9 x i8] c"\08=%.0lf\0A\00"
define i32 @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 double
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %5)
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %0, %9
%10 = phi double [ %16, %9 ], [ 1.000000e+00, %0 ]
%11 = phi i32 [ %17, %9 ], [ %7, %0 ]
%12 = sitofp i32 %11 to double
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %12)
%14 = load i32, i32* %1
%15 = sitofp i32 %14 to double
%16 = fmul double %10, %15
%17 = add nsw i32 %14, -1
store i32 %17, i32* %1
%18 = icmp sgt i32 %14, 1
br i1 %18, label %9, label %19
19: ; preds = %9, %0
%20 = phi double [ 1.000000e+00, %0 ], [ %16, %9 ]
%21 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double %20)
ret i32 0
}