#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*/ new_arena();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ reset();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ view_late();
int /*<<< orphan*/ view_m_win();
int /*<<< orphan*/ view_stat();
void user_dialogue(int *stop) {
  int i = 0;
  printf("\n __________________________________ \n"
         ": What you want to do?             :\n"
         ": -------------------------------- :\n"
         ": New Arena                -> 1    :\n"
         ": View Statistics          -> 2    :\n"
         ": View Latest              -> 3    :\n"
         ": View Most Wins           -> 4    :\n"
         ": Quit                     -> 5    :\n"
         ": RESET ALL STATS!!!!      -> 66   :\n"
         ":__________________________________:\n\n");
  scanf("%d", &i);
  system("cls");
  switch (i) {
  case 1:
    new_arena();
    break;
  case 2:
    view_stat();
    break;
  case 3:
    view_late();
    break;
  case 4:
    view_m_win();
    break;
  case 66:
    reset();
    break;
  default:
    *stop = 1;
    break;
  }
}


x86 assembly (clang, -O0):
<user_dialogue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xe66(%rip),%rdi
call   1060 <printf@plt>
lea    0xfcf(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   10a0 <scanf@plt>
lea    0xfc2(%rip),%rdi
call   1050 <system@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     1213 <user_dialogue+0x93>
jmp    11cf <user_dialogue+0x4f>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     121f <user_dialogue+0x9f>
jmp    11e0 <user_dialogue+0x60>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     122b <user_dialogue+0xab>
jmp    11f1 <user_dialogue+0x71>
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
je     1237 <user_dialogue+0xb7>
jmp    1202 <user_dialogue+0x82>
mov    -0x10(%rbp),%eax
sub    $0x42,%eax
je     1243 <user_dialogue+0xc3>
jmp    124f <user_dialogue+0xcf>
mov    $0x0,%al
call   1070 <new_arena@plt>
jmp    1259 <user_dialogue+0xd9>
mov    $0x0,%al
call   1030 <view_stat@plt>
jmp    1259 <user_dialogue+0xd9>
mov    $0x0,%al
call   1080 <view_late@plt>
jmp    1259 <user_dialogue+0xd9>
mov    $0x0,%al
call   1040 <view_m_win@plt>
jmp    1259 <user_dialogue+0xd9>
mov    $0x0,%al
call   1090 <reset@plt>
jmp    1259 <user_dialogue+0xd9>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<user_dialogue>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movl   $0x0,0xc(%rsp)
lea    0xe80(%rip),%rdi
call   1040 <puts@plt>
lea    0xe6d(%rip),%rdi
lea    0xc(%rsp),%rsi
call   10a0 <scanf@plt>
lea    0xe5f(%rip),%rdi
call   1060 <system@plt>
mov    0xc(%rsp),%ecx
lea    -0x1(%rcx),%eax
cmp    $0x3,%eax
ja     11de <user_dialogue+0x5e>
lea    0xe34(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1070 <new_arena@plt>
jmp    120d <user_dialogue+0x8d>
cmp    $0x42,%ecx
jne    1207 <user_dialogue+0x87>
xor    %eax,%eax
call   1090 <reset@plt>
jmp    120d <user_dialogue+0x8d>
xor    %eax,%eax
call   1030 <view_stat@plt>
jmp    120d <user_dialogue+0x8d>
xor    %eax,%eax
call   1080 <view_late@plt>
jmp    120d <user_dialogue+0x8d>
xor    %eax,%eax
call   1050 <view_m_win@plt>
jmp    120d <user_dialogue+0x8d>
movl   $0x1,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [373 x i8] c"\0A __________________________________ \0A: What you want to do? :\0A: -------------------------------- :\0A: New Arena -> 1 :\0A: View Statistics -> 2 :\0A: View Latest -> 3 :\0A: View Most Wins -> 4 :\0A: Quit -> 5 :\0A: RESET ALL STATS!!!! -> 66 :\0A:__________________________________:\0A\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"cls\00"
define void @user_dialogue(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([373 x i8], [373 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* %3)
%6 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* %3
switch i32 %7, label %18 [
i32 1, label %8
i32 2, label %10
i32 3, label %12
i32 4, label %14
i32 66, label %16
]
8: ; preds = %1
%9 = call i32 (...) @new_arena()
br label %20
10: ; preds = %1
%11 = call i32 (...) @view_stat()
br label %20
12: ; preds = %1
%13 = call i32 (...) @view_late()
br label %20
14: ; preds = %1
%15 = call i32 (...) @view_m_win()
br label %20
16: ; preds = %1
%17 = call i32 (...) @reset()
br label %20
18: ; preds = %1
%19 = load i32*, i32** %2
store i32 1, i32* %19
br label %20
20: ; preds = %18, %16, %14, %12, %10, %8
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"cls\00"
@str = [372 x i8] c"\0A __________________________________ \0A: What you want to do? :\0A: -------------------------------- :\0A: New Arena -> 1 :\0A: View Statistics -> 2 :\0A: View Latest -> 3 :\0A: View Most Wins -> 4 :\0A: Quit -> 5 :\0A: RESET ALL STATS!!!! -> 66 :\0A:__________________________________:\0A\00"
define void @user_dialogue(i32* nocapture writeonly %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([372 x i8], [372 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* %2)
%6 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* %2
switch i32 %7, label %18 [
i32 1, label %8
i32 2, label %10
i32 3, label %12
i32 4, label %14
i32 66, label %16
]
8: ; preds = %1
%9 = call i32 (...) @new_arena()
br label %19
10: ; preds = %1
%11 = call i32 (...) @view_stat()
br label %19
12: ; preds = %1
%13 = call i32 (...) @view_late()
br label %19
14: ; preds = %1
%15 = call i32 (...) @view_m_win()
br label %19
16: ; preds = %1
%17 = call i32 (...) @reset()
br label %19
18: ; preds = %1
store i32 1, i32* %0
br label %19
19: ; preds = %18, %16, %14, %12, %10, %8
ret void
}