const char *lw_elem_id_to_str(int elem_id) {
  switch (elem_id) {
  case 2:
    return "AC Address";
  case 3:
    return "WTP Descriptor";
  case 5:
    return "WTP Name";
  case 6:
    return "AC Descriptor";
  case 31:
    return "AC Name";
  case 16:
    return "Supported Rates";
  case 18:
    return "Test";
  case 44:
    return "Certificate";
  case 50:
    return "WTP Board Data";
  case 82:
    return "AP IP Addr";
  case 104:
    return "Vendor Specific";
  case 8:
    return "80.211 WTP Wlan Radio Configuration";
  case 54:
    return "802.11 WTP Mode and Type";
  default:
    return "Unknown";
  }
}


x86 assembly (clang, -O0):
<lw_elem_id_to_str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xfffffffe,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x66,%eax
ja     1200 <lw_elem_id_to_str+0x100>
mov    -0x18(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1065(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120b <lw_elem_id_to_str+0x10b>
lea    0x1060(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120b <lw_elem_id_to_str+0x10b>
lea    0x105f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120b <lw_elem_id_to_str+0x10b>
lea    0x1058(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120b <lw_elem_id_to_str+0x10b>
lea    0x1056(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120b <lw_elem_id_to_str+0x10b>
lea    0x104e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120b <lw_elem_id_to_str+0x10b>
lea    0x104e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120b <lw_elem_id_to_str+0x10b>
lea    0x1043(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120b <lw_elem_id_to_str+0x10b>
lea    0x103f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120b <lw_elem_id_to_str+0x10b>
lea    0x103e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120b <lw_elem_id_to_str+0x10b>
lea    0x1039(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120b <lw_elem_id_to_str+0x10b>
lea    0x1039(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120b <lw_elem_id_to_str+0x10b>
lea    0x104d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120b <lw_elem_id_to_str+0x10b>
lea    0x1056(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lw_elem_id_to_str>:
add    $0xfffffffe,%edi
cmp    $0x66,%edi
ja     1127 <lw_elem_id_to_str+0x27>
lea    0x108d(%rip),%rax
lea    0xeea(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0x1081(%rip),%rax
ret
lea    0x112f(%rip),%rax
ret
lea    0x1080(%rip),%rax
ret
lea    0x1081(%rip),%rax
ret
lea    0x10da(%rip),%rax
ret
lea    0x1087(%rip),%rax
ret
lea    0x108f(%rip),%rax
ret
lea    0x106f(%rip),%rax
ret
lea    0x1084(%rip),%rax
ret
lea    0x1088(%rip),%rax
ret
lea    0x10ce(%rip),%rax
ret
lea    0x1087(%rip),%rax
ret
lea    0x108a(%rip),%rax
ret

LLVM IR (-O0):
@.str = [11 x i8] c"AC Address\00"
@.str.1 = [15 x i8] c"WTP Descriptor\00"
@.str.2 = [9 x i8] c"WTP Name\00"
@.str.3 = [14 x i8] c"AC Descriptor\00"
@.str.4 = [8 x i8] c"AC Name\00"
@.str.5 = [16 x i8] c"Supported Rates\00"
@.str.6 = [5 x i8] c"Test\00"
@.str.7 = [12 x i8] c"Certificate\00"
@.str.8 = [15 x i8] c"WTP Board Data\00"
@.str.9 = [11 x i8] c"AP IP Addr\00"
@.str.10 = [16 x i8] c"Vendor Specific\00"
@.str.11 = [36 x i8] c"80.211 WTP Wlan Radio Configuration\00"
@.str.12 = [25 x i8] c"802.11 WTP Mode and Type\00"
@.str.13 = [8 x i8] c"Unknown\00"
define i8* @lw_elem_id_to_str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %18 [
i32 2, label %5
i32 3, label %6
i32 5, label %7
i32 6, label %8
i32 31, label %9
i32 16, label %10
i32 18, label %11
i32 44, label %12
i32 50, label %13
i32 82, label %14
i32 104, label %15
i32 8, label %16
i32 54, label %17
]
5: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %2
br label %19
6: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %19
7: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %19
8: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %19
9: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %19
10: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %19
11: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %19
12: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %19
13: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %19
14: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %19
15: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %19
16: ; preds = %1
store i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %19
17: ; preds = %1
store i8* getelementptr inbounds ([25 x i8], [25 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 = [11 x i8] c"AC Address\00"
@.str.1 = [15 x i8] c"WTP Descriptor\00"
@.str.2 = [9 x i8] c"WTP Name\00"
@.str.3 = [14 x i8] c"AC Descriptor\00"
@.str.4 = [8 x i8] c"AC Name\00"
@.str.5 = [16 x i8] c"Supported Rates\00"
@.str.6 = [5 x i8] c"Test\00"
@.str.7 = [12 x i8] c"Certificate\00"
@.str.8 = [15 x i8] c"WTP Board Data\00"
@.str.9 = [11 x i8] c"AP IP Addr\00"
@.str.10 = [16 x i8] c"Vendor Specific\00"
@.str.11 = [36 x i8] c"80.211 WTP Wlan Radio Configuration\00"
@.str.12 = [25 x i8] c"802.11 WTP Mode and Type\00"
@.str.13 = [8 x i8] c"Unknown\00"
define i8* @lw_elem_id_to_str(i32 %0) {
switch i32 %0, label %14 [
i32 2, label %15
i32 3, label %2
i32 5, label %3
i32 6, label %4
i32 31, label %5
i32 16, label %6
i32 18, label %7
i32 44, label %8
i32 50, label %9
i32 82, label %10
i32 104, label %11
i32 8, label %12
i32 54, 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 ([25 x i8], [25 x i8]* @.str.12, i64 0, i64 0), %13 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), %10 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([16 x i8], [16 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 ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %16
}