char *get_command_string(char cmd) {
  switch (cmd) {
  case 'o':
    return "SMR_OP_EXT";
  case 'c':
    return "SMR_OP_SESSION_CLOSE";
  case 'd':
    return "SMR_OP_SESSION_DATA";
  case 'n':
    return "SMR_OP_NODE_CHANGE";
  case 't':
    return "SMR_OP_SEQ_COMMITTED";
  case '<':
    return "SMR_OP_SEQ_RECEIVED";
  case '&':
    return "SMR_OP_SEQ_CONSUMED";
  case 'v':
    return "SMR_OP_SEQ_CKPTED";
  case '!':
    return "SMR_OP_SEQ_SAFE";
  default:
    return "UNKNOWN";
  }
}


x86 assembly (clang, -O0):
<get_command_string>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
add    $0xffffffdf,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x55,%eax
ja     11c4 <get_command_string+0xc4>
mov    -0x18(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x101d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11cf <get_command_string+0xcf>
lea    0x1018(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11cf <get_command_string+0xcf>
lea    0x101d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11cf <get_command_string+0xcf>
lea    0x1021(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11cf <get_command_string+0xcf>
lea    0x1024(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11cf <get_command_string+0xcf>
lea    0x1029(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11cf <get_command_string+0xcf>
lea    0x102d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11cf <get_command_string+0xcf>
lea    0x1031(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11cf <get_command_string+0xcf>
lea    0x1033(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11cf <get_command_string+0xcf>
lea    0x1033(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_command_string>:
add    $0xffffffdf,%edi
cmp    $0x55,%edi
ja     1127 <get_command_string+0x27>
lea    0x1049(%rip),%rax
lea    0xeea(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0x10c8(%rip),%rax
ret
lea    0x10d0(%rip),%rax
ret
lea    0x1092(%rip),%rax
ret
lea    0x1076(%rip),%rax
ret
lea    0x101d(%rip),%rax
ret
lea    0x102a(%rip),%rax
ret
lea    0x1036(%rip),%rax
ret
lea    0x1041(%rip),%rax
ret
lea    0x1076(%rip),%rax
ret

LLVM IR (-O0):
@.str = [11 x i8] c"SMR_OP_EXT\00"
@.str.1 = [21 x i8] c"SMR_OP_SESSION_CLOSE\00"
@.str.2 = [20 x i8] c"SMR_OP_SESSION_DATA\00"
@.str.3 = [19 x i8] c"SMR_OP_NODE_CHANGE\00"
@.str.4 = [21 x i8] c"SMR_OP_SEQ_COMMITTED\00"
@.str.5 = [20 x i8] c"SMR_OP_SEQ_RECEIVED\00"
@.str.6 = [20 x i8] c"SMR_OP_SEQ_CONSUMED\00"
@.str.7 = [18 x i8] c"SMR_OP_SEQ_CKPTED\00"
@.str.8 = [16 x i8] c"SMR_OP_SEQ_SAFE\00"
@.str.9 = [8 x i8] c"UNKNOWN\00"
define i8* @get_command_string(i8 signext %0) {
%2 = alloca i8*
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %15 [
i32 111, label %6
i32 99, label %7
i32 100, label %8
i32 110, label %9
i32 116, label %10
i32 60, label %11
i32 38, label %12
i32 118, label %13
i32 33, label %14
]
6: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %2
br label %16
7: ; preds = %1
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %16
8: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %16
9: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %16
10: ; preds = %1
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %16
11: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %16
12: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %16
13: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %16
14: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %16
15: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %16
16: ; preds = %15, %14, %13, %12, %11, %10, %9, %8, %7, %6
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
@.str = [11 x i8] c"SMR_OP_EXT\00"
@.str.1 = [21 x i8] c"SMR_OP_SESSION_CLOSE\00"
@.str.2 = [20 x i8] c"SMR_OP_SESSION_DATA\00"
@.str.3 = [19 x i8] c"SMR_OP_NODE_CHANGE\00"
@.str.4 = [21 x i8] c"SMR_OP_SEQ_COMMITTED\00"
@.str.5 = [20 x i8] c"SMR_OP_SEQ_RECEIVED\00"
@.str.6 = [20 x i8] c"SMR_OP_SEQ_CONSUMED\00"
@.str.7 = [18 x i8] c"SMR_OP_SEQ_CKPTED\00"
@.str.8 = [16 x i8] c"SMR_OP_SEQ_SAFE\00"
@.str.9 = [8 x i8] c"UNKNOWN\00"
define i8* @get_command_string(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %11 [
i32 111, label %12
i32 99, label %3
i32 100, label %4
i32 110, label %5
i32 116, label %6
i32 60, label %7
i32 38, label %8
i32 118, label %9
i32 33, label %10
]
3: ; preds = %1
br label %12
4: ; preds = %1
br label %12
5: ; preds = %1
br label %12
6: ; preds = %1
br label %12
7: ; preds = %1
br label %12
8: ; preds = %1
br label %12
9: ; preds = %1
br label %12
10: ; preds = %1
br label %12
11: ; preds = %1
br label %12
12: ; preds = %1, %11, %10, %9, %8, %7, %6, %5, %4, %3
%13 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), %11 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), %10 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), %9 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), %8 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %13
}