#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef scalar_t__ u_short;

/* Variables and functions */
char const *HexStr(scalar_t__, char *, int);
const char *dns_Qtype2Txt(u_short qtype) {
  static char failure[6];
  struct {
    u_short id;
    const char *txt;
  } qtxt[] = {{1, "A"},      {2, "NS"},      {3, "MD"},        {4, "MF"},
              {5, "CNAME"},  {6, "SOA"},     {7, "MB"},        {8, "MG"},
              {9, "MR"},     {10, "NULL"},   {11, "WKS"},      {12, "PTR"},
              {13, "HINFO"}, {14, "MINFO"},  {15, "MX"},       {16, "TXT"},
              {17, "RP"},    {18, "AFSDB"},  {19, "X25"},      {20, "ISDN"},
              {21, "RT"},    {22, "NSAP"},   {23, "NSAP-PTR"}, {24, "SIG"},
              {25, "KEY"},   {26, "PX"},     {27, "GPOS"},     {28, "AAAA"},
              {252, "AXFR"}, {253, "MAILB"}, {254, "MAILA"},   {255, "*"}};
  unsigned f;
  for (f = 0; f < sizeof qtxt / sizeof *qtxt; f++)
    if (qtxt[f].id == qtype)
      return qtxt[f].txt;
  return HexStr(qtype, failure, sizeof failure);
}


