// File: 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
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x110(%rbp)
movl $0x1, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movq 0xbf14(%rip), %rdi      # 0x28fc8
leaq 0x1ffd(%rip), %rsi      # 0x1f0b8
callq 0x3210
movq %rax, %rdi
leaq 0x32d7(%rip), %rsi      # 0x203a1
callq 0x3210
movq -0x110(%rbp), %rsi
movq %rax, -0x108(%rbp)
leaq -0x60(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x1d000
movq -0x108(%rbp), %rdi
movq -0x100(%rbp), %rsi
callq 0x31e0
movq %rax, -0xf8(%rbp)
jmp 0x1d109
movq -0xf8(%rbp), %rdi
leaq 0x1fbc(%rip), %rsi      # 0x1f0d3
callq 0x3210
jmp 0x1d11e
leaq -0x60(%rbp), %rdi
callq 0x3448
jmp 0x1d129
movb $0x1, %al
cmpl $0x1, -0x20(%rbp)
movb %al, -0x111(%rbp)
jl 0x1d146
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
setg %al
movb %al, -0x111(%rbp)
movb -0x111(%rbp), %al
testb $0x1, %al
jne 0x1d155
jmp 0x1d5e9
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movq 0xbe3b(%rip), %rdi      # 0x28fc8
movq 0xbe1c(%rip), %rsi      # 0x28fb0
callq 0x3240
movq -0x110(%rbp), %rax
movl $0x1, -0x1c(%rbp)
cmpq $0x0, 0x8(%rax)
je 0x1d298
movq -0x110(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x16010
testb $0x1, %al
jne 0x1d1cb
jmp 0x1d296
movl -0x1c(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %esi
movq 0xbded(%rip), %rdi      # 0x28fc8
callq 0x33b0
movq %rax, %rdi
leaq 0x31c2(%rip), %rsi      # 0x203ac
callq 0x3210
movq %rax, %rcx
movq -0x110(%rbp), %rax
movq %rcx, -0x130(%rbp)
movq 0x8(%rax), %rsi
leaq -0x90(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0x15fc0
movq -0x130(%rbp), %rdi
movq -0x128(%rbp), %rsi
callq 0x31e0
movq %rax, -0x120(%rbp)
jmp 0x1d233
movq -0x120(%rbp), %rdi
movq 0xbd6f(%rip), %rsi      # 0x28fb0
callq 0x3240
jmp 0x1d248
leaq -0x90(%rbp), %rdi
callq 0x3448
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1d296
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x3448
jmp 0x1d6c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x3448
jmp 0x1d6c8
jmp 0x1d298
movq -0x18(%rbp), %rax
movq %rax, -0x148(%rbp)
leaq 0xd89e(%rip), %rsi      # 0x2ab48
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0x30f0
movq -0x148(%rbp), %rdi
movq -0x140(%rbp), %rsi
callq 0x13240
movb %al, -0x131(%rbp)
jmp 0x1d2d8
movb -0x131(%rbp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x149(%rbp)
jne 0x1d2ed
jmp 0x1d302
movq -0x110(%rbp), %rax
cmpq $0x0, 0x8(%rax)
setne %al
movb %al, -0x149(%rbp)
movb -0x149(%rbp), %al
movb %al, -0x14a(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x3448
movb -0x14a(%rbp), %al
testb $0x1, %al
jne 0x1d329
jmp 0x1d412
movq -0x110(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x16010
testb $0x1, %al
jne 0x1d342
jmp 0x1d410
movl -0x1c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x1c(%rbp), %esi
movq 0xbc76(%rip), %rdi      # 0x28fc8
callq 0x33b0
movq %rax, %rdi
leaq 0x3057(%rip), %rsi      # 0x203b8
callq 0x3210
movq %rax, %rcx
movq -0x110(%rbp), %rax
movq %rcx, -0x168(%rbp)
movq 0x8(%rax), %rsi
leaq -0xd0(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0x15fc0
movq -0x168(%rbp), %rdi
movq -0x160(%rbp), %rsi
callq 0x31e0
movq %rax, -0x158(%rbp)
jmp 0x1d3aa
movq -0x158(%rbp), %rdi
leaq 0x258c(%rip), %rsi      # 0x1f944
callq 0x3210
jmp 0x1d3bf
leaq -0xd0(%rbp), %rdi
callq 0x3448
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1d410
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x3448
jmp 0x1d6c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x3448
jmp 0x1d6c8
jmp 0x1d412
movl -0x1c(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x1c(%rbp), %esi
movq 0xbba6(%rip), %rdi      # 0x28fc8
movq %rdi, -0x188(%rbp)
callq 0x33b0
movq %rax, %rdi
leaq 0x2f8b(%rip), %rsi      # 0x203c3
callq 0x3210
movq -0x188(%rbp), %rdi
movl -0x1c(%rbp), %eax
incl %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x1c(%rbp), %esi
callq 0x33b0
movq %rax, %rdi
leaq 0x2f6e(%rip), %rsi      # 0x203d2
callq 0x3210
movq -0x188(%rbp), %rdi
movl -0x1c(%rbp), %eax
incl %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x1c(%rbp), %esi
callq 0x33b0
movq %rax, %rdi
leaq 0x1cda(%rip), %rsi      # 0x1f16a
callq 0x3210
movq -0x188(%rbp), %rdi
movl -0x1c(%rbp), %eax
incl %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x1c(%rbp), %esi
callq 0x33b0
movq %rax, %rdi
leaq 0x2f23(%rip), %rsi      # 0x203df
callq 0x3210
movl -0x1c(%rbp), %eax
incl %eax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x180(%rbp)
leaq 0xd6cd(%rip), %rsi      # 0x2aba8
leaq -0xf0(%rbp), %rdi
movq %rdi, -0x178(%rbp)
callq 0x30f0
movq -0x180(%rbp), %rdi
movq -0x178(%rbp), %rsi
callq 0x13240
movb %al, -0x169(%rbp)
jmp 0x1d509
movb -0x169(%rbp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x189(%rbp)
jne 0x1d51e
jmp 0x1d533
movq -0x110(%rbp), %rax
cmpq $0x0, 0x8(%rax)
setne %al
movb %al, -0x189(%rbp)
movb -0x189(%rbp), %al
movb %al, -0x18a(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x3448
movb -0x18a(%rbp), %al
testb $0x1, %al
jne 0x1d55a
jmp 0x1d5dc
movq -0x110(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x16010
testb $0x1, %al
jne 0x1d570
jmp 0x1d5da
movl -0x1c(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x1c(%rbp), %esi
movq 0xba48(%rip), %rdi      # 0x28fc8
callq 0x33b0
movq %rax, %rdi
leaq 0x2e5e(%rip), %rsi      # 0x203ed
callq 0x3210
movq %rax, %rdi
leaq 0xd60a(%rip), %rsi      # 0x2aba8
callq 0x31e0
movq %rax, %rdi
movq 0xba03(%rip), %rsi      # 0x28fb0
callq 0x3240
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1d5da
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x3448
jmp 0x1d6c8
jmp 0x1d5dc
callq 0x175c0
movl %eax, -0x20(%rbp)
jmp 0x1d129
movl -0x20(%rbp), %eax
cmpl -0x24(%rbp), %eax
jne 0x1d606
movq -0x110(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x16070
jmp 0x1d6ae
movl -0x20(%rbp), %eax
cmpl -0x28(%rbp), %eax
jne 0x1d624
movq -0x110(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq (%rdi), %rax
callq *0x18(%rax)
jmp 0x1d6ac
movl -0x20(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jne 0x1d637
movq -0x18(%rbp), %rdi
callq 0x13100
jmp 0x1d6aa
movl -0x20(%rbp), %eax
cmpl -0x30(%rbp), %eax
jne 0x1d64a
movq -0x18(%rbp), %rdi
callq 0x13060
jmp 0x1d6a8
movl -0x20(%rbp), %eax
cmpl -0x34(%rbp), %eax
jne 0x1d658
movb $0x1, -0x1(%rbp)
jmp 0x1d6ba
movl -0x20(%rbp), %eax
cmpl -0x38(%rbp), %eax
jne 0x1d67d
movq -0x110(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq (%rdi), %rax
callq *0x30(%rax)
testb $0x1, %al
jne 0x1d67b
movb $0x0, -0x1(%rbp)
jmp 0x1d6ba
jmp 0x1d6a4
movl -0x20(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jne 0x1d6a2
movq -0x110(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq (%rdi), %rax
callq *0x28(%rax)
testb $0x1, %al
jne 0x1d6a0
movb $0x0, -0x1(%rbp)
jmp 0x1d6ba
jmp 0x1d6a2
jmp 0x1d6a4
jmp 0x1d6a6
jmp 0x1d6a8
jmp 0x1d6aa
jmp 0x1d6ac
jmp 0x1d6ae
movl $0x0, -0x20(%rbp)
jmp 0x1d127
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x33c0
nopw %cs:(%rax,%rax)