#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*/ glutStopVideoResizing();
int /*<<< orphan*/ glutVideoPan(int, int, int, int);
int /*<<< orphan*/ glutVideoResize(int, int, int, int);
int /*<<< orphan*/ printf(char *, unsigned char);
int /*<<< orphan*/ show_video_size();
void key(unsigned char k, int x, int y) {
  printf("c = %c\n", k);
  switch (k) {
  case 27:
    exit(0);
    return;
  case 'a':
    glutVideoPan(0, 0, 1280, 1024);
    break;
  case 'b':
    glutVideoPan(0, 0, 1600, 1024);
    break;
  case 'c':
    glutVideoPan(640, 512, 640, 512);
    break;
  case 'q':
    glutVideoPan(320, 256, 640, 512);
    break;
  case '1':
    glutVideoResize(0, 0, 640, 512);
    break;
  case '2':
    glutVideoResize(0, 512, 640, 512);
    break;
  case '3':
    glutVideoResize(512, 512, 640, 512);
    break;
  case '4':
    glutVideoResize(512, 0, 640, 512);
    break;
  case 's':
    glutStopVideoResizing();
    break;
  case '=':
    show_video_size();
    break;
  case ' ':
    glutPostRedisplay();
    break;
  }
}


x86 assembly (clang, -O0):
<key>:
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),%esi
lea    0xfd5(%rip),%rdi
call   1030 <printf@plt>
movzbl -0x1(%rbp),%eax
add    $0xffffffe5,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x58,%eax
ja     12aa <key+0x13a>
mov    -0x18(%rbp),%rax
lea    0xe4b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %edi,%edi
call   1060 <exit@plt>
xor    %esi,%esi
mov    $0x500,%edx
mov    $0x400,%ecx
mov    %esi,%edi
call   1040 <glutVideoPan@plt>
jmp    12aa <key+0x13a>
xor    %esi,%esi
mov    $0x640,%edx
mov    $0x400,%ecx
mov    %esi,%edi
call   1040 <glutVideoPan@plt>
jmp    12aa <key+0x13a>
mov    $0x280,%edx
mov    $0x200,%ecx
mov    %edx,%edi
mov    %ecx,%esi
call   1040 <glutVideoPan@plt>
jmp    12aa <key+0x13a>
mov    $0x140,%edi
mov    $0x100,%esi
mov    $0x280,%edx
mov    $0x200,%ecx
call   1040 <glutVideoPan@plt>
jmp    12aa <key+0x13a>
xor    %esi,%esi
mov    $0x280,%edx
mov    $0x200,%ecx
mov    %esi,%edi
call   1090 <glutVideoResize@plt>
jmp    12aa <key+0x13a>
xor    %edi,%edi
mov    $0x200,%ecx
mov    $0x280,%edx
mov    %ecx,%esi
call   1090 <glutVideoResize@plt>
jmp    12aa <key+0x13a>
mov    $0x200,%ecx
mov    $0x280,%edx
mov    %ecx,%edi
mov    %ecx,%esi
call   1090 <glutVideoResize@plt>
jmp    12aa <key+0x13a>
mov    $0x200,%ecx
xor    %esi,%esi
mov    $0x280,%edx
mov    %ecx,%edi
call   1090 <glutVideoResize@plt>
jmp    12aa <key+0x13a>
mov    $0x0,%al
call   1080 <glutStopVideoResizing@plt>
jmp    12aa <key+0x13a>
mov    $0x0,%al
call   1070 <show_video_size@plt>
jmp    12aa <key+0x13a>
mov    $0x0,%al
call   1050 <glutPostRedisplay@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<key>:
push   %rbx
mov    %edi,%ebx
lea    0xfea(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    -0x1b(%rbx),%eax
cmp    $0x58,%al
ja     11a3 <key+0x33>
movzbl %al,%eax
lea    0xe6e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
pop    %rbx
jmp    1050 <glutPostRedisplay@plt>
pop    %rbx
ret
xor    %edi,%edi
jmp    11c3 <key+0x53>
xor    %edi,%edi
mov    $0x200,%esi
jmp    11c5 <key+0x55>
mov    $0x200,%edi
mov    $0x200,%esi
jmp    11c5 <key+0x55>
mov    $0x200,%edi
xor    %esi,%esi
mov    $0x280,%edx
mov    $0x200,%ecx
pop    %rbx
jmp    1090 <glutVideoResize@plt>
xor    %eax,%eax
pop    %rbx
jmp    1070 <show_video_size@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    $0x500,%edx
jmp    11f1 <key+0x81>
xor    %edi,%edi
xor    %esi,%esi
mov    $0x640,%edx
mov    $0x400,%ecx
pop    %rbx
jmp    1040 <glutVideoPan@plt>
mov    $0x280,%edi
mov    $0x200,%esi
jmp    1212 <key+0xa2>
mov    $0x140,%edi
mov    $0x100,%esi
mov    $0x280,%edx
mov    $0x200,%ecx
pop    %rbx
jmp    1040 <glutVideoPan@plt>
xor    %eax,%eax
pop    %rbx
jmp    1080 <glutStopVideoResizing@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"c = %c\0A\00"
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 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 zeroext %7)
%9 = load i8, i8* %4
%10 = zext i8 %9 to i32
switch i32 %10, label %35 [
i32 27, label %11
i32 97, label %13
i32 98, label %15
i32 99, label %17
i32 113, label %19
i32 49, label %21
i32 50, label %23
i32 51, label %25
i32 52, label %27
i32 115, label %29
i32 61, label %31
i32 32, label %33
]
11: ; preds = %3
%12 = call i32 @exit(i32 0)
unreachable
13: ; preds = %3
%14 = call i32 @glutVideoPan(i32 0, i32 0, i32 1280, i32 1024)
br label %35
15: ; preds = %3
%16 = call i32 @glutVideoPan(i32 0, i32 0, i32 1600, i32 1024)
br label %35
17: ; preds = %3
%18 = call i32 @glutVideoPan(i32 640, i32 512, i32 640, i32 512)
br label %35
19: ; preds = %3
%20 = call i32 @glutVideoPan(i32 320, i32 256, i32 640, i32 512)
br label %35
21: ; preds = %3
%22 = call i32 @glutVideoResize(i32 0, i32 0, i32 640, i32 512)
br label %35
23: ; preds = %3
%24 = call i32 @glutVideoResize(i32 0, i32 512, i32 640, i32 512)
br label %35
25: ; preds = %3
%26 = call i32 @glutVideoResize(i32 512, i32 512, i32 640, i32 512)
br label %35
27: ; preds = %3
%28 = call i32 @glutVideoResize(i32 512, i32 0, i32 640, i32 512)
br label %35
29: ; preds = %3
%30 = call i32 (...) @glutStopVideoResizing()
br label %35
31: ; preds = %3
%32 = call i32 (...) @show_video_size()
br label %35
33: ; preds = %3
%34 = call i32 (...) @glutPostRedisplay()
br label %35
35: ; preds = %3, %33, %31, %29, %27, %25, %23, %21, %19, %17, %15, %13
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"c = %c\0A\00"
define void @key(i8 zeroext %0, i32 %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 zeroext %0)
switch i8 %0, label %29 [
i8 27, label %5
i8 97, label %7
i8 98, label %9
i8 99, label %11
i8 113, label %13
i8 49, label %15
i8 50, label %17
i8 51, label %19
i8 52, label %21
i8 115, label %23
i8 61, label %25
i8 32, label %27
]
5: ; preds = %3
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %3
%8 = tail call i32 @glutVideoPan(i32 0, i32 0, i32 1280, i32 1024)
br label %29
9: ; preds = %3
%10 = tail call i32 @glutVideoPan(i32 0, i32 0, i32 1600, i32 1024)
br label %29
11: ; preds = %3
%12 = tail call i32 @glutVideoPan(i32 640, i32 512, i32 640, i32 512)
br label %29
13: ; preds = %3
%14 = tail call i32 @glutVideoPan(i32 320, i32 256, i32 640, i32 512)
br label %29
15: ; preds = %3
%16 = tail call i32 @glutVideoResize(i32 0, i32 0, i32 640, i32 512)
br label %29
17: ; preds = %3
%18 = tail call i32 @glutVideoResize(i32 0, i32 512, i32 640, i32 512)
br label %29
19: ; preds = %3
%20 = tail call i32 @glutVideoResize(i32 512, i32 512, i32 640, i32 512)
br label %29
21: ; preds = %3
%22 = tail call i32 @glutVideoResize(i32 512, i32 0, i32 640, i32 512)
br label %29
23: ; preds = %3
%24 = tail call i32 (...) @glutStopVideoResizing()
br label %29
25: ; preds = %3
%26 = tail call i32 (...) @show_video_size()
br label %29
27: ; preds = %3
%28 = tail call i32 (...) @glutPostRedisplay()
br label %29
29: ; preds = %3, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7
ret void
}