#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*/ printf(char *);
int /*<<< orphan*/ removeleast(int *, int *, int *, int *);
int /*<<< orphan*/ removemost(int *, int *, int *, int *);
int /*<<< orphan*/ treasure(int *, int *, int *, int *, int *, int *, int *,
                            int *, int *, int *, int *, int *,
                            int /*<<< orphan*/, int, int /*<<< orphan*/);
void blackqueen(int *hpmax, int *hpnow, int *aces, int *inv, int *slave,
                int *future, int *map, int *loot, int *vision, int *end,
                int *pos, int *antimag, int good) {
  printf("It is a black priestess, a kleptomaniac demon!\n");
  if (*antimag == 1) {
    printf("Because the antimagic field, the black magic of the priestess is "
           "uneffective!\n");
    return;
  }
  if (good == 1) {
    printf("'Because you freed me, I will take your cheapest item with my "
           "black magic...'\n");
    removeleast(hpmax, hpnow, aces, inv);
    return;
  }
  printf("'Ah, I will take something expensive from you!'\n");
  removemost(hpmax, hpnow, aces, inv);
  treasure(hpmax, hpnow, aces, inv, slave, future, map, loot, vision, end, pos,
           antimag, 0, 1, 0);
}


x86 assembly (clang, -O0):
<blackqueen>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x80,%rsp
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
mov    %rdx,-0x38(%rbp)
mov    %rcx,-0x40(%rbp)
mov    %r8,-0x48(%rbp)
mov    %r9,-0x50(%rbp)
lea    0xe74(%rip),%rdi
call   1050 <printf@plt>
mov    0x38(%rbp),%rax
cmpl   $0x1,(%rax)
jne    11af <blackqueen+0x6f>
lea    0xe8b(%rip),%rdi
call   1050 <printf@plt>
jmp    126d <blackqueen+0x12d>
cmpl   $0x1,0x40(%rbp)
jne    11df <blackqueen+0x9f>
lea    0xebf(%rip),%rdi
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
call   1060 <removeleast@plt>
jmp    126d <blackqueen+0x12d>
lea    0xee8(%rip),%rdi
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
call   1040 <removemost@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x48(%rbp),%r8
mov    -0x50(%rbp),%r9
mov    0x10(%rbp),%r15
mov    0x18(%rbp),%r14
mov    0x20(%rbp),%rbx
mov    0x28(%rbp),%r11
mov    0x30(%rbp),%r10
mov    0x38(%rbp),%rax
xor    %r12d,%r12d
mov    %r15,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
movl   $0x0,0x30(%rsp)
movl   $0x1,0x38(%rsp)
movl   $0x0,0x40(%rsp)
call   1030 <treasure@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<blackqueen>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x8(%rsp)
mov    %r8,(%rsp)
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    0xa0(%rsp),%r13d
mov    0x98(%rsp),%r15
mov    0x90(%rsp),%rax
mov    %rax,0x10(%rsp)
mov    0x88(%rsp),%rax
mov    %rax,0x18(%rsp)
mov    0x80(%rsp),%rax
mov    %rax,0x20(%rsp)
mov    0x78(%rsp),%rax
mov    %rax,0x28(%rsp)
mov    0x70(%rsp),%rax
mov    %rax,0x30(%rsp)
lea    0xe4b(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x1,(%r15)
jne    11da <blackqueen+0x9a>
lea    0xee6(%rip),%rdi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <puts@plt>
cmp    $0x1,%r13d
jne    120b <blackqueen+0xcb>
lea    0xe78(%rip),%rdi
call   1050 <puts@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <removeleast@plt>
lea    0xe1d(%rip),%rdi
call   1050 <puts@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
call   1040 <removemost@plt>
sub    $0x8,%rsp
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
mov    0x8(%rsp),%r8
mov    0x10(%rsp),%r9
push   $0x0
push   $0x1
push   $0x0
push   %r15
push   0x38(%rsp)
push   0x48(%rsp)
push   0x58(%rsp)
push   0x68(%rsp)
push   0x78(%rsp)
call   1030 <treasure@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"It is a black priestess, a kleptomaniac demon!\0A\00"
@.str.1 = [79 x i8] c"Because the antimagic field, the black magic of the priestess is uneffective!\0A\00"
@.str.2 = [79 x i8] c"'Because you freed me, I will take your cheapest item with my black magic...'\0A\00"
@.str.3 = [49 x i8] c"'Ah, I will take something expensive from you!'\0A\00"
define void @blackqueen(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11, i32 %12) {
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32*
%20 = alloca i32*
%21 = alloca i32*
%22 = alloca i32*
%23 = alloca i32*
%24 = alloca i32*
%25 = alloca i32*
%26 = alloca i32
store i32* %0, i32** %14
store i32* %1, i32** %15
store i32* %2, i32** %16
store i32* %3, i32** %17
store i32* %4, i32** %18
store i32* %5, i32** %19
store i32* %6, i32** %20
store i32* %7, i32** %21
store i32* %8, i32** %22
store i32* %9, i32** %23
store i32* %10, i32** %24
store i32* %11, i32** %25
store i32 %12, i32* %26
%27 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%28 = load i32*, i32** %25
%29 = load i32, i32* %28
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %33
31: ; preds = %13
%32 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0))
br label %63
33: ; preds = %13
%34 = load i32, i32* %26
%35 = icmp eq i32 %34, 1
br i1 %35, label %36, label %43
36: ; preds = %33
%37 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.2, i64 0, i64 0))
%38 = load i32*, i32** %14
%39 = load i32*, i32** %15
%40 = load i32*, i32** %16
%41 = load i32*, i32** %17
%42 = call i32 @removeleast(i32* %38, i32* %39, i32* %40, i32* %41)
br label %63
43: ; preds = %33
%44 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0))
%45 = load i32*, i32** %14
%46 = load i32*, i32** %15
%47 = load i32*, i32** %16
%48 = load i32*, i32** %17
%49 = call i32 @removemost(i32* %45, i32* %46, i32* %47, i32* %48)
%50 = load i32*, i32** %14
%51 = load i32*, i32** %15
%52 = load i32*, i32** %16
%53 = load i32*, i32** %17
%54 = load i32*, i32** %18
%55 = load i32*, i32** %19
%56 = load i32*, i32** %20
%57 = load i32*, i32** %21
%58 = load i32*, i32** %22
%59 = load i32*, i32** %23
%60 = load i32*, i32** %24
%61 = load i32*, i32** %25
%62 = call i32 @treasure(i32* %50, i32* %51, i32* %52, i32* %53, i32* %54, i32* %55, i32* %56, i32* %57, i32* %58, i32* %59, i32* %60, i32* %61, i32 0, i32 1, i32 0)
br label %63
63: ; preds = %43, %36, %31
ret void
}

LLVM IR (-O2):
@str = [47 x i8] c"It is a black priestess, a kleptomaniac demon!\00"
@str.4 = [48 x i8] c"'Ah, I will take something expensive from you!'\00"
@str.5 = [78 x i8] c"'Because you freed me, I will take your cheapest item with my black magic...'\00"
@str.6 = [78 x i8] c"Because the antimagic field, the black magic of the priestess is uneffective!\00"
define void @blackqueen(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11, i32 %12) {
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%15 = load i32, i32* %11
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.6, i64 0, i64 0))
br label %28
19: ; preds = %13
%20 = icmp eq i32 %12, 1
br i1 %20, label %21, label %24
21: ; preds = %19
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.5, i64 0, i64 0))
%23 = tail call i32 @removeleast(i32* %0, i32* %1, i32* %2, i32* %3)
br label %28
24: ; preds = %19
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.4, i64 0, i64 0))
%26 = tail call i32 @removemost(i32* %0, i32* %1, i32* %2, i32* %3)
%27 = tail call i32 @treasure(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11, i32 0, i32 1, i32 0)
br label %28
28: ; preds = %24, %21, %17
ret void
}