// File: /workspace/github_cpp_makefile_star2_O1/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 0xec6b(%rip), %r12      # 0x1bfc8
movq %rdi, -0x38(%rbp)
movq 0x8(%rbx), %rcx
subq (%rbx), %rcx
shrq $0x5, %rcx
leal 0x2(%rcx), %eax
movl %eax, -0x2c(%rbp)
leal 0x1(%rcx), %eax
movl %eax, -0x30(%rbp)
movq %rcx, -0x68(%rbp)
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq %rcx, -0x60(%rbp)
movl $0x4, %edx
movq %r12, %rdi
leaq 0x8d19(%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, -0x68(%rbp)
movq -0x38(%rbp), %r13
movq -0x60(%rbp), %rbx
jle 0xd437
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 0x8cd7(%rip), %rsi      # 0x160d0
callq 0x3210
movq (%r13), %rax
movq -0x8(%rax,%r14), %rsi
movq (%rax,%r14), %rdx
movq %r12, %rdi
movq 0xebb3(%rip), %r12      # 0x1bfc8
callq 0x3210
movl $0x1, %edx
movq %rax, %rdi
leaq 0x951b(%rip), %rsi      # 0x16944
callq 0x3210
addq $0x20, %r14
cmpq %r15, %rbx
jne 0xd3d9
movq %r12, %rdi
movl -0x30(%rbp), %esi
callq 0x3310
movq %rax, %r15
movl $0x1d, %edx
movq %rax, %rdi
leaq 0x8c87(%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 -0x2c(%rbp), %esi
callq 0x3310
movq %rax, %r15
movl $0x9, %edx
movq %rax, %rdi
leaq 0x8c5c(%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 0xf8fa
testl %eax, %eax
jle 0xd386
movl %eax, %r15d
cmpl -0x2c(%rbp), %eax
jg 0xd386
movq -0x38(%rbp), %rbx
je 0xd63b
cmpl -0x30(%rbp), %r15d
jne 0xd4fc
callq 0xd66a
jmp 0xd631
movq (%rbx), %rax
movl %r15d, %r14d
shlq $0x5, %r14
leaq -0x48(%rbp), %rcx
movq %rcx, -0x58(%rbp)
movq -0x20(%rax,%r14), %rsi
movq -0x18(%rax,%r14), %rdx
addq %rsi, %rdx
leaq -0x58(%rbp), %r13
movq %r13, %rdi
callq 0xd9b2
movq (%rbx), %r12
movq 0xedcf(%rip), %rdi      # 0x1c300
movq 0xedd0(%rip), %rsi      # 0x1c308
movq %r13, %rdx
callq 0xdb89
cmpq 0xedc1(%rip), %rax      # 0x1c308
je 0xd5a2
movl $0x5, %edx
movq 0xea73(%rip), %r12      # 0x1bfc8
movq %r12, %rdi
leaq 0x8b34(%rip), %rsi      # 0x16093
callq 0x3210
movl $0x15, %edx
movq %r12, %rdi
leaq 0x8b90(%rip), %rsi      # 0x16103
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
jmp 0xd61f
leaq (%r12,%r14), %rsi
addq $-0x20, %rsi
movq %rbx, %rdi
callq 0xdcb6
movq 0xea0f(%rip), %r12      # 0x1bfc8
leaq 0x9384(%rip), %r14      # 0x16944
movl $0x5, %edx
movq %r12, %rdi
leaq 0x8ac4(%rip), %rsi      # 0x16093
callq 0x3210
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rsi
callq 0x3210
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq %r12, %rdi
callq 0x3210
movq %rax, %r14
movl $0x15, %edx
movq %rax, %rdi
leaq 0x8b13(%rip), %rsi      # 0x16119
callq 0x3210
movl $0x4, %edx
movq %r14, %rdi
leaq 0x8a94(%rip), %rsi      # 0x160ae
callq 0x3210
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xd631
callq 0x31c0
cmpl -0x2c(%rbp), %r15d
jne 0xd361
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xd64c
movq %rax, %rbx
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xd661
callq 0x31c0
movq %rbx, %rdi
callq 0x3320
nop