char *mm_dump_cmd(unsigned char cmd) {
  switch (cmd) {
  case 0x54:
    return "LOCATE-REQUEST";
  case 0x55:
    return "LOCATE-ACCEPT";
  case 0x57:
    return "LOCATE-REJECT";
  case 0x56:
    return "DETACH";
  case 0x40:
    return "AUTHENTICATION-REQUEST";
  case 0x44:
    return "ACCESS-RIGHTS-REQUEST";
  case 0x45:
    return "ACCESS-RIGHTS-ACCEPT";
  case 0x47:
    return "ACCESS-RIGHTS-REJECT";
  case 0x48:
    return "ACCESS-RIGHTS-TERM-REQUEST";
  case 0x49:
    return "ACCESS-RIGHTS-TERM-ACCEPT";
  case 0x4B:
    return "ACCESS-RIGHTS-TERM-REJECT";
  }
  return "<UNKNOWN>";
}


x86 assembly (clang, -O0):
<mm_dump_cmd>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
add    $0xffffffc0,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x17,%eax
ja     11e4 <mm_dump_cmd+0xe4>
mov    -0x18(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf25(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ef <mm_dump_cmd+0xef>
lea    0xf24(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ef <mm_dump_cmd+0xef>
lea    0xf22(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ef <mm_dump_cmd+0xef>
lea    0xf20(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ef <mm_dump_cmd+0xef>
lea    0xf17(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ef <mm_dump_cmd+0xef>
lea    0xf1e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ef <mm_dump_cmd+0xef>
lea    0xf24(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ef <mm_dump_cmd+0xef>
lea    0xf29(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ef <mm_dump_cmd+0xef>
lea    0xf2e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ef <mm_dump_cmd+0xef>
lea    0xf39(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ef <mm_dump_cmd+0xef>
lea    0xf43(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ef <mm_dump_cmd+0xef>
lea    0xf4d(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mm_dump_cmd>:
add    $0xc0,%dil
cmp    $0x17,%dil
ja     111d <mm_dump_cmd+0x1d>
movsbq %dil,%rax
lea    0xfcf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xfb4(%rip),%rax
ret

LLVM IR (-O0):
@.str = [15 x i8] c"LOCATE-REQUEST\00"
@.str.1 = [14 x i8] c"LOCATE-ACCEPT\00"
@.str.2 = [14 x i8] c"LOCATE-REJECT\00"
@.str.3 = [7 x i8] c"DETACH\00"
@.str.4 = [23 x i8] c"AUTHENTICATION-REQUEST\00"
@.str.5 = [22 x i8] c"ACCESS-RIGHTS-REQUEST\00"
@.str.6 = [21 x i8] c"ACCESS-RIGHTS-ACCEPT\00"
@.str.7 = [21 x i8] c"ACCESS-RIGHTS-REJECT\00"
@.str.8 = [27 x i8] c"ACCESS-RIGHTS-TERM-REQUEST\00"
@.str.9 = [26 x i8] c"ACCESS-RIGHTS-TERM-ACCEPT\00"
@.str.10 = [26 x i8] c"ACCESS-RIGHTS-TERM-REJECT\00"
@.str.11 = [10 x i8] c"<UNKNOWN>\00"
define i8* @mm_dump_cmd(i8 zeroext %0) {
%2 = alloca i8*
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
switch i32 %5, label %17 [
i32 84, label %6
i32 85, label %7
i32 87, label %8
i32 86, label %9
i32 64, label %10
i32 68, label %11
i32 69, label %12
i32 71, label %13
i32 72, label %14
i32 73, label %15
i32 75, label %16
]
6: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %2
br label %18
7: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %18
8: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %18
9: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %18
10: ; preds = %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %18
11: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %18
12: ; preds = %1
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %18
13: ; preds = %1
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %18
14: ; preds = %1
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %18
15: ; preds = %1
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %18
16: ; preds = %1
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %18
17: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %18
18: ; preds = %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
@.str = [15 x i8] c"LOCATE-REQUEST\00"
@.str.1 = [14 x i8] c"LOCATE-ACCEPT\00"
@.str.2 = [14 x i8] c"LOCATE-REJECT\00"
@.str.3 = [7 x i8] c"DETACH\00"
@.str.4 = [23 x i8] c"AUTHENTICATION-REQUEST\00"
@.str.5 = [22 x i8] c"ACCESS-RIGHTS-REQUEST\00"
@.str.6 = [21 x i8] c"ACCESS-RIGHTS-ACCEPT\00"
@.str.7 = [21 x i8] c"ACCESS-RIGHTS-REJECT\00"
@.str.8 = [27 x i8] c"ACCESS-RIGHTS-TERM-REQUEST\00"
@.str.9 = [26 x i8] c"ACCESS-RIGHTS-TERM-ACCEPT\00"
@.str.10 = [26 x i8] c"ACCESS-RIGHTS-TERM-REJECT\00"
@.str.11 = [10 x i8] c"<UNKNOWN>\00"
@reltable.mm_dump_cmd = [24 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @.str.4 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.11 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.11 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.11 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.5 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.6 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.11 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.7 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @.str.8 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.9 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.11 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.10 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.11 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.11 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.11 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.11 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.11 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.11 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.11 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.11 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.1 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.3 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.2 to i64), i64 ptrtoint ([24 x i32]* @reltable.mm_dump_cmd to i64)) to i32)]
define i8* @mm_dump_cmd(i8 zeroext %0) {
%2 = add i8 %0, -64
%3 = icmp ult i8 %2, 24
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i8 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([24 x i32]* @reltable.mm_dump_cmd to i8*), i64 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), %1 ]
ret i8* %9
}