const char *tree_simple_get_status_str(unsigned char evaluated) {
  if (evaluated == 6)
    return "evaluated";
  if (evaluated == 2)
    return "sent";
  if (evaluated == 1)
    return "try_sending";
  if (evaluated == 0)
    return "created";
  return "unknown";
}


x86 assembly (clang, -O0):
<tree_simple_get_status_str>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
cmp    $0x6,%eax
jne    1127 <tree_simple_get_status_str+0x27>
lea    0xee2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1189 <tree_simple_get_status_str+0x89>
movzbl -0x9(%rbp),%eax
cmp    $0x2,%eax
jne    1144 <tree_simple_get_status_str+0x44>
lea    0xecf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1189 <tree_simple_get_status_str+0x89>
movzbl -0x9(%rbp),%eax
cmp    $0x1,%eax
jne    1161 <tree_simple_get_status_str+0x61>
lea    0xeb7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1189 <tree_simple_get_status_str+0x89>
movzbl -0x9(%rbp),%eax
cmp    $0x0,%eax
jne    117e <tree_simple_get_status_str+0x7e>
lea    0xea6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1189 <tree_simple_get_status_str+0x89>
lea    0xe9e(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tree_simple_get_status_str>:
cmp    $0x6,%dil
ja     1119 <tree_simple_get_status_str+0x19>
movsbq %dil,%rax
lea    0xf1b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xf03(%rip),%rax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"evaluated\00"
@.str.1 = [5 x i8] c"sent\00"
@.str.2 = [12 x i8] c"try_sending\00"
@.str.3 = [8 x i8] c"created\00"
@.str.4 = [8 x i8] c"unknown\00"
define i8* @tree_simple_get_status_str(i8 zeroext %0) {
%2 = alloca i8*
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = icmp eq i32 %5, 6
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %2
br label %24
8: ; preds = %1
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %13
12: ; preds = %8
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %24
13: ; preds = %8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %18
17: ; preds = %13
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %24
18: ; preds = %13
%19 = load i8, i8* %3
%20 = zext i8 %19 to i32
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %24
23: ; preds = %18
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %24
24: ; preds = %23, %22, %17, %12, %7
%25 = load i8*, i8** %2
ret i8* %25
}

LLVM IR (-O2):
@.str = [10 x i8] c"evaluated\00"
@.str.1 = [5 x i8] c"sent\00"
@.str.2 = [12 x i8] c"try_sending\00"
@.str.3 = [8 x i8] c"created\00"
@.str.4 = [8 x i8] c"unknown\00"
@reltable.tree_simple_get_status_str = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.tree_simple_get_status_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.tree_simple_get_status_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.tree_simple_get_status_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.tree_simple_get_status_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.tree_simple_get_status_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.tree_simple_get_status_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.tree_simple_get_status_str to i64)) to i32)]
define i8* @tree_simple_get_status_str(i8 zeroext %0) {
%2 = icmp ult i8 %0, 7
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i8 %0 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.tree_simple_get_status_str to i8*), i64 %5)
br label %7
7: ; preds = %1, %3
%8 = phi i8* [ %6, %3 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %1 ]
ret i8* %8
}