const char *func_name(int func) {
  switch (func) {
  case 1:
    return "ANNOUNCE";
  case 2:
    return "REGISTER";
  case 3:
    return "CLIENT_KEY";
  case 4:
    return "REG_CONF";
  case 6:
    return "KEYINFO";
  case 5:
    return "FILEINFO";
  case 7:
    return "INFO_ACK";
  case 8:
    return "FILESEG";
  case 9:
    return "DONE";
  case 11:
    return "PRSTATUS";
  case 10:
    return "STATUS";
  case 12:
    return "COMPLETE";
  case 13:
    return "DONE_CONF";
  case 14:
    return "HB_REQ";
  case 15:
    return "HB_RESP";
  case 16:
    return "KEY_REQ";
  case 17:
    return "PROXY_KEY";
  case 80:
    return "ENCRYPTED";
  case 99:
    return "ABORT";
  default:
    return "UNKNOWN";
  }
}


x86 assembly (clang, -O0):
<func_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x62,%eax
ja     1260 <func_name+0x160>
mov    -0x18(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1055(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0x104e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0x1047(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0x1042(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0x103b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0x1033(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0x102c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0x1025(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0x101d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0x1012(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0x1004(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0xffb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0xff4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0xfee(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0xfe5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0xfdd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0xfd5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0xfcf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0xfc9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    126b <func_name+0x16b>
lea    0xfbf(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<func_name>:
add    $0xffffffff,%edi
cmp    $0x62,%edi
ja     11b3 <func_name+0xb3>
lea    0x1079(%rip),%rax
lea    0xee6(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0x106b(%rip),%rax
ret
lea    0x106c(%rip),%rax
ret
lea    0x106f(%rip),%rax
ret
lea    0x1078(%rip),%rax
ret
lea    0x1068(%rip),%rax
ret
lea    0x1071(%rip),%rax
ret
lea    0x1072(%rip),%rax
ret
lea    0x1072(%rip),%rax
ret
lea    0x1071(%rip),%rax
ret
lea    0x1067(%rip),%rax
ret
lea    0x1068(%rip),%rax
ret
lea    0x1069(%rip),%rax
ret
lea    0x106b(%rip),%rax
ret
lea    0x106a(%rip),%rax
ret
lea    0x106a(%rip),%rax
ret
lea    0x106a(%rip),%rax
ret
lea    0x106c(%rip),%rax
ret
lea    0x106e(%rip),%rax
ret
lea    0x106c(%rip),%rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"ANNOUNCE\00"
@.str.1 = [9 x i8] c"REGISTER\00"
@.str.2 = [11 x i8] c"CLIENT_KEY\00"
@.str.3 = [9 x i8] c"REG_CONF\00"
@.str.4 = [8 x i8] c"KEYINFO\00"
@.str.5 = [9 x i8] c"FILEINFO\00"
@.str.6 = [9 x i8] c"INFO_ACK\00"
@.str.7 = [8 x i8] c"FILESEG\00"
@.str.8 = [5 x i8] c"DONE\00"
@.str.9 = [9 x i8] c"PRSTATUS\00"
@.str.10 = [7 x i8] c"STATUS\00"
@.str.11 = [9 x i8] c"COMPLETE\00"
@.str.12 = [10 x i8] c"DONE_CONF\00"
@.str.13 = [7 x i8] c"HB_REQ\00"
@.str.14 = [8 x i8] c"HB_RESP\00"
@.str.15 = [8 x i8] c"KEY_REQ\00"
@.str.16 = [10 x i8] c"PROXY_KEY\00"
@.str.17 = [10 x i8] c"ENCRYPTED\00"
@.str.18 = [6 x i8] c"ABORT\00"
@.str.19 = [8 x i8] c"UNKNOWN\00"
define i8* @func_name(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %24 [
i32 1, label %5
i32 2, label %6
i32 3, label %7
i32 4, label %8
i32 6, label %9
i32 5, label %10
i32 7, label %11
i32 8, label %12
i32 9, label %13
i32 11, label %14
i32 10, label %15
i32 12, label %16
i32 13, label %17
i32 14, label %18
i32 15, label %19
i32 16, label %20
i32 17, label %21
i32 80, label %22
i32 99, label %23
]
5: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %2
br label %25
6: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %25
7: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %25
8: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %25
9: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %25
10: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %25
11: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %25
12: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %25
13: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %25
14: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %25
15: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %25
16: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %25
17: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %25
18: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %25
19: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %25
20: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %25
21: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0), i8** %2
br label %25
22: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.17, i64 0, i64 0), i8** %2
br label %25
23: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i64 0, i64 0), i8** %2
br label %25
24: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0), i8** %2
br label %25
25: ; preds = %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%26 = load i8*, i8** %2
ret i8* %26
}

LLVM IR (-O2):
@.str = [9 x i8] c"ANNOUNCE\00"
@.str.1 = [9 x i8] c"REGISTER\00"
@.str.2 = [11 x i8] c"CLIENT_KEY\00"
@.str.3 = [9 x i8] c"REG_CONF\00"
@.str.4 = [8 x i8] c"KEYINFO\00"
@.str.5 = [9 x i8] c"FILEINFO\00"
@.str.6 = [9 x i8] c"INFO_ACK\00"
@.str.7 = [8 x i8] c"FILESEG\00"
@.str.8 = [5 x i8] c"DONE\00"
@.str.9 = [9 x i8] c"PRSTATUS\00"
@.str.10 = [7 x i8] c"STATUS\00"
@.str.11 = [9 x i8] c"COMPLETE\00"
@.str.12 = [10 x i8] c"DONE_CONF\00"
@.str.13 = [7 x i8] c"HB_REQ\00"
@.str.14 = [8 x i8] c"HB_RESP\00"
@.str.15 = [8 x i8] c"KEY_REQ\00"
@.str.16 = [10 x i8] c"PROXY_KEY\00"
@.str.17 = [10 x i8] c"ENCRYPTED\00"
@.str.18 = [6 x i8] c"ABORT\00"
@.str.19 = [8 x i8] c"UNKNOWN\00"
define i8* @func_name(i32 %0) {
switch i32 %0, label %20 [
i32 1, label %21
i32 2, label %2
i32 3, label %3
i32 4, label %4
i32 6, label %5
i32 5, label %6
i32 7, label %7
i32 8, label %8
i32 9, label %9
i32 11, label %10
i32 10, label %11
i32 12, label %12
i32 13, label %13
i32 14, label %14
i32 15, label %15
i32 16, label %16
i32 17, label %17
i32 80, label %18
i32 99, label %19
]
2: ; preds = %1
br label %21
3: ; preds = %1
br label %21
4: ; preds = %1
br label %21
5: ; preds = %1
br label %21
6: ; preds = %1
br label %21
7: ; preds = %1
br label %21
8: ; preds = %1
br label %21
9: ; preds = %1
br label %21
10: ; preds = %1
br label %21
11: ; preds = %1
br label %21
12: ; preds = %1
br label %21
13: ; preds = %1
br label %21
14: ; preds = %1
br label %21
15: ; preds = %1
br label %21
16: ; preds = %1
br label %21
17: ; preds = %1
br label %21
18: ; preds = %1
br label %21
19: ; preds = %1
br label %21
20: ; preds = %1
br label %21
21: ; preds = %1, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%22 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0), %20 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i64 0, i64 0), %19 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.17, i64 0, i64 0), %18 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0), %17 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), %16 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), %15 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), %14 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), %13 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([9 x i8], [9 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 ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %22
}