const char *opcode_name(int code) {
  switch (code) {
  case 0x0:
    return "LOAD_FUNC";
  case 0x1:
    return "LOAD_CLOSURE";
  case 0x2:
    return "LOAD_LOCAL";
  case 0x3:
    return "LOAD_BIND";
  case 0x4:
    return "LOAD_CONST";
  case 0x5:
    return "PUSH_BOOL";
  case 0x6:
    return "PUSH_NULL";
  case 0x7:
    return "JUMP_IF_FALSE";
  case 0x8:
    return "JUMP_FORWARD";
  case 0x9:
    return "FUNC_CALL";
  case 0xa:
    return "SET_LOCAL";
  case 0xb:
    return "SET_BIND";
  case 0xc:
    return "OP_CONS";
  case 0xd:
    return "OP_CAR";
  case 0xe:
    return "OP_CDR";
  case 0xf:
    return "OP_SUB";
  case 0x10:
    return "OP_ADD";
  case 0x11:
    return "OP_MUL";
  case 0x12:
    return "OP_DIV";
  case 0x13:
    return "OP_MOD";
  case 0x14:
    return "OP_BIT_AND";
  case 0x15:
    return "OP_BIT_IOR";
  case 0x16:
    return "OP_BIT_XOR";
  case 0x17:
    return "OP_BIT_NOT";
  case 0x18:
    return "OP_LT";
  case 0x19:
    return "OP_GT";
  case 0x1a:
    return "OP_EQ";
  case 0x1b:
    return "OP_EQ_PTR";
  case 0x1c:
    return "OP_NOT";
  case 0x1d:
    return "OP_TYPE_TEST";
  }
  return "unknown";
}


