// File: 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
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq 0x8(%rax), %rdi
callq 0x16010
testb $0x1, %al
jne 0x1558c
movq 0x13ae5(%rip), %rdi     # 0x28fc8
leaq 0x9bce(%rip), %rsi      # 0x1f0b8
callq 0x3210
movq %rax, %rdi
leaq 0x9d81(%rip), %rsi      # 0x1f27a
callq 0x3210
movq %rax, %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0x90(%rbp)
movq 0x8(%rax), %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0x15fc0
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x31e0
movq %rax, -0x80(%rbp)
jmp 0x15539
movq -0x80(%rbp), %rdi
leaq 0x9d6a(%rip), %rsi      # 0x1f2ae
callq 0x3210
movq %rax, -0x98(%rbp)
jmp 0x15552
movq -0x98(%rbp), %rdi
movq 0x13a50(%rip), %rsi     # 0x28fb0
callq 0x3240
jmp 0x15567
leaq -0x30(%rbp), %rdi
callq 0x3448
jmp 0x1558c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3448
jmp 0x1598c
movq 0x13a35(%rip), %rdi     # 0x28fc8
leaq 0x9b1e(%rip), %rsi      # 0x1f0b8
callq 0x3210
movq %rax, %rdi
leaq 0x9d13(%rip), %rsi      # 0x1f2bc
callq 0x3210
movq %rax, %rdi
leaq 0x9b1b(%rip), %rsi      # 0x1f0d3
callq 0x3210
movl $0x0, -0x40(%rbp)
movb $0x1, %al
cmpl $0x1, -0x40(%rbp)
movb %al, -0x99(%rbp)
jl 0x155df
cmpl $0x2, -0x40(%rbp)
setg %al
movb %al, -0x99(%rbp)
movb -0x99(%rbp), %al
testb $0x1, %al
jne 0x155eb
jmp 0x15626
movq 0x139d6(%rip), %rdi     # 0x28fc8
leaq 0x9cea(%rip), %rsi      # 0x1f2e3
callq 0x3210
movq %rax, %rdi
leaq 0x9cf5(%rip), %rsi      # 0x1f2fd
callq 0x3210
movq %rax, %rdi
movq 0x13999(%rip), %rsi     # 0x28fb0
callq 0x3240
callq 0x175c0
movl %eax, -0x40(%rbp)
jmp 0x155c4
cmpl $0x2, -0x40(%rbp)
jne 0x15631
jmp 0x15983
movq -0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq 0x13e4d(%rip), %rsi     # 0x29490
leaq -0x60(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x30f0
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
callq 0x13240
movb %al, -0x9a(%rbp)
jmp 0x1566e
movb -0x9a(%rbp), %al
xorb $-0x1, %al
movb %al, -0xb1(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x3448
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x15691
jmp 0x156f0
movq 0x13930(%rip), %rdi     # 0x28fc8
leaq 0x9a19(%rip), %rsi      # 0x1f0b8
callq 0x3210
movq %rax, %rdi
leaq 0x9c59(%rip), %rsi      # 0x1f307
callq 0x3210
movq %rax, %rdi
leaq 0x9a16(%rip), %rsi      # 0x1f0d3
callq 0x3210
movq %rax, %rdi
movq 0x138e4(%rip), %rsi     # 0x28fb0
callq 0x3240
jmp 0x15983
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x3448
jmp 0x1598c
movq 0x138d1(%rip), %rdi     # 0x28fc8
leaq 0x99ba(%rip), %rsi      # 0x1f0b8
callq 0x3210
movq %rax, %rdi
leaq 0x9c1b(%rip), %rsi      # 0x1f328
callq 0x3210
movq %rax, %rdi
movq 0x13894(%rip), %rsi     # 0x28fb0
callq 0x3240
jmp 0x15723
jmp 0x15725
movq -0x78(%rbp), %rdi
addq $0x30, %rdi
callq 0x13490
movq -0x78(%rbp), %rdi
movl %eax, -0x64(%rbp)
addq $0x30, %rdi
callq 0x13450
testb $0x1, %al
jne 0x15748
jmp 0x1578d
movq 0x13879(%rip), %rdi     # 0x28fc8
leaq 0x9962(%rip), %rsi      # 0x1f0b8
callq 0x3210
movq %rax, %rdi
leaq 0x9bed(%rip), %rsi      # 0x1f352
callq 0x3210
movq %rax, %rdi
leaq 0x995f(%rip), %rsi      # 0x1f0d3
callq 0x3210
movq %rax, %rdi
movq 0x1382d(%rip), %rsi     # 0x28fb0
callq 0x3240
jmp 0x15983
movq 0x13834(%rip), %rdi     # 0x28fc8
leaq 0x991d(%rip), %rsi      # 0x1f0b8
callq 0x3210
movq %rax, %rdi
leaq 0x9bbf(%rip), %rsi      # 0x1f369
callq 0x3210
movq %rax, %rdi
leaq 0x9936(%rip), %rsi      # 0x1f0ef
callq 0x3210
movl $0x0, -0x68(%rbp)
movl -0x68(%rbp), %eax
movl -0x64(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1580c
movq -0x78(%rbp), %rdi
addq $0x30, %rdi
movslq -0x68(%rbp), %rsi
callq 0x134b0
movq %rax, %rsi
movq 0x137db(%rip), %rdi     # 0x28fc8
callq 0x31e0
movq %rax, %rdi
leaq 0x9b90(%rip), %rsi      # 0x1f38c
callq 0x3210
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x157c5
movq -0x78(%rbp), %rdi
addq $0x30, %rdi
movl -0x64(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x134b0
movq %rax, %rsi
movq 0x1379c(%rip), %rdi     # 0x28fc8
callq 0x31e0
movq %rax, %rdi
leaq 0x992b(%rip), %rsi      # 0x1f166
callq 0x3210
movl $0x0, -0x6c(%rbp)
movb $0x1, %al
cmpl $0x1, -0x6c(%rbp)
movb %al, -0xb2(%rbp)
jl 0x15869
movl -0x6c(%rbp), %eax
movl -0x64(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
setg %al
movb %al, -0xb2(%rbp)
movb -0xb2(%rbp), %al
testb $0x1, %al
jne 0x15878
jmp 0x15948
movq 0x13749(%rip), %rdi     # 0x28fc8
leaq 0x984d(%rip), %rsi      # 0x1f0d3
callq 0x3210
movq %rax, %rdi
leaq 0xa0af(%rip), %rsi      # 0x1f944
callq 0x3210
movl $0x0, -0x70(%rbp)
movl -0x70(%rbp), %eax
cmpl -0x64(%rbp), %eax
jge 0x1590b
movl -0x70(%rbp), %esi
addl $0x1, %esi
movq 0x13712(%rip), %rdi     # 0x28fc8
callq 0x33b0
movq %rax, %rdi
leaq 0x9aca(%rip), %rsi      # 0x1f38f
callq 0x3210
movq -0x78(%rbp), %rdi
movq %rax, -0xc0(%rbp)
addq $0x30, %rdi
movslq -0x70(%rbp), %rsi
callq 0x134b0
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
callq 0x31e0
movq %rax, %rdi
leaq 0x986b(%rip), %rsi      # 0x1f166
callq 0x3210
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x158a1
movl -0x64(%rbp), %esi
addl $0x1, %esi
movq 0x136b0(%rip), %rdi     # 0x28fc8
callq 0x33b0
movq %rax, %rdi
leaq 0x9a70(%rip), %rsi      # 0x1f397
callq 0x3210
movq %rax, %rdi
movq 0x1367a(%rip), %rsi     # 0x28fb0
callq 0x3240
callq 0x175c0
movl %eax, -0x6c(%rbp)
jmp 0x15847
cmpl $0x1, -0x6c(%rbp)
jl 0x15969
movl -0x6c(%rbp), %eax
cmpl -0x64(%rbp), %eax
jg 0x15969
movq -0x78(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x6c(%rbp), %edx
movq (%rdi), %rax
callq *0x20(%rax)
jmp 0x1597e
movq 0x13658(%rip), %rdi     # 0x28fc8
leaq 0x975c(%rip), %rsi      # 0x1f0d3
callq 0x3210
jmp 0x15983
jmp 0x15725
addq $0xc0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x33c0
nopw %cs:(%rax,%rax)
nop