// File: /workspace/github_cpp_makefile_star2_O1/dnegovan[P]Intruder-On-Donnar-V/Space.cpp
// Function: Space::takeItem(Player&, int)
void Space::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);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0xd846
testb %al, %al
je 0x14caa
movq 0x738f(%rip), %rbx      # 0x1bfc8
leaq 0x1d83(%rip), %rsi      # 0x169c3
movl $0x5, %edx
movq %rbx, %rdi
callq 0x3210
leaq 0x261f(%rip), %rsi      # 0x17273
movl $0x31, %edx
movq %rbx, %rdi
callq 0x3210
leaq 0x1446(%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 $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3140
movq 0x7317(%rip), %r12      # 0x1bfc8
leaq 0x13db(%rip), %rsi      # 0x16093
movl $0x5, %edx
movq %r12, %rdi
callq 0x3210
leaq 0x1c78(%rip), %rsi      # 0x16944
movl $0x1, %edx
movq %r12, %rdi
callq 0x3210
movslq %r15d, %rax
movq %rax, -0x30(%rbp)
leaq -0x1(%rax), %r13
movq 0x30(%rbx), %rax
shlq $0x5, %r13
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq %r12, %rdi
callq 0x3210
movq %rax, %r15
leaq 0x259e(%rip), %rsi      # 0x172a5
movl $0xf, %edx
movq %rax, %rdi
callq 0x3210
leaq 0x1393(%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(%rbx), %rax
leaq -0x60(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %r15
movq %r15, %rdi
callq 0xd9b2
movq %r14, %rdi
movq %r15, %rsi
callq 0xd86e
addq $0x30, %rbx
movq -0x70(%rbp), %rdi
cmpq %r12, %rdi
je 0x14d91
callq 0x31c0
movq (%rbx), %rax
leaq -0x40(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %r15
movq %r15, %rdi
callq 0xd9b2
movq 0x8dc4(%rip), %rdi      # 0x1db80
movq 0x8dc5(%rip), %rsi      # 0x1db88
movq %r15, %rdx
callq 0xdb89
cmpq 0x8db6(%rip), %rax      # 0x1db88
je 0x14dd8
incl 0x1c(%r14)
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x14de6
callq 0x31c0
movq (%rbx), %rax
movq -0x30(%rbp), %rcx
shlq $0x5, %rcx
leaq (%rax,%rcx), %rsi
addq $-0x20, %rsi
movq %rbx, %rdi
callq 0xdcb6
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x50(%rbp), %rdi
jmp 0x14e20
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r12, %rdi
je 0x14e2a
callq 0x31c0
movq %rbx, %rdi
callq 0x3320