#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_FLAT;
int /*<<< orphan*/ GL_SMOOTH;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ glShadeModel(int /*<<< orphan*/);
int /*<<< orphan*/ glutPostRedisplay();
void keyboard(unsigned char key, int x, int y) {
  switch (key) {
  case 's':
    glShadeModel(GL_FLAT);
    glutPostRedisplay();
    break;
  case 'S':
    glShadeModel(GL_SMOOTH);
    glutPostRedisplay();
    break;
  case 27:
    exit(0);
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<keyboard>:
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
mov    %eax,-0x10(%rbp)
sub    $0x1b,%eax
je     11af <keyboard+0x7f>
jmp    1159 <keyboard+0x29>
mov    -0x10(%rbp),%eax
sub    $0x53,%eax
je     1195 <keyboard+0x65>
jmp    116a <keyboard+0x3a>
mov    -0x10(%rbp),%eax
sub    $0x73,%eax
jne    11b6 <keyboard+0x86>
jmp    117b <keyboard+0x4b>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
call   1040 <glShadeModel@plt>
mov    $0x0,%al
call   1030 <glutPostRedisplay@plt>
jmp    11bb <keyboard+0x8b>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
call   1040 <glShadeModel@plt>
mov    $0x0,%al
call   1030 <glutPostRedisplay@plt>
jmp    11bb <keyboard+0x8b>
xor    %edi,%edi
call   1050 <exit@plt>
jmp    11bb <keyboard+0x8b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyboard>:
push   %rax
cmp    $0x53,%dil
je     1145 <keyboard+0x15>
cmp    $0x73,%dil
je     114e <keyboard+0x1e>
cmp    $0x1b,%dil
je     1164 <keyboard+0x34>
pop    %rax
ret
mov    0x2e8c(%rip),%rax
jmp    1155 <keyboard+0x25>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
call   1040 <glShadeModel@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <glutPostRedisplay@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@GL_FLAT = global i32 0
@GL_SMOOTH = 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 %19 [
i32 115, label %9
i32 83, label %13
i32 27, label %17
]
9: ; preds = %3
%10 = load i32, i32* @GL_FLAT
%11 = call i32 @glShadeModel(i32 %10)
%12 = call i32 (...) @glutPostRedisplay()
br label %20
13: ; preds = %3
%14 = load i32, i32* @GL_SMOOTH
%15 = call i32 @glShadeModel(i32 %14)
%16 = call i32 (...) @glutPostRedisplay()
br label %20
17: ; preds = %3
%18 = call i32 @exit(i32 0)
unreachable
19: ; preds = %3
br label %20
20: ; preds = %19, %13, %9
ret void
}

LLVM IR (-O2):
@GL_FLAT = global i32 0
@GL_SMOOTH = global i32 0
define void @keyboard(i8 zeroext %0, i32 %1, i32 %2) {
switch i8 %0, label %12 [
i8 115, label %7
i8 83, label %4
i8 27, label %5
]
4: ; preds = %3
br label %7
5: ; preds = %3
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %3, %4
%8 = phi i32* [ @GL_SMOOTH, %4 ], [ @GL_FLAT, %3 ]
%9 = load i32, i32* %8
%10 = tail call i32 @glShadeModel(i32 %9)
%11 = tail call i32 (...) @glutPostRedisplay()
br label %12
12: ; preds = %7, %3
ret void
}