#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_SUCCESS;
int /*<<< orphan*/ afunc();
int /*<<< orphan*/ bfunc();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ glutPostRedisplay();
int /*<<< orphan*/ help();
int /*<<< orphan*/ mfunc();
int /*<<< orphan*/ sfunc();
int /*<<< orphan*/ tfunc();
int /*<<< orphan*/ xfunc();
void key(unsigned char key, int x, int y) {
  switch (key) {
  case 'a':
    afunc();
    break;
  case 'b':
    bfunc();
    break;
  case 'h':
    help();
    break;
  case 'm':
    mfunc();
    break;
  case 's':
    sfunc();
    break;
  case 't':
    tfunc();
    break;
  case 'x':
    xfunc();
    break;
  case '\033':
    exit(EXIT_SUCCESS);
    break;
  default:
    break;
  }
  glutPostRedisplay();
}


x86 assembly (clang, -O0):
<key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1b,%eax
je     1284 <key+0xf4>
jmp    11b9 <key+0x29>
mov    -0x10(%rbp),%eax
sub    $0x61,%eax
je     1230 <key+0xa0>
jmp    11ca <key+0x3a>
mov    -0x10(%rbp),%eax
sub    $0x62,%eax
je     123c <key+0xac>
jmp    11db <key+0x4b>
mov    -0x10(%rbp),%eax
sub    $0x68,%eax
je     1248 <key+0xb8>
jmp    11ec <key+0x5c>
mov    -0x10(%rbp),%eax
sub    $0x6d,%eax
je     1254 <key+0xc4>
jmp    11fd <key+0x6d>
mov    -0x10(%rbp),%eax
sub    $0x73,%eax
je     1260 <key+0xd0>
jmp    120e <key+0x7e>
mov    -0x10(%rbp),%eax
sub    $0x74,%eax
je     126c <key+0xdc>
jmp    121f <key+0x8f>
mov    -0x10(%rbp),%eax
sub    $0x78,%eax
je     1278 <key+0xe8>
jmp    1292 <key+0x102>
mov    $0x0,%al
call   1030 <afunc@plt>
jmp    1297 <key+0x107>
mov    $0x0,%al
call   1060 <bfunc@plt>
jmp    1297 <key+0x107>
mov    $0x0,%al
call   1090 <help@plt>
jmp    1297 <key+0x107>
mov    $0x0,%al
call   1080 <mfunc@plt>
jmp    1297 <key+0x107>
mov    $0x0,%al
call   1040 <sfunc@plt>
jmp    1297 <key+0x107>
mov    $0x0,%al
call   1070 <tfunc@plt>
jmp    1297 <key+0x107>
mov    $0x0,%al
call   10a0 <xfunc@plt>
jmp    1297 <key+0x107>
mov    0x2d55(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
jmp    1297 <key+0x107>
mov    $0x0,%al
call   1050 <glutPostRedisplay@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<key>:
push   %rax
lea    -0x61(%rdi),%eax
cmp    $0x17,%al
ja     11ea <key+0x5a>
movzbl %al,%eax
lea    0xe5e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1030 <afunc@plt>
jmp    11f0 <key+0x60>
xor    %eax,%eax
call   1060 <bfunc@plt>
jmp    11f0 <key+0x60>
xor    %eax,%eax
call   1090 <help@plt>
jmp    11f0 <key+0x60>
xor    %eax,%eax
call   1080 <mfunc@plt>
jmp    11f0 <key+0x60>
xor    %eax,%eax
call   1040 <sfunc@plt>
jmp    11f0 <key+0x60>
xor    %eax,%eax
call   1070 <tfunc@plt>
jmp    11f0 <key+0x60>
xor    %eax,%eax
call   10a0 <xfunc@plt>
jmp    11f0 <key+0x60>
cmp    $0x1b,%dil
je     11f8 <key+0x68>
xor    %eax,%eax
pop    %rcx
jmp    1050 <glutPostRedisplay@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define void @key(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
switch i32 %8, label %26 [
i32 97, label %9
i32 98, label %11
i32 104, label %13
i32 109, label %15
i32 115, label %17
i32 116, label %19
i32 120, label %21
i32 27, label %23
]
9: ; preds = %3
%10 = call i32 (...) @afunc()
br label %27
11: ; preds = %3
%12 = call i32 (...) @bfunc()
br label %27
13: ; preds = %3
%14 = call i32 (...) @help()
br label %27
15: ; preds = %3
%16 = call i32 (...) @mfunc()
br label %27
17: ; preds = %3
%18 = call i32 (...) @sfunc()
br label %27
19: ; preds = %3
%20 = call i32 (...) @tfunc()
br label %27
21: ; preds = %3
%22 = call i32 (...) @xfunc()
br label %27
23: ; preds = %3
%24 = load i32, i32* @EXIT_SUCCESS
%25 = call i32 @exit(i32 %24)
unreachable
26: ; preds = %3
br label %27
27: ; preds = %26, %21, %19, %17, %15, %13, %11, %9
%28 = call i32 (...) @glutPostRedisplay()
ret void
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define void @key(i8 zeroext %0, i32 %1, i32 %2) {
switch i8 %0, label %21 [
i8 97, label %4
i8 98, label %6
i8 104, label %8
i8 109, label %10
i8 115, label %12
i8 116, label %14
i8 120, label %16
i8 27, label %18
]
4: ; preds = %3
%5 = tail call i32 (...) @afunc()
br label %21
6: ; preds = %3
%7 = tail call i32 (...) @bfunc()
br label %21
8: ; preds = %3
%9 = tail call i32 (...) @help()
br label %21
10: ; preds = %3
%11 = tail call i32 (...) @mfunc()
br label %21
12: ; preds = %3
%13 = tail call i32 (...) @sfunc()
br label %21
14: ; preds = %3
%15 = tail call i32 (...) @tfunc()
br label %21
16: ; preds = %3
%17 = tail call i32 (...) @xfunc()
br label %21
18: ; preds = %3
%19 = load i32, i32* @EXIT_SUCCESS
%20 = tail call i32 @exit(i32 %19)
unreachable
21: ; preds = %3, %16, %14, %12, %10, %8, %6, %4
%22 = tail call i32 (...) @glutPostRedisplay()
ret void
}