// File: /workspace/github_cpp_makefile_star2_O3/dnegovan[P]Intruder-On-Donnar-V/Backpack.cpp
// Function: Backpack::discardMenu()
void Backpack::discardMenu()
{
    while (true)
    {
        //cast from unsigned int to avoid compiler warnings
        int size = static_cast<int>(contents.size());

        int input = 0;
        while (input < 1 || input > (size + 2))
        {
            std::cout << RESET << std::endl;
            for (int i = 0; i < size; i++)
            {
                //count menu numbers from 1 not 0
                std::cout << i+1 << ". Discard " << contents[i] << "\n";
            }
            std::cout << size + 1 << ". Show neutralization formula"
                      << std::endl
                      << size + 2 << ". Go back" << std::endl;
            input = getInteger();
        }


        if (input == size + 2)
        {
            //they chose cancel
            return;
        }

        if (input == size + 1)
        {
            displayFormula();
        }
        else
        {
            //save string to be deleted
            std::string toDelete = contents[input - 1];
            //store iterator of its location in pack
            auto iterator = contents.begin() + input - 1;

            //erase their selection if it's not important to the game
            if (std::find(importantItems.begin(), importantItems.end(),
                           toDelete) != importantItems.end())
            {
                std::cout << NARRATOR_COLOR << "\nYou might need that."
                          << std::endl;
            }
            else
            {
                contents.erase(iterator);
                std::cout << NARRATOR_COLOR << "\n"
                          << toDelete << " has been discarded.\n" << RESET;
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq 0xee6b(%rip), %r12      # 0x1bfc8
movq %rdi, -0x38(%rbp)
movq 0x8(%rbx), %rcx
subq (%rbx), %rcx
shrq $0x5, %rcx
leal 0x2(%rcx), %ebx
leal 0x1(%rcx), %eax
movl %eax, -0x2c(%rbp)
movq %rcx, -0x50(%rbp)
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq %rcx, -0x48(%rbp)
movl %ebx, -0x3c(%rbp)
movl $0x4, %edx
movq %r12, %rdi
leaq 0x8f19(%rip), %rsi      # 0x160ae
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
cmpl $0x0, -0x50(%rbp)
movq -0x38(%rbp), %r13
movq -0x48(%rbp), %rbx
jle 0xd237
movl $0x8, %r14d
xorl %r15d, %r15d
incq %r15
movq %r12, %rdi
movl %r15d, %esi
callq 0x3310
movq %rax, %r12
movl $0xa, %edx
movq %rax, %rdi
leaq 0x8ed7(%rip), %rsi      # 0x160d0
callq 0x3210
movq (%r13), %rax
movq -0x8(%rax,%r14), %rsi
movq (%rax,%r14), %rdx
movq %r12, %rdi
movq 0xedb3(%rip), %r12      # 0x1bfc8
callq 0x3210
movl $0x1, %edx
movq %rax, %rdi
leaq 0x971b(%rip), %rsi      # 0x16944
callq 0x3210
addq $0x20, %r14
cmpq %r15, %rbx
jne 0xd1d9
movq %r12, %rdi
movl -0x2c(%rbp), %esi
callq 0x3310
movq %rax, %r15
movl $0x1d, %edx
movq %rax, %rdi
leaq 0x8e87(%rip), %rsi      # 0x160db
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 %rax, %rdi
movl -0x3c(%rbp), %ebx
movl %ebx, %esi
callq 0x3310
movq %rax, %r15
movl $0x9, %edx
movq %rax, %rdi
leaq 0x8e5a(%rip), %rsi      # 0x160f9
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
callq 0xf6ef
testl %eax, %eax
jle 0xd186
cmpl %ebx, %eax
jg 0xd186
je 0xd44d
cmpl -0x2c(%rbp), %eax
jne 0xd2f9
callq 0xd478
movq -0x38(%rbp), %rbx
jmp 0xd161
movq -0x38(%rbp), %rbx
movq (%rbx), %rcx
movl %eax, %r14d
shlq $0x5, %r14
leaq -0x60(%rbp), %r12
movq %r12, -0x70(%rbp)
movq -0x20(%rcx,%r14), %rsi
movq -0x18(%rcx,%r14), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %r13
movq %r13, %rdi
callq 0xd7ca
movq (%rbx), %r15
movq 0xefce(%rip), %rdi      # 0x1c300
movq 0xefcf(%rip), %rsi      # 0x1c308
movq %r13, %rdx
callq 0xd9a5
cmpq 0xefc0(%rip), %rax      # 0x1c308
je 0xd3b1
movl $0x5, %edx
movq 0xec72(%rip), %rdi      # 0x1bfc8
leaq 0x8d36(%rip), %rsi      # 0x16093
callq 0x3210
movl $0x15, %edx
movq 0xec5a(%rip), %rdi      # 0x1bfc8
leaq 0x8d8e(%rip), %rsi      # 0x16103
callq 0x3210
movq 0xec47(%rip), %rcx      # 0x1bfc8
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq 0xec29(%rip), %rdi      # 0x1bfc8
callq 0x3030
movq %rax, %rdi
callq 0x3140
jmp 0xd433
leaq (%r15,%r14), %rsi
addq $-0x20, %rsi
movq %rbx, %rdi
callq 0xdae2
leaq 0x957c(%rip), %r14      # 0x16944
movl $0x5, %edx
movq 0xebf4(%rip), %rdi      # 0x1bfc8
leaq 0x8cb8(%rip), %rsi      # 0x16093
callq 0x3210
movl $0x1, %edx
movq 0xebdc(%rip), %rdi      # 0x1bfc8
movq %r14, %rsi
callq 0x3210
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq 0xebc5(%rip), %rdi      # 0x1bfc8
callq 0x3210
movq %rax, %r15
movl $0x15, %edx
movq %rax, %rdi
leaq 0x8cff(%rip), %rsi      # 0x16119
callq 0x3210
movl $0x4, %edx
movq %r15, %rdi
leaq 0x8c80(%rip), %rsi      # 0x160ae
callq 0x3210
movq -0x70(%rbp), %rdi
cmpq %r12, %rdi
je 0xd441
callq 0x31c0
movq 0xeb80(%rip), %r12      # 0x1bfc8
jmp 0xd161
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xd45e
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r12, %rdi
je 0xd46f
callq 0x31c0
movq %rbx, %rdi
callq 0x3320
nop