char *sas_axi_err_type(int etype) {
  switch (etype) {
  case 0x0001:
    return "IOST_AXI_W_ERR";
  case 0x0002:
    return "IOST_AXI_R_ERR";
  case 0x0004:
    return "ITCT_AXI_W_ERR";
  case 0x0008:
    return "ITCT_AXI_R_ERR";
  case 0x0010:
    return "SATA_AXI_W_ERR";
  case 0x0020:
    return "SATA_AXI_R_ERR";
  case 0x0040:
    return "DQE_AXI_R_ERR";
  case 0x0080:
    return "CQE_AXI_W_ERR";
  case 0x0100:
    return "CQE_WINFO_FIFO";
  case 0x0200:
    return "CQE_MSG_FIFIO";
  case 0x0400:
    return "GETDQE_FIFO";
  case 0x0800:
    return "CMDP_FIFO";
  case 0x1000:
    return "AWTCTRL_FIFO";
  }
  return "unknown error";
}


x86 assembly (clang, -O0):
<sas_axi_err_type>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     11f3 <sas_axi_err_type+0xf3>
jmp    111b <sas_axi_err_type+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     1203 <sas_axi_err_type+0x103>
jmp    112c <sas_axi_err_type+0x2c>
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
je     1213 <sas_axi_err_type+0x113>
jmp    113d <sas_axi_err_type+0x3d>
mov    -0x10(%rbp),%eax
sub    $0x8,%eax
je     1223 <sas_axi_err_type+0x123>
jmp    114e <sas_axi_err_type+0x4e>
mov    -0x10(%rbp),%eax
sub    $0x10,%eax
je     1233 <sas_axi_err_type+0x133>
jmp    115f <sas_axi_err_type+0x5f>
mov    -0x10(%rbp),%eax
sub    $0x20,%eax
je     1243 <sas_axi_err_type+0x143>
jmp    1170 <sas_axi_err_type+0x70>
mov    -0x10(%rbp),%eax
sub    $0x40,%eax
je     1253 <sas_axi_err_type+0x153>
jmp    1181 <sas_axi_err_type+0x81>
mov    -0x10(%rbp),%eax
sub    $0x80,%eax
je     1263 <sas_axi_err_type+0x163>
jmp    1194 <sas_axi_err_type+0x94>
mov    -0x10(%rbp),%eax
sub    $0x100,%eax
je     1273 <sas_axi_err_type+0x173>
jmp    11a7 <sas_axi_err_type+0xa7>
mov    -0x10(%rbp),%eax
sub    $0x200,%eax
je     1283 <sas_axi_err_type+0x183>
jmp    11ba <sas_axi_err_type+0xba>
mov    -0x10(%rbp),%eax
sub    $0x400,%eax
je     1293 <sas_axi_err_type+0x193>
jmp    11cd <sas_axi_err_type+0xcd>
mov    -0x10(%rbp),%eax
sub    $0x800,%eax
je     12a3 <sas_axi_err_type+0x1a3>
jmp    11e0 <sas_axi_err_type+0xe0>
mov    -0x10(%rbp),%eax
sub    $0x1000,%eax
je     12b3 <sas_axi_err_type+0x1b3>
jmp    12c3 <sas_axi_err_type+0x1c3>
lea    0xe06(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <sas_axi_err_type+0x1ce>
lea    0xe05(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <sas_axi_err_type+0x1ce>
lea    0xe04(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <sas_axi_err_type+0x1ce>
lea    0xe03(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <sas_axi_err_type+0x1ce>
lea    0xe02(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <sas_axi_err_type+0x1ce>
lea    0xe01(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <sas_axi_err_type+0x1ce>
lea    0xe00(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <sas_axi_err_type+0x1ce>
lea    0xdfe(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <sas_axi_err_type+0x1ce>
lea    0xdfc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <sas_axi_err_type+0x1ce>
lea    0xdfb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <sas_axi_err_type+0x1ce>
lea    0xdf9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <sas_axi_err_type+0x1ce>
lea    0xdf5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <sas_axi_err_type+0x1ce>
lea    0xdef(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12ce <sas_axi_err_type+0x1ce>
lea    0xdec(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sas_axi_err_type>:
cmp    $0x7f,%edi
jg     1130 <sas_axi_err_type+0x30>
add    $0xffffffff,%edi
cmp    $0x3f,%edi
ja     11c0 <sas_axi_err_type+0xc0>
lea    0xfe8(%rip),%rax
lea    0xee1(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xfe0(%rip),%rax
ret
cmp    $0x3ff,%edi
jg     1158 <sas_axi_err_type+0x58>
cmp    $0x80,%edi
je     11a0 <sas_axi_err_type+0xa0>
cmp    $0x100,%edi
je     11a8 <sas_axi_err_type+0xa8>
cmp    $0x200,%edi
jne    11c0 <sas_axi_err_type+0xc0>
lea    0x102e(%rip),%rax
ret
cmp    $0x400,%edi
je     11b0 <sas_axi_err_type+0xb0>
cmp    $0x800,%edi
je     11b8 <sas_axi_err_type+0xb8>
cmp    $0x1000,%edi
jne    11c0 <sas_axi_err_type+0xc0>
lea    0x1032(%rip),%rax
ret
lea    0xf9f(%rip),%rax
ret
lea    0xfa6(%rip),%rax
ret
lea    0xfad(%rip),%rax
ret
lea    0xfb4(%rip),%rax
ret
lea    0xfbb(%rip),%rax
ret
lea    0xfc1(%rip),%rax
ret
lea    0xfc7(%rip),%rax
ret
lea    0xfdc(%rip),%rax
ret
lea    0xfe0(%rip),%rax
ret
lea    0xfef(%rip),%rax
ret

LLVM IR (-O0):
@.str = [15 x i8] c"IOST_AXI_W_ERR\00"
@.str.1 = [15 x i8] c"IOST_AXI_R_ERR\00"
@.str.2 = [15 x i8] c"ITCT_AXI_W_ERR\00"
@.str.3 = [15 x i8] c"ITCT_AXI_R_ERR\00"
@.str.4 = [15 x i8] c"SATA_AXI_W_ERR\00"
@.str.5 = [15 x i8] c"SATA_AXI_R_ERR\00"
@.str.6 = [14 x i8] c"DQE_AXI_R_ERR\00"
@.str.7 = [14 x i8] c"CQE_AXI_W_ERR\00"
@.str.8 = [15 x i8] c"CQE_WINFO_FIFO\00"
@.str.9 = [14 x i8] c"CQE_MSG_FIFIO\00"
@.str.10 = [12 x i8] c"GETDQE_FIFO\00"
@.str.11 = [10 x i8] c"CMDP_FIFO\00"
@.str.12 = [13 x i8] c"AWTCTRL_FIFO\00"
@.str.13 = [14 x i8] c"unknown error\00"
define i8* @sas_axi_err_type(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %18 [
i32 1, label %5
i32 2, label %6
i32 4, label %7
i32 8, label %8
i32 16, label %9
i32 32, label %10
i32 64, label %11
i32 128, label %12
i32 256, label %13
i32 512, label %14
i32 1024, label %15
i32 2048, label %16
i32 4096, label %17
]
5: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 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 ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %19
8: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %19
9: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %19
10: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %19
11: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %19
12: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 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 ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %19
15: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %19
16: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %19
17: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %19
18: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 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 = [15 x i8] c"IOST_AXI_W_ERR\00"
@.str.1 = [15 x i8] c"IOST_AXI_R_ERR\00"
@.str.2 = [15 x i8] c"ITCT_AXI_W_ERR\00"
@.str.3 = [15 x i8] c"ITCT_AXI_R_ERR\00"
@.str.4 = [15 x i8] c"SATA_AXI_W_ERR\00"
@.str.5 = [15 x i8] c"SATA_AXI_R_ERR\00"
@.str.6 = [14 x i8] c"DQE_AXI_R_ERR\00"
@.str.7 = [14 x i8] c"CQE_AXI_W_ERR\00"
@.str.8 = [15 x i8] c"CQE_WINFO_FIFO\00"
@.str.9 = [14 x i8] c"CQE_MSG_FIFIO\00"
@.str.10 = [12 x i8] c"GETDQE_FIFO\00"
@.str.11 = [10 x i8] c"CMDP_FIFO\00"
@.str.12 = [13 x i8] c"AWTCTRL_FIFO\00"
@.str.13 = [14 x i8] c"unknown error\00"
define i8* @sas_axi_err_type(i32 %0) {
switch i32 %0, label %14 [
i32 1, label %15
i32 2, label %2
i32 4, label %3
i32 8, label %4
i32 16, label %5
i32 32, label %6
i32 64, label %7
i32 128, label %8
i32 256, label %9
i32 512, label %10
i32 1024, label %11
i32 2048, label %12
i32 4096, 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 ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), %14 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), %13 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([14 x i8], [14 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 ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([15 x i8], [15 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 ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %16
}