const char *mbuftype(int type) {
  static const char *const mbufdesc[42] = {
      "ip in",     "ip out",     "ipv6 in",   "ipv6 out",  "nat in",
      "nat out",   "mp in",      "mp out",    "vj in",     "vj out",
      "icompd in", "icompd out", "compd in",  "compd out", "lqr in",
      "lqr out",   "echo in",    "echo out",  "proto in",  "proto out",
      "acf in",    "acf out",    "sync in",   "sync out",  "hdlc in",
      "hdlc out",  "async in",   "async out", "cbcp in",   "cbcp out",
      "chap in",   "chap out",   "pap in",    "pap out",   "ccp in",
      "ccp out",   "ipcp in",    "ipcp out",  "ipv6cp in", "ipv6cp out",
      "lcp in",    "lcp out"};
  return type < 0 || type >= 42 ? "unknown" : mbufdesc[type];
}


x86 assembly (clang, -O0):
<mbuftype>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     111b <mbuftype+0x1b>
cmpl   $0x2a,-0x4(%rbp)
jl     112b <mbuftype+0x2b>
lea    0x1015(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    113e <mbuftype+0x3e>
movslq -0x4(%rbp),%rcx
lea    0x2bca(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@mbuftype.mbufdesc = internal constant [42 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 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 ([8 x i8], [8 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 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 ([7 x i8], [7 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 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 ([7 x i8], [7 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.31, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.32, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.33, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.34, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.35, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.36, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.37, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.38, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.39, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.40, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.41, i32 0, i32 0)]
@.str = [6 x i8] c"ip in\00"
@.str.1 = [7 x i8] c"ip out\00"
@.str.2 = [8 x i8] c"ipv6 in\00"
@.str.3 = [9 x i8] c"ipv6 out\00"
@.str.4 = [7 x i8] c"nat in\00"
@.str.5 = [8 x i8] c"nat out\00"
@.str.6 = [6 x i8] c"mp in\00"
@.str.7 = [7 x i8] c"mp out\00"
@.str.8 = [6 x i8] c"vj in\00"
@.str.9 = [7 x i8] c"vj out\00"
@.str.10 = [10 x i8] c"icompd in\00"
@.str.11 = [11 x i8] c"icompd out\00"
@.str.12 = [9 x i8] c"compd in\00"
@.str.13 = [10 x i8] c"compd out\00"
@.str.14 = [7 x i8] c"lqr in\00"
@.str.15 = [8 x i8] c"lqr out\00"
@.str.16 = [8 x i8] c"echo in\00"
@.str.17 = [9 x i8] c"echo out\00"
@.str.18 = [9 x i8] c"proto in\00"
@.str.19 = [10 x i8] c"proto out\00"
@.str.20 = [7 x i8] c"acf in\00"
@.str.21 = [8 x i8] c"acf out\00"
@.str.22 = [8 x i8] c"sync in\00"
@.str.23 = [9 x i8] c"sync out\00"
@.str.24 = [8 x i8] c"hdlc in\00"
@.str.25 = [9 x i8] c"hdlc out\00"
@.str.26 = [9 x i8] c"async in\00"
@.str.27 = [10 x i8] c"async out\00"
@.str.28 = [8 x i8] c"cbcp in\00"
@.str.29 = [9 x i8] c"cbcp out\00"
@.str.30 = [8 x i8] c"chap in\00"
@.str.31 = [9 x i8] c"chap out\00"
@.str.32 = [7 x i8] c"pap in\00"
@.str.33 = [8 x i8] c"pap out\00"
@.str.34 = [7 x i8] c"ccp in\00"
@.str.35 = [8 x i8] c"ccp out\00"
@.str.36 = [8 x i8] c"ipcp in\00"
@.str.37 = [9 x i8] c"ipcp out\00"
@.str.38 = [10 x i8] c"ipv6cp in\00"
@.str.39 = [11 x i8] c"ipv6cp out\00"
@.str.40 = [7 x i8] c"lcp in\00"
@.str.41 = [8 x i8] c"lcp out\00"
@.str.42 = [8 x i8] c"unknown\00"
define i8* @mbuftype(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 42
br i1 %7, label %8, label %9
8: ; preds = %5, %1
br label %14
9: ; preds = %5
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [42 x i8*], [42 x i8*]* @mbuftype.mbufdesc, i64 0, i64 %11
%13 = load i8*, i8** %12
br label %14
14: ; preds = %9, %8
%15 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.42, i64 0, i64 0), %8 ], [ %13, %9 ]
ret i8* %15
}

LLVM IR (-O2):
@reltable.mbuftype = internal unnamed_addr constant [42 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.1 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.2 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.3 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.5 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.6 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.7 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.8 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.9 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.10 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.11 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.12 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.13 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.14 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.15 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.16 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.17 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.18 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.19 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.20 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.21 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.22 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.23 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.24 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.25 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.26 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.27 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.28 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.29 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.30 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.31 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.32 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.33 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.34 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.35 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.36 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.37 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.38 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.39 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.40 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.41 to i64), i64 ptrtoint ([42 x i32]* @reltable.mbuftype to i64)) to i32)]
@.str = [6 x i8] c"ip in\00"
@.str.1 = [7 x i8] c"ip out\00"
@.str.2 = [8 x i8] c"ipv6 in\00"
@.str.3 = [9 x i8] c"ipv6 out\00"
@.str.4 = [7 x i8] c"nat in\00"
@.str.5 = [8 x i8] c"nat out\00"
@.str.6 = [6 x i8] c"mp in\00"
@.str.7 = [7 x i8] c"mp out\00"
@.str.8 = [6 x i8] c"vj in\00"
@.str.9 = [7 x i8] c"vj out\00"
@.str.10 = [10 x i8] c"icompd in\00"
@.str.11 = [11 x i8] c"icompd out\00"
@.str.12 = [9 x i8] c"compd in\00"
@.str.13 = [10 x i8] c"compd out\00"
@.str.14 = [7 x i8] c"lqr in\00"
@.str.15 = [8 x i8] c"lqr out\00"
@.str.16 = [8 x i8] c"echo in\00"
@.str.17 = [9 x i8] c"echo out\00"
@.str.18 = [9 x i8] c"proto in\00"
@.str.19 = [10 x i8] c"proto out\00"
@.str.20 = [7 x i8] c"acf in\00"
@.str.21 = [8 x i8] c"acf out\00"
@.str.22 = [8 x i8] c"sync in\00"
@.str.23 = [9 x i8] c"sync out\00"
@.str.24 = [8 x i8] c"hdlc in\00"
@.str.25 = [9 x i8] c"hdlc out\00"
@.str.26 = [9 x i8] c"async in\00"
@.str.27 = [10 x i8] c"async out\00"
@.str.28 = [8 x i8] c"cbcp in\00"
@.str.29 = [9 x i8] c"cbcp out\00"
@.str.30 = [8 x i8] c"chap in\00"
@.str.31 = [9 x i8] c"chap out\00"
@.str.32 = [7 x i8] c"pap in\00"
@.str.33 = [8 x i8] c"pap out\00"
@.str.34 = [7 x i8] c"ccp in\00"
@.str.35 = [8 x i8] c"ccp out\00"
@.str.36 = [8 x i8] c"ipcp in\00"
@.str.37 = [9 x i8] c"ipcp out\00"
@.str.38 = [10 x i8] c"ipv6cp in\00"
@.str.39 = [11 x i8] c"ipv6cp out\00"
@.str.40 = [7 x i8] c"lcp in\00"
@.str.41 = [8 x i8] c"lcp out\00"
@.str.42 = [8 x i8] c"unknown\00"
define i8* @mbuftype(i32 %0) {
%2 = icmp ugt i32 %0, 41
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 ([42 x i32]* @reltable.mbuftype 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.42, i64 0, i64 0), %1 ]
ret i8* %8
}