#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 atoi(char *);
int class_number(char *);
int /*<<< orphan*/ commandlist(int);
int /*<<< orphan*/ delete_arena();
int /*<<< orphan*/ new_arena();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char **);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ view_late();
int /*<<< orphan*/ view_m_win();
void user_dialog(int *stop) {
  int i = 0, classnum = 0;
  char choice[100];
  char *choicep = choice;
  printf("\n __________________________________ \n"
         ": Command list below:              :\n"
         ": -------------------------------- :\n"
         ": New Arena                -> 1    :\n"
         ": Delete Arena             -> 2    :\n"
         ": View Latest              -> 3    :\n"
         ": View Most Wins           -> 4    :\n"
         ": Quit                     -> 5    :\n"
         ": -------------------------------- :\n"
         ": Enter class name to get specific :\n"
         ": class statistics or 'all'        :\n"
         ": 'Hunter' or 'Warrior' or 'Mage'  :\n"
         ":__________________________________:\n\n");
  scanf("%s", &choice);
  system("cls");
  if (strcmp(choicep, "1") == 0 || strcmp(choicep, "2") == 0 ||
      strcmp(choicep, "3") == 0 || strcmp(choicep, "4") == 0 ||
      strcmp(choicep, "5") == 0) {
    i = atoi(choicep);
    switch (i) {
    case 1:
      new_arena();
      break;
    case 2:
      delete_arena();
      break;
    case 3:
      view_late();
      break;
    case 4:
      view_m_win();
      break;
    default:
      *stop = 1;
      break;
    }
  } else {
    classnum = class_number(choice);
    commandlist(classnum);
  }
}


