#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_BIND(unsigned char);
const char *get_st_bind(unsigned char val) {
  static const char *const binds[] = {
      "LOCAL", "GLOBAL", "WEAK", "3",  "4",  "5",  "6",  "7",
      "8",     "9",      "10",   "11", "12", "13", "14", "15"};
  return binds[ELF32_ST_BIND(val)];
}


x86 assembly (clang, -O0):
<get_st_bind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <ELF32_ST_BIND@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_bind>:
push   %rax
call   1030 <ELF32_ST_BIND@plt>
lea    0xee3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@get_st_bind.binds = internal constant [16 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 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 ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 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 = [6 x i8] c"LOCAL\00"
@.str.1 = [7 x i8] c"GLOBAL\00"
@.str.2 = [5 x i8] c"WEAK\00"
@.str.3 = [2 x i8] c"3\00"
@.str.4 = [2 x i8] c"4\00"
@.str.5 = [2 x i8] c"5\00"
@.str.6 = [2 x i8] c"6\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_bind(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @ELF32_ST_BIND(i8 zeroext %3)
%5 = getelementptr inbounds [16 x i8*], [16 x i8*]* @get_st_bind.binds, i64 0, i64 %4
%6 = load i8*, i8** %5
ret i8* %6
}

LLVM IR (-O2):
@reltable.get_st_bind = internal unnamed_addr constant [16 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_bind 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_bind 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_bind to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.3 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_bind to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.4 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_bind to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.5 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_bind to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.6 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_st_bind 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_bind 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_bind 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_bind 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_bind 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_bind 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_bind 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_bind 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_bind 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_bind to i64)) to i32)]
@.str = [6 x i8] c"LOCAL\00"
@.str.1 = [7 x i8] c"GLOBAL\00"
@.str.2 = [5 x i8] c"WEAK\00"
@.str.3 = [2 x i8] c"3\00"
@.str.4 = [2 x i8] c"4\00"
@.str.5 = [2 x i8] c"5\00"
@.str.6 = [2 x i8] c"6\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_bind(i8 zeroext %0) {
%2 = tail call i64 @ELF32_ST_BIND(i8 zeroext %0)
%3 = shl i64 %2, 2
%4 = call i8* @llvm.load.relative.i64(i8* bitcast ([16 x i32]* @reltable.get_st_bind to i8*), i64 %3)
ret i8* %4
}