#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 /*<<< orphan*/ glutPostRedisplay();
int /*<<< orphan*/ help();
int /*<<< orphan*/ set_balance();
int /*<<< orphan*/ set_brighten();
int /*<<< orphan*/ set_contrast();
int /*<<< orphan*/ set_saturate();
int /*<<< orphan*/ set_sharpen();
void key(unsigned char key, int x, int y) {
  switch (key) {
  case 'b':
    set_brighten();
    break;
  case 's':
    set_saturate();
    break;
  case 'c':
    set_contrast();
    break;
  case 'z':
    set_sharpen();
    break;
  case 'a':
    set_balance();
    break;
  case 'h':
    help();
    break;
  case '\033':
    exit(0);
    break;
  default:
    return;
  }
  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     1257 <key+0xd7>
jmp    11a9 <key+0x29>
mov    -0x10(%rbp),%eax
sub    $0x61,%eax
je     123f <key+0xbf>
jmp    11ba <key+0x3a>
mov    -0x10(%rbp),%eax
sub    $0x62,%eax
je     120f <key+0x8f>
jmp    11cb <key+0x4b>
mov    -0x10(%rbp),%eax
sub    $0x63,%eax
je     1227 <key+0xa7>
jmp    11dc <key+0x5c>
mov    -0x10(%rbp),%eax
sub    $0x68,%eax
je     124b <key+0xcb>
jmp    11ed <key+0x6d>
mov    -0x10(%rbp),%eax
sub    $0x73,%eax
je     121b <key+0x9b>
jmp    11fe <key+0x7e>
mov    -0x10(%rbp),%eax
sub    $0x7a,%eax
je     1233 <key+0xb3>
jmp    125e <key+0xde>
mov    $0x0,%al
call   1060 <set_brighten@plt>
jmp    1263 <key+0xe3>
mov    $0x0,%al
call   1030 <set_saturate@plt>
jmp    1263 <key+0xe3>
mov    $0x0,%al
call   1050 <set_contrast@plt>
jmp    1263 <key+0xe3>
mov    $0x0,%al
call   1040 <set_sharpen@plt>
jmp    1263 <key+0xe3>
mov    $0x0,%al
call   10a0 <set_balance@plt>
jmp    1263 <key+0xe3>
mov    $0x0,%al
call   1080 <help@plt>
jmp    1263 <key+0xe3>
xor    %edi,%edi
call   1090 <exit@plt>
jmp    126a <key+0xea>
mov    $0x0,%al
call   1070 <glutPostRedisplay@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<key>:
push   %rax
lea    -0x61(%rdi),%eax
cmp    $0x19,%al
ja     11d7 <key+0x57>
movzbl %al,%eax
lea    0xe6e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   10a0 <set_balance@plt>
jmp    11cf <key+0x4f>
xor    %eax,%eax
call   1060 <set_brighten@plt>
jmp    11cf <key+0x4f>
xor    %eax,%eax
call   1050 <set_contrast@plt>
jmp    11cf <key+0x4f>
xor    %eax,%eax
call   1080 <help@plt>
jmp    11cf <key+0x4f>
xor    %eax,%eax
call   1030 <set_saturate@plt>
jmp    11cf <key+0x4f>
xor    %eax,%eax
call   1040 <set_sharpen@plt>
xor    %eax,%eax
pop    %rcx
jmp    1070 <glutPostRedisplay@plt>
cmp    $0x1b,%dil
je     11df <key+0x5f>
pop    %rax
ret
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
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 %23 [
i32 98, label %9
i32 115, label %11
i32 99, label %13
i32 122, label %15
i32 97, label %17
i32 104, label %19
i32 27, label %21
]
9: ; preds = %3
%10 = call i32 (...) @set_brighten()
br label %24
11: ; preds = %3
%12 = call i32 (...) @set_saturate()
br label %24
13: ; preds = %3
%14 = call i32 (...) @set_contrast()
br label %24
15: ; preds = %3
%16 = call i32 (...) @set_sharpen()
br label %24
17: ; preds = %3
%18 = call i32 (...) @set_balance()
br label %24
19: ; preds = %3
%20 = call i32 (...) @help()
br label %24
21: ; preds = %3
%22 = call i32 @exit(i32 0)
unreachable
23: ; preds = %3
br label %26
24: ; preds = %19, %17, %15, %13, %11, %9
%25 = call i32 (...) @glutPostRedisplay()
br label %26
26: ; preds = %24, %23
ret void
}

LLVM IR (-O2):
define void @key(i8 zeroext %0, i32 %1, i32 %2) {
switch i8 %0, label %20 [
i8 98, label %4
i8 115, label %6
i8 99, label %8
i8 122, label %10
i8 97, label %12
i8 104, label %14
i8 27, label %16
]
4: ; preds = %3
%5 = tail call i32 (...) @set_brighten()
br label %18
6: ; preds = %3
%7 = tail call i32 (...) @set_saturate()
br label %18
8: ; preds = %3
%9 = tail call i32 (...) @set_contrast()
br label %18
10: ; preds = %3
%11 = tail call i32 (...) @set_sharpen()
br label %18
12: ; preds = %3
%13 = tail call i32 (...) @set_balance()
br label %18
14: ; preds = %3
%15 = tail call i32 (...) @help()
br label %18
16: ; preds = %3
%17 = tail call i32 @exit(i32 0)
unreachable
18: ; preds = %14, %12, %10, %8, %6, %4
%19 = tail call i32 (...) @glutPostRedisplay()
br label %20
20: ; preds = %3, %18
ret void
}