#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*/ type_name;

/* Variables and functions */
#define STT_COMMON 134
#define STT_FILE 133
#define STT_FUNC 132
#define STT_NOTYPE 131
#define STT_OBJECT 130
#define STT_SECTION 129
#define STT_TLS 128
const char *sym_type(unsigned type) {
  static const char *type_name[] = {
      [STT_NOTYPE] = "STT_NOTYPE", [STT_OBJECT] = "STT_OBJECT",
      [STT_FUNC] = "STT_FUNC",     [STT_SECTION] = "STT_SECTION",
      [STT_FILE] = "STT_FILE",     [STT_COMMON] = "STT_COMMON",
      [STT_TLS] = "STT_TLS",
  };
  const char *name = "unknown sym type name";
  if (type < (sizeof(type_name) / sizeof((type_name)[0]))) {
    name = type_name[type];
  }
  return name;
}


x86 assembly (clang, -O0):
<sym_type>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0xf39(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    $0x87,%rax
jae    1135 <sym_type+0x35>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0x2f03(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sym_type>:
cmp    $0x86,%edi
ja     1116 <sym_type+0x16>
mov    %edi,%eax
lea    0x28ff(%rip),%rcx
mov    (%rcx,%rax,8),%rax
ret
lea    0xf2a(%rip),%rax
ret

LLVM IR (-O0):
@sym_type.type_name = internal global [135 x i8*] [i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i32 0, i32 0)]
@.str = [8 x i8] c"STT_TLS\00"
@.str.1 = [12 x i8] c"STT_SECTION\00"
@.str.2 = [11 x i8] c"STT_OBJECT\00"
@.str.3 = [11 x i8] c"STT_NOTYPE\00"
@.str.4 = [9 x i8] c"STT_FUNC\00"
@.str.5 = [9 x i8] c"STT_FILE\00"
@.str.6 = [11 x i8] c"STT_COMMON\00"
@.str.7 = [22 x i8] c"unknown sym type name\00"
define i8* @sym_type(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8** %3
%4 = load i32, i32* %2
%5 = zext i32 %4 to i64
%6 = icmp ult i64 %5, 135
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [135 x i8*], [135 x i8*]* @sym_type.type_name, i64 0, i64 %9
%11 = load i8*, i8** %10
store i8* %11, i8** %3
br label %12
12: ; preds = %7, %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@sym_type.type_name = internal unnamed_addr constant [135 x i8*] [i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i32 0, i32 0)]
@.str = [8 x i8] c"STT_TLS\00"
@.str.1 = [12 x i8] c"STT_SECTION\00"
@.str.2 = [11 x i8] c"STT_OBJECT\00"
@.str.3 = [11 x i8] c"STT_NOTYPE\00"
@.str.4 = [9 x i8] c"STT_FUNC\00"
@.str.5 = [9 x i8] c"STT_FILE\00"
@.str.6 = [11 x i8] c"STT_COMMON\00"
@.str.7 = [22 x i8] c"unknown sym type name\00"
define i8* @sym_type(i32 %0) {
%2 = icmp ult i32 %0, 135
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = zext i32 %0 to i64
%5 = getelementptr inbounds [135 x i8*], [135 x i8*]* @sym_type.type_name, i64 0, i64 %4
%6 = load i8*, i8** %5
br label %7
7: ; preds = %3, %1
%8 = phi i8* [ %6, %3 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), %1 ]
ret i8* %8
}