char *type_to_string(int t) {
  switch (t) {
  case (1 << 0):
    return "LIST";
  case ((1 << 13) | (1 << 14)):
    return "BOOL";
  case (1 << 1):
    return "INTEGER";
  case (1 << 2):
    return "FLOAT";
  case (1 << 3):
    return "STRING";
  case (1 << 4):
    return "IDENT";
  case (1 << 5):
    return "OP";
  case (1 << 6):
    return "FUN";
  case (1 << 7):
    return "PORT";
  case (1 << 9):
    return "RE";
  case (1 << 10):
    return "NIL";
  case (1 << 12):
    return "ERR";
  case (1 << 11):
    return "<<EOF>>";
  default:
    return "UNKNOWN";
  }
}


x86 assembly (clang, -O0):
<type_to_string>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     11f3 <type_to_string+0xf3>
jmp    111b <type_to_string+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     1213 <type_to_string+0x113>
jmp    112c <type_to_string+0x2c>
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
je     1223 <type_to_string+0x123>
jmp    113d <type_to_string+0x3d>
mov    -0x10(%rbp),%eax
sub    $0x8,%eax
je     1233 <type_to_string+0x133>
jmp    114e <type_to_string+0x4e>
mov    -0x10(%rbp),%eax
sub    $0x10,%eax
je     1243 <type_to_string+0x143>
jmp    115f <type_to_string+0x5f>
mov    -0x10(%rbp),%eax
sub    $0x20,%eax
je     1253 <type_to_string+0x153>
jmp    1170 <type_to_string+0x70>
mov    -0x10(%rbp),%eax
sub    $0x40,%eax
je     1263 <type_to_string+0x163>
jmp    1181 <type_to_string+0x81>
mov    -0x10(%rbp),%eax
sub    $0x80,%eax
je     1273 <type_to_string+0x173>
jmp    1194 <type_to_string+0x94>
mov    -0x10(%rbp),%eax
sub    $0x200,%eax
je     1283 <type_to_string+0x183>
jmp    11a7 <type_to_string+0xa7>
mov    -0x10(%rbp),%eax
sub    $0x400,%eax
je     1293 <type_to_string+0x193>
jmp    11ba <type_to_string+0xba>
mov    -0x10(%rbp),%eax
sub    $0x800,%eax
je     12b3 <type_to_string+0x1b3>
jmp    11cd <type_to_string+0xcd>
mov    -0x10(%rbp),%eax
sub    $0x1000,%eax
je     12a3 <type_to_string+0x1a3>
jmp    11e0 <type_to_string+0xe0>
mov    -0x10(%rbp),%eax
sub    $0x6000,%eax
je     1203 <type_to_string+0x103>
jmp    12c3 <type_to_string+0x1c3>
lea    0xe06(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <type_to_string+0x1ce>
lea    0xdfb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <type_to_string+0x1ce>
lea    0xdf0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <type_to_string+0x1ce>
lea    0xde8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <type_to_string+0x1ce>
lea    0xdde(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <type_to_string+0x1ce>
lea    0xdd5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <type_to_string+0x1ce>
lea    0xdcb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <type_to_string+0x1ce>
lea    0xdbe(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <type_to_string+0x1ce>
lea    0xdb2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <type_to_string+0x1ce>
lea    0xda7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <type_to_string+0x1ce>
lea    0xd9a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <type_to_string+0x1ce>
lea    0xd8e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <type_to_string+0x1ce>
lea    0xd82(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <type_to_string+0x1ce>
lea    0xd7a(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<type_to_string>:
cmp    $0x7f,%edi
jg     1130 <type_to_string+0x30>
add    $0xffffffff,%edi
cmp    $0x3f,%edi
ja     11c0 <type_to_string+0xc0>
lea    0xfe8(%rip),%rax
lea    0xee1(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xfdb(%rip),%rax
ret
cmp    $0x7ff,%edi
jg     1158 <type_to_string+0x58>
cmp    $0x80,%edi
je     11a0 <type_to_string+0xa0>
cmp    $0x200,%edi
je     11a8 <type_to_string+0xa8>
cmp    $0x400,%edi
jne    11c0 <type_to_string+0xc0>
lea    0xfdd(%rip),%rax
ret
cmp    $0x800,%edi
je     11b0 <type_to_string+0xb0>
cmp    $0x1000,%edi
je     11b8 <type_to_string+0xb8>
cmp    $0x6000,%edi
jne    11c0 <type_to_string+0xc0>
lea    0xf8e(%rip),%rax
ret
lea    0xf93(%rip),%rax
ret
lea    0xf91(%rip),%rax
ret
lea    0xf90(%rip),%rax
ret
lea    0xf8e(%rip),%rax
ret
lea    0xf89(%rip),%rax
ret
lea    0xf85(%rip),%rax
ret
lea    0xf82(%rip),%rax
ret
lea    0xf85(%rip),%rax
ret
lea    0xf79(%rip),%rax
ret
lea    0xf7d(%rip),%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"LIST\00"
@.str.1 = [5 x i8] c"BOOL\00"
@.str.2 = [8 x i8] c"INTEGER\00"
@.str.3 = [6 x i8] c"FLOAT\00"
@.str.4 = [7 x i8] c"STRING\00"
@.str.5 = [6 x i8] c"IDENT\00"
@.str.6 = [3 x i8] c"OP\00"
@.str.7 = [4 x i8] c"FUN\00"
@.str.8 = [5 x i8] c"PORT\00"
@.str.9 = [3 x i8] c"RE\00"
@.str.10 = [4 x i8] c"NIL\00"
@.str.11 = [4 x i8] c"ERR\00"
@.str.12 = [8 x i8] c"<<EOF>>\00"
@.str.13 = [8 x i8] c"UNKNOWN\00"
define i8* @type_to_string(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %18 [
i32 1, label %5
i32 24576, label %6
i32 2, label %7
i32 4, label %8
i32 8, label %9
i32 16, label %10
i32 32, label %11
i32 64, label %12
i32 128, label %13
i32 512, label %14
i32 1024, label %15
i32 4096, label %16
i32 2048, label %17
]
5: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %19
6: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %19
7: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %19
8: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %19
9: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %19
10: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %19
11: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %19
12: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %19
13: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %19
14: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %19
15: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %19
16: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %19
17: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %19
18: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %19
19: ; preds = %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
@.str = [5 x i8] c"LIST\00"
@.str.1 = [5 x i8] c"BOOL\00"
@.str.2 = [8 x i8] c"INTEGER\00"
@.str.3 = [6 x i8] c"FLOAT\00"
@.str.4 = [7 x i8] c"STRING\00"
@.str.5 = [6 x i8] c"IDENT\00"
@.str.6 = [3 x i8] c"OP\00"
@.str.7 = [4 x i8] c"FUN\00"
@.str.8 = [5 x i8] c"PORT\00"
@.str.9 = [3 x i8] c"RE\00"
@.str.10 = [4 x i8] c"NIL\00"
@.str.11 = [4 x i8] c"ERR\00"
@.str.12 = [8 x i8] c"<<EOF>>\00"
@.str.13 = [8 x i8] c"UNKNOWN\00"
define i8* @type_to_string(i32 %0) {
switch i32 %0, label %14 [
i32 1, label %15
i32 24576, label %2
i32 2, label %3
i32 4, label %4
i32 8, label %5
i32 16, label %6
i32 32, label %7
i32 64, label %8
i32 128, label %9
i32 512, label %10
i32 1024, label %11
i32 4096, label %12
i32 2048, label %13
]
2: ; preds = %1
br label %15
3: ; preds = %1
br label %15
4: ; preds = %1
br label %15
5: ; preds = %1
br label %15
6: ; preds = %1
br label %15
7: ; preds = %1
br label %15
8: ; preds = %1
br label %15
9: ; preds = %1
br label %15
10: ; preds = %1
br label %15
11: ; preds = %1
br label %15
12: ; preds = %1
br label %15
13: ; preds = %1
br label %15
14: ; preds = %1
br label %15
15: ; preds = %1, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%16 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), %14 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), %13 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), %10 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %16
}