#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 z, x;
  scanf("%d\n", &z);
  x == z;
  if (z <= 0)
    printf("Отрицательного или нулевого факториала не существует");
  else if (z = 1)
    printf("Факториал=1");
  else
    while (z > 1) {
      x == x *(z - 1);
      z == z - 1;
    }
  printf("Факториал=%d", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jg     115c <main+0x3c>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a3 <main+0x83>
movl   $0x1,-0x8(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    1172 <main+0x52>
jmp    1185 <main+0x65>
lea    0xeef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119e <main+0x7e>
jmp    118a <main+0x6a>
cmpl   $0x1,-0x8(%rbp)
jle    1199 <main+0x79>
jmp    118a <main+0x6a>
jmp    119e <main+0x7e>
jmp    11a3 <main+0x83>
mov    -0xc(%rbp),%esi
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    114a <main+0x2a>
movl   $0x1,0x4(%rsp)
lea    0xf20(%rip),%rdi
jmp    1151 <main+0x31>
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf1e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [100 x i8] c"\D0\9E\D1\82\D1\80\D0\B8\D1\86\D0\B0\D1\82\D0\B5\D0\BB\D1\8C\D0\BD\D0\BE\D0\B3\D0\BE \D0\B8\D0\BB\D0\B8 \D0\BD\D1\83\D0\BB\D0\B5\D0\B2\D0\BE\D0\B3\D0\BE \D1\84\D0\B0\D0\BA\D1\82\D0\BE\D1\80\D0\B8\D0\B0\D0\BB\D0\B0 \D0\BD\D0\B5 \D1\81\D1\83\D1\89\D0\B5\D1\81\D1\82\D0\B2\D1\83\D0\B5\D1\82\00"
@.str.2 = [21 x i8] c"\D0\A4\D0\B0\D0\BA\D1\82\D0\BE\D1\80\D0\B8\D0\B0\D0\BB=1\00"
@.str.3 = [22 x i8] c"\D0\A4\D0\B0\D0\BA\D1\82\D0\BE\D1\80\D0\B8\D0\B0\D0\BB=%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp eq i32 %5, %6
%8 = zext i1 %7 to i32
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.1, i64 0, i64 0))
br label %35
13: ; preds = %0
store i32 1, i32* %2
br i1 true, label %14, label %16
14: ; preds = %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %34
16: ; preds = %13
br label %17
17: ; preds = %20, %16
%18 = load i32, i32* %2
%19 = icmp sgt i32 %18, 1
br i1 %19, label %20, label %33
20: ; preds = %17
%21 = load i32, i32* %3
%22 = load i32, i32* %3
%23 = load i32, i32* %2
%24 = sub nsw i32 %23, 1
%25 = mul nsw i32 %22, %24
%26 = icmp eq i32 %21, %25
%27 = zext i1 %26 to i32
%28 = load i32, i32* %2
%29 = load i32, i32* %2
%30 = sub nsw i32 %29, 1
%31 = icmp eq i32 %28, %30
%32 = zext i1 %31 to i32
br label %17
33: ; preds = %17
br label %34
34: ; preds = %33, %14
br label %35
35: ; preds = %34, %11
%36 = load i32, i32* %3
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %36)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [100 x i8] c"\D0\9E\D1\82\D1\80\D0\B8\D1\86\D0\B0\D1\82\D0\B5\D0\BB\D1\8C\D0\BD\D0\BE\D0\B3\D0\BE \D0\B8\D0\BB\D0\B8 \D0\BD\D1\83\D0\BB\D0\B5\D0\B2\D0\BE\D0\B3\D0\BE \D1\84\D0\B0\D0\BA\D1\82\D0\BE\D1\80\D0\B8\D0\B0\D0\BB\D0\B0 \D0\BD\D0\B5 \D1\81\D1\83\D1\89\D0\B5\D1\81\D1\82\D0\B2\D1\83\D0\B5\D1\82\00"
@.str.2 = [21 x i8] c"\D0\A4\D0\B0\D0\BA\D1\82\D0\BE\D1\80\D0\B8\D0\B0\D0\BB=1\00"
@.str.3 = [22 x i8] c"\D0\A4\D0\B0\D0\BA\D1\82\D0\BE\D1\80\D0\B8\D0\B0\D0\BB=%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 1
br i1 %5, label %7, label %6
6: ; preds = %0
store i32 1, i32* %1
br label %7
7: ; preds = %0, %6
%8 = phi i8* [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), %6 ], [ getelementptr inbounds ([100 x i8], [100 x i8]* @.str.1, i64 0, i64 0), %0 ]
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 undef)
ret i32 0
}