x86 assembly (clang, -O0):
<dns_Qtype2Txt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
lea    0x2ae3(%rip),%rsi
mov    $0x200,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x214(%rbp)
mov    -0x214(%rbp),%eax
cmp    $0x20,%rax
jae    11c0 <dns_Qtype2Txt+0xa0>
mov    -0x214(%rbp),%eax
mov    %eax,%ecx
lea    -0x210(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rax
cmp    -0x10(%rbp),%rax
jne    11a7 <dns_Qtype2Txt+0x87>
mov    -0x214(%rbp),%eax
mov    %eax,%ecx
lea    -0x210(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    11d9 <dns_Qtype2Txt+0xb9>
jmp    11ac <dns_Qtype2Txt+0x8c>
mov    -0x214(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x214(%rbp)
jmp    1151 <dns_Qtype2Txt+0x31>
mov    -0x10(%rbp),%rdi
lea    0x2e66(%rip),%rsi
mov    $0x6,%edx
call   1030 <HexStr@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dns_Qtype2Txt>:
lea    0x2b39(%rip),%rcx
xor    %eax,%eax
nopl   0x0(%rax)
cmp    %rdi,-0x30(%rcx)
je     1166 <dns_Qtype2Txt+0x56>
cmp    %rdi,-0x20(%rcx)
je     1156 <dns_Qtype2Txt+0x46>
cmp    %rdi,-0x10(%rcx)
je     115c <dns_Qtype2Txt+0x4c>
cmp    %rdi,(%rcx)
je     1162 <dns_Qtype2Txt+0x52>
add    $0x4,%rax
add    $0x40,%rcx
cmp    $0x20,%rax
jne    1120 <dns_Qtype2Txt+0x10>
lea    0x2edd(%rip),%rsi
mov    $0x6,%edx
jmp    1030 <HexStr@plt>
add    $0x1,%rax
jmp    1166 <dns_Qtype2Txt+0x56>
add    $0x2,%rax
jmp    1166 <dns_Qtype2Txt+0x56>
add    $0x3,%rax
mov    %eax,%eax
shl    $0x4,%rax
lea    0x2aad(%rip),%rcx
mov    0x8(%rax,%rcx,1),%rax
ret

LLVM IR (-O0):
%struct.anon = type { i64, i8* }
@dns_Qtype2Txt.failure = internal global [6 x i8] zeroinitializer
@.str = [2 x i8] c"A\00"
@.str.1 = [3 x i8] c"NS\00"
@.str.2 = [3 x i8] c"MD\00"
@.str.3 = [3 x i8] c"MF\00"
@.str.4 = [6 x i8] c"CNAME\00"
@.str.5 = [4 x i8] c"SOA\00"
@.str.6 = [3 x i8] c"MB\00"
@.str.7 = [3 x i8] c"MG\00"
@.str.8 = [3 x i8] c"MR\00"
@.str.9 = [5 x i8] c"NULL\00"
@.str.10 = [4 x i8] c"WKS\00"
@.str.11 = [4 x i8] c"PTR\00"
@.str.12 = [6 x i8] c"HINFO\00"
@.str.13 = [6 x i8] c"MINFO\00"
@.str.14 = [3 x i8] c"MX\00"
@.str.15 = [4 x i8] c"TXT\00"
@.str.16 = [3 x i8] c"RP\00"
@.str.17 = [6 x i8] c"AFSDB\00"
@.str.18 = [4 x i8] c"X25\00"
@.str.19 = [5 x i8] c"ISDN\00"
@.str.20 = [3 x i8] c"RT\00"
@.str.21 = [5 x i8] c"NSAP\00"
@.str.22 = [9 x i8] c"NSAP-PTR\00"
@.str.23 = [4 x i8] c"SIG\00"
@.str.24 = [4 x i8] c"KEY\00"
@.str.25 = [3 x i8] c"PX\00"
@.str.26 = [5 x i8] c"GPOS\00"
@.str.27 = [5 x i8] c"AAAA\00"
@.str.28 = [5 x i8] c"AXFR\00"
@.str.29 = [6 x i8] c"MAILB\00"
@.str.30 = [6 x i8] c"MAILA\00"
@.str.31 = [2 x i8] c"*\00"
@__const.dns_Qtype2Txt.qtxt = [32 x %struct.anon] [%struct.anon { i64 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0) }, %struct.anon { i64 2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0) }, %struct.anon { i64 3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i32 0, i32 0) }, %struct.anon { i64 4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0) }, %struct.anon { i64 5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0) }, %struct.anon { i64 6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0) }, %struct.anon { i64 7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0) }, %struct.anon { i64 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i32 0, i32 0) }, %struct.anon { i64 9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0) }, %struct.anon { i64 10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0) }, %struct.anon { i64 11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0) }, %struct.anon { i64 12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i32 0, i32 0) }, %struct.anon { i64 13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i32 0, i32 0) }, %struct.anon { i64 14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i32 0, i32 0) }, %struct.anon { i64 15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i32 0, i32 0) }, %struct.anon { i64 16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i32 0, i32 0) }, %struct.anon { i64 17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i32 0, i32 0) }, %struct.anon { i64 18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i32 0, i32 0) }, %struct.anon { i64 19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i32 0, i32 0) }, %struct.anon { i64 20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i32 0, i32 0) }, %struct.anon { i64 21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i32 0, i32 0) }, %struct.anon { i64 22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i32 0, i32 0) }, %struct.anon { i64 23, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.22, i32 0, i32 0) }, %struct.anon { i64 24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.23, i32 0, i32 0) }, %struct.anon { i64 25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.24, i32 0, i32 0) }, %struct.anon { i64 26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i32 0, i32 0) }, %struct.anon { i64 27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.26, i32 0, i32 0) }, %struct.anon { i64 28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.27, i32 0, i32 0) }, %struct.anon { i64 252, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.28, i32 0, i32 0) }, %struct.anon { i64 253, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.29, i32 0, i32 0) }, %struct.anon { i64 254, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.30, i32 0, i32 0) }, %struct.anon { i64 255, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.31, i32 0, i32 0) }]
define i8* @dns_Qtype2Txt(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca [32 x %struct.anon]
%5 = alloca i32
store i64 %0, i64* %3
%6 = bitcast [32 x %struct.anon]* %4 to i8*
store i32 0, i32* %5
br label %7
7: ; preds = %26, %1
%8 = load i32, i32* %5
%9 = zext i32 %8 to i64
%10 = icmp ult i64 %9, 32
br i1 %10, label %11, label %29
11: ; preds = %7
%12 = load i32, i32* %5
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds [32 x %struct.anon], [32 x %struct.anon]* %4, i64 0, i64 %13
%15 = getelementptr inbounds %struct.anon, %struct.anon* %14, i32 0, i32 0
%16 = load i64, i64* %15
%17 = load i64, i64* %3
%18 = icmp eq i64 %16, %17
br i1 %18, label %19, label %25
19: ; preds = %11
%20 = load i32, i32* %5
%21 = zext i32 %20 to i64
%22 = getelementptr inbounds [32 x %struct.anon], [32 x %struct.anon]* %4, i64 0, i64 %21
%23 = getelementptr inbounds %struct.anon, %struct.anon* %22, i32 0, i32 1
%24 = load i8*, i8** %23
store i8* %24, i8** %2
br label %32
25: ; preds = %11
br label %26
26: ; preds = %25
%27 = load i32, i32* %5
%28 = add i32 %27, 1
store i32 %28, i32* %5
br label %7
29: ; preds = %7
%30 = load i64, i64* %3
%31 = call i8* @HexStr(i64 %30, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @dns_Qtype2Txt.failure, i64 0, i64 0), i32 6)
store i8* %31, i8** %2
br label %32
32: ; preds = %29, %19
%33 = load i8*, i8** %2
ret i8* %33
}

