#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*/ glLoadIdentity();
int /*<<< orphan*/ glRotatef(int, double, double, double);
int /*<<< orphan*/ gluLookAt(int /*<<< orphan*/, int /*<<< orphan*/, int,
                             int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/, int,
                             int /*<<< orphan*/);
int /*<<< orphan*/ glutPostRedisplay();
void torus_keyboard(unsigned char key, int x, int y) {
  switch (key) {
  case 'x':
  case 'X':
    glRotatef(30., 1.0, 0.0, 0.0);
    glutPostRedisplay();
    break;
  case 'y':
  case 'Y':
    glRotatef(30., 0.0, 1.0, 0.0);
    glutPostRedisplay();
    break;
  case 'i':
  case 'I':
    glLoadIdentity();
    gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0);
    glutPostRedisplay();
    break;
  case 27:
    exit(0);
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<torus_keyboard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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     126a <torus_keyboard+0x11a>
jmp    1179 <torus_keyboard+0x29>
mov    -0x10(%rbp),%eax
sub    $0x49,%eax
je     1227 <torus_keyboard+0xd7>
jmp    118a <torus_keyboard+0x3a>
mov    -0x10(%rbp),%eax
sub    $0x58,%eax
je     11df <torus_keyboard+0x8f>
jmp    119b <torus_keyboard+0x4b>
mov    -0x10(%rbp),%eax
sub    $0x59,%eax
je     1203 <torus_keyboard+0xb3>
jmp    11ac <torus_keyboard+0x5c>
mov    -0x10(%rbp),%eax
sub    $0x69,%eax
je     1227 <torus_keyboard+0xd7>
jmp    11bd <torus_keyboard+0x6d>
mov    -0x10(%rbp),%eax
sub    $0x78,%eax
je     11df <torus_keyboard+0x8f>
jmp    11ce <torus_keyboard+0x7e>
mov    -0x10(%rbp),%eax
sub    $0x79,%eax
je     1203 <torus_keyboard+0xb3>
jmp    1271 <torus_keyboard+0x121>
mov    $0x1e,%edi
movsd  0xe14(%rip),%xmm0
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm1
call   1070 <glRotatef@plt>
mov    $0x0,%al
call   1050 <glutPostRedisplay@plt>
jmp    1276 <torus_keyboard+0x126>
mov    $0x1e,%edi
xorps  %xmm2,%xmm2
movsd  0xded(%rip),%xmm1
movaps %xmm2,%xmm0
call   1070 <glRotatef@plt>
mov    $0x0,%al
call   1050 <glutPostRedisplay@plt>
jmp    1276 <torus_keyboard+0x126>
mov    $0x0,%al
call   1040 <glLoadIdentity@plt>
xor    %r9d,%r9d
mov    $0xa,%edx
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
movl   $0x1,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   1030 <gluLookAt@plt>
mov    $0x0,%al
call   1050 <glutPostRedisplay@plt>
jmp    1276 <torus_keyboard+0x126>
xor    %edi,%edi
call   1060 <exit@plt>
jmp    1276 <torus_keyboard+0x126>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<torus_keyboard>:
push   %rax
lea    -0x49(%rdi),%eax
cmp    $0x30,%al
ja     11e9 <torus_keyboard+0x99>
movzbl %al,%eax
movabs $0x100000001,%rcx
bt     %rax,%rcx
jb     119c <torus_keyboard+0x4c>
movabs $0x800000008000,%rcx
bt     %rax,%rcx
jb     11c9 <torus_keyboard+0x79>
movabs $0x1000000010000,%rcx
bt     %rax,%rcx
jae    11e9 <torus_keyboard+0x99>
movsd  0xe69(%rip),%xmm1
xorps  %xmm0,%xmm0
jmp    11d4 <torus_keyboard+0x84>
xor    %eax,%eax
call   1040 <glLoadIdentity@plt>
sub    $0x8,%rsp
xor    %edi,%edi
xor    %esi,%esi
mov    $0xa,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x0
push   $0x1
push   $0x0
call   1030 <gluLookAt@plt>
add    $0x20,%rsp
jmp    11e1 <torus_keyboard+0x91>
movsd  0xe2f(%rip),%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
mov    $0x1e,%edi
call   1070 <glRotatef@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <glutPostRedisplay@plt>
cmp    $0x1b,%dil
je     11f1 <torus_keyboard+0xa1>
pop    %rax
ret
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
define void @torus_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 %21 [
i32 120, label %9
i32 88, label %9
i32 121, label %12
i32 89, label %12
i32 105, label %15
i32 73, label %15
i32 27, label %19
]
9: ; preds = %3, %3
%10 = call i32 @glRotatef(i32 30, double 1.000000e+00, double 0.000000e+00, double 0.000000e+00)
%11 = call i32 (...) @glutPostRedisplay()
br label %22
12: ; preds = %3, %3
%13 = call i32 @glRotatef(i32 30, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%14 = call i32 (...) @glutPostRedisplay()
br label %22
15: ; preds = %3, %3
%16 = call i32 (...) @glLoadIdentity()
%17 = call i32 @gluLookAt(i32 0, i32 0, i32 10, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0)
%18 = call i32 (...) @glutPostRedisplay()
br label %22
19: ; preds = %3
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %3
br label %22
22: ; preds = %21, %15, %12, %9
ret void
}

LLVM IR (-O2):
define void @torus_keyboard(i8 zeroext %0, i32 %1, i32 %2) {
switch i8 %0, label %15 [
i8 120, label %4
i8 88, label %4
i8 121, label %6
i8 89, label %6
i8 105, label %8
i8 73, label %8
i8 27, label %11
]
4: ; preds = %3, %3
%5 = tail call i32 @glRotatef(i32 30, double 1.000000e+00, double 0.000000e+00, double 0.000000e+00)
br label %13
6: ; preds = %3, %3
%7 = tail call i32 @glRotatef(i32 30, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
br label %13
8: ; preds = %3, %3
%9 = tail call i32 (...) @glLoadIdentity()
%10 = tail call i32 @gluLookAt(i32 0, i32 0, i32 10, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0)
br label %13
11: ; preds = %3
%12 = tail call i32 @exit(i32 0)
unreachable
13: ; preds = %4, %6, %8
%14 = tail call i32 (...) @glutPostRedisplay()
br label %15
15: ; preds = %13, %3
ret void
}