#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*/ FireCannon();
#define GLUT_KEY_DOWN 132
#define GLUT_KEY_LEFT 131
#define GLUT_KEY_PAGE_UP 130
#define GLUT_KEY_RIGHT 129
#define GLUT_KEY_UP 128
int /*<<< orphan*/ TurnBackwards();
int /*<<< orphan*/ TurnForwards();
int /*<<< orphan*/ TurnLeft();
int /*<<< orphan*/ TurnRight();
int /*<<< orphan*/ glutPostRedisplay();
void special(int key, int x, int y) {
  int i = 0;
  switch (key) {
  case GLUT_KEY_RIGHT: {
    TurnRight();
    i++;
  } break;
  case GLUT_KEY_LEFT: {
    TurnLeft();
    i++;
  } break;
  case GLUT_KEY_DOWN: {
    TurnForwards();
    i++;
  } break;
  case GLUT_KEY_UP: {
    TurnBackwards();
    i++;
  } break;
  case GLUT_KEY_PAGE_UP: {
    FireCannon();
    i++;
  } break;
  }
  if (i)
    glutPostRedisplay();
}


x86 assembly (clang, -O0):
<special>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     1205 <special+0xa5>
mov    -0x18(%rbp),%rax
lea    0xe68(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1040 <TurnRight@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1205 <special+0xa5>
mov    $0x0,%al
call   1050 <TurnLeft@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1205 <special+0xa5>
mov    $0x0,%al
call   1060 <TurnForwards@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1205 <special+0xa5>
mov    $0x0,%al
call   1070 <TurnBackwards@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1205 <special+0xa5>
mov    $0x0,%al
call   1080 <FireCannon@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1216 <special+0xb6>
mov    $0x0,%al
call   1030 <glutPostRedisplay@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<special>:
add    $0xffffff80,%edi
cmp    $0x4,%edi
ja     1182 <special+0x22>
push   %rax
lea    0xe90(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
xor    %eax,%eax
call   1070 <TurnBackwards@plt>
jmp    11a5 <special+0x45>
ret
xor    %eax,%eax
call   1040 <TurnRight@plt>
jmp    11a5 <special+0x45>
xor    %eax,%eax
call   1080 <FireCannon@plt>
jmp    11a5 <special+0x45>
xor    %eax,%eax
call   1050 <TurnLeft@plt>
jmp    11a5 <special+0x45>
xor    %eax,%eax
call   1060 <TurnForwards@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <glutPostRedisplay@plt>

LLVM IR (-O0):
define void @special(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
%8 = load i32, i32* %4
switch i32 %8, label %29 [
i32 129, label %9
i32 131, label %13
i32 132, label %17
i32 128, label %21
i32 130, label %25
]
9: ; preds = %3
%10 = call i32 (...) @TurnRight()
%11 = load i32, i32* %7
%12 = add nsw i32 %11, 1
store i32 %12, i32* %7
br label %29
13: ; preds = %3
%14 = call i32 (...) @TurnLeft()
%15 = load i32, i32* %7
%16 = add nsw i32 %15, 1
store i32 %16, i32* %7
br label %29
17: ; preds = %3
%18 = call i32 (...) @TurnForwards()
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
br label %29
21: ; preds = %3
%22 = call i32 (...) @TurnBackwards()
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
store i32 %24, i32* %7
br label %29
25: ; preds = %3
%26 = call i32 (...) @FireCannon()
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %29
29: ; preds = %3, %25, %21, %17, %13, %9
%30 = load i32, i32* %7
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 (...) @glutPostRedisplay()
br label %34
34: ; preds = %32, %29
ret void
}

LLVM IR (-O2):
define void @special(i32 %0, i32 %1, i32 %2) {
switch i32 %0, label %16 [
i32 129, label %4
i32 131, label %6
i32 132, label %8
i32 128, label %10
i32 130, label %12
]
4: ; preds = %3
%5 = tail call i32 (...) @TurnRight()
br label %14
6: ; preds = %3
%7 = tail call i32 (...) @TurnLeft()
br label %14
8: ; preds = %3
%9 = tail call i32 (...) @TurnForwards()
br label %14
10: ; preds = %3
%11 = tail call i32 (...) @TurnBackwards()
br label %14
12: ; preds = %3
%13 = tail call i32 (...) @FireCannon()
br label %14
14: ; preds = %4, %6, %8, %10, %12
%15 = tail call i32 (...) @glutPostRedisplay()
br label %16
16: ; preds = %3, %14
ret void
}