LLVM IR (-O2):
%struct.anon = type { i64, i8* }
@dns_Qtype2Txt.failure = internal global [6 x i8] zeroinitializer
@.str = [2 x i8] c"A\00"
@.str.1 = [3 x i8] c"NS\00"
@.str.2 = [3 x i8] c"MD\00"
@.str.3 = [3 x i8] c"MF\00"
@.str.4 = [6 x i8] c"CNAME\00"
@.str.5 = [4 x i8] c"SOA\00"
@.str.6 = [3 x i8] c"MB\00"
@.str.7 = [3 x i8] c"MG\00"
@.str.8 = [3 x i8] c"MR\00"
@.str.9 = [5 x i8] c"NULL\00"
@.str.10 = [4 x i8] c"WKS\00"
@.str.11 = [4 x i8] c"PTR\00"
@.str.12 = [6 x i8] c"HINFO\00"
@.str.13 = [6 x i8] c"MINFO\00"
@.str.14 = [3 x i8] c"MX\00"
@.str.15 = [4 x i8] c"TXT\00"
@.str.16 = [3 x i8] c"RP\00"
@.str.17 = [6 x i8] c"AFSDB\00"
@.str.18 = [4 x i8] c"X25\00"
@.str.19 = [5 x i8] c"ISDN\00"
@.str.20 = [3 x i8] c"RT\00"
@.str.21 = [5 x i8] c"NSAP\00"
@.str.22 = [9 x i8] c"NSAP-PTR\00"
@.str.23 = [4 x i8] c"SIG\00"
@.str.24 = [4 x i8] c"KEY\00"
@.str.25 = [3 x i8] c"PX\00"
@.str.26 = [5 x i8] c"GPOS\00"
@.str.27 = [5 x i8] c"AAAA\00"
@.str.28 = [5 x i8] c"AXFR\00"
@.str.29 = [6 x i8] c"MAILB\00"
@.str.30 = [6 x i8] c"MAILA\00"
@.str.31 = [2 x i8] c"*\00"
@__const.dns_Qtype2Txt.qtxt = [32 x %struct.anon] [%struct.anon { i64 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0) }, %struct.anon { i64 2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0) }, %struct.anon { i64 3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i32 0, i32 0) }, %struct.anon { i64 4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0) }, %struct.anon { i64 5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0) }, %struct.anon { i64 6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0) }, %struct.anon { i64 7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0) }, %struct.anon { i64 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i32 0, i32 0) }, %struct.anon { i64 9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0) }, %struct.anon { i64 10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0) }, %struct.anon { i64 11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0) }, %struct.anon { i64 12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i32 0, i32 0) }, %struct.anon { i64 13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i32 0, i32 0) }, %struct.anon { i64 14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i32 0, i32 0) }, %struct.anon { i64 15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i32 0, i32 0) }, %struct.anon { i64 16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i32 0, i32 0) }, %struct.anon { i64 17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i32 0, i32 0) }, %struct.anon { i64 18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i32 0, i32 0) }, %struct.anon { i64 19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i32 0, i32 0) }, %struct.anon { i64 20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i32 0, i32 0) }, %struct.anon { i64 21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i32 0, i32 0) }, %struct.anon { i64 22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i32 0, i32 0) }, %struct.anon { i64 23, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.22, i32 0, i32 0) }, %struct.anon { i64 24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.23, i32 0, i32 0) }, %struct.anon { i64 25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.24, i32 0, i32 0) }, %struct.anon { i64 26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i32 0, i32 0) }, %struct.anon { i64 27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.26, i32 0, i32 0) }, %struct.anon { i64 28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.27, i32 0, i32 0) }, %struct.anon { i64 252, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.28, i32 0, i32 0) }, %struct.anon { i64 253, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.29, i32 0, i32 0) }, %struct.anon { i64 254, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.30, i32 0, i32 0) }, %struct.anon { i64 255, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.31, i32 0, i32 0) }]
define i8* @dns_Qtype2Txt(i64 %0) {
br label %2
2: ; preds = %27, %1
%3 = phi i64 [ 0, %1 ], [ %28, %27 ]
%4 = getelementptr inbounds [32 x %struct.anon], [32 x %struct.anon]* @__const.dns_Qtype2Txt.qtxt, i64 0, i64 %3, i32 0
%5 = load i64, i64* %4
%6 = icmp eq i64 %5, %0
br i1 %6, label %7, label %12
7: ; preds = %22, %17, %12, %2
%8 = phi i64 [ %3, %2 ], [ %13, %12 ], [ %18, %17 ], [ %23, %22 ]
%9 = and i64 %8, 4294967295
%10 = getelementptr inbounds [32 x %struct.anon], [32 x %struct.anon]* @__const.dns_Qtype2Txt.qtxt, i64 0, i64 %9, i32 1
%11 = load i8*, i8** %10
br label %32
12: ; preds = %2
%13 = or i64 %3, 1
%14 = getelementptr inbounds [32 x %struct.anon], [32 x %struct.anon]* @__const.dns_Qtype2Txt.qtxt, i64 0, i64 %13, i32 0
%15 = load i64, i64* %14
%16 = icmp eq i64 %15, %0
br i1 %16, label %7, label %17
17: ; preds = %12
%18 = or i64 %3, 2
%19 = getelementptr inbounds [32 x %struct.anon], [32 x %struct.anon]* @__const.dns_Qtype2Txt.qtxt, i64 0, i64 %18, i32 0
%20 = load i64, i64* %19
%21 = icmp eq i64 %20, %0
br i1 %21, label %7, label %22
22: ; preds = %17
%23 = or i64 %3, 3
%24 = getelementptr inbounds [32 x %struct.anon], [32 x %struct.anon]* @__const.dns_Qtype2Txt.qtxt, i64 0, i64 %23, i32 0
%25 = load i64, i64* %24
%26 = icmp eq i64 %25, %0
br i1 %26, label %7, label %27
27: ; preds = %22
%28 = add nuw nsw i64 %3, 4
%29 = icmp eq i64 %28, 32
br i1 %29, label %30, label %2
30: ; preds = %27
%31 = tail call i8* @HexStr(i64 %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @dns_Qtype2Txt.failure, i64 0, i64 0), i32 6)
br label %32
32: ; preds = %30, %7
%33 = phi i8* [ %11, %7 ], [ %31, %30 ]
ret i8* %33
}