// File: /workspace/github_cpp_makefile_star2_O2/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 $0x28, %rsp
movq %rdi, %rbx
movq 0xcc35(%rip), %r14      # 0x15fc8
movq 0x8(%rbx), %r15
subq (%rbx), %r15
shrq $0x5, %r15
leal 0x2(%r15), %eax
movl %eax, -0x30(%rbp)
leal 0x1(%r15), %eax
movl %eax, -0x2c(%rbp)
testl %r15d, %r15d
movl $0x0, %eax
cmovlel %eax, %r15d
shlq $0x5, %r15
xorl %eax, %eax
testl %eax, %eax
jle 0x93cb
cmpl -0x30(%rbp), %eax
jle 0x9479
movq %r14, %rdi
leaq 0x6cde(%rip), %rsi      # 0x100b3
callq 0x31d0
movq %rax, %rdi
callq 0x30f0
pushq $0x1
popq %r13
xorl %r12d, %r12d
movq %r14, %rdi
cmpq %r12, %r15
je 0x942e
movl %r13d, %esi
callq 0x32f0
movq %rax, %rdi
leaq 0x6cd2(%rip), %rsi      # 0x100d5
callq 0x31d0
movq (%rbx), %rsi
addq %r12, %rsi
movq %rax, %rdi
callq 0x31b0
movq %rax, %rdi
leaq 0x7504(%rip), %rsi      # 0x10924
callq 0x31d0
addq $0x20, %r12
incl %r13d
jmp 0x93e9
movl -0x2c(%rbp), %esi
callq 0x32f0
movq %rax, %rdi
leaq 0x6ca0(%rip), %rsi      # 0x100e0
callq 0x31d0
movq %rax, %rdi
callq 0x30f0
movq %rax, %rdi
movl -0x30(%rbp), %esi
callq 0x32f0
movq %rax, %rdi
leaq 0x6c9c(%rip), %rsi      # 0x100fe
callq 0x31d0
movq %rax, %rdi
callq 0x30f0
callq 0xaed4
jmp 0x93be
je 0x955c
cmpl -0x2c(%rbp), %eax
jne 0x948e
callq 0x9582
jmp 0x9393
movq (%rbx), %rcx
movl %eax, %r15d
shlq $0x5, %r15
leaq (%rcx,%r15), %rsi
addq $-0x20, %rsi
leaq -0x50(%rbp), %r13
movq %r13, %rdi
callq 0x3250
movq (%rbx), %r12
movq 0xce3a(%rip), %rdi      # 0x162f0
movq 0xce3b(%rip), %rsi      # 0x162f8
movq %r13, %rdx
callq 0x997d
cmpq 0xce2c(%rip), %rax      # 0x162f8
je 0x94f6
movq %r14, %rdi
leaq 0x6bc0(%rip), %rsi      # 0x10098
callq 0x31d0
movq %rax, %rdi
leaq 0x6c21(%rip), %rsi      # 0x10108
callq 0x31d0
movq %rax, %rdi
callq 0x30f0
jmp 0x954e
leaq (%r12,%r15), %rsi
addq $-0x20, %rsi
movq %rbx, %rdi
callq 0x97c0
movq %r14, %rdi
leaq 0x6b88(%rip), %rsi      # 0x10098
callq 0x31d0
movq %rax, %rdi
leaq 0x7405(%rip), %rsi      # 0x10924
callq 0x31d0
movq %rax, %rdi
leaq -0x50(%rbp), %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x6be4(%rip), %rsi      # 0x1011e
callq 0x31d0
movq %rax, %rdi
leaq 0x6b6a(%rip), %rsi      # 0x100b3
callq 0x31d0
leaq -0x50(%rbp), %rdi
callq 0x3368
jmp 0x9393
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x956d
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x3368
movq %rbx, %rdi
callq 0x3300
nop