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

/* Variables and functions */
size_t ELF32_ST_TYPE(unsigned char);
const char *get_st_type(unsigned char val) {
  static const char *const types[] = {
      "NOTYPE", "OBJECT", "FUNC", "SECTION", "FILE", "COMMON", "TLS", "7",
      "8",      "9",      "10",   "11",      "12",   "13",     "14",  "15"};
  return types[ELF32_ST_TYPE(val)];
}


x86 assembly (clang, -O0):
<get_st_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <ELF32_ST_TYPE@plt>
mov    %rax,%rcx
lea    0x2c6f(%rip),%rax
mov    (%rax,%rcx,8),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_st_type>:
push   %rax
call   1030 <ELF32_ST_TYPE@plt>
lea    0xee3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@get_st_type.types = internal constant [16 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i32 0, i32 0)]
@.str = [7 x i8] c"NOTYPE\00"
@.str.1 = [7 x i8] c"OBJECT\00"
@.str.2 = [5 x i8] c"FUNC\00"
@.str.3 = [8 x i8] c"SECTION\00"
@.str.4 = [5 x i8] c"FILE\00"
@.str.5 = [7 x i8] c"COMMON\00"
@.str.6 = [4 x i8] c"TLS\00"
@.str.7 = [2 x i8] c"7\00"
@.str.8 = [2 x i8] c"8\00"
@.str.9 = [2 x i8] c"9\00"
@.str.10 = [3 x i8] c"10\00"
@.str.11 = [3 x i8] c"11\00"
@.str.12 = [3 x i8] c"12\00"
@.str.13 = [3 x i8] c"13\00"
@.str.14 = [3 x i8] c"14\00"
@.str.15 = [3 x i8] c"15\00"
define i8* @get_st_type(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @ELF32_ST_TYPE(i8 zeroext %3)
%5 = getelementptr inbounds [16 x i8*], [16 x i8*]* @get_st_type.types, i64 0, i64 %4
%6 = load i8*, i8** %5
ret i8* %6
}

LLVM IR (-O2):
@reltable.get_st_type = internal unnamed_addr constant [16 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.1 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.2 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.3 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.4 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.5 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.6 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.7 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.8 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.9 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.10 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.11 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.12 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.13 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.14 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.15 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_type to i64)) to i32)]
@.str = [7 x i8] c"NOTYPE\00"
@.str.1 = [7 x i8] c"OBJECT\00"
@.str.2 = [5 x i8] c"FUNC\00"
@.str.3 = [8 x i8] c"SECTION\00"
@.str.4 = [5 x i8] c"FILE\00"
@.str.5 = [7 x i8] c"COMMON\00"
@.str.6 = [4 x i8] c"TLS\00"
@.str.7 = [2 x i8] c"7\00"
@.str.8 = [2 x i8] c"8\00"
@.str.9 = [2 x i8] c"9\00"
@.str.10 = [3 x i8] c"10\00"
@.str.11 = [3 x i8] c"11\00"
@.str.12 = [3 x i8] c"12\00"
@.str.13 = [3 x i8] c"13\00"
@.str.14 = [3 x i8] c"14\00"
@.str.15 = [3 x i8] c"15\00"
define i8* @get_st_type(i8 zeroext %0) {
%2 = tail call i64 @ELF32_ST_TYPE(i8 zeroext %0)
%3 = shl i64 %2, 2
%4 = call i8* @llvm.load.relative.i64(i8* bitcast ([16 x i32]* @reltable.get_st_type to i8*), i64 %3)
ret i8* %4
}