const char *status2str(int status) {
  switch (status) {
  case 0x0000:
    return "NULL";
  case 0x0606:
    return "READY";
  case 0x1414:
    return "BUSY";
  case 0x1515:
    return "ERR";
  default:
    return "???";
  }
}


x86 assembly (clang, -O0):
<status2str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     1153 <status2str+0x53>
jmp    111a <status2str+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x606,%eax
je     1163 <status2str+0x63>
jmp    112d <status2str+0x2d>
mov    -0x10(%rbp),%eax
sub    $0x1414,%eax
je     1173 <status2str+0x73>
jmp    1140 <status2str+0x40>
mov    -0x10(%rbp),%eax
sub    $0x1515,%eax
je     1183 <status2str+0x83>
jmp    1193 <status2str+0x93>
lea    0xea6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119e <status2str+0x9e>
lea    0xe9b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119e <status2str+0x9e>
lea    0xe91(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119e <status2str+0x9e>
lea    0xe86(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119e <status2str+0x9e>
lea    0xe7a(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<status2str>:
cmp    $0x1413,%edi
jg     111c <status2str+0x1c>
test   %edi,%edi
je     113c <status2str+0x3c>
cmp    $0x606,%edi
jne    1134 <status2str+0x34>
lea    0xeea(%rip),%rax
ret
cmp    $0x1414,%edi
je     1144 <status2str+0x44>
cmp    $0x1515,%edi
jne    1134 <status2str+0x34>
lea    0xedd(%rip),%rax
ret
lea    0xed9(%rip),%rax
ret
lea    0xebd(%rip),%rax
ret
lea    0xec0(%rip),%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"NULL\00"
@.str.1 = [6 x i8] c"READY\00"
@.str.2 = [5 x i8] c"BUSY\00"
@.str.3 = [4 x i8] c"ERR\00"
@.str.4 = [4 x i8] c"???\00"
define i8* @status2str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %9 [
i32 0, label %5
i32 1542, label %6
i32 5140, label %7
i32 5397, label %8
]
5: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %10
6: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %10
7: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %10
8: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %10
9: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %10
10: ; preds = %9, %8, %7, %6, %5
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
@.str = [5 x i8] c"NULL\00"
@.str.1 = [6 x i8] c"READY\00"
@.str.2 = [5 x i8] c"BUSY\00"
@.str.3 = [4 x i8] c"ERR\00"
@.str.4 = [4 x i8] c"???\00"
define i8* @status2str(i32 %0) {
switch i32 %0, label %5 [
i32 0, label %6
i32 1542, label %2
i32 5140, label %3
i32 5397, label %4
]
2: ; preds = %1
br label %6
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %5, %4, %3, %2
%7 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %7
}