const char *profile_stringify(unsigned int profile) {
  static const char na[] = "n.a.";
  static const char *Names[] = {na,           "Experimental",
                                na,           na,
                                na,           na,
                                na,           "Telephone",
                                "Thumb",      "Radio",
                                "Standard",   "Xtreme",
                                "Insane",     "BrainDead",
                                "BrainDead+", "BrainDead++"};
  return profile >= sizeof(Names) / sizeof(*Names) ? na : Names[profile];
}


x86 assembly (clang, -O0):
<profile_stringify>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    $0x10,%rax
jb     1124 <profile_stringify+0x24>
lea    0xee5(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1138 <profile_stringify+0x38>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0x2f00(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<profile_stringify>:
cmp    $0xf,%edi
jbe    110d <profile_stringify+0xd>
lea    0xef4(%rip),%rax
ret
mov    %edi,%eax
lea    0xef2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@profile_stringify.na = internal constant [5 x i8] c"n.a.\00"
@profile_stringify.Names = internal global [16 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @profile_stringify.na, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @profile_stringify.na, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @profile_stringify.na, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @profile_stringify.na, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @profile_stringify.na, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @profile_stringify.na, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 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 ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i32 0, i32 0)]
@.str = [13 x i8] c"Experimental\00"
@.str.1 = [10 x i8] c"Telephone\00"
@.str.2 = [6 x i8] c"Thumb\00"
@.str.3 = [6 x i8] c"Radio\00"
@.str.4 = [9 x i8] c"Standard\00"
@.str.5 = [7 x i8] c"Xtreme\00"
@.str.6 = [7 x i8] c"Insane\00"
@.str.7 = [10 x i8] c"BrainDead\00"
@.str.8 = [11 x i8] c"BrainDead+\00"
@.str.9 = [12 x i8] c"BrainDead++\00"
define i8* @profile_stringify(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = zext i32 %3 to i64
%5 = icmp uge i64 %4, 16
br i1 %5, label %6, label %7
6: ; preds = %1
br label %12
7: ; preds = %1
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [16 x i8*], [16 x i8*]* @profile_stringify.Names, i64 0, i64 %9
%11 = load i8*, i8** %10
br label %12
12: ; preds = %7, %6
%13 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @profile_stringify.na, i64 0, i64 0), %6 ], [ %11, %7 ]
ret i8* %13
}

LLVM IR (-O2):
@profile_stringify.na = internal constant [5 x i8] c"n.a.\00"
@reltable.profile_stringify = internal unnamed_addr constant [16 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @profile_stringify.na to i64), i64 ptrtoint ([16 x i32]* @reltable.profile_stringify to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str to i64), i64 ptrtoint ([16 x i32]* @reltable.profile_stringify to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @profile_stringify.na to i64), i64 ptrtoint ([16 x i32]* @reltable.profile_stringify to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @profile_stringify.na to i64), i64 ptrtoint ([16 x i32]* @reltable.profile_stringify to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @profile_stringify.na to i64), i64 ptrtoint ([16 x i32]* @reltable.profile_stringify to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @profile_stringify.na to i64), i64 ptrtoint ([16 x i32]* @reltable.profile_stringify to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @profile_stringify.na to i64), i64 ptrtoint ([16 x i32]* @reltable.profile_stringify to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.1 to i64), i64 ptrtoint ([16 x i32]* @reltable.profile_stringify to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.2 to i64), i64 ptrtoint ([16 x i32]* @reltable.profile_stringify to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.3 to i64), i64 ptrtoint ([16 x i32]* @reltable.profile_stringify to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.4 to i64), i64 ptrtoint ([16 x i32]* @reltable.profile_stringify to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.5 to i64), i64 ptrtoint ([16 x i32]* @reltable.profile_stringify to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.6 to i64), i64 ptrtoint ([16 x i32]* @reltable.profile_stringify to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.7 to i64), i64 ptrtoint ([16 x i32]* @reltable.profile_stringify to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.8 to i64), i64 ptrtoint ([16 x i32]* @reltable.profile_stringify to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.9 to i64), i64 ptrtoint ([16 x i32]* @reltable.profile_stringify to i64)) to i32)]
@.str = [13 x i8] c"Experimental\00"
@.str.1 = [10 x i8] c"Telephone\00"
@.str.2 = [6 x i8] c"Thumb\00"
@.str.3 = [6 x i8] c"Radio\00"
@.str.4 = [9 x i8] c"Standard\00"
@.str.5 = [7 x i8] c"Xtreme\00"
@.str.6 = [7 x i8] c"Insane\00"
@.str.7 = [10 x i8] c"BrainDead\00"
@.str.8 = [11 x i8] c"BrainDead+\00"
@.str.9 = [12 x i8] c"BrainDead++\00"
define i8* @profile_stringify(i32 %0) {
%2 = icmp ugt i32 %0, 15
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = zext i32 %0 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([16 x i32]* @reltable.profile_stringify to i8*), i64 %5)
br label %7
7: ; preds = %1, %3
%8 = phi i8* [ %6, %3 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @profile_stringify.na, i64 0, i64 0), %1 ]
ret i8* %8
}