#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*/ GL_FUNC_ADD;
int /*<<< orphan*/ GL_FUNC_REVERSE_SUBTRACT;
int /*<<< orphan*/ GL_FUNC_SUBTRACT;
int /*<<< orphan*/ GL_MAX;
int /*<<< orphan*/ GL_MIN;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ glBlendEquation(int /*<<< orphan*/);
int /*<<< orphan*/ glutPostRedisplay();
void keyboard(unsigned char key, int x, int y) {
  switch (key) {
  case 'a':
  case 'A':
    glBlendEquation(GL_FUNC_ADD);
    break;
  case 's':
  case 'S':
    glBlendEquation(GL_FUNC_SUBTRACT);
    break;
  case 'r':
  case 'R':
    glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
    break;
  case 'm':
  case 'M':
    glBlendEquation(GL_MIN);
    break;
  case 'x':
  case 'X':
    glBlendEquation(GL_MAX);
    break;
  case 27:
    exit(0);
    break;
  }
  glutPostRedisplay();
}


x86 assembly (clang, -O0):
<keyboard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
add    $0xffffffe5,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5d,%eax
ja     11d4 <keyboard+0xa4>
mov    -0x18(%rbp),%rax
lea    0xe9b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
call   1030 <glBlendEquation@plt>
jmp    11d4 <keyboard+0xa4>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
call   1030 <glBlendEquation@plt>
jmp    11d4 <keyboard+0xa4>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
call   1030 <glBlendEquation@plt>
jmp    11d4 <keyboard+0xa4>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
call   1030 <glBlendEquation@plt>
jmp    11d4 <keyboard+0xa4>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
call   1030 <glBlendEquation@plt>
jmp    11d4 <keyboard+0xa4>
xor    %edi,%edi
call   1050 <exit@plt>
mov    $0x0,%al
call   1040 <glutPostRedisplay@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyboard>:
push   %rax
add    $0xe5,%dil
cmp    $0x5d,%dil
ja     117f <keyboard+0x4f>
mov    0x2e9e(%rip),%rax
movzbl %dil,%ecx
lea    0xeb3(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    0x2e73(%rip),%rax
jmp    1178 <keyboard+0x48>
mov    0x2e82(%rip),%rax
jmp    1178 <keyboard+0x48>
mov    0x2e69(%rip),%rax
jmp    1178 <keyboard+0x48>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
call   1030 <glBlendEquation@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <glutPostRedisplay@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@GL_FUNC_ADD = global i32 0
@GL_FUNC_SUBTRACT = global i32 0
@GL_FUNC_REVERSE_SUBTRACT = global i32 0
@GL_MIN = global i32 0
@GL_MAX = global i32 0
define void @keyboard(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 65, label %9
i32 115, label %12
i32 83, label %12
i32 114, label %15
i32 82, label %15
i32 109, label %18
i32 77, label %18
i32 120, label %21
i32 88, label %21
i32 27, label %24
]
9: ; preds = %3, %3
%10 = load i32, i32* @GL_FUNC_ADD
%11 = call i32 @glBlendEquation(i32 %10)
br label %26
12: ; preds = %3, %3
%13 = load i32, i32* @GL_FUNC_SUBTRACT
%14 = call i32 @glBlendEquation(i32 %13)
br label %26
15: ; preds = %3, %3
%16 = load i32, i32* @GL_FUNC_REVERSE_SUBTRACT
%17 = call i32 @glBlendEquation(i32 %16)
br label %26
18: ; preds = %3, %3
%19 = load i32, i32* @GL_MIN
%20 = call i32 @glBlendEquation(i32 %19)
br label %26
21: ; preds = %3, %3
%22 = load i32, i32* @GL_MAX
%23 = call i32 @glBlendEquation(i32 %22)
br label %26
24: ; preds = %3
%25 = call i32 @exit(i32 0)
unreachable
26: ; preds = %3, %21, %18, %15, %12, %9
%27 = call i32 (...) @glutPostRedisplay()
ret void
}

LLVM IR (-O2):
@GL_FUNC_ADD = global i32 0
@GL_FUNC_SUBTRACT = global i32 0
@GL_FUNC_REVERSE_SUBTRACT = global i32 0
@GL_MIN = global i32 0
@GL_MAX = global i32 0
define void @keyboard(i8 zeroext %0, i32 %1, i32 %2) {
switch i8 %0, label %14 [
i8 97, label %10
i8 65, label %10
i8 115, label %4
i8 83, label %4
i8 114, label %5
i8 82, label %5
i8 109, label %6
i8 77, label %6
i8 120, label %7
i8 88, label %7
i8 27, label %8
]
4: ; preds = %3, %3
br label %10
5: ; preds = %3, %3
br label %10
6: ; preds = %3, %3
br label %10
7: ; preds = %3, %3
br label %10
8: ; preds = %3
%9 = tail call i32 @exit(i32 0)
unreachable
10: ; preds = %3, %3, %4, %5, %6, %7
%11 = phi i32* [ @GL_MAX, %7 ], [ @GL_MIN, %6 ], [ @GL_FUNC_REVERSE_SUBTRACT, %5 ], [ @GL_FUNC_SUBTRACT, %4 ], [ @GL_FUNC_ADD, %3 ], [ @GL_FUNC_ADD, %3 ]
%12 = load i32, i32* %11
%13 = tail call i32 @glBlendEquation(i32 %12)
br label %14
14: ; preds = %10, %3
%15 = tail call i32 (...) @glutPostRedisplay()
ret void
}