#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*/ exit(int /*<<< orphan*/);
int getchar();
int /*<<< orphan*/ playgame();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ printhelp();
int main() {
  char *menu = "WATSON\n+---------------+\n| [0] Play Game |\n| [1] Help      "
               "|\n| [2] Quit      |\n+---------------+\n> ";
  printf("%s", menu);
  int inp = getchar();
  switch (inp) {
  case 0:
    playgame();
    break;
  case 1:
    printhelp();
    break;
  case 2:
    exit(0);
    break;
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeef(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
test   %eax,%eax
je     11b9 <main+0x69>
jmp    1197 <main+0x47>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
je     11c5 <main+0x75>
jmp    11a8 <main+0x58>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     11d1 <main+0x81>
jmp    11d8 <main+0x88>
mov    $0x0,%al
call   1050 <playgame@plt>
jmp    11d8 <main+0x88>
mov    $0x0,%al
call   1070 <printhelp@plt>
jmp    11d8 <main+0x88>
xor    %edi,%edi
call   1060 <exit@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf0c(%rip),%rdi
lea    0xea1(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0x2,%eax
je     118e <main+0x3e>
cmp    $0x1,%eax
je     1187 <main+0x37>
test   %eax,%eax
jne    118e <main+0x3e>
xor    %eax,%eax
call   1050 <playgame@plt>
xor    %edi,%edi
call   1060 <exit@plt>
xor    %eax,%eax
call   1070 <printhelp@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [100 x i8] c"WATSON\0A+---------------+\0A| [0] Play Game |\0A| [1] Help |\0A| [2] Quit |\0A+---------------+\0A> \00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @getchar()
store i32 %6, i32* %3
%7 = load i32, i32* %3
switch i32 %7, label %14 [
i32 0, label %8
i32 1, label %10
i32 2, label %12
]
8: ; preds = %0
%9 = call i32 (...) @playgame()
br label %14
10: ; preds = %0
%11 = call i32 (...) @printhelp()
br label %14
12: ; preds = %0
%13 = call i32 @exit(i32 0)
unreachable
14: ; preds = %0, %10, %8
%15 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [100 x i8] c"WATSON\0A+---------------+\0A| [0] Play Game |\0A| [1] Help |\0A| [2] Quit |\0A+---------------+\0A> \00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
switch i32 %2, label %9 [
i32 0, label %3
i32 1, label %5
i32 2, label %7
]
3: ; preds = %0
%4 = tail call i32 (...) @playgame()
br label %9
5: ; preds = %0
%6 = tail call i32 (...) @printhelp()
br label %9
7: ; preds = %0
%8 = tail call i32 @exit(i32 0)
unreachable
9: ; preds = %0, %5, %3
%10 = tail call i32 @exit(i32 0)
unreachable
}