const char *name_option(long type) {
  const char *at[] = {"unknown", "integer", "float",  "string",
                      "boolean", "file",    "outfile"};
  if ((type & 0x00000fff) <= 6) {
    return at[type & 0x00000fff];
  }
  return at[0];
}


x86 assembly (clang, -O0):
<name_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0x2cb9(%rip),%rsi
mov    $0x38,%edx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%rax
and    $0xfff,%rax
cmp    $0x6,%rax
jg     115d <name_option+0x4d>
mov    -0x10(%rbp),%rax
and    $0xfff,%rax
mov    -0x50(%rbp,%rax,8),%rax
mov    %rax,-0x8(%rbp)
jmp    1165 <name_option+0x55>
mov    -0x50(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<name_option>:
and    $0xfff,%edi
cmp    $0x6,%rdi
ja     111b <name_option+0x1b>
lea    0xf1d(%rip),%rcx
movslq (%rcx,%rdi,4),%rax
add    %rcx,%rax
ret
lea    0xede(%rip),%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"unknown\00"
@.str.1 = [8 x i8] c"integer\00"
@.str.2 = [6 x i8] c"float\00"
@.str.3 = [7 x i8] c"string\00"
@.str.4 = [8 x i8] c"boolean\00"
@.str.5 = [5 x i8] c"file\00"
@.str.6 = [8 x i8] c"outfile\00"
@__const.name_option.at = [7 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i32 0, i32 0)]
define i8* @name_option(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca [7 x i8*]
store i64 %0, i64* %3
%5 = bitcast [7 x i8*]* %4 to i8*
%6 = load i64, i64* %3
%7 = and i64 %6, 4095
%8 = icmp sle i64 %7, 6
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i64, i64* %3
%11 = and i64 %10, 4095
%12 = getelementptr inbounds [7 x i8*], [7 x i8*]* %4, i64 0, i64 %11
%13 = load i8*, i8** %12
store i8* %13, i8** %2
br label %17
14: ; preds = %1
%15 = getelementptr inbounds [7 x i8*], [7 x i8*]* %4, i64 0, i64 0
%16 = load i8*, i8** %15
store i8* %16, i8** %2
br label %17
17: ; preds = %14, %9
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
@.str = [8 x i8] c"unknown\00"
@.str.1 = [8 x i8] c"integer\00"
@.str.2 = [6 x i8] c"float\00"
@.str.3 = [7 x i8] c"string\00"
@.str.4 = [8 x i8] c"boolean\00"
@.str.5 = [5 x i8] c"file\00"
@.str.6 = [8 x i8] c"outfile\00"
@reltable.name_option = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.name_option to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.name_option to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.name_option to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.name_option to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.name_option to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.name_option to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.name_option to i64)) to i32)]
define i8* @name_option(i64 %0) {
%2 = and i64 %0, 4095
%3 = icmp ult i64 %2, 7
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = shl i64 %2, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.name_option to i8*), i64 %5)
br label %7
7: ; preds = %1, %4
%8 = phi i8* [ %6, %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %8
}