#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_BACK;
int /*<<< orphan*/ GL_CULL_FACE;
int /*<<< orphan*/ GL_DEPTH_TEST;
int /*<<< orphan*/ GL_FLAT;
int /*<<< orphan*/ GL_FRONT;
int /*<<< orphan*/ GL_SMOOTH;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ glCullFace(int /*<<< orphan*/);
int /*<<< orphan*/ glDisable(int /*<<< orphan*/);
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
int /*<<< orphan*/ glShadeModel(int /*<<< orphan*/);
void tipka(unsigned char c, int x, int y) {
  if (c == 'q')
    exit(0);
  if (c == 's')
    glShadeModel(GL_SMOOTH);
  if (c == 'f')
    glShadeModel(GL_FLAT);
  if (c == 'B')
    glCullFace(GL_BACK);
  if (c == 'b')
    glCullFace(GL_FRONT);
  if (c == 'C')
    glEnable(GL_CULL_FACE);
  if (c == 'c')
    glDisable(GL_CULL_FACE);
  if (c == 'D')
    glEnable(GL_DEPTH_TEST);
  if (c == 'd')
    glDisable(GL_DEPTH_TEST);
}


x86 assembly (clang, -O0):
<tipka>:
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
cmp    $0x71,%eax
jne    1178 <tipka+0x28>
xor    %edi,%edi
call   1050 <exit@plt>
movzbl -0x1(%rbp),%eax
cmp    $0x73,%eax
jne    1193 <tipka+0x43>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
call   1040 <glShadeModel@plt>
movzbl -0x1(%rbp),%eax
cmp    $0x66,%eax
jne    11ae <tipka+0x5e>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
call   1040 <glShadeModel@plt>
movzbl -0x1(%rbp),%eax
cmp    $0x42,%eax
jne    11c9 <tipka+0x79>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
call   1070 <glCullFace@plt>
movzbl -0x1(%rbp),%eax
cmp    $0x62,%eax
jne    11e4 <tipka+0x94>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
call   1070 <glCullFace@plt>
movzbl -0x1(%rbp),%eax
cmp    $0x43,%eax
jne    11ff <tipka+0xaf>
mov    0x2dd0(%rip),%rax
mov    (%rax),%edi
call   1030 <glEnable@plt>
movzbl -0x1(%rbp),%eax
cmp    $0x63,%eax
jne    121a <tipka+0xca>
mov    0x2db5(%rip),%rax
mov    (%rax),%edi
call   1060 <glDisable@plt>
movzbl -0x1(%rbp),%eax
cmp    $0x44,%eax
jne    1235 <tipka+0xe5>
mov    0x2d8a(%rip),%rax
mov    (%rax),%edi
call   1030 <glEnable@plt>
movzbl -0x1(%rbp),%eax
cmp    $0x64,%eax
jne    1250 <tipka+0x100>
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
call   1060 <glDisable@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tipka>:
push   %rax
add    $0xbe,%dil
cmp    $0x31,%dil
ja     1190 <tipka+0x40>
movzbl %dil,%eax
lea    0xe9a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e5a(%rip),%rax
jmp    1199 <tipka+0x49>
mov    0x2e49(%rip),%rax
jmp    1188 <tipka+0x38>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1030 <glEnable@plt>
pop    %rax
ret
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1070 <glCullFace@plt>
mov    0x2e20(%rip),%rax
jmp    11b1 <tipka+0x61>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1060 <glDisable@plt>
mov    0x2e20(%rip),%rax
jmp    11c9 <tipka+0x79>
mov    0x2df7(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <glShadeModel@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@GL_SMOOTH = global i32 0
@GL_FLAT = global i32 0
@GL_BACK = global i32 0
@GL_FRONT = global i32 0
@GL_CULL_FACE = global i32 0
@GL_DEPTH_TEST = global i32 0
define void @tipka(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
%9 = icmp eq i32 %8, 113
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %3
%13 = load i8, i8* %4
%14 = zext i8 %13 to i32
%15 = icmp eq i32 %14, 115
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i32, i32* @GL_SMOOTH
%18 = call i32 @glShadeModel(i32 %17)
br label %19
19: ; preds = %16, %12
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = icmp eq i32 %21, 102
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* @GL_FLAT
%25 = call i32 @glShadeModel(i32 %24)
br label %26
26: ; preds = %23, %19
%27 = load i8, i8* %4
%28 = zext i8 %27 to i32
%29 = icmp eq i32 %28, 66
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = load i32, i32* @GL_BACK
%32 = call i32 @glCullFace(i32 %31)
br label %33
33: ; preds = %30, %26
%34 = load i8, i8* %4
%35 = zext i8 %34 to i32
%36 = icmp eq i32 %35, 98
br i1 %36, label %37, label %40
37: ; preds = %33
%38 = load i32, i32* @GL_FRONT
%39 = call i32 @glCullFace(i32 %38)
br label %40
40: ; preds = %37, %33
%41 = load i8, i8* %4
%42 = zext i8 %41 to i32
%43 = icmp eq i32 %42, 67
br i1 %43, label %44, label %47
44: ; preds = %40
%45 = load i32, i32* @GL_CULL_FACE
%46 = call i32 @glEnable(i32 %45)
br label %47
47: ; preds = %44, %40
%48 = load i8, i8* %4
%49 = zext i8 %48 to i32
%50 = icmp eq i32 %49, 99
br i1 %50, label %51, label %54
51: ; preds = %47
%52 = load i32, i32* @GL_CULL_FACE
%53 = call i32 @glDisable(i32 %52)
br label %54
54: ; preds = %51, %47
%55 = load i8, i8* %4
%56 = zext i8 %55 to i32
%57 = icmp eq i32 %56, 68
br i1 %57, label %58, label %61
58: ; preds = %54
%59 = load i32, i32* @GL_DEPTH_TEST
%60 = call i32 @glEnable(i32 %59)
br label %61
61: ; preds = %58, %54
%62 = load i8, i8* %4
%63 = zext i8 %62 to i32
%64 = icmp eq i32 %63, 100
br i1 %64, label %65, label %68
65: ; preds = %61
%66 = load i32, i32* @GL_DEPTH_TEST
%67 = call i32 @glDisable(i32 %66)
br label %68
68: ; preds = %65, %61
ret void
}

LLVM IR (-O2):
@GL_SMOOTH = global i32 0
@GL_FLAT = global i32 0
@GL_BACK = global i32 0
@GL_FRONT = global i32 0
@GL_CULL_FACE = global i32 0
@GL_DEPTH_TEST = global i32 0
define void @tipka(i8 zeroext %0, i32 %1, i32 %2) {
switch i8 %0, label %30 [
i8 113, label %4
i8 115, label %6
i8 102, label %9
i8 66, label %12
i8 98, label %15
i8 67, label %18
i8 99, label %21
i8 68, label %24
i8 100, label %27
]
4: ; preds = %3
%5 = tail call i32 @exit(i32 0)
unreachable
6: ; preds = %3
%7 = load i32, i32* @GL_SMOOTH
%8 = tail call i32 @glShadeModel(i32 %7)
br label %30
9: ; preds = %3
%10 = load i32, i32* @GL_FLAT
%11 = tail call i32 @glShadeModel(i32 %10)
br label %30
12: ; preds = %3
%13 = load i32, i32* @GL_BACK
%14 = tail call i32 @glCullFace(i32 %13)
br label %30
15: ; preds = %3
%16 = load i32, i32* @GL_FRONT
%17 = tail call i32 @glCullFace(i32 %16)
br label %30
18: ; preds = %3
%19 = load i32, i32* @GL_CULL_FACE
%20 = tail call i32 @glEnable(i32 %19)
br label %30
21: ; preds = %3
%22 = load i32, i32* @GL_CULL_FACE
%23 = tail call i32 @glDisable(i32 %22)
br label %30
24: ; preds = %3
%25 = load i32, i32* @GL_DEPTH_TEST
%26 = tail call i32 @glEnable(i32 %25)
br label %30
27: ; preds = %3
%28 = load i32, i32* @GL_DEPTH_TEST
%29 = tail call i32 @glDisable(i32 %28)
br label %30
30: ; preds = %24, %21, %18, %15, %12, %9, %6, %3, %27
ret void
}