#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*/ print_run(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
void view_stat() {
  int i = 0, stop = 0;
  while (stop == 0) {
    printf("\n __________________________________ \n"
           ": Choose class or all?             :\n"
           ": -------------------------------- :\n"
           ": All Classes              -> 0    :\n"
           ": Druid                    -> 1    :\n"
           ": Hunter                   -> 2    :\n"
           ": Mage                     -> 3    :\n"
           ": Paladin                  -> 4    :\n"
           ": Priest                   -> 5    :\n"
           ": Rogue                    -> 6    :\n"
           ": Shaman                   -> 7    :\n"
           ": Warlock                  -> 8    :\n"
           ": Warrior                  -> 9    :\n"
           ": Back                     -> 10   :\n"
           ":__________________________________:\n\n");
    scanf("%d", &i);
    system("cls");
    if (i < 10)
      print_run(i);
    else
      stop = 1;
  }
}


x86 assembly (clang, -O0):
<view_stat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    11ab <view_stat+0x6b>
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
lea    0x10bb(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1060 <scanf@plt>
lea    0x10ae(%rip),%rdi
call   1030 <system@plt>
cmpl   $0xa,-0x4(%rbp)
jge    119f <view_stat+0x5f>
mov    -0x4(%rbp),%edi
call   1050 <print_run@plt>
jmp    11a6 <view_stat+0x66>
movl   $0x1,-0x8(%rbp)
jmp    1156 <view_stat+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<view_stat>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9d(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
lea    0xe8f(%rip),%rdi
call   1040 <system@plt>
mov    0x4(%rsp),%edi
cmp    $0x9,%edi
jg     11c9 <view_stat+0x89>
lea    0xe7e(%rip),%r14
lea    0xe70(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xe67(%rip),%rbx
nopl   0x0(%rax)
call   1050 <print_run@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
mov    0x4(%rsp),%edi
cmp    $0xa,%edi
jl     11a0 <view_stat+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [558 x i8] c"\0A __________________________________ \0A: Choose class or all? :\0A: -------------------------------- :\0A: All Classes -> 0 :\0A: Druid -> 1 :\0A: Hunter -> 2 :\0A: Mage -> 3 :\0A: Paladin -> 4 :\0A: Priest -> 5 :\0A: Rogue -> 6 :\0A: Shaman -> 7 :\0A: Warlock -> 8 :\0A: Warrior -> 9 :\0A: Back -> 10 :\0A:__________________________________:\0A\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"cls\00"
define void @view_stat() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %16, %0
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %17
6: ; preds = %3
%7 = call i32 @printf(i8* getelementptr inbounds ([558 x i8], [558 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* %1
%11 = icmp slt i32 %10, 10
br i1 %11, label %12, label %15
12: ; preds = %6
%13 = load i32, i32* %1
%14 = call i32 @print_run(i32 %13)
br label %16
15: ; preds = %6
store i32 1, i32* %2
br label %16
16: ; preds = %15, %12
br label %3
17: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"cls\00"
@str = [557 x i8] c"\0A __________________________________ \0A: Choose class or all? :\0A: -------------------------------- :\0A: All Classes -> 0 :\0A: Druid -> 1 :\0A: Hunter -> 2 :\0A: Mage -> 3 :\0A: Paladin -> 4 :\0A: Priest -> 5 :\0A: Rogue -> 6 :\0A: Shaman -> 7 :\0A: Warlock -> 8 :\0A: Warrior -> 9 :\0A: Back -> 10 :\0A:__________________________________:\0A\00"
define void @view_stat() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([557 x i8], [557 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %16
8: ; preds = %0, %8
%9 = phi i32 [ %14, %8 ], [ %6, %0 ]
%10 = call i32 @print_run(i32 %9)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([557 x i8], [557 x i8]* @str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%13 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* %1
%15 = icmp slt i32 %14, 10
br i1 %15, label %8, label %16
16: ; preds = %8, %0
ret void
}