#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*/ check();
int /*<<< orphan*/ dis();
int /*<<< orphan*/ down();
char getchar();
int /*<<< orphan*/ left();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ right();
int /*<<< orphan*/ up();
void game() {
  char in;
  while (1) {
    printf("\nEnter: ");
    in = getchar();
    printf("%c", in);
    switch (in) {
    case 'a':
      left();
      break;
    case 's':
      down();
      break;
    case 'd':
      right();
      break;
    case 'w':
      up();
      break;
    case 'e':
      check();
      break;
    default:
      printf("\npress e when done\n");
      dis();
      break;
    }
  }
}


x86 assembly (clang, -O0):
<game>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xecd(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x11(%rbp)
call   1050 <printf@plt>
mov    -0x11(%rbp),%al
call   1080 <getchar@plt>
mov    %al,%cl
mov    -0x11(%rbp),%al
mov    %cl,-0x1(%rbp)
movsbl -0x1(%rbp),%esi
lea    0xeb1(%rip),%rdi
call   1050 <printf@plt>
movsbl -0x1(%rbp),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x16,%eax
ja     121f <game+0x9f>
mov    -0x10(%rbp),%rax
lea    0xe26(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1030 <left@plt>
jmp    1234 <game+0xb4>
mov    $0x0,%al
call   1060 <down@plt>
jmp    1234 <game+0xb4>
mov    $0x0,%al
call   1040 <right@plt>
jmp    1234 <game+0xb4>
mov    $0x0,%al
call   1070 <up@plt>
jmp    1234 <game+0xb4>
mov    $0x0,%al
call   10a0 <check@plt>
jmp    1234 <game+0xb4>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1090 <dis@plt>
jmp    1188 <game+0x8>

x86 assembly (clang, -O2):
<game>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xead(%rip),%r15
lea    0xeaf(%rip),%r14
lea    0xe43(%rip),%r12
jmp    11d0 <game+0x30>
xor    %eax,%eax
call   10c0 <check@plt>
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   10a0 <getchar@plt>
movsbl %al,%ebx
mov    %ebx,%edi
call   1030 <putchar@plt>
add    $0xffffff9f,%ebx
cmp    $0x16,%ebx
ja     1205 <game+0x65>
movslq (%r12,%rbx,4),%rax
add    %r12,%rax
jmp    *%rax
xor    %eax,%eax
call   1050 <left@plt>
jmp    11d0 <game+0x30>
mov    %r14,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   10b0 <dis@plt>
jmp    11d0 <game+0x30>
xor    %eax,%eax
call   1060 <right@plt>
jmp    11d0 <game+0x30>
xor    %eax,%eax
call   1080 <down@plt>
jmp    11d0 <game+0x30>
xor    %eax,%eax
call   1090 <up@plt>
jmp    11d0 <game+0x30>

LLVM IR (-O0):
@.str = [9 x i8] c"\0AEnter: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [20 x i8] c"\0Apress e when done\0A\00"
define void @game() {
%1 = alloca i8
br label %2
2: ; preds = %0, %23
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = call signext i8 (...) @getchar()
store i8 %4, i8* %1
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i8, i8* %1
%9 = sext i8 %8 to i32
switch i32 %9, label %20 [
i32 97, label %10
i32 115, label %12
i32 100, label %14
i32 119, label %16
i32 101, label %18
]
10: ; preds = %2
%11 = call i32 (...) @left()
br label %23
12: ; preds = %2
%13 = call i32 (...) @down()
br label %23
14: ; preds = %2
%15 = call i32 (...) @right()
br label %23
16: ; preds = %2
%17 = call i32 (...) @up()
br label %23
18: ; preds = %2
%19 = call i32 (...) @check()
br label %23
20: ; preds = %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 (...) @dis()
br label %23
23: ; preds = %20, %18, %16, %14, %12, %10
br label %2
}

LLVM IR (-O2):
@.str = [9 x i8] c"\0AEnter: \00"
@str = [19 x i8] c"\0Apress e when done\00"
define void @game() {
br label %1
1: ; preds = %19, %0
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = tail call signext i8 (...) @getchar()
%4 = sext i8 %3 to i32
%5 = tail call i32 @putchar(i32 %4)
switch i32 %4, label %16 [
i32 97, label %6
i32 115, label %8
i32 100, label %10
i32 119, label %12
i32 101, label %14
]
6: ; preds = %1
%7 = tail call i32 (...) @left()
br label %19
8: ; preds = %1
%9 = tail call i32 (...) @down()
br label %19
10: ; preds = %1
%11 = tail call i32 (...) @right()
br label %19
12: ; preds = %1
%13 = tail call i32 (...) @up()
br label %19
14: ; preds = %1
%15 = tail call i32 (...) @check()
br label %19
16: ; preds = %1
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%18 = tail call i32 (...) @dis()
br label %19
19: ; preds = %16, %14, %12, %10, %8, %6
br label %1
}