#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 /*<<< orphan*/ strcat(char *, char *);
char *shield_bit_name(int vector) {
  static char buf[512];
  buf[0] = '\0';
  if (vector & (1))
    strcat(buf, " prot_voodoo");
  if (vector & (2))
    strcat(buf, " invisible");
  if (vector & (4))
    strcat(buf, " ice");
  if (vector & (8))
    strcat(buf, " fire");
  if (vector & (16))
    strcat(buf, " shock");
  if (vector & (128))
    strcat(buf, " sanctuary");
  if (vector & (8192))
    strcat(buf, " prot_evil");
  if (vector & (16384))
    strcat(buf, " prot_good");
  return (buf[0] != '\0') ? buf + 1 : "none";
}


x86 assembly (clang, -O0):
<shield_bit_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x0,0x2f1e(%rip)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1144 <shield_bit_name+0x34>
lea    0x2f08(%rip),%rdi
lea    0xec1(%rip),%rsi
call   1030 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1166 <shield_bit_name+0x56>
lea    0x2ee6(%rip),%rdi
lea    0xeac(%rip),%rsi
call   1030 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1188 <shield_bit_name+0x78>
lea    0x2ec4(%rip),%rdi
lea    0xe95(%rip),%rsi
call   1030 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11aa <shield_bit_name+0x9a>
lea    0x2ea2(%rip),%rdi
lea    0xe78(%rip),%rsi
call   1030 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11cc <shield_bit_name+0xbc>
lea    0x2e80(%rip),%rdi
lea    0xe5c(%rip),%rsi
call   1030 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     11f0 <shield_bit_name+0xe0>
lea    0x2e5c(%rip),%rdi
lea    0xe3f(%rip),%rsi
call   1030 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x2000,%eax
cmp    $0x0,%eax
je     1214 <shield_bit_name+0x104>
lea    0x2e38(%rip),%rdi
lea    0xe26(%rip),%rsi
call   1030 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x4000,%eax
cmp    $0x0,%eax
je     1238 <shield_bit_name+0x128>
lea    0x2e14(%rip),%rdi
lea    0xe0d(%rip),%rsi
call   1030 <strcat@plt>
movsbl 0x2e01(%rip),%edx
lea    0xe05(%rip),%rax
lea    0x2df3(%rip),%rcx
add    $0x1,%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shield_bit_name>:
push   %rbx
mov    %edi,%ebx
movb   $0x0,0x2f26(%rip)
test   $0x1,%bl
jne    118a <shield_bit_name+0x7a>
test   $0x2,%bl
jne    11a2 <shield_bit_name+0x92>
test   $0x4,%bl
jne    11be <shield_bit_name+0xae>
test   $0x8,%bl
jne    11da <shield_bit_name+0xca>
test   $0x10,%bl
jne    11f6 <shield_bit_name+0xe6>
test   $0x80,%bl
jne    1212 <shield_bit_name+0x102>
test   $0x2000,%ebx
jne    1231 <shield_bit_name+0x121>
test   $0x4000,%ebx
je     116f <shield_bit_name+0x5f>
lea    0x2edd(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1030 <strcat@plt>
cmpb   $0x0,0x2eca(%rip)
lea    0xece(%rip),%rcx
lea    0x2ebd(%rip),%rax
cmove  %rcx,%rax
pop    %rbx
ret
lea    0x2eaf(%rip),%rdi
lea    0xe68(%rip),%rsi
call   1030 <strcat@plt>
test   $0x2,%bl
je     1124 <shield_bit_name+0x14>
lea    0x2e97(%rip),%rdi
lea    0xe5d(%rip),%rsi
call   1030 <strcat@plt>
test   $0x4,%bl
je     112d <shield_bit_name+0x1d>
lea    0x2e7b(%rip),%rdi
lea    0xe4c(%rip),%rsi
call   1030 <strcat@plt>
test   $0x8,%bl
je     1136 <shield_bit_name+0x26>
lea    0x2e5f(%rip),%rdi
lea    0xe35(%rip),%rsi
call   1030 <strcat@plt>
test   $0x10,%bl
je     113f <shield_bit_name+0x2f>
lea    0x2e43(%rip),%rdi
lea    0xe1f(%rip),%rsi
call   1030 <strcat@plt>
test   $0x80,%bl
je     1148 <shield_bit_name+0x38>
lea    0x2e27(%rip),%rdi
lea    0xe0a(%rip),%rsi
call   1030 <strcat@plt>
test   $0x2000,%ebx
je     1154 <shield_bit_name+0x44>
lea    0x2e08(%rip),%rdi
lea    0xdf6(%rip),%rsi
call   1030 <strcat@plt>
test   $0x4000,%ebx
jne    115c <shield_bit_name+0x4c>
jmp    116f <shield_bit_name+0x5f>

LLVM IR (-O0):
@shield_bit_name.buf = internal global [512 x i8] zeroinitializer
@.str = [13 x i8] c" prot_voodoo\00"
@.str.1 = [11 x i8] c" invisible\00"
@.str.2 = [5 x i8] c" ice\00"
@.str.3 = [6 x i8] c" fire\00"
@.str.4 = [7 x i8] c" shock\00"
@.str.5 = [11 x i8] c" sanctuary\00"
@.str.6 = [11 x i8] c" prot_evil\00"
@.str.7 = [11 x i8] c" prot_good\00"
@.str.8 = [5 x i8] c"none\00"
define i8* @shield_bit_name(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
store i8 0, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0)
%3 = load i32, i32* %2
%4 = and i32 %3, 1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = load i32, i32* %2
%10 = and i32 %9, 2
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %8
%15 = load i32, i32* %2
%16 = and i32 %15, 4
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %14
%21 = load i32, i32* %2
%22 = and i32 %21, 8
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %24, %20
%27 = load i32, i32* %2
%28 = and i32 %27, 16
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %32
32: ; preds = %30, %26
%33 = load i32, i32* %2
%34 = and i32 %33, 128
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %38
38: ; preds = %36, %32
%39 = load i32, i32* %2
%40 = and i32 %39, 8192
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %44
44: ; preds = %42, %38
%45 = load i32, i32* %2
%46 = and i32 %45, 16384
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
br label %50
50: ; preds = %48, %44
%51 = load i8, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0)
%52 = sext i8 %51 to i32
%53 = icmp ne i32 %52, 0
%54 = zext i1 %53 to i64
%55 = select i1 %53, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 1), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0)
ret i8* %55
}

