char *sas_err_type(int etype) {
  switch (etype) {
  case 0x0001:
    return "hgc_dqe ecc";
  case 0x0002:
    return "hgc_iost ecc";
  case 0x0004:
    return "hgc_itct ecc";
  case 0x0008:
    return "hgc_iostl ecc";
  case 0x0010:
    return "hgc_itctl ecc";
  case 0x0020:
    return "hgc_cqe ecc";
  case 0x0040:
    return "rxm_mem0 ecc";
  case 0x0080:
    return "rxm_mem1 ecc";
  case 0x0100:
    return "rxm_mem2 ecc";
  case 0x0200:
    return "rxm_mem3 ecc";
  case 0x0400:
    return "wp_depth";
  case 0x0800:
    return "iptt_slot_no_match";
  case 0x1000:
    return "rp_depth";
  case 0x2000:
    return "axi err";
  case 0x4000:
    return "fifo err";
  case 0x8000:
    return "lm_add_fetch_list";
  case 0x10000:
    return "hgc_abt_fetch_lm";
  }
  return "unknown error";
}


x86 assembly (clang, -O0):
<sas_err_type>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     123f <sas_err_type+0x13f>
jmp    111b <sas_err_type+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     124f <sas_err_type+0x14f>
jmp    112c <sas_err_type+0x2c>
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
je     125f <sas_err_type+0x15f>
jmp    113d <sas_err_type+0x3d>
mov    -0x10(%rbp),%eax
sub    $0x8,%eax
je     126f <sas_err_type+0x16f>
jmp    114e <sas_err_type+0x4e>
mov    -0x10(%rbp),%eax
sub    $0x10,%eax
je     127f <sas_err_type+0x17f>
jmp    115f <sas_err_type+0x5f>
mov    -0x10(%rbp),%eax
sub    $0x20,%eax
je     128f <sas_err_type+0x18f>
jmp    1170 <sas_err_type+0x70>
mov    -0x10(%rbp),%eax
sub    $0x40,%eax
je     129f <sas_err_type+0x19f>
jmp    1181 <sas_err_type+0x81>
mov    -0x10(%rbp),%eax
sub    $0x80,%eax
je     12af <sas_err_type+0x1af>
jmp    1194 <sas_err_type+0x94>
mov    -0x10(%rbp),%eax
sub    $0x100,%eax
je     12bf <sas_err_type+0x1bf>
jmp    11a7 <sas_err_type+0xa7>
mov    -0x10(%rbp),%eax
sub    $0x200,%eax
je     12cf <sas_err_type+0x1cf>
jmp    11ba <sas_err_type+0xba>
mov    -0x10(%rbp),%eax
sub    $0x400,%eax
je     12df <sas_err_type+0x1df>
jmp    11cd <sas_err_type+0xcd>
mov    -0x10(%rbp),%eax
sub    $0x800,%eax
je     12ef <sas_err_type+0x1ef>
jmp    11e0 <sas_err_type+0xe0>
mov    -0x10(%rbp),%eax
sub    $0x1000,%eax
je     12ff <sas_err_type+0x1ff>
jmp    11f3 <sas_err_type+0xf3>
mov    -0x10(%rbp),%eax
sub    $0x2000,%eax
je     130f <sas_err_type+0x20f>
jmp    1206 <sas_err_type+0x106>
mov    -0x10(%rbp),%eax
sub    $0x4000,%eax
je     131f <sas_err_type+0x21f>
jmp    1219 <sas_err_type+0x119>
mov    -0x10(%rbp),%eax
sub    $0x8000,%eax
je     132f <sas_err_type+0x22f>
jmp    122c <sas_err_type+0x12c>
mov    -0x10(%rbp),%eax
sub    $0x10000,%eax
je     133f <sas_err_type+0x23f>
jmp    134f <sas_err_type+0x24f>
lea    0xdba(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xdb6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xdb3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xdb0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xdae(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xdac(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xda8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xda5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xda2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xd9f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xd9c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xd95(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xd98(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xd91(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xd89(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xd82(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xd84(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    135a <sas_err_type+0x25a>
lea    0xd85(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sas_err_type>:
cmp    $0xff,%edi
jle    1144 <sas_err_type+0x44>
cmp    $0xfff,%edi
jle    116b <sas_err_type+0x6b>
cmp    $0x3fff,%edi
jle    1193 <sas_err_type+0x93>
cmp    $0x4000,%edi
je     11d7 <sas_err_type+0xd7>
cmp    $0x8000,%edi
je     11df <sas_err_type+0xdf>
cmp    $0x10000,%edi
jne    1227 <sas_err_type+0x127>
lea    0x1087(%rip),%rax
ret
lea    -0x1(%rdi),%ecx
cmp    $0x3f,%ecx
ja     11c7 <sas_err_type+0xc7>
lea    0xfad(%rip),%rax
lea    0xea6(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0xfa2(%rip),%rax
ret
cmp    $0x3ff,%edi
jg     11af <sas_err_type+0xaf>
cmp    $0x100,%edi
je     120f <sas_err_type+0x10f>
cmp    $0x200,%edi
jne    1227 <sas_err_type+0x127>
lea    0xfe3(%rip),%rax
ret
cmp    $0x1000,%edi
je     1217 <sas_err_type+0x117>
cmp    $0x2000,%edi
jne    1227 <sas_err_type+0x127>
lea    0xff9(%rip),%rax
ret
cmp    $0x400,%edi
je     121f <sas_err_type+0x11f>
cmp    $0x800,%edi
jne    1227 <sas_err_type+0x127>
lea    0xfc5(%rip),%rax
ret
cmp    $0x80,%edi
jne    1227 <sas_err_type+0x127>
lea    0xf85(%rip),%rax
ret
lea    0xfd1(%rip),%rax
ret
lea    0xfd2(%rip),%rax
ret
lea    0xf2b(%rip),%rax
ret
lea    0xf30(%rip),%rax
ret
lea    0xf36(%rip),%rax
ret
lea    0xf3c(%rip),%rax
ret
lea    0xf40(%rip),%rax
ret
lea    0xf52(%rip),%rax
ret
lea    0xf80(%rip),%rax
ret
lea    0xf5c(%rip),%rax
ret
lea    0xfad(%rip),%rax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"hgc_dqe ecc\00"
@.str.1 = [13 x i8] c"hgc_iost ecc\00"
@.str.2 = [13 x i8] c"hgc_itct ecc\00"
@.str.3 = [14 x i8] c"hgc_iostl ecc\00"
@.str.4 = [14 x i8] c"hgc_itctl ecc\00"
@.str.5 = [12 x i8] c"hgc_cqe ecc\00"
@.str.6 = [13 x i8] c"rxm_mem0 ecc\00"
@.str.7 = [13 x i8] c"rxm_mem1 ecc\00"
@.str.8 = [13 x i8] c"rxm_mem2 ecc\00"
@.str.9 = [13 x i8] c"rxm_mem3 ecc\00"
@.str.10 = [9 x i8] c"wp_depth\00"
@.str.11 = [19 x i8] c"iptt_slot_no_match\00"
@.str.12 = [9 x i8] c"rp_depth\00"
@.str.13 = [8 x i8] c"axi err\00"
@.str.14 = [9 x i8] c"fifo err\00"
@.str.15 = [18 x i8] c"lm_add_fetch_list\00"
@.str.16 = [17 x i8] c"hgc_abt_fetch_lm\00"
@.str.17 = [14 x i8] c"unknown error\00"
define i8* @sas_err_type(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %22 [
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
i32 8192, label %18
i32 16384, label %19
i32 32768, label %20
i32 65536, label %21
]
5: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %2
br label %23
6: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %23
7: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %23
8: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %23
9: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %23
10: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %23
11: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %23
12: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %23
13: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %23
14: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %23
15: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %23
16: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %23
17: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %23
18: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %23
19: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %23
20: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %23
21: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.16, i64 0, i64 0), i8** %2
br label %23
22: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0), i8** %2
br label %23
23: ; preds = %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%24 = load i8*, i8** %2
ret i8* %24
}

LLVM IR (-O2):
@.str = [12 x i8] c"hgc_dqe ecc\00"
@.str.1 = [13 x i8] c"hgc_iost ecc\00"
@.str.2 = [13 x i8] c"hgc_itct ecc\00"
@.str.3 = [14 x i8] c"hgc_iostl ecc\00"
@.str.4 = [14 x i8] c"hgc_itctl ecc\00"
@.str.5 = [12 x i8] c"hgc_cqe ecc\00"
@.str.6 = [13 x i8] c"rxm_mem0 ecc\00"
@.str.7 = [13 x i8] c"rxm_mem1 ecc\00"
@.str.8 = [13 x i8] c"rxm_mem2 ecc\00"
@.str.9 = [13 x i8] c"rxm_mem3 ecc\00"
@.str.10 = [9 x i8] c"wp_depth\00"
@.str.11 = [19 x i8] c"iptt_slot_no_match\00"
@.str.12 = [9 x i8] c"rp_depth\00"
@.str.13 = [8 x i8] c"axi err\00"
@.str.14 = [9 x i8] c"fifo err\00"
@.str.15 = [18 x i8] c"lm_add_fetch_list\00"
@.str.16 = [17 x i8] c"hgc_abt_fetch_lm\00"
@.str.17 = [14 x i8] c"unknown error\00"
define i8* @sas_err_type(i32 %0) {
switch i32 %0, label %18 [
i32 1, label %19
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
i32 8192, label %14
i32 16384, label %15
i32 32768, label %16
i32 65536, label %17
]
2: ; preds = %1
br label %19
3: ; preds = %1
br label %19
4: ; preds = %1
br label %19
5: ; preds = %1
br label %19
6: ; preds = %1
br label %19
7: ; preds = %1
br label %19
8: ; preds = %1
br label %19
9: ; preds = %1
br label %19
10: ; preds = %1
br label %19
11: ; preds = %1
br label %19
12: ; preds = %1
br label %19
13: ; preds = %1
br label %19
14: ; preds = %1
br label %19
15: ; preds = %1
br label %19
16: ; preds = %1
br label %19
17: ; preds = %1
br label %19
18: ; preds = %1
br label %19
19: ; preds = %1, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%20 = phi i8* [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0), %18 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.16, i64 0, i64 0), %17 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0), %16 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), %15 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), %14 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), %13 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), %10 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([14 x i8], [14 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 ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %20
}