// File: /workspace/github_cpp_makefile_star2_O2/dnegovan[P]Intruder-On-Donnar-V/Space.cpp
// Function: Space::actionMenu(Player&)
bool Space::actionMenu(Player& markNelson)
{
    int menuNum = START_COUNT;    //running menu number counter
    int input = 0;

    //these will become the menu options we check against
    int talk = 0, search = 0, pack = 0, formula = 0,
        leave = 0, administer = 0, kill = 0;

    std::cout << NARRATOR_COLOR << "Location: " << getRoomName() << RESET;
    while (true)
    {
        while (input < START_COUNT || input > menuNum)
        {
            talk = 0, search = 0, pack = 0, formula = 0, leave = 0,
                      administer = 0, kill = 0;

            std::cout << std::endl;
            menuNum = START_COUNT;

            //check if possible to speak to occupant
            if (occupant)
            {
                if (occupant->getAlive())
                {
                    talk = menuNum;
                    std::cout << menuNum << ". Speak to " << occupant->getName()
                              << std::endl;
                    menuNum++;
                }
            }

            //check if possible to kill occupant
            if (markNelson.pack.checkFor(gun) && occupant)  //false if nullptr
            {
                if (occupant->getAlive())
                {
                    kill = menuNum;
                    std::cout << menuNum
                              << ". Execute " << occupant->getName() << "\n";
                    menuNum++;
                }
            }

            search = menuNum;
            std::cout << menuNum << ". Search room\n";
            menuNum++;
            pack = menuNum;
            std::cout << menuNum << ". Open pack\n";
            menuNum++;
            formula = menuNum;
            std::cout << menuNum << ". Show neutralization formula\n";
            menuNum++;
            leave = menuNum;
            std::cout << menuNum << ". Leave room\n";
            menuNum++;

            //check if it's possible to adminster compound
            if (markNelson.pack.checkFor(compound) && occupant)
            {
                if (occupant->getAlive())
                {
                    administer = menuNum;
                    std::cout << menuNum
                              << ". Administer " << compound << std::endl;
                    menuNum++;
                }
            }

            input = getInteger();
        }

        if (input == talk)
        {
            occupant->talk();
        }
        else if (input == search)
        {
            searchRoom(markNelson);
        }
        else if (input == pack)
        {
            markNelson.pack.menu();
        }
        else if (input == formula)
        {
            markNelson.pack.displayFormula();
        }
        else if (input == leave)
        {
            return true;  //wants to leave, continue game
        }
        else if (input == administer)
        {
            if(!administerCompound(markNelson))
            {
                //breaks out of function & play loop if gameOver
                return false;
            }
        }
        else if (input == kill)
        {
            if(!killOccupant(markNelson))
            {
                //breaks out of function and play loop if gameOver
                return false;
            }
        }

        input = 0;  //reset to access main actionMenu again
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, -0x38(%rbp)
movq %rdi, %r14
movq 0x7c32(%rip), %rdi      # 0x15fc8
leaq 0x1cfb(%rip), %rsi      # 0x10098
callq 0x31d0
leaq 0x2fd8(%rip), %rsi      # 0x11381
movq %rax, %rdi
callq 0x31d0
movq %rax, %rbx
movq %r14, -0x48(%rbp)
leaq 0x10(%r14), %rsi
leaq -0x70(%rbp), %r14
movq %r14, %rdi
callq 0x3250
movq %rbx, %rdi
movq %r14, %rsi
callq 0x31b0
leaq 0x1cd9(%rip), %rsi      # 0x100b3
movq %rax, %rdi
callq 0x31d0
leaq -0x70(%rbp), %rdi
callq 0x3368
xorl %eax, %eax
pushq $0x1
popq %r13
xorl %ebx, %ebx
xorl %r15d, %r15d
movl $0x0, -0x50(%rbp)
movl $0x0, -0x4c(%rbp)
xorl %r14d, %r14d
movl $0x0, -0x2c(%rbp)
movq $0x0, -0x40(%rbp)
testl %eax, %eax
jle 0xe43c
movl %eax, %r12d
cmpl %r13d, %eax
jg 0xe43c
cmpl %ebx, %r12d
jne 0xe4c6
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xa5f8
xorl %eax, %eax
jmp 0xe416
movq 0x7b85(%rip), %rdi      # 0x15fc8
callq 0x30f0
movq -0x48(%rbp), %r12
movq 0x8(%r12), %rdi
xorl %r13d, %r13d
testq %rdi, %rdi
je 0xe4e4
callq 0xa5da
pushq $0x1
popq %rcx
movl %ecx, %r15d
testb %al, %al
je 0xe4ea
movq 0x7b55(%rip), %rdi      # 0x15fc8
pushq $0x1
popq %rsi
callq 0x32f0
movq %rax, %rdi
leaq 0x2f07(%rip), %rsi      # 0x1138c
callq 0x31d0
movq %rax, %rbx
movq 0x8(%r12), %rsi
leaq -0x70(%rbp), %r14
movq %r14, %rdi
callq 0xa5b4
movq %rbx, %rdi
movq %r14, %rsi
callq 0x31b0
movq %rax, %rdi
callq 0x30f0
leaq -0x70(%rbp), %rdi
callq 0x3368
pushq $0x2
popq %rax
movl %eax, %r15d
pushq $0x1
popq %r13
jmp 0xe4ea
cmpl %r15d, %r12d
jne 0xe6c4
movq -0x48(%rbp), %rdi
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
callq *0x18(%rax)
xorl %eax, %eax
jmp 0xe416
pushq $0x1
popq %rax
movl %eax, %r15d
leaq -0xb0(%rbp), %rbx
movq %rbx, %rdi
leaq 0x95dd(%rip), %rsi      # 0x17ad8
callq 0x3250
movq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0x970a
testb %al, %al
je 0xe596
movq 0x8(%r12), %rbx
leaq -0xb0(%rbp), %rdi
callq 0x3368
testq %rbx, %rbx
je 0xe5a2
movq 0x8(%r12), %rdi
callq 0xa5da
testb %al, %al
je 0xe5a2
movq 0x7a89(%rip), %rdi      # 0x15fc8
movl %r15d, %esi
callq 0x32f0
movq %rax, %rdi
leaq 0x2e47(%rip), %rsi      # 0x11398
callq 0x31d0
movq %rax, %rbx
movq 0x8(%r12), %rsi
leaq -0x70(%rbp), %r14
movq %r14, %rdi
callq 0xa5b4
movq %rbx, %rdi
movq %r14, %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x23a5(%rip), %rsi      # 0x10924
callq 0x31d0
leaq -0x70(%rbp), %rdi
callq 0x3368
movq %r15, -0x40(%rbp)
incl %r15d
jmp 0xe5aa
leaq -0xb0(%rbp), %rdi
callq 0x3368
movq $0x0, -0x40(%rbp)
movq 0x7a17(%rip), %rbx      # 0x15fc8
movq %rbx, %rdi
movl %r15d, %esi
callq 0x32f0
movq %rax, %rdi
leaq 0x2ddd(%rip), %rsi      # 0x113a3
callq 0x31d0
leal 0x1(%r15), %esi
movq %rbx, %rdi
movl %esi, -0x50(%rbp)
callq 0x32f0
movq %rax, %rdi
leaq 0x2dce(%rip), %rsi      # 0x113b2
callq 0x31d0
leal 0x2(%r15), %esi
movq %rbx, %rdi
movl %esi, -0x4c(%rbp)
callq 0x32f0
movq %rax, %rdi
leaq 0x1b48(%rip), %rsi      # 0x1014a
callq 0x31d0
leal 0x3(%r15), %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x32f0
movq %rax, %rdi
leaq 0x2d9f(%rip), %rsi      # 0x113bf
callq 0x31d0
leaq -0x90(%rbp), %rbx
movq %rbx, %rdi
leaq 0x9502(%rip), %rsi      # 0x17b38
callq 0x3250
movq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0x970a
leal 0x4(%r15), %ebx
testb %al, %al
je 0xe6b4
movl %ebx, -0x2c(%rbp)
movq 0x8(%r12), %rbx
leaq -0x90(%rbp), %rdi
callq 0x3368
testq %rbx, %rbx
je 0xe6da
movq 0x8(%r12), %rdi
callq 0xa5da
testb %al, %al
movl %r13d, %ebx
je 0xe6f4
movq 0x7948(%rip), %rdi      # 0x15fc8
movl -0x2c(%rbp), %esi
callq 0x32f0
movq %rax, %rdi
leaq 0x2d3b(%rip), %rsi      # 0x113cd
callq 0x31d0
movq %rax, %rdi
leaq 0x9497(%rip), %rsi      # 0x17b38
callq 0x31b0
movq %rax, %rdi
callq 0x30f0
leal 0x5(%r15), %r13d
jmp 0xe6ea
leaq -0x90(%rbp), %rdi
callq 0x3368
movl %ebx, %eax
jmp 0xe6dd
cmpl -0x50(%rbp), %r12d
jne 0xe701
movq -0x38(%rbp), %rdi
callq 0x960c
xorl %eax, %eax
jmp 0xe416
movl -0x2c(%rbp), %eax
movl $0x0, -0x2c(%rbp)
movl %r13d, %ebx
movl %eax, %r13d
callq 0xaed4
jmp 0xe416
movl -0x2c(%rbp), %r13d
movl $0x0, -0x2c(%rbp)
jmp 0xe6ea
cmpl -0x4c(%rbp), %r12d
jne 0xe717
movq -0x38(%rbp), %rdi
callq 0x9582
xorl %eax, %eax
jmp 0xe416
cmpl %r14d, %r12d
je 0xe75e
cmpl -0x2c(%rbp), %r12d
jne 0xe732
movq -0x48(%rbp), %rdi
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
callq *0x30(%rax)
jmp 0xe74f
movl $0x0, %eax
cmpl -0x40(%rbp), %r12d
jne 0xe416
movq -0x48(%rbp), %rdi
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
callq *0x28(%rax)
movl %eax, %ecx
movl $0x0, %eax
testb %cl, %cl
jne 0xe416
cmpl %r14d, %r12d
sete %al
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xe77a
jmp 0xe77a
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
jmp 0xe799
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
jmp 0xe799
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x3368
movq %rbx, %rdi
callq 0x3300