const char *classname(int class) {
  if (class == 1)
    return "IN";
  else if (class == 3)
    return "CH";
  else if (class == 4)
    return "HS";
  else if (class == 0xFE)
    return "NO";
  else if (class == 0xFF)
    return "AY";
  else if (class > 0xFF00 && class < 0xFFFF)
    return "PV";
  else if (class == 0 || class == 0xFFFF)
    return "RV";
  else
    return "UN";
}


x86 assembly (clang, -O0):
<classname>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1121 <classname+0x21>
lea    0xee8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11eb <classname+0xeb>
cmpl   $0x3,-0xc(%rbp)
jne    113b <classname+0x3b>
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11eb <classname+0xeb>
cmpl   $0x4,-0xc(%rbp)
jne    1155 <classname+0x55>
lea    0xeba(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11eb <classname+0xeb>
cmpl   $0xfe,-0xc(%rbp)
jne    1172 <classname+0x72>
lea    0xea0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11eb <classname+0xeb>
cmpl   $0xff,-0xc(%rbp)
jne    118f <classname+0x8f>
lea    0xe86(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11eb <classname+0xeb>
cmpl   $0xff00,-0xc(%rbp)
jle    11b9 <classname+0xb9>
cmpl   $0xffff,-0xc(%rbp)
jge    11b9 <classname+0xb9>
lea    0xe5f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11eb <classname+0xeb>
cmpl   $0x0,-0xc(%rbp)
je     11d0 <classname+0xd0>
cmpl   $0xffff,-0xc(%rbp)
jne    11e0 <classname+0xe0>
lea    0xe3b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11eb <classname+0xeb>
lea    0xe2e(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<classname>:
cmp    $0x3,%edi
jle    1122 <classname+0x22>
cmp    $0x4,%edi
je     1134 <classname+0x34>
cmp    $0xfe,%edi
je     113c <classname+0x3c>
cmp    $0xff,%edi
jne    114c <classname+0x4c>
lea    0xeeb(%rip),%rax
ret
cmp    $0x1,%edi
je     1144 <classname+0x44>
cmp    $0x3,%edi
jne    114c <classname+0x4c>
lea    0xed0(%rip),%rax
ret
lea    0xecb(%rip),%rax
ret
lea    0xec6(%rip),%rax
ret
lea    0xeb5(%rip),%rax
ret
lea    -0xff01(%rdi),%eax
cmp    $0xfe,%eax
jae    1161 <classname+0x61>
lea    0xeaf(%rip),%rax
ret
test   %edi,%edi
lea    0xea8(%rip),%rcx
lea    0xea4(%rip),%rax
cmove  %rcx,%rax
cmp    $0xffff,%edi
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"IN\00"
@.str.1 = [3 x i8] c"CH\00"
@.str.2 = [3 x i8] c"HS\00"
@.str.3 = [3 x i8] c"NO\00"
@.str.4 = [3 x i8] c"AY\00"
@.str.5 = [3 x i8] c"PV\00"
@.str.6 = [3 x i8] c"RV\00"
@.str.7 = [3 x i8] c"UN\00"
define i8* @classname(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %38
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 3
br i1 %9, label %10, label %11
10: ; preds = %7
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %38
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 4
br i1 %13, label %14, label %15
14: ; preds = %11
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %38
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 254
br i1 %17, label %18, label %19
18: ; preds = %15
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %38
19: ; preds = %15
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 255
br i1 %21, label %22, label %23
22: ; preds = %19
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %38
23: ; preds = %19
%24 = load i32, i32* %3
%25 = icmp sgt i32 %24, 65280
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = load i32, i32* %3
%28 = icmp slt i32 %27, 65535
br i1 %28, label %29, label %30
29: ; preds = %26
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %38
30: ; preds = %26, %23
%31 = load i32, i32* %3
%32 = icmp eq i32 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = load i32, i32* %3
%35 = icmp eq i32 %34, 65535
br i1 %35, label %36, label %37
36: ; preds = %33, %30
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %38
37: ; preds = %33
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %38
38: ; preds = %37, %36, %29, %22, %18, %14, %10, %6
%39 = load i8*, i8** %2
ret i8* %39
}

LLVM IR (-O2):
@.str = [3 x i8] c"IN\00"
@.str.1 = [3 x i8] c"CH\00"
@.str.2 = [3 x i8] c"HS\00"
@.str.3 = [3 x i8] c"NO\00"
@.str.4 = [3 x i8] c"AY\00"
@.str.5 = [3 x i8] c"PV\00"
@.str.6 = [3 x i8] c"RV\00"
@.str.7 = [3 x i8] c"UN\00"
define i8* @classname(i32 %0) {
switch i32 %0, label %6 [
i32 1, label %14
i32 3, label %2
i32 4, label %3
i32 254, label %4
i32 255, label %5
]
2: ; preds = %1
br label %14
3: ; preds = %1
br label %14
4: ; preds = %1
br label %14
5: ; preds = %1
br label %14
6: ; preds = %1
%7 = add i32 %0, -65281
%8 = icmp ult i32 %7, 254
br i1 %8, label %14, label %9
9: ; preds = %6
%10 = icmp eq i32 %0, 65535
%11 = icmp eq i32 %0, 0
%12 = or i1 %10, %11
%13 = select i1 %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
br label %14
14: ; preds = %9, %6, %1, %5, %4, %3, %2
%15 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %6 ], [ %13, %9 ]
ret i8* %15
}