x86 assembly (clang, -O0):
<opcode_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x1d,%rax
ja     130c <opcode_name+0x20c>
mov    -0x18(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf45(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xf3f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xf3c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xf37(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xf31(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xf2c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xf26(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xf20(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xf1e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xf1b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xf15(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xf0f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xf08(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xf00(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xef7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xeee(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xee5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xedc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xed3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xeca(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xebc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xeb7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xeb2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xead(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xea3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xe99(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xe8f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xe89(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xe80(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1317 <opcode_name+0x217>
lea    0xe7d(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<opcode_name>:
cmp    $0x1d,%edi
ja     1117 <opcode_name+0x17>
movslq %edi,%rax
lea    0x1011(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xffa(%rip),%rax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"LOAD_FUNC\00"
@.str.1 = [13 x i8] c"LOAD_CLOSURE\00"
@.str.2 = [11 x i8] c"LOAD_LOCAL\00"
@.str.3 = [10 x i8] c"LOAD_BIND\00"
@.str.4 = [11 x i8] c"LOAD_CONST\00"
@.str.5 = [10 x i8] c"PUSH_BOOL\00"
@.str.6 = [10 x i8] c"PUSH_NULL\00"
@.str.7 = [14 x i8] c"JUMP_IF_FALSE\00"
@.str.8 = [13 x i8] c"JUMP_FORWARD\00"
@.str.9 = [10 x i8] c"FUNC_CALL\00"
@.str.10 = [10 x i8] c"SET_LOCAL\00"
@.str.11 = [9 x i8] c"SET_BIND\00"
@.str.12 = [8 x i8] c"OP_CONS\00"
@.str.13 = [7 x i8] c"OP_CAR\00"
@.str.14 = [7 x i8] c"OP_CDR\00"
@.str.15 = [7 x i8] c"OP_SUB\00"
@.str.16 = [7 x i8] c"OP_ADD\00"
@.str.17 = [7 x i8] c"OP_MUL\00"
@.str.18 = [7 x i8] c"OP_DIV\00"
@.str.19 = [7 x i8] c"OP_MOD\00"
@.str.20 = [11 x i8] c"OP_BIT_AND\00"
@.str.21 = [11 x i8] c"OP_BIT_IOR\00"
@.str.22 = [11 x i8] c"OP_BIT_XOR\00"
@.str.23 = [11 x i8] c"OP_BIT_NOT\00"
@.str.24 = [6 x i8] c"OP_LT\00"
@.str.25 = [6 x i8] c"OP_GT\00"
@.str.26 = [6 x i8] c"OP_EQ\00"
@.str.27 = [10 x i8] c"OP_EQ_PTR\00"
@.str.28 = [7 x i8] c"OP_NOT\00"
@.str.29 = [13 x i8] c"OP_TYPE_TEST\00"
@.str.30 = [8 x i8] c"unknown\00"
define i8* @opcode_name(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %35 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
i32 4, label %9
i32 5, label %10
i32 6, label %11
i32 7, label %12
i32 8, label %13
i32 9, label %14
i32 10, label %15
i32 11, label %16
i32 12, label %17
i32 13, label %18
i32 14, label %19
i32 15, label %20
i32 16, label %21
i32 17, label %22
i32 18, label %23
i32 19, label %24
i32 20, label %25
i32 21, label %26
i32 22, label %27
i32 23, label %28
i32 24, label %29
i32 25, label %30
i32 26, label %31
i32 27, label %32
i32 28, label %33
i32 29, label %34
]
5: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %2
br label %36
6: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %36
7: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %36
8: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %36
9: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %36
10: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %36
11: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %36
12: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %36
13: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %36
14: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %36
15: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %36
16: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %36
17: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %36
18: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %36
19: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %36
20: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %36
21: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i8** %2
br label %36
22: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8** %2
br label %36
23: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0), i8** %2
br label %36
24: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0), i8** %2
br label %36
25: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.20, i64 0, i64 0), i8** %2
br label %36
26: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.21, i64 0, i64 0), i8** %2
br label %36
27: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.22, i64 0, i64 0), i8** %2
br label %36
28: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.23, i64 0, i64 0), i8** %2
br label %36
29: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.24, i64 0, i64 0), i8** %2
br label %36
30: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.25, i64 0, i64 0), i8** %2
br label %36
31: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.26, i64 0, i64 0), i8** %2
br label %36
32: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.27, i64 0, i64 0), i8** %2
br label %36
33: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.28, i64 0, i64 0), i8** %2
br label %36
34: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.29, i64 0, i64 0), i8** %2
br label %36
35: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.30, i64 0, i64 0), i8** %2
br label %36
36: ; preds = %35, %34, %33, %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%37 = load i8*, i8** %2
ret i8* %37
}

LLVM IR (-O2):
@.str = [10 x i8] c"LOAD_FUNC\00"
@.str.1 = [13 x i8] c"LOAD_CLOSURE\00"
@.str.2 = [11 x i8] c"LOAD_LOCAL\00"
@.str.3 = [10 x i8] c"LOAD_BIND\00"
@.str.4 = [11 x i8] c"LOAD_CONST\00"
@.str.5 = [10 x i8] c"PUSH_BOOL\00"
@.str.6 = [10 x i8] c"PUSH_NULL\00"
@.str.7 = [14 x i8] c"JUMP_IF_FALSE\00"
@.str.8 = [13 x i8] c"JUMP_FORWARD\00"
@.str.9 = [10 x i8] c"FUNC_CALL\00"
@.str.10 = [10 x i8] c"SET_LOCAL\00"
@.str.11 = [9 x i8] c"SET_BIND\00"
@.str.12 = [8 x i8] c"OP_CONS\00"
@.str.13 = [7 x i8] c"OP_CAR\00"
@.str.14 = [7 x i8] c"OP_CDR\00"
@.str.15 = [7 x i8] c"OP_SUB\00"
@.str.16 = [7 x i8] c"OP_ADD\00"
@.str.17 = [7 x i8] c"OP_MUL\00"
@.str.18 = [7 x i8] c"OP_DIV\00"
@.str.19 = [7 x i8] c"OP_MOD\00"
@.str.20 = [11 x i8] c"OP_BIT_AND\00"
@.str.21 = [11 x i8] c"OP_BIT_IOR\00"
@.str.22 = [11 x i8] c"OP_BIT_XOR\00"
@.str.23 = [11 x i8] c"OP_BIT_NOT\00"
@.str.24 = [6 x i8] c"OP_LT\00"
@.str.25 = [6 x i8] c"OP_GT\00"
@.str.26 = [6 x i8] c"OP_EQ\00"
@.str.27 = [10 x i8] c"OP_EQ_PTR\00"
@.str.28 = [7 x i8] c"OP_NOT\00"
@.str.29 = [13 x i8] c"OP_TYPE_TEST\00"
@.str.30 = [8 x i8] c"unknown\00"
@reltable.opcode_name = [30 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.1 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.2 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.3 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.4 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.5 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.6 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.7 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.8 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.9 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.10 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.11 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.12 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.13 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.14 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.15 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.16 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.17 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.18 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.19 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.20 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.21 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.22 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.23 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.24 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.25 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.26 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.27 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.28 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.29 to i64), i64 ptrtoint ([30 x i32]* @reltable.opcode_name to i64)) to i32)]
define i8* @opcode_name(i32 %0) {
%2 = icmp ult i32 %0, 30
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([30 x i32]* @reltable.opcode_name to i8*), i64 %5)
br label %7
7: ; preds = %1, %3
%8 = phi i8* [ %6, %3 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.30, i64 0, i64 0), %1 ]
ret i8* %8
}