// File: MichaelXanth[P]RPG_Game/Living/Heroes/Hero.cpp
// Function: Hero::isValidForSale(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, int&, int&, int const&)
bool Hero::isValidForSale(string testSelections[], int& column, int& row, const int& sellState) //checks if items is valid for sale
{
    if(sellState == 2)
    {
        if(!isValid(testSelections[0].c_str(),column,0,6))
            return false;
    }
    else
    {
        if(!isValid(testSelections[0].c_str(),column,0,3))
            return false;
    }

    if(!isNumeric(testSelections[1].c_str(),row))
        return false;

    switch(column)
    {
        case 1:
            if(sellState == 1)
            {
                if(row == 0 || row > weaponsArray.size())
                {
                    cerr << endl << "\033[31mError:\033[0m The input is invalid." << endl;
                    cerr << "Please, try again!" << endl << endl;
                    return false;
                }
            }
            else
            {
                if(row == 0 || row > iceSpellsArray.size())
                {
                    cerr << endl << "\033[31mError:\033[0m The input is invalid." << endl;
                    cerr << "Please, try again!" << endl << endl;
                    return false;
                }
            }

            break;

        case 2:
            if(sellState == 1)
            {
                if(row == 0 || row > armorsArray.size())
                {
                    cerr << endl << "\033[31mError:\033[0m The input is invalid." << endl;
                    cerr << "Please, try again!" << endl << endl;
                    return false;
                }
            }
            else
            {
                if(row == 0 || row > fireSpellsArray.size())
                {
                    cerr << endl << "\033[31mError:\033[0m The input is invalid." << endl;
                    cerr << "Please, try again!" << endl << endl;
                    return false;
                }
            }

            break;

        case 3:
            if(sellState == 1)
            {
                if(row == 0 || row > potionsArray.size())
                {
                    cerr << endl << "\033[31mError:\033[0m The input is invalid." << endl;
                    cerr << "Please, try again!" << endl << endl;
                    return false;
                }
            }
            else
            {
                if(row == 0 || row > lightingSpellsArray.size())
                {
                    cerr << endl << "\033[31mError:\033[0m The input is invalid." << endl;
                    cerr << "Please, try again!" << endl << endl;
                    return false;
                }
            }

            break;

        case 4:
            if(row == 0 || row > weaponsArray.size())
            {
                cerr << endl << "\033[31mError:\033[0m The input is invalid." << endl;
                cerr << "Please, try again!" << endl << endl;
                return false;
            }

            break;

        case 5:
            if(row == 0 || row > armorsArray.size())
            {
                cerr << endl << "\033[31mError:\033[0m The input is invalid." << endl;
                cerr << "Please, try again!" << endl << endl;
                return false;
            }

            break;

        case 6:
            if(row == 0 || row > potionsArray.size())
            {
                cerr << endl << "\033[31mError:\033[0m The input is invalid." << endl;
                cerr << "Please, try again!" << endl << endl;
                return false;
            }

            break;
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x1fcf4
movq -0x18(%rbp), %rdi
callq 0x4100
movq %rax, %rdi
movq -0x20(%rbp), %rsi
movl $0x0, -0x34(%rbp)
movl $0x6, -0x38(%rbp)
leaq -0x34(%rbp), %rdx
leaq -0x38(%rbp), %rcx
movl $0x1, %r8d
callq 0x1e340
xorb $-0x1, %al
testb $0x1, %al
jne 0x1fce9
jmp 0x1fcf2
movb $0x0, -0x1(%rbp)
jmp 0x20362
jmp 0x1fd38
movq -0x18(%rbp), %rdi
callq 0x4100
movq %rax, %rdi
movq -0x20(%rbp), %rsi
movl $0x0, -0x3c(%rbp)
movl $0x3, -0x40(%rbp)
leaq -0x3c(%rbp), %rdx
leaq -0x40(%rbp), %rcx
movl $0x1, %r8d
callq 0x1e340
xorb $-0x1, %al
testb $0x1, %al
jne 0x1fd2d
jmp 0x1fd36
movb $0x0, -0x1(%rbp)
jmp 0x20362
jmp 0x1fd38
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
callq 0x4100
movq %rax, %rdi
movq -0x28(%rbp), %rsi
movl $0x1, %edx
callq 0x1e240
testb $0x1, %al
jne 0x1fd63
movb $0x0, -0x1(%rbp)
jmp 0x20362
movq -0x20(%rbp), %rax
movl (%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x50(%rbp)
subl $0x5, %eax
ja 0x2035e
movq -0x50(%rbp), %rax
leaq 0x1e023(%rip), %rcx     # 0x3dda8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x30(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x1fe3b
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1fdcb
movq -0x48(%rbp), %rdi
movq -0x28(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x58(%rbp)
addq $0x80, %rdi
callq 0x26e80
movq %rax, %rcx
movq -0x58(%rbp), %rax
cmpq %rcx, %rax
jbe 0x1fe36
movq 0x2e21e(%rip), %rdi     # 0x4dff0
movq 0x2e1df(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
leaq 0x1df3e(%rip), %rsi     # 0x3dd26
callq 0x4260
movq %rax, %rdi
movq 0x2e1c1(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq 0x2e1ed(%rip), %rdi     # 0x4dff0
leaq 0x1df08(%rip), %rsi     # 0x3dd12
callq 0x4260
movq %rax, %rdi
movq 0x2e19f(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
movq 0x2e190(%rip), %rsi     # 0x4dfb8
callq 0x4290
movb $0x0, -0x1(%rbp)
jmp 0x20362
jmp 0x1fed5
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1fe68
movq -0x48(%rbp), %rdi
movq -0x28(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x60(%rbp)
addq $0x68, %rdi
callq 0x26e60
movq %rax, %rcx
movq -0x60(%rbp), %rax
cmpq %rcx, %rax
jbe 0x1fed3
movq 0x2e181(%rip), %rdi     # 0x4dff0
movq 0x2e142(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
leaq 0x1dea1(%rip), %rsi     # 0x3dd26
callq 0x4260
movq %rax, %rdi
movq 0x2e124(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq 0x2e150(%rip), %rdi     # 0x4dff0
leaq 0x1de6b(%rip), %rsi     # 0x3dd12
callq 0x4260
movq %rax, %rdi
movq 0x2e102(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
movq 0x2e0f3(%rip), %rsi     # 0x4dfb8
callq 0x4290
movb $0x0, -0x1(%rbp)
jmp 0x20362
jmp 0x1fed5
jmp 0x2035e
movq -0x30(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x1ff87
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1ff17
movq -0x48(%rbp), %rdi
movq -0x28(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x68(%rbp)
addq $0xb0, %rdi
callq 0x26ec0
movq %rax, %rcx
movq -0x68(%rbp), %rax
cmpq %rcx, %rax
jbe 0x1ff82
movq 0x2e0d2(%rip), %rdi     # 0x4dff0
movq 0x2e093(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
leaq 0x1ddf2(%rip), %rsi     # 0x3dd26
callq 0x4260
movq %rax, %rdi
movq 0x2e075(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq 0x2e0a1(%rip), %rdi     # 0x4dff0
leaq 0x1ddbc(%rip), %rsi     # 0x3dd12
callq 0x4260
movq %rax, %rdi
movq 0x2e053(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
movq 0x2e044(%rip), %rsi     # 0x4dfb8
callq 0x4290
movb $0x0, -0x1(%rbp)
jmp 0x20362
jmp 0x20021
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1ffb4
movq -0x48(%rbp), %rdi
movq -0x28(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x70(%rbp)
addq $0x50, %rdi
callq 0x26e40
movq %rax, %rcx
movq -0x70(%rbp), %rax
cmpq %rcx, %rax
jbe 0x2001f
movq 0x2e035(%rip), %rdi     # 0x4dff0
movq 0x2dff6(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
leaq 0x1dd55(%rip), %rsi     # 0x3dd26
callq 0x4260
movq %rax, %rdi
movq 0x2dfd8(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq 0x2e004(%rip), %rdi     # 0x4dff0
leaq 0x1dd1f(%rip), %rsi     # 0x3dd12
callq 0x4260
movq %rax, %rdi
movq 0x2dfb6(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
movq 0x2dfa7(%rip), %rsi     # 0x4dfb8
callq 0x4290
movb $0x0, -0x1(%rbp)
jmp 0x20362
jmp 0x20021
jmp 0x2035e
movq -0x30(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x200d3
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x20063
movq -0x48(%rbp), %rdi
movq -0x28(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x78(%rbp)
addq $0x98, %rdi
callq 0x26ea0
movq %rax, %rcx
movq -0x78(%rbp), %rax
cmpq %rcx, %rax
jbe 0x200ce
movq 0x2df86(%rip), %rdi     # 0x4dff0
movq 0x2df47(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
leaq 0x1dca6(%rip), %rsi     # 0x3dd26
callq 0x4260
movq %rax, %rdi
movq 0x2df29(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq 0x2df55(%rip), %rdi     # 0x4dff0
leaq 0x1dc70(%rip), %rsi     # 0x3dd12
callq 0x4260
movq %rax, %rdi
movq 0x2df07(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
movq 0x2def8(%rip), %rsi     # 0x4dfb8
callq 0x4290
movb $0x0, -0x1(%rbp)
jmp 0x20362
jmp 0x2016d
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x20100
movq -0x48(%rbp), %rdi
movq -0x28(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x80(%rbp)
addq $0x38, %rdi
callq 0x26e20
movq %rax, %rcx
movq -0x80(%rbp), %rax
cmpq %rcx, %rax
jbe 0x2016b
movq 0x2dee9(%rip), %rdi     # 0x4dff0
movq 0x2deaa(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
leaq 0x1dc09(%rip), %rsi     # 0x3dd26
callq 0x4260
movq %rax, %rdi
movq 0x2de8c(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq 0x2deb8(%rip), %rdi     # 0x4dff0
leaq 0x1dbd3(%rip), %rsi     # 0x3dd12
callq 0x4260
movq %rax, %rdi
movq 0x2de6a(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
movq 0x2de5b(%rip), %rsi     # 0x4dfb8
callq 0x4290
movb $0x0, -0x1(%rbp)
jmp 0x20362
jmp 0x2016d
jmp 0x2035e
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x201a8
movq -0x48(%rbp), %rdi
movq -0x28(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x88(%rbp)
addq $0x80, %rdi
callq 0x26e80
movq %rax, %rcx
movq -0x88(%rbp), %rax
cmpq %rcx, %rax
jbe 0x20213
movq 0x2de41(%rip), %rdi     # 0x4dff0
movq 0x2de02(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
leaq 0x1db61(%rip), %rsi     # 0x3dd26
callq 0x4260
movq %rax, %rdi
movq 0x2dde4(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq 0x2de10(%rip), %rdi     # 0x4dff0
leaq 0x1db2b(%rip), %rsi     # 0x3dd12
callq 0x4260
movq %rax, %rdi
movq 0x2ddc2(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
movq 0x2ddb3(%rip), %rsi     # 0x4dfb8
callq 0x4290
movb $0x0, -0x1(%rbp)
jmp 0x20362
jmp 0x2035e
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2024e
movq -0x48(%rbp), %rdi
movq -0x28(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x90(%rbp)
addq $0xb0, %rdi
callq 0x26ec0
movq %rax, %rcx
movq -0x90(%rbp), %rax
cmpq %rcx, %rax
jbe 0x202b9
movq 0x2dd9b(%rip), %rdi     # 0x4dff0
movq 0x2dd5c(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
leaq 0x1dabb(%rip), %rsi     # 0x3dd26
callq 0x4260
movq %rax, %rdi
movq 0x2dd3e(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq 0x2dd6a(%rip), %rdi     # 0x4dff0
leaq 0x1da85(%rip), %rsi     # 0x3dd12
callq 0x4260
movq %rax, %rdi
movq 0x2dd1c(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
movq 0x2dd0d(%rip), %rsi     # 0x4dfb8
callq 0x4290
movb $0x0, -0x1(%rbp)
jmp 0x20362
jmp 0x2035e
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x202f4
movq -0x48(%rbp), %rdi
movq -0x28(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x98(%rbp)
addq $0x98, %rdi
callq 0x26ea0
movq %rax, %rcx
movq -0x98(%rbp), %rax
cmpq %rcx, %rax
jbe 0x2035c
movq 0x2dcf5(%rip), %rdi     # 0x4dff0
movq 0x2dcb6(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
leaq 0x1da15(%rip), %rsi     # 0x3dd26
callq 0x4260
movq %rax, %rdi
movq 0x2dc98(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq 0x2dcc4(%rip), %rdi     # 0x4dff0
leaq 0x1d9df(%rip), %rsi     # 0x3dd12
callq 0x4260
movq %rax, %rdi
movq 0x2dc76(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
movq 0x2dc67(%rip), %rsi     # 0x4dfb8
callq 0x4290
movb $0x0, -0x1(%rbp)
jmp 0x20362
jmp 0x2035e
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xa0, %rsp
popq %rbp
retq