#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 */
int ELF64_ST_BIND(unsigned char);
#define STB_GLOBAL 135
#define STB_HIOS 134
#define STB_HIPROC 133
#define STB_LOCAL 132
#define STB_LOOS 131
#define STB_LOPROC 130
#define STB_NUM 129
#define STB_WEAK 128
const char *st_bind_lookup(unsigned char c) {
  switch (ELF64_ST_BIND(c)) {
  case STB_LOCAL:
    return "STB_LOCAL";
  case STB_GLOBAL:
    return "STB_GLOBAL";
  case STB_WEAK:
    return "STB_WEAK";
  case STB_NUM:
    return "STB_NUM";
  case STB_LOOS:
    return "STB_LOOS/STB_GNU";
  case STB_HIOS:
    return "STB_HIOS";
  case STB_LOPROC:
    return "STB_LOPROC";
  case STB_HIPROC:
    return "STB_HIPROC";
  default:
    return "(UNKNOWN)";
  }
  return "(UNKNOWN)";
}


x86 assembly (clang, -O0):
<st_bind_lookup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%edi
call   1030 <ELF64_ST_BIND@plt>
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x7,%eax
ja     11cd <st_bind_lookup+0xbd>
mov    -0x18(%rbp),%rax
lea    0xebc(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xecc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d8 <st_bind_lookup+0xc8>
lea    0xec6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d8 <st_bind_lookup+0xc8>
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d8 <st_bind_lookup+0xc8>
lea    0xeba(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d8 <st_bind_lookup+0xc8>
lea    0xeb2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d8 <st_bind_lookup+0xc8>
lea    0xeb3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d8 <st_bind_lookup+0xc8>
lea    0xeac(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d8 <st_bind_lookup+0xc8>
lea    0xea7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d8 <st_bind_lookup+0xc8>
lea    0xea2(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<st_bind_lookup>:
push   %rax
call   1030 <ELF64_ST_BIND@plt>
add    $0xffffff80,%eax
cmp    $0x7,%eax
ja     1130 <st_bind_lookup+0x20>
cltq
lea    0xf39(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
pop    %rcx
ret
lea    0xf1f(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"STB_LOCAL\00"
@.str.1 = [11 x i8] c"STB_GLOBAL\00"
@.str.2 = [9 x i8] c"STB_WEAK\00"
@.str.3 = [8 x i8] c"STB_NUM\00"
@.str.4 = [17 x i8] c"STB_LOOS/STB_GNU\00"
@.str.5 = [9 x i8] c"STB_HIOS\00"
@.str.6 = [11 x i8] c"STB_LOPROC\00"
@.str.7 = [11 x i8] c"STB_HIPROC\00"
@.str.8 = [10 x i8] c"(UNKNOWN)\00"
define i8* @st_bind_lookup(i8 zeroext %0) {
%2 = alloca i8*
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = call i32 @ELF64_ST_BIND(i8 zeroext %4)
switch i32 %5, label %14 [
i32 132, label %6
i32 135, label %7
i32 128, label %8
i32 129, label %9
i32 131, label %10
i32 134, label %11
i32 130, label %12
i32 133, label %13
]
6: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %2
br label %15
7: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %15
8: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %15
9: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %15
10: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %15
11: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %15
12: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %15
13: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %15
14: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %15
15: ; preds = %14, %13, %12, %11, %10, %9, %8, %7, %6
%16 = load i8*, i8** %2
ret i8* %16
}

LLVM IR (-O2):
@.str = [10 x i8] c"STB_LOCAL\00"
@.str.1 = [11 x i8] c"STB_GLOBAL\00"
@.str.2 = [9 x i8] c"STB_WEAK\00"
@.str.3 = [8 x i8] c"STB_NUM\00"
@.str.4 = [17 x i8] c"STB_LOOS/STB_GNU\00"
@.str.5 = [9 x i8] c"STB_HIOS\00"
@.str.6 = [11 x i8] c"STB_LOPROC\00"
@.str.7 = [11 x i8] c"STB_HIPROC\00"
@.str.8 = [10 x i8] c"(UNKNOWN)\00"
@reltable.st_bind_lookup = [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.2 to i64), i64 ptrtoint ([8 x i32]* @reltable.st_bind_lookup to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.3 to i64), i64 ptrtoint ([8 x i32]* @reltable.st_bind_lookup to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.6 to i64), i64 ptrtoint ([8 x i32]* @reltable.st_bind_lookup to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @.str.4 to i64), i64 ptrtoint ([8 x i32]* @reltable.st_bind_lookup to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.st_bind_lookup to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.7 to i64), i64 ptrtoint ([8 x i32]* @reltable.st_bind_lookup to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.5 to i64), i64 ptrtoint ([8 x i32]* @reltable.st_bind_lookup to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.1 to i64), i64 ptrtoint ([8 x i32]* @reltable.st_bind_lookup to i64)) to i32)]
define i8* @st_bind_lookup(i8 zeroext %0) {
%2 = tail call i32 @ELF64_ST_BIND(i8 zeroext %0)
%3 = add i32 %2, -128
%4 = icmp ult i32 %3, 8
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = shl i64 %6, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.st_bind_lookup to i8*), i64 %7)
br label %9
9: ; preds = %1, %5
%10 = phi i8* [ %8, %5 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), %1 ]
ret i8* %10
}