#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 getch();
char arrkeys() {
  switch (getch()) {
  case 259:
    return 'u';
    break;
  case 261:
    return 'r';
    break;
  case 260:
    return 'l';
    break;
  case 258:
    return 'd';
    break;
  case 10:
    return 'q';
    break;
  case 27:
    return 'x';
    break;
  default:
    return 'e';
  }
}


x86 assembly (clang, -O0):
<arrkeys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <getch@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
sub    $0xa,%eax
je     11b3 <arrkeys+0xa3>
jmp    1132 <arrkeys+0x22>
mov    -0x8(%rbp),%eax
sub    $0x1b,%eax
je     11bc <arrkeys+0xac>
jmp    1143 <arrkeys+0x33>
mov    -0x8(%rbp),%eax
sub    $0x102,%eax
je     11aa <arrkeys+0x9a>
jmp    1156 <arrkeys+0x46>
mov    -0x8(%rbp),%eax
sub    $0x103,%eax
je     118f <arrkeys+0x7f>
jmp    1169 <arrkeys+0x59>
mov    -0x8(%rbp),%eax
sub    $0x104,%eax
je     11a1 <arrkeys+0x91>
jmp    117c <arrkeys+0x6c>
mov    -0x8(%rbp),%eax
sub    $0x105,%eax
je     1198 <arrkeys+0x88>
jmp    11c5 <arrkeys+0xb5>
movb   $0x75,-0x1(%rbp)
jmp    11c9 <arrkeys+0xb9>
movb   $0x72,-0x1(%rbp)
jmp    11c9 <arrkeys+0xb9>
movb   $0x6c,-0x1(%rbp)
jmp    11c9 <arrkeys+0xb9>
movb   $0x64,-0x1(%rbp)
jmp    11c9 <arrkeys+0xb9>
movb   $0x71,-0x1(%rbp)
jmp    11c9 <arrkeys+0xb9>
movb   $0x78,-0x1(%rbp)
jmp    11c9 <arrkeys+0xb9>
movb   $0x65,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arrkeys>:
push   %rax
xor    %eax,%eax
call   1030 <getch@plt>
lea    -0x102(%rax),%ecx
cmp    $0x3,%ecx
ja     1139 <arrkeys+0x29>
mov    $0x75,%al
lea    0xed4(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x64,%al
pop    %rcx
ret
cmp    $0xa,%eax
je     114f <arrkeys+0x3f>
cmp    $0x1b,%eax
jne    1153 <arrkeys+0x43>
mov    $0x78,%al
pop    %rcx
ret
mov    $0x6c,%al
pop    %rcx
ret
mov    $0x72,%al
pop    %rcx
ret
mov    $0x71,%al
pop    %rcx
ret
mov    $0x65,%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @arrkeys() {
%1 = alloca i8
%2 = call i32 (...) @getch()
switch i32 %2, label %9 [
i32 259, label %3
i32 261, label %4
i32 260, label %5
i32 258, label %6
i32 10, label %7
i32 27, label %8
]
3: ; preds = %0
store i8 117, i8* %1
br label %10
4: ; preds = %0
store i8 114, i8* %1
br label %10
5: ; preds = %0
store i8 108, i8* %1
br label %10
6: ; preds = %0
store i8 100, i8* %1
br label %10
7: ; preds = %0
store i8 113, i8* %1
br label %10
8: ; preds = %0
store i8 120, i8* %1
br label %10
9: ; preds = %0
store i8 101, i8* %1
br label %10
10: ; preds = %9, %8, %7, %6, %5, %4, %3
%11 = load i8, i8* %1
ret i8 %11
}

LLVM IR (-O2):
define signext i8 @arrkeys() {
%1 = tail call i32 (...) @getch()
switch i32 %1, label %7 [
i32 259, label %8
i32 261, label %2
i32 260, label %3
i32 258, label %4
i32 10, label %5
i32 27, label %6
]
2: ; preds = %0
br label %8
3: ; preds = %0
br label %8
4: ; preds = %0
br label %8
5: ; preds = %0
br label %8
6: ; preds = %0
br label %8
7: ; preds = %0
br label %8
8: ; preds = %0, %7, %6, %5, %4, %3, %2
%9 = phi i8 [ 101, %7 ], [ 120, %6 ], [ 113, %5 ], [ 100, %4 ], [ 108, %3 ], [ 114, %2 ], [ 117, %0 ]
ret i8 %9
}