// File: /workspace/github_cpp_makefile_star2_O3/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 $0x98, %rsp
movq %rsi, -0x38(%rbp)
movq %rdi, %r14
movq 0x7f0e(%rip), %r15      # 0x1bfc8
leaq 0x1fd2(%rip), %rsi      # 0x16093
movl $0x5, %edx
movq %r15, %rdi
callq 0x3210
leaq 0x32d1(%rip), %rsi      # 0x173a6
movl $0xa, %edx
movq %r15, %rdi
callq 0x3210
leaq -0x60(%rbp), %rax
movq %rax, -0x10(%rax)
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %rbx
movq %rbx, %rdi
callq 0xd7ca
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r15, %rdi
callq 0x3210
leaq 0x1f97(%rip), %rsi      # 0x160ae
movl $0x4, %edx
movq %rax, %rdi
callq 0x3210
movq %r14, -0x48(%rbp)
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x1413a
callq 0x31c0
movq 0x7e87(%rip), %rbx      # 0x1bfc8
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3140
movq -0x48(%rbp), %r13
movq 0x8(%r13), %rdi
xorl %r15d, %r15d
testq %rdi, %rdi
je 0x14225
callq 0xeaf8
movl $0x1, %r12d
testb %al, %al
leaq -0xa8(%rbp), %r14
je 0x14232
movq 0x7e2b(%rip), %rdi      # 0x1bfc8
movl $0x1, %esi
callq 0x3310
movq %rax, %rbx
movl $0xb, %edx
movq %rax, %rdi
leaq 0x31f8(%rip), %rsi      # 0x173b1
callq 0x3210
movq 0x8(%r13), %rsi
leaq -0x70(%rbp), %rdi
callq 0xeac0
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %rbx, %rdi
callq 0x3210
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3140
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x14217
callq 0x31c0
movl $0x1, %r15d
movl $0x2, %r12d
jmp 0x14232
movl $0x1, %r12d
leaq -0xa8(%rbp), %r14
movq %r14, -0xb8(%rbp)
movq 0x98a8(%rip), %rsi      # 0x1dae8
movq 0x98a9(%rip), %rdx      # 0x1daf0
addq %rsi, %rdx
leaq -0xb8(%rbp), %rbx
movq %rbx, %rdi
callq 0xd7ca
movq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0xd686
testb %al, %al
movl %r15d, -0x74(%rbp)
je 0x14312
movq 0x8(%r13), %rbx
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
je 0x14286
callq 0x31c0
testq %rbx, %rbx
je 0x14323
movq 0x8(%r13), %rdi
callq 0xeaf8
testb %al, %al
je 0x14323
movq 0x7d21(%rip), %rdi      # 0x1bfc8
movl %r12d, %esi
callq 0x3310
movq %rax, %rbx
movl $0xa, %edx
movq %rax, %rdi
leaq 0x30fc(%rip), %rsi      # 0x173bd
callq 0x3210
movq 0x8(%r13), %rsi
leaq -0x70(%rbp), %rdi
callq 0xeac0
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %rbx, %rdi
callq 0x3210
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2652(%rip), %rsi      # 0x16944
callq 0x3210
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x14309
callq 0x31c0
movq %r12, -0x40(%rbp)
incl %r12d
jmp 0x1432b
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
je 0x14323
callq 0x31c0
movq $0x0, -0x40(%rbp)
movq 0x7c96(%rip), %rbx      # 0x1bfc8
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3310
movl $0xe, %edx
movq %rax, %rdi
leaq 0x307c(%rip), %rsi      # 0x173c8
callq 0x3210
leal 0x1(%r12), %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3310
movl $0xc, %edx
movq %rax, %rdi
leaq 0x3067(%rip), %rsi      # 0x173d7
callq 0x3210
leal 0x2(%r12), %r15d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x3310
movl $0x1e, %edx
movq %rax, %rdi
leaq 0x1db1(%rip), %rsi      # 0x16145
callq 0x3210
leal 0x3(%r12), %esi
movq %rbx, %rdi
movl %esi, -0x4c(%rbp)
callq 0x3310
movl $0xd, %edx
movq %rax, %rdi
leaq 0x302c(%rip), %rsi      # 0x173e4
callq 0x3210
leaq -0x88(%rbp), %rax
movq %rax, -0x98(%rbp)
movq 0x9776(%rip), %rsi      # 0x1db48
movq 0x9777(%rip), %rdx      # 0x1db50
addq %rsi, %rdx
leaq -0x98(%rbp), %rbx
movq %rbx, %rdi
callq 0xd7ca
movq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0xd686
leal 0x4(%r12), %ebx
testb %al, %al
je 0x144ae
movl %ebx, -0x2c(%rbp)
movq 0x8(%r13), %rbx
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x14423
callq 0x31c0
testq %rbx, %rbx
je 0x144cb
movq 0x8(%r13), %rdi
callq 0xeaf8
testb %al, %al
movl -0x2c(%rbp), %r13d
je 0x144cf
movq 0x7b80(%rip), %rdi      # 0x1bfc8
movl %r13d, %esi
callq 0x3310
movq %rax, %rbx
movl $0xd, %edx
movq %rax, %rdi
leaq 0x2f90(%rip), %rsi      # 0x173f2
callq 0x3210
movq 0x96da(%rip), %rsi      # 0x1db48
movq 0x96db(%rip), %rdx      # 0x1db50
movq %rbx, %rdi
callq 0x3210
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3140
leal 0x5(%r12), %r13d
jmp 0x144d6
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x144c6
callq 0x31c0
movl %ebx, %r13d
jmp 0x144cf
movl -0x2c(%rbp), %r13d
movl $0x0, -0x2c(%rbp)
callq 0xf6ef
testl %eax, %eax
jle 0x1413a
movl %eax, %ebx
cmpl %r13d, %eax
ja 0x1413a
cmpl -0x74(%rbp), %ebx
jne 0x14505
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xeb16
jmp 0x1413a
cmpl %r12d, %ebx
movq -0x48(%rbp), %rdi
jne 0x1451d
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
callq *0x18(%rax)
jmp 0x1413a
cmpl %r14d, %ebx
jne 0x14530
movq -0x38(%rbp), %rdi
callq 0xd552
jmp 0x1413a
cmpl %r15d, %ebx
jne 0x14543
movq -0x38(%rbp), %rdi
callq 0xd478
jmp 0x1413a
cmpl -0x4c(%rbp), %ebx
je 0x1457c
cmpl -0x2c(%rbp), %ebx
jne 0x1455d
movq -0x48(%rbp), %rdi
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
callq *0x30(%rax)
jmp 0x14574
cmpl -0x40(%rbp), %ebx
jne 0x1413a
movq -0x48(%rbp), %rdi
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
callq *0x28(%rax)
testb %al, %al
jne 0x1413a
cmpl -0x4c(%rbp), %ebx
sete %al
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x145bc
jmp 0x145bc
movq %rax, %rbx
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
jmp 0x145c7
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
jne 0x145cc
jmp 0x145d1
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x145d1
callq 0x31c0
movq %rbx, %rdi
callq 0x3320
nop