// File: /workspace/github_cpp_makefile_star2_O1/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 0xd846
testb %al, %al
je 0x13c3e
movq 0x83fb(%rip), %rbx      # 0x1bfc8
leaq 0x2def(%rip), %rsi      # 0x169c3
movl $0x5, %edx
movq %rbx, %rdi
callq 0x3210
leaq 0x368b(%rip), %rsi      # 0x17273
movl $0x31, %edx
movq %rbx, %rdi
callq 0x3210
leaq 0x24b2(%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 0x8383(%rip), %r12      # 0x1bfc8
leaq 0x2447(%rip), %rsi      # 0x16093
movl $0x5, %edx
movq %r12, %rdi
callq 0x3210
leaq 0x2ce4(%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 0x360a(%rip), %rsi      # 0x172a5
movl $0xf, %edx
movq %rax, %rdi
callq 0x3210
leaq 0x23ff(%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 0xd9b2
movq -0x30(%rbp), %rdi
movq %rdi, %r12
movq %r15, %rsi
callq 0xd86e
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x13d28
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 0xd9b2
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x14e32
addq $0x30, %r14
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x13d70
callq 0x31c0
movq (%r14), %rax
shlq $0x5, %r13
leaq (%rax,%r13), %rsi
addq $-0x20, %rsi
movq %r14, %rdi
callq 0xdcb6
cmpl $0x5, 0x1c(%r12)
jne 0x13de7
leaq -0x80(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x34ad(%rip), %rsi      # 0x1724b
leaq 0x34cd(%rip), %rdx      # 0x17272
leaq -0x90(%rbp), %r14
movq %r14, %rdi
callq 0xe724
movq %r14, %rdi
callq 0xf806
movl %eax, %r14d
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x13dd0
callq 0x31c0
cmpb $0x59, %r14b
jne 0x13de7
movq %r12, %rsi
callq 0x1391e
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 0x13e24
jmp 0x13e29
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
jmp 0x13e1f
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x13e29
callq 0x31c0
movq %rbx, %rdi
callq 0x3320
nopl (%rax)