// File: /workspace/github_cpp_makefile_star2_O1/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 0x7cc6(%rip), %r15      # 0x1bfc8
leaq 0x1d8a(%rip), %rsi      # 0x16093
movl $0x5, %edx
movq %r15, %rdi
callq 0x3210
leaq 0x3089(%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 0xd9b2
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r15, %rdi
callq 0x3210
leaq 0x1d4f(%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 0x14382
callq 0x31c0
movq 0x7c3f(%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 0x1446d
callq 0xeca8
movl $0x1, %r12d
testb %al, %al
leaq -0xa8(%rbp), %r14
je 0x1447a
movq 0x7be3(%rip), %rdi      # 0x1bfc8
movl $0x1, %esi
callq 0x3310
movq %rax, %rbx
movl $0xb, %edx
movq %rax, %rdi
leaq 0x2fb0(%rip), %rsi      # 0x173b1
callq 0x3210
movq 0x8(%r13), %rsi
leaq -0x70(%rbp), %rdi
callq 0xec70
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 0x1445f
callq 0x31c0
movl $0x1, %r15d
movl $0x2, %r12d
jmp 0x1447a
movl $0x1, %r12d
leaq -0xa8(%rbp), %r14
movq %r14, -0xb8(%rbp)
movq 0x9660(%rip), %rsi      # 0x1dae8
movq 0x9661(%rip), %rdx      # 0x1daf0
addq %rsi, %rdx
leaq -0xb8(%rbp), %rbx
movq %rbx, %rdi
callq 0xd9b2
movq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0xd878
testb %al, %al
movl %r15d, -0x74(%rbp)
je 0x1455a
movq 0x8(%r13), %rbx
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
je 0x144ce
callq 0x31c0
testq %rbx, %rbx
je 0x1456b
movq 0x8(%r13), %rdi
callq 0xeca8
testb %al, %al
je 0x1456b
movq 0x7ad9(%rip), %rdi      # 0x1bfc8
movl %r12d, %esi
callq 0x3310
movq %rax, %rbx
movl $0xa, %edx
movq %rax, %rdi
leaq 0x2eb4(%rip), %rsi      # 0x173bd
callq 0x3210
movq 0x8(%r13), %rsi
leaq -0x70(%rbp), %rdi
callq 0xec70
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %rbx, %rdi
callq 0x3210
movl $0x1, %edx
movq %rax, %rdi
leaq 0x240a(%rip), %rsi      # 0x16944
callq 0x3210
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x14551
callq 0x31c0
movq %r12, -0x40(%rbp)
incl %r12d
jmp 0x14573
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
je 0x1456b
callq 0x31c0
movq $0x0, -0x40(%rbp)
movq 0x7a4e(%rip), %rbx      # 0x1bfc8
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3310
movl $0xe, %edx
movq %rax, %rdi
leaq 0x2e34(%rip), %rsi      # 0x173c8
callq 0x3210
leal 0x1(%r12), %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3310
movl $0xc, %edx
movq %rax, %rdi
leaq 0x2e1f(%rip), %rsi      # 0x173d7
callq 0x3210
leal 0x2(%r12), %r15d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x3310
movl $0x1e, %edx
movq %rax, %rdi
leaq 0x1b69(%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 0x2de4(%rip), %rsi      # 0x173e4
callq 0x3210
leaq -0x88(%rbp), %rax
movq %rax, -0x98(%rbp)
movq 0x952e(%rip), %rsi      # 0x1db48
movq 0x952f(%rip), %rdx      # 0x1db50
addq %rsi, %rdx
leaq -0x98(%rbp), %rbx
movq %rbx, %rdi
callq 0xd9b2
movq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0xd878
leal 0x4(%r12), %ebx
testb %al, %al
je 0x146f6
movl %ebx, -0x2c(%rbp)
movq 0x8(%r13), %rbx
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x1466b
callq 0x31c0
testq %rbx, %rbx
je 0x14713
movq 0x8(%r13), %rdi
callq 0xeca8
testb %al, %al
movl -0x2c(%rbp), %r13d
je 0x14717
movq 0x7938(%rip), %rdi      # 0x1bfc8
movl %r13d, %esi
callq 0x3310
movq %rax, %rbx
movl $0xd, %edx
movq %rax, %rdi
leaq 0x2d48(%rip), %rsi      # 0x173f2
callq 0x3210
movq 0x9492(%rip), %rsi      # 0x1db48
movq 0x9493(%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 0x1471e
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x1470e
callq 0x31c0
movl %ebx, %r13d
jmp 0x14717
movl -0x2c(%rbp), %r13d
movl $0x0, -0x2c(%rbp)
callq 0xf8fa
testl %eax, %eax
jle 0x14382
movl %eax, %ebx
cmpl %r13d, %eax
jg 0x14382
cmpl -0x74(%rbp), %ebx
jne 0x1474d
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xecc6
jmp 0x14382
cmpl %r12d, %ebx
movq -0x48(%rbp), %rdi
jne 0x14765
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
callq *0x18(%rax)
jmp 0x14382
cmpl %r14d, %ebx
jne 0x14778
movq -0x38(%rbp), %rdi
callq 0xd744
jmp 0x14382
cmpl %r15d, %ebx
jne 0x1478b
movq -0x38(%rbp), %rdi
callq 0xd66a
jmp 0x14382
cmpl -0x4c(%rbp), %ebx
je 0x147c4
cmpl -0x2c(%rbp), %ebx
jne 0x147a5
movq -0x48(%rbp), %rdi
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
callq *0x30(%rax)
jmp 0x147bc
cmpl -0x40(%rbp), %ebx
jne 0x14382
movq -0x48(%rbp), %rdi
movq (%rdi), %rax
movq -0x38(%rbp), %rsi
callq *0x28(%rax)
testb %al, %al
jne 0x14382
cmpl -0x4c(%rbp), %ebx
sete %al
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x14804
jmp 0x14804
movq %rax, %rbx
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
jmp 0x1480f
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
jne 0x14814
jmp 0x14819
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x14819
callq 0x31c0
movq %rbx, %rdi
callq 0x3320
nop