char *tst_ttype2color(int ttype) {
  switch (((ttype)&0x3f)) {
  case 0:
    return "\033[1;32m";
    break;
  case 1:
    return "\033[1;31m";
    break;
  case 2:
    return "\033[1;31m";
    break;
  case 32:
    return "\033[1;33m";
    break;
  case 4:
    return "\033[1;35m";
    break;
  case 16:
    return "\033[1;34m";
    break;
  default:
    return "";
  }
}


x86 assembly (clang, -O0):
<tst_ttype2color>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x3f,%eax
mov    %rax,-0x18(%rbp)
sub    $0x20,%eax
ja     118e <tst_ttype2color+0x8e>
mov    -0x18(%rbp),%rax
lea    0xedb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf4f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <tst_ttype2color+0x99>
lea    0xf47(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <tst_ttype2color+0x99>
lea    0xf37(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <tst_ttype2color+0x99>
lea    0xf2f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <tst_ttype2color+0x99>
lea    0xf27(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <tst_ttype2color+0x99>
lea    0xf1f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <tst_ttype2color+0x99>
lea    0xefe(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tst_ttype2color>:
and    $0x3f,%edi
cmp    $0x20,%edi
ja     1127 <tst_ttype2color+0x27>
lea    0xf75(%rip),%rax
lea    0xeea(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xf66(%rip),%rax
ret
lea    0xf65(%rip),%rax
ret
lea    0xf66(%rip),%rax
ret
lea    0xf66(%rip),%rax
ret
lea    0xf4e(%rip),%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"\1B[1;32m\00"
@.str.1 = [8 x i8] c"\1B[1;31m\00"
@.str.2 = [8 x i8] c"\1B[1;33m\00"
@.str.3 = [8 x i8] c"\1B[1;35m\00"
@.str.4 = [8 x i8] c"\1B[1;34m\00"
@.str.5 = [1 x i8] zeroinitializer
define i8* @tst_ttype2color(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 63
switch i32 %5, label %12 [
i32 0, label %6
i32 1, label %7
i32 2, label %8
i32 32, label %9
i32 4, label %10
i32 16, label %11
]
6: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
br label %13
7: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %13
8: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %13
9: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %13
10: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %13
11: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %13
12: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %13
13: ; preds = %12, %11, %10, %9, %8, %7, %6
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
@.str = [8 x i8] c"\1B[1;32m\00"
@.str.1 = [8 x i8] c"\1B[1;31m\00"
@.str.2 = [8 x i8] c"\1B[1;33m\00"
@.str.3 = [8 x i8] c"\1B[1;35m\00"
@.str.4 = [8 x i8] c"\1B[1;34m\00"
@.str.5 = [1 x i8] zeroinitializer
define i8* @tst_ttype2color(i32 %0) {
%2 = and i32 %0, 63
switch i32 %2, label %8 [
i32 0, label %9
i32 1, label %3
i32 2, label %4
i32 32, label %5
i32 4, label %6
i32 16, label %7
]
3: ; preds = %1
br label %9
4: ; preds = %1
br label %9
5: ; preds = %1
br label %9
6: ; preds = %1
br label %9
7: ; preds = %1
br label %9
8: ; preds = %1
br label %9
9: ; preds = %1, %8, %7, %6, %5, %4, %3
%10 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %5 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %10
}