#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*/ ispisPoPopularnosti();
int /*<<< orphan*/ ispisPoZanru(int);
int ispisZanrova();
int /*<<< orphan*/ pretraziPoImenu();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int stanje() {
  int o = 0;
  while (o > 1 || o < 3) {
    printf("1. Po imenu\n");
    printf("2. Po zanru\n");
    printf("3. Po popularnosti\n");
    printf("> ");
    scanf("%i", &o);
  }
  if (o == 1) {
    pretraziPoImenu();
  } else if (o == 2) {
    int zanr = ispisZanrova();
    ispisPoZanru(zanr);
  } else if (o == 3) {
    ispisPoPopularnosti();
  }
}


x86 assembly (clang, -O0):
<stanje>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0xd(%rbp)
jg     1188 <stanje+0x28>
cmpl   $0x3,-0x8(%rbp)
setl   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1198 <stanje+0x38>
jmp    11dd <stanje+0x7d>
lea    0xe61(%rip),%rdi
call   1040 <printf@plt>
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
lea    0xe63(%rip),%rdi
call   1040 <printf@plt>
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
lea    0xe62(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
jmp    116f <stanje+0xf>
cmpl   $0x1,-0x8(%rbp)
jne    11f3 <stanje+0x93>
mov    $0x0,%al
call   1060 <pretraziPoImenu@plt>
jmp    122f <stanje+0xcf>
cmpl   $0x2,-0x8(%rbp)
jne    1214 <stanje+0xb4>
mov    $0x0,%al
call   1050 <ispisZanrova@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1080 <ispisPoZanru@plt>
jmp    122a <stanje+0xca>
cmpl   $0x3,-0x8(%rbp)
jne    1225 <stanje+0xc5>
mov    $0x0,%al
call   1030 <ispisPoPopularnosti@plt>
jmp    122a <stanje+0xca>
jmp    122f <stanje+0xcf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stanje>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xebc(%rip),%r14
lea    0xec1(%rip),%r15
lea    0xec6(%rip),%r12
lea    0xea1(%rip),%r13
lea    0xe9d(%rip),%rbx
lea    0x4(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
jmp    1170 <stanje+0x40>

LLVM IR (-O0):
@.str = [13 x i8] c"1. Po imenu\0A\00"
@.str.1 = [13 x i8] c"2. Po zanru\0A\00"
@.str.2 = [20 x i8] c"3. Po popularnosti\0A\00"
@.str.3 = [3 x i8] c"> \00"
@.str.4 = [3 x i8] c"%i\00"
define i32 @stanje() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %2
br label %4
4: ; preds = %12, %0
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 1
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 3
br label %10
10: ; preds = %7, %4
%11 = phi i1 [ true, %4 ], [ %9, %7 ]
br i1 %11, label %12, label %18
12: ; preds = %10
%13 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
br label %4
18: ; preds = %10
%19 = load i32, i32* %2
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 (...) @pretraziPoImenu()
br label %37
23: ; preds = %18
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 2
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = call i32 (...) @ispisZanrova()
store i32 %27, i32* %3
%28 = load i32, i32* %3
%29 = call i32 @ispisPoZanru(i32 %28)
br label %36
30: ; preds = %23
%31 = load i32, i32* %2
%32 = icmp eq i32 %31, 3
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 (...) @ispisPoPopularnosti()
br label %35
35: ; preds = %33, %30
br label %36
36: ; preds = %35, %26
br label %37
37: ; preds = %36, %21
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
@.str.3 = [3 x i8] c"> \00"
@.str.4 = [3 x i8] c"%i\00"
@str = [12 x i8] c"1. Po imenu\00"
@str.5 = [12 x i8] c"2. Po zanru\00"
@str.6 = [19 x i8] c"3. Po popularnosti\00"
define i32 @stanje() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %3, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.5, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.6, i64 0, i64 0))
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
br label %3
}