// File: /workspace/github_cpp_makefile_star2_O3/MichaelXanth[P]RPG_Game/Market/Market.cpp
// Function: Market::EnterMarket(std::vector<Hero*, std::allocator<Hero*>>&)
bool Market::EnterMarket(vector<Hero *>& heroes)
{
    int action;
    //int buyState;
    string testAction;
    bool infoState = false;

    NewStuff(heroes);

    DisplayMarket();

    while(true){

        bool errFlag = false;

        cout << endl;
        cout << "-------------------------------" << endl << endl;
        cout << "Choose an action: ";

        cout << "\n\n\n\n\n";
        cout << "\033[5A\033[18C";

        cout << "\033[s";

        do {
            if (errFlag)
                usleep(1800000);

            cout << "\033[u";
            cout << "\033[J";
            cout << "\033[s";

            cin >> testAction;

            errFlag = true;
        } while(!isValid(testAction.c_str(),action,1,4));

        switch(action)
        {
            case 1:
                Buy(heroes);
                break;
            case 2:
                Sell(heroes);
                break;
            case 3:
                infoState = !infoState;
                DisplayMarket(infoState);
                break;
            case 4:
                return false;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq -0x60(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
xorl %eax, %eax
movb %al, (%rcx)
movb %al, -0x29(%rbp)
movq %rsi, -0x50(%rbp)
callq 0x1ab12
leaq -0x30(%rbp), %rsi
movb $0x0, (%rsi)
movq %rbx, -0x38(%rbp)
movq %rbx, %rdi
xorl %edx, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x1b982
movq $0x0, -0x48(%rbp)
movq 0xc975(%rip), %r15      # 0x2efc8
leaq 0x2224(%rip), %r12      # 0x2487e
leaq -0x30(%rbp), %r14
leaq -0x3c(%rbp), %r13
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3100
movl $0x1f, %edx
movq %r15, %rdi
leaq 0x4bba(%rip), %rsi      # 0x27252
callq 0x31e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3100
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3100
movl $0x12, %edx
movq %r15, %rdi
leaq 0x5116(%rip), %rsi      # 0x27813
callq 0x31e0
movl $0x5, %edx
movq %r15, %rdi
leaq 0x4d17(%rip), %rsi      # 0x27428
callq 0x31e0
movl $0x9, %edx
movq %r15, %rdi
leaq 0x5101(%rip), %rsi      # 0x27826
callq 0x31e0
movl $0x3, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x31e0
movl $0x3, %edx
movq %r15, %rdi
leaq 0x215f(%rip), %rsi      # 0x248a8
callq 0x31e0
movl $0x3, %edx
movq %r15, %rdi
leaq 0x4046(%rip), %rsi      # 0x267a3
callq 0x31e0
movl $0x3, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x31e0
movq 0xc85f(%rip), %rdi      # 0x2efd8
leaq -0x70(%rbp), %rsi
callq 0x3230
movq -0x70(%rbp), %rdi
movl $0x1, -0x30(%rbp)
movl $0x4, -0x3c(%rbp)
leaq -0x40(%rbp), %rsi
movq %r14, %rdx
movq %r13, %rcx
movl $0x1, %r8d
callq 0x10336
testb %al, %al
jne 0x227b9
movl $0x1b7740, %edi         # imm = 0x1B7740
callq 0x3260
jmp 0x2273a
movl -0x40(%rbp), %eax
decl %eax
cmpl $0x3, %eax
ja 0x22662
leaq 0x4932(%rip), %rcx      # 0x27100
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x38(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x2080a
jmp 0x22662
movq -0x38(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x21de0
jmp 0x22662
movq -0x48(%rbp), %rax
xorb $0x1, %al
movq %rax, -0x48(%rbp)
movb %al, -0x29(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x29(%rbp), %rsi
xorl %edx, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x1b982
jmp 0x22662
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x22833
callq 0x3170
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2284e
jmp 0x2284e
jmp 0x2284e
jmp 0x2284e
jmp 0x2284e
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x22863
callq 0x3170
movq %rbx, %rdi
callq 0x32f0
nop