int mspack_version(int entity) {
  switch (entity) {
  case (4):
  case (2):
  case (14):
    return 2;
  case (0):
  case (1):
  case (10):
  case (12):
    return 1;
  case (3):
  case (5):
  case (6):
  case (7):
  case (8):
  case (9):
  case (11):
  case (13):
  case (15):
    return 0;
  }
  return -1;
}


x86 assembly (clang, -O0):
<mspack_version>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x2,%eax
jb     11d4 <mspack_version+0xd4>
jmp    111b <mspack_version+0x1b>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11c8 <mspack_version+0xc8>
jmp    112c <mspack_version+0x2c>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     11e0 <mspack_version+0xe0>
jmp    113d <mspack_version+0x3d>
mov    -0xc(%rbp),%eax
sub    $0x4,%eax
je     11c8 <mspack_version+0xc8>
jmp    114e <mspack_version+0x4e>
mov    -0xc(%rbp),%eax
add    $0xfffffffb,%eax
sub    $0x5,%eax
jb     11e0 <mspack_version+0xe0>
jmp    1162 <mspack_version+0x62>
mov    -0xc(%rbp),%eax
sub    $0xa,%eax
je     11d4 <mspack_version+0xd4>
jmp    1173 <mspack_version+0x73>
mov    -0xc(%rbp),%eax
sub    $0xb,%eax
je     11e0 <mspack_version+0xe0>
jmp    1184 <mspack_version+0x84>
mov    -0xc(%rbp),%eax
sub    $0xc,%eax
je     11d4 <mspack_version+0xd4>
jmp    1195 <mspack_version+0x95>
mov    -0xc(%rbp),%eax
sub    $0xd,%eax
je     11e0 <mspack_version+0xe0>
jmp    11a6 <mspack_version+0xa6>
mov    -0xc(%rbp),%eax
sub    $0xe,%eax
je     11c8 <mspack_version+0xc8>
jmp    11b7 <mspack_version+0xb7>
mov    -0xc(%rbp),%eax
sub    $0xf,%eax
je     11e0 <mspack_version+0xe0>
jmp    11ec <mspack_version+0xec>
movl   $0x2,-0x4(%rbp)
jmp    11f3 <mspack_version+0xf3>
movl   $0x1,-0x4(%rbp)
jmp    11f3 <mspack_version+0xf3>
movl   $0x0,-0x4(%rbp)
jmp    11f3 <mspack_version+0xf3>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mspack_version>:
mov    $0xffffffff,%eax
cmp    $0xf,%edi
ja     1117 <mspack_version+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @mspack_version(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 4, label %5
i32 2, label %5
i32 14, label %5
i32 0, label %6
i32 1, label %6
i32 10, label %6
i32 12, label %6
i32 3, label %7
i32 5, label %7
i32 6, label %7
i32 7, label %7
i32 8, label %7
i32 9, label %7
i32 11, label %7
i32 13, label %7
i32 15, label %7
]
5: ; preds = %1, %1, %1
store i32 2, i32* %2
br label %9
6: ; preds = %1, %1, %1, %1
store i32 1, i32* %2
br label %9
7: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1
store i32 0, i32* %2
br label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %9
9: ; preds = %8, %7, %6, %5
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@switch.table.mspack_version = [16 x i32] [i32 1, i32 1, i32 2, i32 0, i32 2, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 2, i32 0]
define i32 @mspack_version(i32 %0) {
%2 = icmp ult i32 %0, 16
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [16 x i32], [16 x i32]* @switch.table.mspack_version, i64 0, i64 %4
%6 = load i32, i32* %5
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ -1, %1 ]
ret i32 %8
}