#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 int /*<<< orphan*/ block_type_desc;

/* Variables and functions */
char *mhvtl_block_type_desc(int blk_type) {
  int i;
  static const struct {
    int blk_type;
    char *desc;
  } block_type_desc[] = {
      {3, "FILEMARK"},
      {5, "END OF DATA"},
      {8, "NO OP"},
      {11, "DATA"},
  };
  for (i = 0; i < (sizeof(block_type_desc) / sizeof((block_type_desc)[0])); i++)
    if (block_type_desc[i].blk_type == blk_type)
      return block_type_desc[i].desc;
  return NULL;
}


x86 assembly (clang, -O0):
<mhvtl_block_type_desc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movslq -0x10(%rbp),%rax
cmp    $0x4,%rax
jae    116b <mhvtl_block_type_desc+0x6b>
movslq -0x10(%rbp),%rcx
lea    0x2ce9(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%eax
cmp    -0xc(%rbp),%eax
jne    1158 <mhvtl_block_type_desc+0x58>
movslq -0x10(%rbp),%rcx
lea    0x2ccc(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1173 <mhvtl_block_type_desc+0x73>
jmp    115d <mhvtl_block_type_desc+0x5d>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    110e <mhvtl_block_type_desc+0xe>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mhvtl_block_type_desc>:
add    $0xfffffffd,%edi
cmp    $0x8,%edi
ja     1112 <mhvtl_block_type_desc+0x12>
mov    $0x125,%eax
bt     %edi,%eax
jb     1115 <mhvtl_block_type_desc+0x15>
xor    %eax,%eax
ret
movslq %edi,%rax
lea    0xf01(%rip),%rcx
mov    (%rcx,%rax,8),%rax
shl    $0x4,%rax
lea    0x2ce2(%rip),%rcx
mov    0x8(%rax,%rcx,1),%rax
ret

LLVM IR (-O0):
%struct.anon = type { i32, i8* }
@mhvtl_block_type_desc.block_type_desc = internal constant [4 x %struct.anon] [%struct.anon { i32 3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0) }, %struct.anon { i32 5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i32 0, i32 0) }, %struct.anon { i32 8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0) }, %struct.anon { i32 11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0) }]
@.str = [9 x i8] c"FILEMARK\00"
@.str.1 = [12 x i8] c"END OF DATA\00"
@.str.2 = [6 x i8] c"NO OP\00"
@.str.3 = [5 x i8] c"DATA\00"
define i8* @mhvtl_block_type_desc(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %24, %1
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = icmp ult i64 %7, 4
br i1 %8, label %9, label %27
9: ; preds = %5
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [4 x %struct.anon], [4 x %struct.anon]* @mhvtl_block_type_desc.block_type_desc, i64 0, i64 %11
%13 = getelementptr inbounds %struct.anon, %struct.anon* %12, i32 0, i32 0
%14 = load i32, i32* %13
%15 = load i32, i32* %3
%16 = icmp eq i32 %14, %15
br i1 %16, label %17, label %23
17: ; preds = %9
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [4 x %struct.anon], [4 x %struct.anon]* @mhvtl_block_type_desc.block_type_desc, i64 0, i64 %19
%21 = getelementptr inbounds %struct.anon, %struct.anon* %20, i32 0, i32 1
%22 = load i8*, i8** %21
store i8* %22, i8** %2
br label %28
23: ; preds = %9
br label %24
24: ; preds = %23
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %5
27: ; preds = %5
store i8* null, i8** %2
br label %28
28: ; preds = %27, %17
%29 = load i8*, i8** %2
ret i8* %29
}

LLVM IR (-O2):
%struct.anon = type { i32, i8* }
@mhvtl_block_type_desc.block_type_desc = internal unnamed_addr constant [4 x %struct.anon] [%struct.anon { i32 3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0) }, %struct.anon { i32 5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i32 0, i32 0) }, %struct.anon { i32 8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0) }, %struct.anon { i32 11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0) }]
@.str = [9 x i8] c"FILEMARK\00"
@.str.1 = [12 x i8] c"END OF DATA\00"
@.str.2 = [6 x i8] c"NO OP\00"
@.str.3 = [5 x i8] c"DATA\00"
@switch.table.mhvtl_block_type_desc = [9 x i64] [i64 0, i64 0, i64 1, i64 0, i64 0, i64 2, i64 0, i64 0, i64 3]
define i8* @mhvtl_block_type_desc(i32 %0) {
%2 = add i32 %0, -3
%3 = icmp ult i32 %2, 9
br i1 %3, label %4, label %15
4: ; preds = %1
%5 = trunc i32 %2 to i16
%6 = lshr i16 293, %5
%7 = and i16 %6, 1
%8 = icmp eq i16 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %4
%10 = sext i32 %2 to i64
%11 = getelementptr inbounds [9 x i64], [9 x i64]* @switch.table.mhvtl_block_type_desc, i64 0, i64 %10
%12 = load i64, i64* %11
%13 = getelementptr inbounds [4 x %struct.anon], [4 x %struct.anon]* @mhvtl_block_type_desc.block_type_desc, i64 0, i64 %12, i32 1
%14 = load i8*, i8** %13
br label %15
15: ; preds = %4, %1, %9
%16 = phi i8* [ %14, %9 ], [ null, %1 ], [ null, %4 ]
ret i8* %16
}