#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 scalar_t__ act2_flags;

/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
char *act2_bit_name(int act2_flags) {
  static char buf[512];
  buf[0] = '\0';
  if (((act2_flags) & ((1)))) {
    strcat(buf, " npc");
    if (act2_flags & (2))
      strcat(buf, " forger");
  } else {
    strcat(buf, " player");
  }
  return (buf[0] != '\0') ? buf + 1 : "none";
}


x86 assembly (clang, -O0):
<act2_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     116b <act2_bit_name+0x5b>
lea    0x2f08(%rip),%rdi
lea    0xec1(%rip),%rsi
call   1030 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1166 <act2_bit_name+0x56>
lea    0x2ee6(%rip),%rdi
lea    0xea4(%rip),%rsi
call   1030 <strcat@plt>
jmp    117e <act2_bit_name+0x6e>
lea    0x2ece(%rip),%rdi
lea    0xe94(%rip),%rsi
call   1030 <strcat@plt>
movsbl 0x2ebb(%rip),%edx
lea    0xe89(%rip),%rax
lea    0x2ead(%rip),%rcx
add    $0x1,%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<act2_bit_name>:
push   %rbx
mov    %edi,%ebx
movb   $0x0,0x2f26(%rip)
test   $0x1,%bl
jne    1128 <act2_bit_name+0x18>
lea    0xee7(%rip),%rsi
jmp    1147 <act2_bit_name+0x37>
lea    0x2f11(%rip),%rdi
lea    0xeca(%rip),%rsi
call   1030 <strcat@plt>
test   $0x2,%bl
je     1153 <act2_bit_name+0x43>
lea    0xebe(%rip),%rsi
lea    0x2ef2(%rip),%rdi
call   1030 <strcat@plt>
cmpb   $0x0,0x2ee6(%rip)
lea    0xeb4(%rip),%rcx
lea    0x2ed9(%rip),%rax
cmove  %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@act2_bit_name.buf = internal global [512 x i8] zeroinitializer
@.str = [5 x i8] c" npc\00"
@.str.1 = [8 x i8] c" forger\00"
@.str.2 = [8 x i8] c" player\00"
@.str.3 = [5 x i8] c"none\00"
define i8* @act2_bit_name(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
store i8 0, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @act2_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 %14
6: ; preds = %1
%7 = call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @act2_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %2
%9 = and i32 %8, 2
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @act2_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %6
br label %16
14: ; preds = %1
%15 = call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @act2_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %13
%17 = load i8, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @act2_bit_name.buf, i64 0, i64 0)
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 0
%20 = zext i1 %19 to i64
%21 = select i1 %19, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @act2_bit_name.buf, i64 0, i64 1), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
ret i8* %21
}

LLVM IR (-O2):
@act2_bit_name.buf = internal global [512 x i8] zeroinitializer
@.str = [5 x i8] c" npc\00"
@.str.1 = [8 x i8] c" forger\00"
@.str.2 = [8 x i8] c" player\00"
@.str.3 = [5 x i8] c"none\00"
define i8* @act2_bit_name(i32 %0) {
store i8 0, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @act2_bit_name.buf, i64 0, i64 0)
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @act2_bit_name.buf, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = and i32 %0, 2
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %1, %4
%9 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %1 ]
%10 = tail call i32 @strcat(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @act2_bit_name.buf, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %8, %4
%12 = load i8, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @act2_bit_name.buf, i64 0, i64 0)
%13 = icmp eq i8 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([512 x i8], [512 x i8]* @act2_bit_name.buf, i64 0, i64 1)
ret i8* %14
}