x86 assembly (clang, -O0):
<user_dialog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x88(%rbp)
lea    0xe31(%rip),%rdi
call   1070 <printf@plt>
lea    -0x80(%rbp),%rsi
lea    0x1005(%rip),%rdi
call   10c0 <scanf@plt>
lea    0xffc(%rip),%rdi
call   1060 <system@plt>
mov    -0x88(%rbp),%rdi
lea    0xfed(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     1291 <user_dialog+0xe1>
mov    -0x88(%rbp),%rdi
lea    0xfd2(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     1291 <user_dialog+0xe1>
mov    -0x88(%rbp),%rdi
lea    0xfb7(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     1291 <user_dialog+0xe1>
mov    -0x88(%rbp),%rdi
lea    0xf9c(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     1291 <user_dialog+0xe1>
mov    -0x88(%rbp),%rdi
lea    0xf81(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    130e <user_dialog+0x15e>
mov    -0x88(%rbp),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x90(%rbp)
sub    $0x3,%eax
ja     12ff <user_dialog+0x14f>
mov    -0x90(%rbp),%rax
lea    0xd3a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1090 <new_arena@plt>
jmp    1309 <user_dialog+0x159>
mov    $0x0,%al
call   1030 <delete_arena@plt>
jmp    1309 <user_dialog+0x159>
mov    $0x0,%al
call   10a0 <view_late@plt>
jmp    1309 <user_dialog+0x159>
mov    $0x0,%al
call   1050 <view_m_win@plt>
jmp    1309 <user_dialog+0x159>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
jmp    1322 <user_dialog+0x172>
lea    -0x80(%rbp),%rdi
call   1040 <class_number@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   10b0 <commandlist@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<user_dialog>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rdi,%r14
lea    0xe60(%rip),%rdi
call   1040 <puts@plt>
lea    0xe43(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   10c0 <scanf@plt>
lea    0xe34(%rip),%rdi
call   1070 <system@plt>
lea    0xe2c(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1259 <user_dialog+0xa9>
lea    0xe1a(%rip),%rsi
mov    %rsp,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1259 <user_dialog+0xa9>
lea    0xe08(%rip),%rsi
mov    %rsp,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1259 <user_dialog+0xa9>
lea    0xdf6(%rip),%rsi
mov    %rsp,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1259 <user_dialog+0xa9>
lea    0xde4(%rip),%rsi
mov    %rsp,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1259 <user_dialog+0xa9>
mov    %rsp,%rdi
call   1050 <class_number@plt>
mov    %eax,%edi
call   10b0 <commandlist@plt>
jmp    12a4 <user_dialog+0xf4>
mov    %rsp,%rdi
call   10d0 <atoi@plt>
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1282 <user_dialog+0xd2>
lea    0xd90(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1090 <new_arena@plt>
jmp    12a4 <user_dialog+0xf4>
movl   $0x1,(%r14)
jmp    12a4 <user_dialog+0xf4>
xor    %eax,%eax
call   1030 <delete_arena@plt>
jmp    12a4 <user_dialog+0xf4>
xor    %eax,%eax
call   10a0 <view_late@plt>
jmp    12a4 <user_dialog+0xf4>
xor    %eax,%eax
call   1060 <view_m_win@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [484 x i8] c"\0A __________________________________ \0A: Command list below: :\0A: -------------------------------- :\0A: New Arena -> 1 :\0A: Delete Arena -> 2 :\0A: View Latest -> 3 :\0A: View Most Wins -> 4 :\0A: Quit -> 5 :\0A: -------------------------------- :\0A: Enter class name to get specific :\0A: class statistics or 'all' :\0A: 'Hunter' or 'Warrior' or 'Mage' :\0A:__________________________________:\0A\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"cls\00"
@.str.3 = [2 x i8] c"1\00"
@.str.4 = [2 x i8] c"2\00"
@.str.5 = [2 x i8] c"3\00"
@.str.6 = [2 x i8] c"4\00"
@.str.7 = [2 x i8] c"5\00"
define void @user_dialog(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca [100 x i8]
%6 = alloca i8*
store i32* %0, i32** %2
store i32 0, i32* %3
store i32 0, i32* %4
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
store i8* %7, i8** %6
%8 = call i32 @printf(i8* getelementptr inbounds ([484 x i8], [484 x i8]* @.str, i64 0, i64 0))
%9 = bitcast [100 x i8]* %5 to i8**
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %9)
%11 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%12 = load i8*, i8** %6
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %31, label %15
15: ; preds = %1
%16 = load i8*, i8** %6
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %31, label %19
19: ; preds = %15
%20 = load i8*, i8** %6
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %31, label %23
23: ; preds = %19
%24 = load i8*, i8** %6
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %31, label %27
27: ; preds = %23
%28 = load i8*, i8** %6
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %46
31: ; preds = %27, %23, %19, %15, %1
%32 = load i8*, i8** %6
%33 = call i32 @atoi(i8* %32)
store i32 %33, i32* %3
%34 = load i32, i32* %3
switch i32 %34, label %43 [
i32 1, label %35
i32 2, label %37
i32 3, label %39
i32 4, label %41
]
35: ; preds = %31
%36 = call i32 (...) @new_arena()
br label %45
37: ; preds = %31
%38 = call i32 (...) @delete_arena()
br label %45
39: ; preds = %31
%40 = call i32 (...) @view_late()
br label %45
41: ; preds = %31
%42 = call i32 (...) @view_m_win()
br label %45
43: ; preds = %31
%44 = load i32*, i32** %2
store i32 1, i32* %44
br label %45
45: ; preds = %43, %41, %39, %37, %35
br label %51
46: ; preds = %27
%47 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%48 = call i32 @class_number(i8* %47)
store i32 %48, i32* %4
%49 = load i32, i32* %4
%50 = call i32 @commandlist(i32 %49)
br label %51
51: ; preds = %46, %45
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"cls\00"
@.str.3 = [2 x i8] c"1\00"
@.str.4 = [2 x i8] c"2\00"
@.str.5 = [2 x i8] c"3\00"
@.str.6 = [2 x i8] c"4\00"
@.str.7 = [2 x i8] c"5\00"
@str = [483 x i8] c"\0A __________________________________ \0A: Command list below: :\0A: -------------------------------- :\0A: New Arena -> 1 :\0A: Delete Arena -> 2 :\0A: View Latest -> 3 :\0A: View Most Wins -> 4 :\0A: Quit -> 5 :\0A: -------------------------------- :\0A: Enter class name to get specific :\0A: class statistics or 'all' :\0A: 'Hunter' or 'Warrior' or 'Mage' :\0A:__________________________________:\0A\00"
define void @user_dialog(i32* nocapture writeonly %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([483 x i8], [483 x i8]* @str, i64 0, i64 0))
%5 = bitcast [100 x i8]* %2 to i8**
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %5)
%7 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%8 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %22, label %10
10: ; preds = %1
%11 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %22, label %13
13: ; preds = %10
%14 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %13
%17 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %33
22: ; preds = %19, %16, %13, %10, %1
%23 = call i32 @atoi(i8* %3)
switch i32 %23, label %32 [
i32 1, label %24
i32 2, label %26
i32 3, label %28
i32 4, label %30
]
24: ; preds = %22
%25 = call i32 (...) @new_arena()
br label %36
26: ; preds = %22
%27 = call i32 (...) @delete_arena()
br label %36
28: ; preds = %22
%29 = call i32 (...) @view_late()
br label %36
30: ; preds = %22
%31 = call i32 (...) @view_m_win()
br label %36
32: ; preds = %22
store i32 1, i32* %0
br label %36
33: ; preds = %19
%34 = call i32 @class_number(i8* %3)
%35 = call i32 @commandlist(i32 %34)
br label %36
36: ; preds = %24, %26, %28, %30, %32, %33
ret void
}