// File: /workspace/github_cpp_makefile_star2_O1/dnegovan[P]Intruder-On-Donnar-V/Bridge.cpp
// Function: Bridge::searchRoom(Player&)
void Bridge::searchRoom(Player& markNelson)
{
    if (!occupant->getAlive())
    {
        std::cout << NARRATOR_COLOR
                  <<  "\nAs you scan the room, your eyes move quickly past "
                  << occupant->getName() << "'s dead body." << std::endl;
    }

    std::cout << NARRATOR_COLOR << "\nThe crew's lockers are located here.\n"
              << RESET;
    int lockerInput = 0;
    while (lockerInput < 1 || lockerInput > 2)
    {
        std::cout << "1. Open Captain's locker\n"
                  << "2. Return" << std::endl;

        lockerInput = getInteger();
    }

    if (lockerInput == 2)
    {
        return;   //exit room search
    }
    else
    {
        if (!markNelson.pack.checkFor(keyCard))
        {
            std::cout << NARRATOR_COLOR << "\nYou need a key card to open it."
                      << RESET << std::endl;
            //exit since user can't open the locker yet
            return;
        }
        else
        {
            std::cout << NARRATOR_COLOR
                      << "\nYou use your key card to open the locker"
                      << std::endl;
        }
    }

    //menu to search locker
    while (true)
    {
        //cast from unsigned int to avoid compiler warnings
        int size = static_cast<int>(roomItems.size());

        if (roomItems.empty())
        {
            std::cout << NARRATOR_COLOR << "\nYour locker is empty."
                      << RESET << std::endl;
            return;
        }
        //Show what's in the locker
        std::cout << NARRATOR_COLOR << "\nThese items are in your locker: \n"
                  << ITEM_COLOR;
        for (int i = 0; i < size - 1; i++)
        {
            std::cout << roomItems[i] << ", ";
        }
        std::cout << roomItems[size - 1] << ".\n";

        //menu for which item to take, or cancel
        int input = 0;
        while (input < 1 || input > (size + 1))
        {
            std::cout << RESET << "\n";
            for (int i = 0; i < size; i++)
            {
                std::cout << i+1 << ". Take " << roomItems[i] << ".\n";
            }
            std::cout << size + 1 << ". Return to previous menu"
                      << std::endl;
            input = getInteger();
        }

        //execute user choice
        if (input >= 1 && input <= size)
        {
            takeItem(markNelson, input);
        }
        else
        {
            std::cout << RESET;
            //exit menu
            return;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, -0x40(%rbp)
movq %rdi, %r14
movq 0x8(%rdi), %rdi
callq 0xeca8
testb %al, %al
jne 0xe2e6
movq 0xdd7c(%rip), %rbx      # 0x1bfc8
leaq 0x7e40(%rip), %rsi      # 0x16093
movl $0x5, %edx
movq %rbx, %rdi
callq 0x3210
leaq 0x8018(%rip), %rsi      # 0x1627f
movl $0x33, %edx
movq %rbx, %rdi
callq 0x3210
movq 0x8(%r14), %rsi
leaq -0x90(%rbp), %r15
movq %r15, %rdi
callq 0xec70
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x3210
movq %rax, %rbx
leaq 0x8013(%rip), %rsi      # 0x162b3
movl $0xd, %edx
movq %rax, %rdi
callq 0x3210
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
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xe2e6
callq 0x31c0
movq %r14, -0x38(%rbp)
movq 0xdcd7(%rip), %rbx      # 0x1bfc8
leaq 0x7d9b(%rip), %rsi      # 0x16093
movl $0x5, %edx
movq %rbx, %rdi
callq 0x3210
leaq 0x7fb5(%rip), %rsi      # 0x162c1
movl $0x26, %edx
movq %rbx, %rdi
callq 0x3210
leaq 0x7d8e(%rip), %rsi      # 0x160ae
movl $0x4, %edx
movq %rbx, %rdi
callq 0x3210
leaq 0x7fb4(%rip), %r15      # 0x162e8
leaq 0x7fc7(%rip), %r12      # 0x16302
movl $0x19, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3210
movl $0x9, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3210
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
callq 0xf8fa
leal -0x3(%rax), %ecx
cmpl $-0x2, %ecx
jb 0xe33b
cmpl $0x2, %eax
je 0xe6ea
leaq -0x60(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0xe089(%rip), %rsi      # 0x1c430
movq 0xe08a(%rip), %rdx      # 0x1c438
addq %rsi, %rdx
leaq -0x70(%rbp), %rbx
movq %rbx, %rdi
callq 0xd9b2
movq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0xd878
movl %eax, %ebx
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0xe3d9
callq 0x31c0
movq 0xdbe8(%rip), %r13      # 0x1bfc8
leaq 0x7cac(%rip), %rsi      # 0x16093
movl $0x5, %edx
movq %r13, %rdi
callq 0x3210
testb %bl, %bl
je 0xe681
leaq 0x7f2a(%rip), %rsi      # 0x1632d
movl $0x29, %edx
movq %r13, %rdi
callq 0x3210
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3140
leaq 0x7f52(%rip), %r14      # 0x16391
movq -0x38(%rbp), %rax
movq 0x38(%rax), %r12
movq 0x30(%rax), %r15
movq %r12, %rbx
subq %r15, %rbx
movl $0x5, %edx
movq 0xdb6b(%rip), %r13      # 0x1bfc8
movq %r13, %rdi
leaq 0x7c2c(%rip), %rsi      # 0x16093
callq 0x3210
cmpq %r15, %r12
je 0xe696
shrq $0x5, %rbx
movl $0x22, %edx
movq %r13, %rdi
leaq 0x7ee6(%rip), %rsi      # 0x1636e
callq 0x3210
movl $0x5, %edx
movq %r13, %rdi
leaq 0x7c2e(%rip), %rsi      # 0x160ca
callq 0x3210
leal -0x1(%rbx), %eax
movl %eax, -0x2c(%rbp)
movq %rbx, -0x48(%rbp)
cmpl $0x2, %ebx
movq %r14, %rbx
movq -0x38(%rbp), %r14
jl 0xe4ef
movl -0x2c(%rbp), %r15d
movl $0x8, %r12d
movq 0x30(%r14), %rax
movq -0x8(%rax,%r12), %rsi
movq (%rax,%r12), %rdx
movq %r13, %rdi
callq 0x3210
movl $0x2, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3210
addq $0x20, %r12
decq %r15
jne 0xe4c1
movslq -0x2c(%rbp), %rax
movq 0x30(%r14), %rcx
shlq $0x5, %rax
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
movq %r13, %rdi
callq 0x3210
movl $0x2, %edx
movq %rax, %rdi
leaq 0x7c26(%rip), %rsi      # 0x16141
callq 0x3210
movq -0x48(%rbp), %rbx
leal 0x1(%rbx), %r14d
movl %ebx, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, -0x50(%rbp)
movq %r13, %r15
movl %r14d, -0x2c(%rbp)
movl $0x4, %edx
movq %r15, %rdi
leaq 0x7b65(%rip), %rsi      # 0x160ae
callq 0x3210
movl $0x1, %edx
movq %r15, %rdi
leaq 0x83e7(%rip), %rsi      # 0x16944
callq 0x3210
testl %ebx, %ebx
leaq 0x7e29(%rip), %r14      # 0x16394
movq -0x50(%rbp), %rbx
jle 0xe5d8
movl $0x8, %r13d
xorl %r12d, %r12d
incq %r12
movq %r15, %rdi
movl %r12d, %esi
callq 0x3310
movq %rax, %r15
movl $0x7, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x3210
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x8(%rax,%r13), %rsi
movq (%rax,%r13), %rdx
movq %r15, %rdi
movq 0xda12(%rip), %r15      # 0x1bfc8
callq 0x3210
movl $0x2, %edx
movq %rax, %rdi
leaq 0x7b77(%rip), %rsi      # 0x16141
callq 0x3210
addq $0x20, %r13
cmpq %r12, %rbx
jne 0xe57a
movq %r15, %rdi
movl -0x2c(%rbp), %r14d
movl %r14d, %esi
callq 0x3310
movq %rax, %r12
movl $0x19, %edx
movq %rax, %rdi
leaq 0x7da3(%rip), %rsi      # 0x1639c
callq 0x3210
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq %r12, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3140
callq 0xf8fa
testl %eax, %eax
movq -0x48(%rbp), %rbx
jle 0xe53a
movl %eax, %r12d
cmpl %r14d, %eax
jg 0xe53a
cmpl %ebx, %r12d
jle 0xe65e
movl $0x4, %edx
movq %r15, %rdi
leaq 0x7a57(%rip), %rsi      # 0x160ae
callq 0x3210
jmp 0xe66f
movq -0x38(%rbp), %rdi
movq (%rdi), %rax
movq -0x40(%rbp), %rsi
movl %r12d, %edx
callq *0x20(%rax)
cmpl %ebx, %r12d
leaq 0x7d18(%rip), %r14      # 0x16391
jle 0xe43f
jmp 0xe6ea
movq 0xd940(%rip), %rdi      # 0x1bfc8
leaq 0x7c7d(%rip), %rsi      # 0x1630c
movl $0x20, %edx
jmp 0xe6a9
movq 0xd92b(%rip), %rdi      # 0x1bfc8
leaq 0x7cb3(%rip), %rsi      # 0x16357
movl $0x16, %edx
callq 0x3210
leaq 0x79f9(%rip), %rsi      # 0x160ae
movl $0x4, %edx
movq %r13, %rdi
callq 0x3210
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3140
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
jne 0xe717
jmp 0xe71c
movq %rax, %rbx
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xe71c
callq 0x31c0
movq %rbx, %rdi
callq 0x3320