#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_Qclass2Txt(u_short qclass) {
  static char failure[6];
  struct {
    u_short id;
    const char *txt;
  } qtxt[] = {{1, "IN"}, {2, "CS"}, {3, "CH"}, {4, "HS"}, {255, "*"}};
  unsigned f;
  for (f = 0; f < sizeof qtxt / sizeof *qtxt; f++)
    if (qtxt[f].id == qclass)
      return qtxt[f].txt;
  return HexStr(qclass, failure, sizeof failure);
}


x86 assembly (clang, -O0):
<dns_Qclass2Txt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
lea    0x2c99(%rip),%rsi
mov    $0x50,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    $0x5,%rax
jae    11a2 <dns_Qclass2Txt+0x82>
mov    -0x64(%rbp),%eax
mov    %eax,%ecx
lea    -0x60(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rax
cmp    -0x10(%rbp),%rax
jne    118f <dns_Qclass2Txt+0x6f>
mov    -0x64(%rbp),%eax
mov    %eax,%ecx
lea    -0x60(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    11bb <dns_Qclass2Txt+0x9b>
jmp    1194 <dns_Qclass2Txt+0x74>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1148 <dns_Qclass2Txt+0x28>
mov    -0x10(%rbp),%rdi
lea    0x2e84(%rip),%rsi
mov    $0x6,%edx
call   1030 <HexStr@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dns_Qclass2Txt>:
lea    -0x1(%rdi),%rcx
cmp    $0x3,%rcx
ja     1133 <dns_Qclass2Txt+0x23>
xor    %eax,%eax
lea    0xedd(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x1,%eax
jmp    114f <dns_Qclass2Txt+0x3f>
cmp    $0xff,%rdi
jne    1160 <dns_Qclass2Txt+0x50>
mov    $0x4,%eax
jmp    114f <dns_Qclass2Txt+0x3f>
mov    $0x2,%eax
jmp    114f <dns_Qclass2Txt+0x3f>
mov    $0x3,%eax
shl    $0x4,%rax
lea    0x2c76(%rip),%rcx
mov    0x8(%rax,%rcx,1),%rax
ret
lea    0x2ec2(%rip),%rsi
mov    $0x6,%edx
jmp    1030 <HexStr@plt>

LLVM IR (-O0):
%struct.anon = type { i64, i8* }
@dns_Qclass2Txt.failure = internal global [6 x i8] zeroinitializer
@.str = [3 x i8] c"IN\00"
@.str.1 = [3 x i8] c"CS\00"
@.str.2 = [3 x i8] c"CH\00"
@.str.3 = [3 x i8] c"HS\00"
@.str.4 = [2 x i8] c"*\00"
@__const.dns_Qclass2Txt.qtxt = [5 x %struct.anon] [%struct.anon { i64 1, i8* getelementptr inbounds ([3 x i8], [3 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 255, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0) }]
define i8* @dns_Qclass2Txt(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca [5 x %struct.anon]
%5 = alloca i32
store i64 %0, i64* %3
%6 = bitcast [5 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, 5
br i1 %10, label %11, label %29
11: ; preds = %7
%12 = load i32, i32* %5
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds [5 x %struct.anon], [5 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 [5 x %struct.anon], [5 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_Qclass2Txt.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_Qclass2Txt.failure = internal global [6 x i8] zeroinitializer
@.str = [3 x i8] c"IN\00"
@.str.1 = [3 x i8] c"CS\00"
@.str.2 = [3 x i8] c"CH\00"
@.str.3 = [3 x i8] c"HS\00"
@.str.4 = [2 x i8] c"*\00"
@__const.dns_Qclass2Txt.qtxt = [5 x %struct.anon] [%struct.anon { i64 1, i8* getelementptr inbounds ([3 x i8], [3 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 255, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0) }]
define i8* @dns_Qclass2Txt(i64 %0) {
switch i64 %0, label %10 [
i64 1, label %6
i64 2, label %2
i64 3, label %3
i64 4, label %4
i64 255, label %5
]
2: ; preds = %1
br label %6
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %5, %4, %3, %2
%7 = phi i64 [ 0, %1 ], [ 1, %2 ], [ 2, %3 ], [ 3, %4 ], [ 4, %5 ]
%8 = getelementptr inbounds [5 x %struct.anon], [5 x %struct.anon]* @__const.dns_Qclass2Txt.qtxt, i64 0, i64 %7, i32 1
%9 = load i8*, i8** %8
br label %12
10: ; preds = %1
%11 = tail call i8* @HexStr(i64 %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @dns_Qclass2Txt.failure, i64 0, i64 0), i32 6)
br label %12
12: ; preds = %10, %6
%13 = phi i8* [ %9, %6 ], [ %11, %10 ]
ret i8* %13
}