#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 COLOR_BLACK;
int COLOR_BLUE;
int COLOR_CYAN;
int COLOR_GREEN;
int COLOR_MAGENTA;
int COLOR_RED;
int COLOR_WHITE;
int COLOR_YELLOW;
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int colortab(int a) {
  switch (a) {
  case 0:
    return COLOR_BLACK;
  case 1:
    return COLOR_BLUE;
  case 2:
    return COLOR_GREEN;
  case 3:
    return COLOR_CYAN;
  case 4:
    return COLOR_RED;
  case 5:
    return COLOR_MAGENTA;
  case 6:
    return COLOR_YELLOW;
  case 7:
    return COLOR_WHITE;
  }
  assert(0);
  return -1;
}


x86 assembly (clang, -O0):
<colortab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x7,%rax
ja     11c8 <colortab+0xb8>
mov    -0x10(%rbp),%rax
lea    0xec9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d6 <colortab+0xc6>
mov    0x2e58(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d6 <colortab+0xc6>
mov    0x2e6f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d6 <colortab+0xc6>
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d6 <colortab+0xc6>
mov    0x2e1d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d6 <colortab+0xc6>
mov    0x2e2c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d6 <colortab+0xc6>
mov    0x2e0b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d6 <colortab+0xc6>
mov    0x2e02(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d6 <colortab+0xc6>
xor    %edi,%edi
call   1030 <assert@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<colortab>:
push   %rax
cmp    $0x7,%edi
ja     1131 <colortab+0x21>
mov    %edi,%eax
lea    0xee1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2eb9(%rip),%rax
jmp    117c <colortab+0x6c>
xor    %edi,%edi
call   1030 <assert@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret
mov    0x2e6a(%rip),%rax
jmp    117c <colortab+0x6c>
mov    0x2e89(%rip),%rax
jmp    117c <colortab+0x6c>
mov    0x2e88(%rip),%rax
jmp    117c <colortab+0x6c>
mov    0x2e47(%rip),%rax
jmp    117c <colortab+0x6c>
mov    0x2e5e(%rip),%rax
jmp    117c <colortab+0x6c>
mov    0x2e45(%rip),%rax
jmp    117c <colortab+0x6c>
mov    0x2e44(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@COLOR_BLACK = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_CYAN = global i32 0
@COLOR_RED = global i32 0
@COLOR_MAGENTA = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_WHITE = global i32 0
define i32 @colortab(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %21 [
i32 0, label %5
i32 1, label %7
i32 2, label %9
i32 3, label %11
i32 4, label %13
i32 5, label %15
i32 6, label %17
i32 7, label %19
]
5: ; preds = %1
%6 = load i32, i32* @COLOR_BLACK
store i32 %6, i32* %2
br label %23
7: ; preds = %1
%8 = load i32, i32* @COLOR_BLUE
store i32 %8, i32* %2
br label %23
9: ; preds = %1
%10 = load i32, i32* @COLOR_GREEN
store i32 %10, i32* %2
br label %23
11: ; preds = %1
%12 = load i32, i32* @COLOR_CYAN
store i32 %12, i32* %2
br label %23
13: ; preds = %1
%14 = load i32, i32* @COLOR_RED
store i32 %14, i32* %2
br label %23
15: ; preds = %1
%16 = load i32, i32* @COLOR_MAGENTA
store i32 %16, i32* %2
br label %23
17: ; preds = %1
%18 = load i32, i32* @COLOR_YELLOW
store i32 %18, i32* %2
br label %23
19: ; preds = %1
%20 = load i32, i32* @COLOR_WHITE
store i32 %20, i32* %2
br label %23
21: ; preds = %1
%22 = call i32 @assert(i32 0)
store i32 -1, i32* %2
br label %23
23: ; preds = %21, %19, %17, %15, %13, %11, %9, %7, %5
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
@COLOR_BLACK = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_CYAN = global i32 0
@COLOR_RED = global i32 0
@COLOR_MAGENTA = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_WHITE = global i32 0
define i32 @colortab(i32 %0) {
switch i32 %0, label %18 [
i32 0, label %2
i32 1, label %4
i32 2, label %6
i32 3, label %8
i32 4, label %10
i32 5, label %12
i32 6, label %14
i32 7, label %16
]
2: ; preds = %1
%3 = load i32, i32* @COLOR_BLACK
br label %20
4: ; preds = %1
%5 = load i32, i32* @COLOR_BLUE
br label %20
6: ; preds = %1
%7 = load i32, i32* @COLOR_GREEN
br label %20
8: ; preds = %1
%9 = load i32, i32* @COLOR_CYAN
br label %20
10: ; preds = %1
%11 = load i32, i32* @COLOR_RED
br label %20
12: ; preds = %1
%13 = load i32, i32* @COLOR_MAGENTA
br label %20
14: ; preds = %1
%15 = load i32, i32* @COLOR_YELLOW
br label %20
16: ; preds = %1
%17 = load i32, i32* @COLOR_WHITE
br label %20
18: ; preds = %1
%19 = tail call i32 @assert(i32 0)
br label %20
20: ; preds = %18, %16, %14, %12, %10, %8, %6, %4, %2
%21 = phi i32 [ -1, %18 ], [ %17, %16 ], [ %15, %14 ], [ %13, %12 ], [ %11, %10 ], [ %9, %8 ], [ %7, %6 ], [ %5, %4 ], [ %3, %2 ]
ret i32 %21
}