// File: /workspace/github_cpp_makefile_star2_O3/dnegovan[P]Intruder-On-Donnar-V/Lab.cpp
// Function: Lab::takeItem(Player&, int)
void Lab::takeItem(Player& markNelson, int input)
{
    if (markNelson.pack.isFull())
    {
        std::cout << RED
                  << "\nYour pack is full. Discard items you don't need."
                  << RESET << std::endl;
        //won't be able to take anything else, exit search menu
        return;
    }
    else
    {
        std::cout << NARRATOR_COLOR << "\n" << roomItems[input-1]
                  << " added to pack." << RESET << std::endl;
        //add item to pack
        markNelson.pack.addItem(roomItems[input-1]);

        //update ingredient counter if necessary
        checkForIngredient(markNelson, roomItems[input-1]);

        //remove item from room
        auto iterator = roomItems.begin() + input - 1;
        roomItems.erase(iterator);

        //if player has all ingredients, give option to make compound
        if (markNelson.ingredientsFound == TOTAL_INGREDIENTS)
        {
            char answer = getYesNo("Create Neutralization Compound? [y/n]: ");
            if (answer == 'Y')
            {
                makeCompound(markNelson);
                //reset this so this option isn't triggered next time you enter
                //the room
                markNelson.ingredientsFound = 0;
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0xd654
testb %al, %al
je 0x139fe
movq 0x863b(%rip), %rbx      # 0x1bfc8
leaq 0x302f(%rip), %rsi      # 0x169c3
movl $0x5, %edx
movq %rbx, %rdi
callq 0x3210
leaq 0x38cb(%rip), %rsi      # 0x17273
movl $0x31, %edx
movq %rbx, %rdi
callq 0x3210
leaq 0x26f2(%rip), %rsi      # 0x160ae
movl $0x4, %edx
movq %rbx, %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
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3140
movq 0x85c3(%rip), %r12      # 0x1bfc8
leaq 0x2687(%rip), %rsi      # 0x16093
movl $0x5, %edx
movq %r12, %rdi
callq 0x3210
leaq 0x2f24(%rip), %rsi      # 0x16944
movl $0x1, %edx
movq %r12, %rdi
callq 0x3210
movslq %r15d, %r13
movq %rbx, -0x30(%rbp)
leaq -0x1(%r13), %rbx
movq 0x30(%r14), %rax
shlq $0x5, %rbx
movq (%rax,%rbx), %rsi
movq 0x8(%rax,%rbx), %rdx
movq %r12, %rdi
callq 0x3210
movq %rax, %r15
leaq 0x384a(%rip), %rsi      # 0x172a5
movl $0xf, %edx
movq %rax, %rdi
callq 0x3210
leaq 0x263f(%rip), %rsi      # 0x160ae
movl $0x4, %edx
movq %r15, %rdi
callq 0x3210
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3140
movq 0x30(%r14), %rax
leaq -0x60(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq (%rax,%rbx), %rsi
movq 0x8(%rax,%rbx), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %r15
movq %r15, %rdi
callq 0xd7ca
movq -0x30(%rbp), %rdi
movq %rdi, %r12
movq %r15, %rsi
callq 0xd67c
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x13ae8
callq 0x31c0
movq 0x30(%r14), %rax
leaq -0x40(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq (%rax,%rbx), %rsi
movq 0x8(%rax,%rbx), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %r15
movq %r15, %rdi
callq 0xd7ca
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x14bea
addq $0x30, %r14
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x13b30
callq 0x31c0
movq (%r14), %rax
shlq $0x5, %r13
leaq (%rax,%r13), %rsi
addq $-0x20, %rsi
movq %r14, %rdi
callq 0xdae2
cmpl $0x5, 0x1c(%r12)
jne 0x13ba7
leaq -0x80(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x36ed(%rip), %rsi      # 0x1724b
leaq 0x370d(%rip), %rdx      # 0x17272
leaq -0x90(%rbp), %r14
movq %r14, %rdi
callq 0xe56e
movq %r14, %rdi
callq 0xf629
movl %eax, %r14d
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x13b90
callq 0x31c0
cmpb $0x59, %r14b
jne 0x13ba7
movq %r12, %rsi
callq 0x136de
movl $0x0, 0x1c(%r12)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
jne 0x13be4
jmp 0x13be9
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
jmp 0x13bdf
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x13be9
callq 0x31c0
movq %rbx, %rdi
callq 0x3320
nopl (%rax)