char *pr_type(unsigned char t) {
  static char *ttab1[] = {"Error", "Destination Unreachable", "Packet Too Big",
                          "Time Exceeded in Transit", "Parameter Problem"};
  static char *ttab2[] = {
      "Echo Reply",        "Echo Request",         "Membership Query",
      "Membership Report", "Membership Reduction",
  };
  if (t < 5) {
    return (ttab1[t]);
  }
  if (t >= 128 && t <= 132) {
    return (ttab2[t]);
  }
  return ("OUT-OF-RANGE");
}


x86 assembly (clang, -O0):
<pr_type>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
cmp    $0x5,%eax
jge    1131 <pr_type+0x31>
movzbl -0x9(%rbp),%eax
mov    %eax,%ecx
lea    0x2f0c(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
jmp    1174 <pr_type+0x74>
movzbl -0x9(%rbp),%eax
cmp    $0x80,%eax
jl     1169 <pr_type+0x69>
movzbl -0x9(%rbp),%eax
cmp    $0x84,%eax
jg     1169 <pr_type+0x69>
movzbl -0x9(%rbp),%eax
mov    %eax,%ecx
lea    0x2f04(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
jmp    1174 <pr_type+0x74>
lea    0xf38(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_type>:
cmp    $0x5,%dil
jae    110f <pr_type+0xf>
lea    0x2ce3(%rip),%rax
jmp    111c <pr_type+0x1c>
cmp    $0x84,%dil
jg     1125 <pr_type+0x25>
lea    0x2d04(%rip),%rax
movzbl %dil,%ecx
mov    (%rax,%rcx,8),%rax
ret
lea    0xf7c(%rip),%rax
ret

LLVM IR (-O0):
@pr_type.ttab1 = internal global [5 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i32 0, i32 0)]
@.str = [6 x i8] c"Error\00"
@.str.1 = [24 x i8] c"Destination Unreachable\00"
@.str.2 = [15 x i8] c"Packet Too Big\00"
@.str.3 = [25 x i8] c"Time Exceeded in Transit\00"
@.str.4 = [18 x i8] c"Parameter Problem\00"
@pr_type.ttab2 = internal global [5 x i8*] [i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i32 0, i32 0)]
@.str.5 = [11 x i8] c"Echo Reply\00"
@.str.6 = [13 x i8] c"Echo Request\00"
@.str.7 = [17 x i8] c"Membership Query\00"
@.str.8 = [18 x i8] c"Membership Report\00"
@.str.9 = [21 x i8] c"Membership Reduction\00"
@.str.10 = [13 x i8] c"OUT-OF-RANGE\00"
define i8* @pr_type(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 slt i32 %5, 5
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = zext i8 %8 to i64
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* @pr_type.ttab1, i64 0, i64 %9
%11 = load i8*, i8** %10
store i8* %11, i8** %2
br label %26
12: ; preds = %1
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = icmp sge i32 %14, 128
br i1 %15, label %16, label %25
16: ; preds = %12
%17 = load i8, i8* %3
%18 = zext i8 %17 to i32
%19 = icmp sle i32 %18, 132
br i1 %19, label %20, label %25
20: ; preds = %16
%21 = load i8, i8* %3
%22 = zext i8 %21 to i64
%23 = getelementptr inbounds [5 x i8*], [5 x i8*]* @pr_type.ttab2, i64 0, i64 %22
%24 = load i8*, i8** %23
store i8* %24, i8** %2
br label %26
25: ; preds = %16, %12
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %26
26: ; preds = %25, %20, %7
%27 = load i8*, i8** %2
ret i8* %27
}

LLVM IR (-O2):
@pr_type.ttab1 = internal unnamed_addr constant [5 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i32 0, i32 0)]
@.str = [6 x i8] c"Error\00"
@.str.1 = [24 x i8] c"Destination Unreachable\00"
@.str.2 = [15 x i8] c"Packet Too Big\00"
@.str.3 = [25 x i8] c"Time Exceeded in Transit\00"
@.str.4 = [18 x i8] c"Parameter Problem\00"
@pr_type.ttab2 = internal unnamed_addr constant [5 x i8*] [i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i32 0, i32 0)]
@.str.5 = [11 x i8] c"Echo Reply\00"
@.str.6 = [13 x i8] c"Echo Request\00"
@.str.7 = [17 x i8] c"Membership Query\00"
@.str.8 = [18 x i8] c"Membership Report\00"
@.str.9 = [21 x i8] c"Membership Reduction\00"
@.str.10 = [13 x i8] c"OUT-OF-RANGE\00"
define i8* @pr_type(i8 zeroext %0) {
%2 = icmp ult i8 %0, 5
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = icmp slt i8 %0, -123
br i1 %4, label %5, label %10
5: ; preds = %3, %1
%6 = phi [5 x i8*]* [ @pr_type.ttab1, %1 ], [ @pr_type.ttab2, %3 ]
%7 = zext i8 %0 to i64
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i64 0, i64 %7
%9 = load i8*, i8** %8
br label %10
10: ; preds = %5, %3
%11 = phi i8* [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), %3 ], [ %9, %5 ]
ret i8* %11
}