char *decode_type(int type) {
  switch (type) {
  case 0x00:
    return "I";
  case 0x2F:
    return "SABM";
  case 0x6F:
    return "SABME";
  case 0x43:
    return "DISC";
  case 0x0F:
    return "DM";
  case 0x63:
    return "UA";
  case 0x01:
    return "RR";
  case 0x05:
    return "RNR";
  case 0x09:
    return "REJ";
  case 0x87:
    return "FRMR";
  case 0x03:
    return "UI";
  default:
    return "[invalid]";
  }
}


x86 assembly (clang, -O0):
<decode_type>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     11c6 <decode_type+0xc6>
jmp    111a <decode_type+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     1226 <decode_type+0x126>
jmp    112b <decode_type+0x2b>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     1266 <decode_type+0x166>
jmp    113c <decode_type+0x3c>
mov    -0x10(%rbp),%eax
sub    $0x5,%eax
je     1236 <decode_type+0x136>
jmp    114d <decode_type+0x4d>
mov    -0x10(%rbp),%eax
sub    $0x9,%eax
je     1246 <decode_type+0x146>
jmp    115e <decode_type+0x5e>
mov    -0x10(%rbp),%eax
sub    $0xf,%eax
je     1206 <decode_type+0x106>
jmp    116f <decode_type+0x6f>
mov    -0x10(%rbp),%eax
sub    $0x2f,%eax
je     11d6 <decode_type+0xd6>
jmp    1180 <decode_type+0x80>
mov    -0x10(%rbp),%eax
sub    $0x43,%eax
je     11f6 <decode_type+0xf6>
jmp    1191 <decode_type+0x91>
mov    -0x10(%rbp),%eax
sub    $0x63,%eax
je     1216 <decode_type+0x116>
jmp    11a2 <decode_type+0xa2>
mov    -0x10(%rbp),%eax
sub    $0x6f,%eax
je     11e6 <decode_type+0xe6>
jmp    11b3 <decode_type+0xb3>
mov    -0x10(%rbp),%eax
sub    $0x87,%eax
je     1256 <decode_type+0x156>
jmp    1276 <decode_type+0x176>
lea    0xe5a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1281 <decode_type+0x181>
lea    0xe23(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1281 <decode_type+0x181>
lea    0xe18(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1281 <decode_type+0x181>
lea    0xe0e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1281 <decode_type+0x181>
lea    0xe03(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1281 <decode_type+0x181>
lea    0xdf6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1281 <decode_type+0x181>
lea    0xde9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1281 <decode_type+0x181>
lea    0xddc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1281 <decode_type+0x181>
lea    0xdd0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1281 <decode_type+0x181>
lea    0xdc4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1281 <decode_type+0x181>
lea    0xdb9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1281 <decode_type+0x181>
lea    0xdac(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_type>:
cmp    $0x62,%edi
jg     112b <decode_type+0x2b>
cmp    $0x43,%edi
ja     1185 <decode_type+0x85>
lea    0x1026(%rip),%rax
mov    %edi,%ecx
lea    0xee6(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0xffc(%rip),%rax
ret
cmp    $0x63,%edi
je     1175 <decode_type+0x75>
cmp    $0x6f,%edi
je     117d <decode_type+0x7d>
cmp    $0x87,%edi
jne    1185 <decode_type+0x85>
lea    0xfed(%rip),%rax
ret
lea    0xfea(%rip),%rax
ret
lea    0xfd5(%rip),%rax
ret
lea    0xfd1(%rip),%rax
ret
lea    0xfbc(%rip),%rax
ret
lea    0xfa4(%rip),%rax
ret
lea    0xfa7(%rip),%rax
ret
lea    0xfa7(%rip),%rax
ret
lea    0xf91(%rip),%rax
ret
lea    0xfad(%rip),%rax
ret

LLVM IR (-O0):
@.str = [2 x i8] c"I\00"
@.str.1 = [5 x i8] c"SABM\00"
@.str.2 = [6 x i8] c"SABME\00"
@.str.3 = [5 x i8] c"DISC\00"
@.str.4 = [3 x i8] c"DM\00"
@.str.5 = [3 x i8] c"UA\00"
@.str.6 = [3 x i8] c"RR\00"
@.str.7 = [4 x i8] c"RNR\00"
@.str.8 = [4 x i8] c"REJ\00"
@.str.9 = [5 x i8] c"FRMR\00"
@.str.10 = [3 x i8] c"UI\00"
@.str.11 = [10 x i8] c"[invalid]\00"
define i8* @decode_type(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %16 [
i32 0, label %5
i32 47, label %6
i32 111, label %7
i32 67, label %8
i32 15, label %9
i32 99, label %10
i32 1, label %11
i32 5, label %12
i32 9, label %13
i32 135, label %14
i32 3, label %15
]
5: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %2
br label %17
6: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %17
7: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %17
8: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %17
9: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %17
10: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %17
11: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %17
12: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %17
13: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %17
14: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %17
15: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %17
16: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %17
17: ; preds = %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
@.str = [2 x i8] c"I\00"
@.str.1 = [5 x i8] c"SABM\00"
@.str.2 = [6 x i8] c"SABME\00"
@.str.3 = [5 x i8] c"DISC\00"
@.str.4 = [3 x i8] c"DM\00"
@.str.5 = [3 x i8] c"UA\00"
@.str.6 = [3 x i8] c"RR\00"
@.str.7 = [4 x i8] c"RNR\00"
@.str.8 = [4 x i8] c"REJ\00"
@.str.9 = [5 x i8] c"FRMR\00"
@.str.10 = [3 x i8] c"UI\00"
@.str.11 = [10 x i8] c"[invalid]\00"
define i8* @decode_type(i32 %0) {
switch i32 %0, label %12 [
i32 0, label %13
i32 47, label %2
i32 111, label %3
i32 67, label %4
i32 15, label %5
i32 99, label %6
i32 1, label %7
i32 5, label %8
i32 9, label %9
i32 135, label %10
i32 3, label %11
]
2: ; preds = %1
br label %13
3: ; preds = %1
br label %13
4: ; preds = %1
br label %13
5: ; preds = %1
br label %13
6: ; preds = %1
br label %13
7: ; preds = %1
br label %13
8: ; preds = %1
br label %13
9: ; preds = %1
br label %13
10: ; preds = %1
br label %13
11: ; preds = %1
br label %13
12: ; preds = %1
br label %13
13: ; preds = %1, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%14 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), %10 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %14
}