char *parse_priv(unsigned char c) {
  char *p;
  c = (c & 0x0f);
  switch (c) {
  case 1:
    p = "Callback";
    break;
  case 2:
    p = "User  ";
    break;
  case 3:
    p = "Operator";
    break;
  case 4:
    p = "Admin ";
    break;
  case 5:
    p = "OEM   ";
    break;
  case 0x0f:
    p = "No access";
    break;
  default:
    p = "Reserved";
  }
  return (p);
}


x86 assembly (clang, -O0):
<parse_priv>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0xf,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xe,%eax
ja     119c <parse_priv+0x9c>
mov    -0x18(%rbp),%rax
lea    0xecd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xef9(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11a7 <parse_priv+0xa7>
lea    0xef2(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11a7 <parse_priv+0xa7>
lea    0xee9(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11a7 <parse_priv+0xa7>
lea    0xee2(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11a7 <parse_priv+0xa7>
lea    0xed9(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11a7 <parse_priv+0xa7>
lea    0xed0(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11a7 <parse_priv+0xa7>
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_priv>:
and    $0xf,%edi
add    $0xffffffff,%edi
cmp    $0xe,%edi
ja     111d <parse_priv+0x1d>
movslq %edi,%rax
lea    0xf27(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xf0d(%rip),%rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Callback\00"
@.str.1 = [7 x i8] c"User \00"
@.str.2 = [9 x i8] c"Operator\00"
@.str.3 = [7 x i8] c"Admin \00"
@.str.4 = [7 x i8] c"OEM \00"
@.str.5 = [10 x i8] c"No access\00"
@.str.6 = [9 x i8] c"Reserved\00"
define i8* @parse_priv(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8*
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = and i32 %5, 15
%7 = trunc i32 %6 to i8
store i8 %7, i8* %2
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
switch i32 %9, label %16 [
i32 1, label %10
i32 2, label %11
i32 3, label %12
i32 4, label %13
i32 5, label %14
i32 15, label %15
]
10: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %3
br label %17
11: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %17
12: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %17
13: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %17
14: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8** %3
br label %17
15: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8** %3
br label %17
16: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8** %3
br label %17
17: ; preds = %16, %15, %14, %13, %12, %11, %10
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
@.str = [9 x i8] c"Callback\00"
@.str.1 = [7 x i8] c"User \00"
@.str.2 = [9 x i8] c"Operator\00"
@.str.3 = [7 x i8] c"Admin \00"
@.str.4 = [7 x i8] c"OEM \00"
@.str.5 = [10 x i8] c"No access\00"
@.str.6 = [9 x i8] c"Reserved\00"
@reltable.parse_priv = [15 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str to i64), i64 ptrtoint ([15 x i32]* @reltable.parse_priv to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.1 to i64), i64 ptrtoint ([15 x i32]* @reltable.parse_priv to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.2 to i64), i64 ptrtoint ([15 x i32]* @reltable.parse_priv to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.3 to i64), i64 ptrtoint ([15 x i32]* @reltable.parse_priv to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([15 x i32]* @reltable.parse_priv to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.6 to i64), i64 ptrtoint ([15 x i32]* @reltable.parse_priv to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.6 to i64), i64 ptrtoint ([15 x i32]* @reltable.parse_priv to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.6 to i64), i64 ptrtoint ([15 x i32]* @reltable.parse_priv to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.6 to i64), i64 ptrtoint ([15 x i32]* @reltable.parse_priv to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.6 to i64), i64 ptrtoint ([15 x i32]* @reltable.parse_priv to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.6 to i64), i64 ptrtoint ([15 x i32]* @reltable.parse_priv to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.6 to i64), i64 ptrtoint ([15 x i32]* @reltable.parse_priv to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.6 to i64), i64 ptrtoint ([15 x i32]* @reltable.parse_priv to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.6 to i64), i64 ptrtoint ([15 x i32]* @reltable.parse_priv to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.5 to i64), i64 ptrtoint ([15 x i32]* @reltable.parse_priv to i64)) to i32)]
define i8* @parse_priv(i8 zeroext %0) {
%2 = and i8 %0, 15
%3 = zext i8 %2 to i32
%4 = add nsw i32 %3, -1
%5 = icmp ult i32 %4, 15
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = sext i32 %4 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([15 x i32]* @reltable.parse_priv to i8*), i64 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), %1 ]
ret i8* %11
}