#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 *);
int main() {
  int i, n, result = 1;
  do {
    printf("Unesite broj:\n");
    scanf("%d", &n);
  } while (n < 1);
  for (i = 1; i <= n; i++) {
    if (i > 10) {
      printf("Broj je prevelik, prekidam!\n");
      break;
    }
    printf("%d! = ", i);
    result *= i;
    printf("%d\n", result);
  }
}


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    0xec4(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0xc(%rbp)
jl     1136 <main+0x16>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11c8 <main+0xa8>
cmpl   $0xa,-0x8(%rbp)
jle    118e <main+0x6e>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c8 <main+0xa8>
mov    -0x8(%rbp),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1165 <main+0x45>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xece(%rip),%r14
lea    0xeb9(%rip),%r15
lea    0xc(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1150 <main+0x20>
lea    0xe92(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe86(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x1,0xc(%rsp)
jle    1354 <main+0x224>
lea    0xe61(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe55(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x3,0xc(%rsp)
jl     1354 <main+0x224>
lea    0xe30(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe24(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x4,0xc(%rsp)
jl     1354 <main+0x224>
lea    0xdff(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdf3(%rip),%rdi
mov    $0x18,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x5,0xc(%rsp)
jl     1354 <main+0x224>
lea    0xdce(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdc2(%rip),%rdi
mov    $0x78,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x6,0xc(%rsp)
jl     1354 <main+0x224>
lea    0xd9d(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd91(%rip),%rdi
mov    $0x2d0,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x7,0xc(%rsp)
jl     1354 <main+0x224>
lea    0xd6c(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd60(%rip),%rdi
mov    $0x13b0,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x8,0xc(%rsp)
jl     1354 <main+0x224>
lea    0xd3b(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd2f(%rip),%rdi
mov    $0x9d80,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x9,0xc(%rsp)
jl     1354 <main+0x224>
lea    0xd0e(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd02(%rip),%rdi
mov    $0x58980,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0xa,0xc(%rsp)
jl     1354 <main+0x224>
lea    0xce1(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xcd5(%rip),%rdi
mov    $0x375f00,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0xa,0xc(%rsp)
jle    1354 <main+0x224>
lea    0xccd(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Unesite broj:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"Broj je prevelik, prekidam!\0A\00"
@.str.3 = [7 x i8] c"%d! = \00"
@.str.4 = [4 x i8] c"%d\0A\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
br label %5
5: ; preds = %8, %0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %8
8: ; preds = %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 1
br i1 %10, label %5, label %11
11: ; preds = %8
store i32 1, i32* %2
br label %12
12: ; preds = %29, %11
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %32
16: ; preds = %12
%17 = load i32, i32* %2
%18 = icmp sgt i32 %17, 10
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %32
21: ; preds = %16
%22 = load i32, i32* %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %2
%25 = load i32, i32* %4
%26 = mul nsw i32 %25, %24
store i32 %26, i32* %4
%27 = load i32, i32* %4
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %21
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
br label %12
32: ; preds = %19, %12
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [7 x i8] c"%d! = \00"
@.str.4 = [4 x i8] c"%d\0A\00"
@str = [14 x i8] c"Unesite broj:\00"
@str.5 = [28 x i8] c"Broj je prevelik, prekidam!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 1
br i1 %7, label %3, label %8
8: ; preds = %3
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 1)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 1)
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 1
br i1 %12, label %15, label %60
13: ; preds = %55
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.5, i64 0, i64 0))
br label %60
15: ; preds = %8
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 2)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 2)
%18 = load i32, i32* %1
%19 = icmp sgt i32 %18, 2
br i1 %19, label %20, label %60
20: ; preds = %15
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 3)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 6)
%23 = load i32, i32* %1
%24 = icmp sgt i32 %23, 3
br i1 %24, label %25, label %60
25: ; preds = %20
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 4)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 24)
%28 = load i32, i32* %1
%29 = icmp sgt i32 %28, 4
br i1 %29, label %30, label %60
30: ; preds = %25
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 5)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 120)
%33 = load i32, i32* %1
%34 = icmp sgt i32 %33, 5
br i1 %34, label %35, label %60
35: ; preds = %30
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 6)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 720)
%38 = load i32, i32* %1
%39 = icmp sgt i32 %38, 6
br i1 %39, label %40, label %60
40: ; preds = %35
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 7)
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 5040)
%43 = load i32, i32* %1
%44 = icmp sgt i32 %43, 7
br i1 %44, label %45, label %60
45: ; preds = %40
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 8)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 40320)
%48 = load i32, i32* %1
%49 = icmp sgt i32 %48, 8
br i1 %49, label %50, label %60
50: ; preds = %45
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 9)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 362880)
%53 = load i32, i32* %1
%54 = icmp sgt i32 %53, 9
br i1 %54, label %55, label %60
55: ; preds = %50
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 10)
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 3628800)
%58 = load i32, i32* %1
%59 = icmp sgt i32 %58, 10
br i1 %59, label %13, label %60
60: ; preds = %8, %15, %20, %25, %30, %35, %40, %45, %50, %55, %13
ret i32 0
}