int lsda_util_id2kind(int type_id) {
  switch (type_id) {
  case 1:
  case 2:
  case 3:
  case 4:
  case 12:
  case 13:
  case 14:
  case 20:
    return 12;
  case 5:
  case 6:
  case 7:
  case 8:
  case 15:
  case 16:
  case 17:
    return 15;
  case 9:
  case 10:
  case 18:
  case 19:
  case 21:
  case 22:
    return 18;
  }
  return 0;
}


x86 assembly (clang, -O0):
<lsda_util_id2kind>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffff,%eax
sub    $0x4,%eax
jb     11a7 <lsda_util_id2kind+0xa7>
jmp    111e <lsda_util_id2kind+0x1e>
mov    -0xc(%rbp),%eax
add    $0xfffffffb,%eax
sub    $0x4,%eax
jb     11b3 <lsda_util_id2kind+0xb3>
jmp    1132 <lsda_util_id2kind+0x32>
mov    -0xc(%rbp),%eax
add    $0xfffffff7,%eax
sub    $0x2,%eax
jb     11bf <lsda_util_id2kind+0xbf>
jmp    1146 <lsda_util_id2kind+0x46>
mov    -0xc(%rbp),%eax
add    $0xfffffff4,%eax
sub    $0x3,%eax
jb     11a7 <lsda_util_id2kind+0xa7>
jmp    115a <lsda_util_id2kind+0x5a>
mov    -0xc(%rbp),%eax
add    $0xfffffff1,%eax
sub    $0x3,%eax
jb     11b3 <lsda_util_id2kind+0xb3>
jmp    116e <lsda_util_id2kind+0x6e>
mov    -0xc(%rbp),%eax
add    $0xffffffee,%eax
sub    $0x2,%eax
jb     11bf <lsda_util_id2kind+0xbf>
jmp    1182 <lsda_util_id2kind+0x82>
mov    -0xc(%rbp),%eax
sub    $0x14,%eax
je     11a7 <lsda_util_id2kind+0xa7>
jmp    1193 <lsda_util_id2kind+0x93>
mov    -0xc(%rbp),%eax
add    $0xffffffeb,%eax
sub    $0x2,%eax
jb     11bf <lsda_util_id2kind+0xbf>
jmp    11cb <lsda_util_id2kind+0xcb>
movl   $0xc,-0x4(%rbp)
jmp    11d2 <lsda_util_id2kind+0xd2>
movl   $0xf,-0x4(%rbp)
jmp    11d2 <lsda_util_id2kind+0xd2>
movl   $0x12,-0x4(%rbp)
jmp    11d2 <lsda_util_id2kind+0xd2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

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