#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*/ delete_arena();
int /*<<< orphan*/ new_arena();
int /*<<< orphan*/ print_all();
int /*<<< orphan*/ print_run(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ recover_run();
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[10];
  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);
    if (classnum > 0 && classnum != 10 && classnum != 11) {
      print_run(classnum);
    } else if (classnum == 10) {
      recover_run();
    } else if (classnum == 11) {
      print_all();
    }
  }
}


x86 assembly (clang, -O0):
<user_dialog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0x1a(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xe17(%rip),%rdi
call   1080 <printf@plt>
lea    -0x1a(%rbp),%rsi
lea    0xfeb(%rip),%rdi
call   10d0 <scanf@plt>
lea    0xfe2(%rip),%rdi
call   1070 <system@plt>
mov    -0x28(%rbp),%rdi
lea    0xfd6(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     129c <user_dialog+0xcc>
mov    -0x28(%rbp),%rdi
lea    0xfbe(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     129c <user_dialog+0xcc>
mov    -0x28(%rbp),%rdi
lea    0xfa6(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     129c <user_dialog+0xcc>
mov    -0x28(%rbp),%rdi
lea    0xf8e(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     129c <user_dialog+0xcc>
mov    -0x28(%rbp),%rdi
lea    0xf76(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1310 <user_dialog+0x140>
mov    -0x28(%rbp),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x3,%eax
ja     1301 <user_dialog+0x131>
mov    -0x30(%rbp),%rax
lea    0xd38(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   10a0 <new_arena@plt>
jmp    130b <user_dialog+0x13b>
mov    $0x0,%al
call   1040 <delete_arena@plt>
jmp    130b <user_dialog+0x13b>
mov    $0x0,%al
call   10b0 <view_late@plt>
jmp    130b <user_dialog+0x13b>
mov    $0x0,%al
call   1060 <view_m_win@plt>
jmp    130b <user_dialog+0x13b>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
jmp    137d <user_dialog+0x1ad>
lea    -0x1a(%rbp),%rdi
call   1050 <class_number@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1347 <user_dialog+0x177>
cmpl   $0xa,-0x10(%rbp)
je     1347 <user_dialog+0x177>
cmpl   $0xb,-0x10(%rbp)
je     1347 <user_dialog+0x177>
mov    -0x10(%rbp),%edi
call   10c0 <print_run@plt>
jmp    1378 <user_dialog+0x1a8>
cmpl   $0xa,-0x10(%rbp)
jne    135d <user_dialog+0x18d>
mov    $0x0,%al
call   1030 <recover_run@plt>
jmp    1373 <user_dialog+0x1a3>
cmpl   $0xb,-0x10(%rbp)
jne    136e <user_dialog+0x19e>
mov    $0x0,%al
call   10f0 <print_all@plt>
jmp    1373 <user_dialog+0x1a3>
jmp    1378 <user_dialog+0x1a8>
jmp    137d <user_dialog+0x1ad>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<user_dialog>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
lea    0xe40(%rip),%rdi
call   1050 <puts@plt>
lea    0xe23(%rip),%rdi
lea    0xe(%rsp),%rbx
mov    %rbx,%rsi
call   10d0 <scanf@plt>
lea    0xe12(%rip),%rdi
call   1080 <system@plt>
lea    0xe0a(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1293 <user_dialog+0xc3>
lea    0xdf8(%rip),%rsi
lea    0xe(%rsp),%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1293 <user_dialog+0xc3>
lea    0xde4(%rip),%rsi
lea    0xe(%rsp),%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1293 <user_dialog+0xc3>
lea    0xdd0(%rip),%rsi
lea    0xe(%rsp),%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1293 <user_dialog+0xc3>
lea    0xdbc(%rip),%rsi
lea    0xe(%rsp),%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1293 <user_dialog+0xc3>
lea    0xe(%rsp),%rdi
call   1060 <class_number@plt>
test   %eax,%eax
jle    12e8 <user_dialog+0x118>
mov    %eax,%ecx
and    $0xfffffffe,%ecx
cmp    $0xa,%ecx
je     12e8 <user_dialog+0x118>
mov    %eax,%edi
call   10c0 <print_run@plt>
jmp    12e0 <user_dialog+0x110>
lea    0xe(%rsp),%rdi
call   10e0 <atoi@plt>
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     12be <user_dialog+0xee>
lea    0xd54(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   10a0 <new_arena@plt>
jmp    12e0 <user_dialog+0x110>
movl   $0x1,(%r14)
jmp    12e0 <user_dialog+0x110>
xor    %eax,%eax
call   1040 <delete_arena@plt>
jmp    12e0 <user_dialog+0x110>
xor    %eax,%eax
call   10b0 <view_late@plt>
jmp    12e0 <user_dialog+0x110>
xor    %eax,%eax
call   1070 <view_m_win@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret
cmp    $0xb,%eax
je     12fb <user_dialog+0x12b>
cmp    $0xa,%eax
jne    12e0 <user_dialog+0x110>
xor    %eax,%eax
call   1030 <recover_run@plt>
jmp    12e0 <user_dialog+0x110>
xor    %eax,%eax
call   10f0 <print_all@plt>
jmp    12e0 <user_dialog+0x110>

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 [10 x i8]
%6 = alloca i8*
store i32* %0, i32** %2
store i32 0, i32* %3
store i32 0, i32* %4
%7 = getelementptr inbounds [10 x i8], [10 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 [10 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 %73
46: ; preds = %27
%47 = getelementptr inbounds [10 x i8], [10 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 = icmp sgt i32 %49, 0
br i1 %50, label %51, label %60
51: ; preds = %46
%52 = load i32, i32* %4
%53 = icmp ne i32 %52, 10
br i1 %53, label %54, label %60
54: ; preds = %51
%55 = load i32, i32* %4
%56 = icmp ne i32 %55, 11
br i1 %56, label %57, label %60
57: ; preds = %54
%58 = load i32, i32* %4
%59 = call i32 @print_run(i32 %58)
br label %72
60: ; preds = %54, %51, %46
%61 = load i32, i32* %4
%62 = icmp eq i32 %61, 10
br i1 %62, label %63, label %65
63: ; preds = %60
%64 = call i32 (...) @recover_run()
br label %71
65: ; preds = %60
%66 = load i32, i32* %4
%67 = icmp eq i32 %66, 11
br i1 %67, label %68, label %70
68: ; preds = %65
%69 = call i32 (...) @print_all()
br label %70
70: ; preds = %68, %65
br label %71
71: ; preds = %70, %63
br label %72
72: ; preds = %71, %57
br label %73
73: ; preds = %72, %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 [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 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 [10 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 %46
26: ; preds = %22
%27 = call i32 (...) @delete_arena()
br label %46
28: ; preds = %22
%29 = call i32 (...) @view_late()
br label %46
30: ; preds = %22
%31 = call i32 (...) @view_m_win()
br label %46
32: ; preds = %22
store i32 1, i32* %0
br label %46
33: ; preds = %19
%34 = call i32 @class_number(i8* %3)
%35 = icmp sgt i32 %34, 0
%36 = and i32 %34, -2
%37 = icmp ne i32 %36, 10
%38 = and i1 %35, %37
br i1 %38, label %39, label %41
39: ; preds = %33
%40 = call i32 @print_run(i32 %34)
br label %46
41: ; preds = %33
switch i32 %34, label %46 [
i32 10, label %42
i32 11, label %44
]
42: ; preds = %41
%43 = call i32 (...) @recover_run()
br label %46
44: ; preds = %41
%45 = call i32 (...) @print_all()
br label %46
46: ; preds = %41, %39, %44, %42, %24, %26, %28, %30, %32
ret void
}