LLVM IR (-O2):
@shield_bit_name.buf = internal global [512 x i8] zeroinitializer
@.str = [13 x i8] c" prot_voodoo\00"
@.str.1 = [11 x i8] c" invisible\00"
@.str.2 = [5 x i8] c" ice\00"
@.str.3 = [6 x i8] c" fire\00"
@.str.4 = [7 x i8] c" shock\00"
@.str.5 = [11 x i8] c" sanctuary\00"
@.str.6 = [11 x i8] c" prot_evil\00"
@.str.7 = [11 x i8] c" prot_good\00"
@.str.8 = [5 x i8] c"none\00"
define i8* @shield_bit_name(i32 %0) {
store i8 0, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0)
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = and i32 %0, 2
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
%12 = and i32 %0, 4
%13 = icmp eq i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = tail call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
%17 = and i32 %0, 8
%18 = icmp eq i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = tail call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %21
21: ; preds = %19, %16
%22 = and i32 %0, 16
%23 = icmp eq i32 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %21
%25 = tail call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %26
26: ; preds = %24, %21
%27 = and i32 %0, 128
%28 = icmp eq i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %26
%30 = tail call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %31
31: ; preds = %29, %26
%32 = and i32 %0, 8192
%33 = icmp eq i32 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %31
%35 = tail call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %36
36: ; preds = %34, %31
%37 = and i32 %0, 16384
%38 = icmp eq i32 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %36
%40 = tail call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
br label %41
41: ; preds = %39, %36
%42 = load i8, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 0)
%43 = icmp eq i8 %42, 0
%44 = select i1 %43, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([512 x i8], [512 x i8]* @shield_bit_name.buf, i64 0, i64 1)
ret i8* %44
}