const char *rsl_nodetypestr(int type) {
  static const char *types[] = {
      "none",  "set",       "if",   "else",      "elseif",
      "endif", "and",       "or",   "equal",     "notequal",
      "less",  "lessequal", "grtr", "grtrequal", "nonzero",
  };
  if (type < 0 || type >= sizeof(types) / sizeof(types[0]))
    return "<unknown>";
  return types[type];
}


x86 assembly (clang, -O0):
<rsl_nodetypestr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     111f <rsl_nodetypestr+0x1f>
movslq -0xc(%rbp),%rax
cmp    $0xf,%rax
jb     112f <rsl_nodetypestr+0x2f>
lea    0xf2b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1142 <rsl_nodetypestr+0x42>
movslq -0xc(%rbp),%rcx
lea    0x2ef6(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rsl_nodetypestr>:
cmp    $0xe,%edi
jbe    110d <rsl_nodetypestr+0xd>
lea    0xf81(%rip),%rax
ret
mov    %edi,%eax
lea    0xeea(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@rsl_nodetypestr.types = internal global [15 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i32 0, i32 0)]
@.str = [5 x i8] c"none\00"
@.str.1 = [4 x i8] c"set\00"
@.str.2 = [3 x i8] c"if\00"
@.str.3 = [5 x i8] c"else\00"
@.str.4 = [7 x i8] c"elseif\00"
@.str.5 = [6 x i8] c"endif\00"
@.str.6 = [4 x i8] c"and\00"
@.str.7 = [3 x i8] c"or\00"
@.str.8 = [6 x i8] c"equal\00"
@.str.9 = [9 x i8] c"notequal\00"
@.str.10 = [5 x i8] c"less\00"
@.str.11 = [10 x i8] c"lessequal\00"
@.str.12 = [5 x i8] c"grtr\00"
@.str.13 = [10 x i8] c"grtrequal\00"
@.str.14 = [8 x i8] c"nonzero\00"
@.str.15 = [10 x i8] c"<unknown>\00"
define i8* @rsl_nodetypestr(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = icmp uge i64 %8, 15
br i1 %9, label %10, label %11
10: ; preds = %6, %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %16
11: ; preds = %6
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [15 x i8*], [15 x i8*]* @rsl_nodetypestr.types, i64 0, i64 %13
%15 = load i8*, i8** %14
store i8* %15, i8** %2
br label %16
16: ; preds = %11, %10
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
@reltable.rsl_nodetypestr = internal unnamed_addr constant [15 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([15 x i32]* @reltable.rsl_nodetypestr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([15 x i32]* @reltable.rsl_nodetypestr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.2 to i64), i64 ptrtoint ([15 x i32]* @reltable.rsl_nodetypestr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.3 to i64), i64 ptrtoint ([15 x i32]* @reltable.rsl_nodetypestr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([15 x i32]* @reltable.rsl_nodetypestr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.5 to i64), i64 ptrtoint ([15 x i32]* @reltable.rsl_nodetypestr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.6 to i64), i64 ptrtoint ([15 x i32]* @reltable.rsl_nodetypestr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.7 to i64), i64 ptrtoint ([15 x i32]* @reltable.rsl_nodetypestr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.8 to i64), i64 ptrtoint ([15 x i32]* @reltable.rsl_nodetypestr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.9 to i64), i64 ptrtoint ([15 x i32]* @reltable.rsl_nodetypestr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.10 to i64), i64 ptrtoint ([15 x i32]* @reltable.rsl_nodetypestr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.11 to i64), i64 ptrtoint ([15 x i32]* @reltable.rsl_nodetypestr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.12 to i64), i64 ptrtoint ([15 x i32]* @reltable.rsl_nodetypestr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.13 to i64), i64 ptrtoint ([15 x i32]* @reltable.rsl_nodetypestr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.14 to i64), i64 ptrtoint ([15 x i32]* @reltable.rsl_nodetypestr to i64)) to i32)]
@.str = [5 x i8] c"none\00"
@.str.1 = [4 x i8] c"set\00"
@.str.2 = [3 x i8] c"if\00"
@.str.3 = [5 x i8] c"else\00"
@.str.4 = [7 x i8] c"elseif\00"
@.str.5 = [6 x i8] c"endif\00"
@.str.6 = [4 x i8] c"and\00"
@.str.7 = [3 x i8] c"or\00"
@.str.8 = [6 x i8] c"equal\00"
@.str.9 = [9 x i8] c"notequal\00"
@.str.10 = [5 x i8] c"less\00"
@.str.11 = [10 x i8] c"lessequal\00"
@.str.12 = [5 x i8] c"grtr\00"
@.str.13 = [10 x i8] c"grtrequal\00"
@.str.14 = [8 x i8] c"nonzero\00"
@.str.15 = [10 x i8] c"<unknown>\00"
define i8* @rsl_nodetypestr(i32 %0) {
%2 = icmp ugt i32 %0, 14
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 ([15 x i32]* @reltable.rsl_nodetypestr to i8*), i64 %5)
br label %7
7: ; preds = %1, %3
%8 = phi i8* [ %6, %3 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0), %1 ]
ret i8* %8
}