// File: /workspace/github_cpp_makefile_star2_O2/MichaelXanth[P]RPG_Game/Grid/Grid.cpp
// Function: Grid::DisplayGrid(std::vector<Hero*, std::allocator<Hero*>>&)
void Grid::DisplayGrid(vector<Hero *>& heroes)/*displays non-accessible blocks with red , the market with yellow and the heroes with green*/
{
    cout << "\033[2J\033[1;1H";
    cout << "\033[s";
    cout << "\033[1;33m+\033[0;34m====================================================================================================\033[1;33m+\033[34m" << endl;
    
    for(int i = 0; i < verticalSize; i++) {
        cout << "\033[0;34m|\033[0m";
        for(int j = 0; j < horizontalSize; j++) {
            if(grid[i][j] == ' ')
                cout << "  ";
            else if(grid[i][j] == 'X')
                cout << "\033[48;5;9m  \033[0m";
            else if(grid[i][j] == 'M')
                cout << "\033[48;5;11m  \033[0m";
            else
                cout << "\033[48;5;70m  \033[0m";
        }
        cout << "\033[34m|\033[0m" << endl;
    }
    
    cout << "\033[1;33m+\033[0;34m====================================================================================================\033[1;33m+\033[34m" << endl;
    cout << "\033[0;34m|\033[0m \033[48;5;9m  \033[0m -> Non-accessible, \033[48;5;11m  \033[0m -> Market, \033[48;5;70m  \033[0m -> Heroes \033[34m|\033[0m";
    cout << "       Press: \033[1;33mi\033[0m for inventory or \033[1;33mq\033[0m to quit       \033[34m|\033[0m" << endl;
    cout << "\033[1;33m+\033[0;34m--------------------------------------------------\033[1;33m+\033[0;34m-------------------------------------------------\033[1;33m+\033[0m" << endl;

    cout << "\033[u";

    for(int  i = 0; i < heroes.size(); i++)
    {
        cout << "\033[104C\033[1;33m+\033[0;34m==============================\033[1;33m+\033[0m" << endl;

        cout << "\033[104C\033[34m|\033[0m";
        cout << "Name:          \033[38;5;220m";
        cout.width(15);
        cout << left << heroes[i]->GetName() << "\033[34m|\033[0m" << endl;

        cout << "\033[104C\033[34m|\033[0m";
        cout << "Level:         ";
        cout.width(15);
        cout << left << heroes[i]->GetLevel() << "\033[34m|\033[0m" << endl;

        cout << "\033[104C\033[34m|\033[0m";
        string str = to_string(heroes[i]->GetHP()) + "/" + to_string(heroes[i]->GetMaxHP());

        if(heroes[i]->GetHP() >= 2.0 / 3.0 * heroes[i]->GetMaxHP())
            cout << "HP:            \033[38;5;2m";
        else if(heroes[i]->GetHP() >= 1.0 / 3.0 * heroes[i]->GetMaxHP())
            cout << "HP:            \033[38;5;202m";
        else
            cout << "HP:            \033[38;5;9m";

        cout.width(15);
        cout << left << str << "\033[34m|\033[0m" << endl;

        cout << "\033[104C\033[34m|\033[0m";
        cout << "Magic Power:   ";
        cout.width(15);
        cout << left << heroes[i]->GetMagicPower() << "\033[34m|\033[0m" << endl;

        cout << "\033[104C\033[34m|\033[0m";
        cout << "Money:         ";
        cout.width(15);
        cout << left << heroes[i]->GetMoney() << "\033[34m|\033[0m" << endl;

        cout << "\033[104C\033[34m|\033[0m";
        cout << "Strength:      ";
        cout.width(15);
        cout << left << heroes[i]->GetStrength() << "\033[34m|\033[0m" << endl;

        cout << "\033[104C\033[34m|\033[0m";
        cout << "Dexterity:     ";
        cout.width(15);
        cout << left << heroes[i]->GetDexterity() << "\033[34m|\033[0m" << endl;

        cout << "\033[104C\033[34m|\033[0m";
        cout << "Agility:       ";
        cout.width(15);
        cout << left << heroes[i]->GetAgility() << "\033[34m|\033[0m" << endl;

        cout << "\033[104C\033[34m|\033[0m";
        cout << "Armor Defence: ";
        cout.width(15);
        cout << left << heroes[i]->GetArmorDefence() << "\033[34m|\033[0m" << endl;

        cout << "\033[104C\033[34m|\033[0m";
        cout << "Weapon Damage: ";
        cout.width(15);
        cout << left << heroes[i]->GetWeaponDamage() << "\033[34m|\033[0m" << endl;

    }
    cout << "\033[104C\033[1;33m+\033[0;34m==============================\033[1;33m+\033[0m" << endl;

    cout << "\033[" << 33 - 11 * heroes.size() << "B";

    if(heroes.size() == 3)
        cout << "\033[1A";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %rbx
movq %rdi, %r15
movq 0x1ae0a(%rip), %r14     # 0x26fc8
leaq 0xf20b(%rip), %rsi      # 0x1b3d0
movq %r14, %rdi
callq 0x31d0
leaq 0xf6aa(%rip), %rsi      # 0x1b87e
movq %r14, %rdi
callq 0x31d0
leaq 0xf7a5(%rip), %rsi      # 0x1b988
movq %r14, %rdi
callq 0x31d0
movq %rax, %rdi
callq 0x30d0
xorl %ebp, %ebp
leaq 0xf60c(%rip), %r12      # 0x1b808
leaq 0xf834(%rip), %r13      # 0x1ba37
movq %rbx, (%rsp)
movslq 0x4(%r15), %rax
cmpq %rax, %rbp
jge 0xc28c
movq %r14, %rdi
leaq 0xf7ef(%rip), %rsi      # 0x1ba09
callq 0x31d0
xorl %ebx, %ebx
movslq (%r15), %rax
cmpq %rax, %rbx
jge 0xc269
movq 0x10(%r15), %rax
movq (%rax,%rbp,8), %rax
movzbl (%rax,%rbx), %eax
movq %r12, %rsi
cmpl $0x20, %eax
je 0xc25c
cmpl $0x4d, %eax
je 0xc250
cmpl $0x58, %eax
jne 0xc259
leaq 0xf7c8(%rip), %rsi      # 0x1ba16
jmp 0xc25c
leaq 0xf7cf(%rip), %rsi      # 0x1ba26
jmp 0xc25c
movq %r13, %rsi
movq %r14, %rdi
callq 0x31d0
incq %rbx
jmp 0xc221
movq %r14, %rdi
leaq 0x10320(%rip), %rsi     # 0x1c593
callq 0x31d0
movq %rax, %rdi
callq 0x30d0
incq %rbp
movq (%rsp), %rbx
jmp 0xc207
leaq 0xf6f5(%rip), %rsi      # 0x1b988
movq %r14, %rdi
callq 0x31d0
movq %rax, %rdi
callq 0x30d0
leaq 0xf79e(%rip), %rsi      # 0x1ba48
movq %r14, %rdi
callq 0x31d0
leaq 0xf801(%rip), %rsi      # 0x1baba
movq %r14, %rdi
callq 0x31d0
movq %rax, %rdi
callq 0x30d0
leaq 0xf83c(%rip), %rsi      # 0x1bb0c
movq %r14, %rdi
callq 0x31d0
movq %rax, %rdi
callq 0x30d0
leaq 0xf5c1(%rip), %rsi      # 0x1b8a8
movq %r14, %rdi
callq 0x31d0
xorl %ebp, %ebp
leaq 0x1029b(%rip), %r13     # 0x1c593
movq %rbx, %r15
movq 0x8(%rbx), %rbx
subq (%r15), %rbx
sarq $0x3, %rbx
movq %r14, %rdi
leaq 0xf88a(%rip), %rsi      # 0x1bb9a
callq 0x31d0
movq %rax, %rdi
callq 0x30d0
cmpq %rbp, %rbx
jbe 0xc894
movq %r14, %rdi
leaq 0xf8aa(%rip), %rsi      # 0x1bbda
callq 0x31d0
movq %r14, %rdi
leaq 0xf211(%rip), %rsi      # 0x1b550
callq 0x31d0
movq (%r14), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl %edx, %ecx
orl $0x20, %ecx
movl %ecx, 0x18(%r14,%rax)
movq (%r15), %rax
movq (%rax,%rbp,8), %rsi
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xced6
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3190
movq %r15, %rbx
movq %rax, %rdi
movq %r13, %rsi
callq 0x31d0
movq %rax, %rdi
callq 0x30d0
leaq 0x8(%rsp), %rdi
callq 0x30c0
movq %r14, %rdi
leaq 0xf825(%rip), %r15      # 0x1bbda
movq %r15, %rsi
callq 0x31d0
movq %r14, %rdi
leaq 0xf1a4(%rip), %rsi      # 0x1b56b
callq 0x31d0
movq (%r14), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl %edx, %ecx
orl $0x20, %ecx
movl %ecx, 0x18(%r14,%rax)
movq (%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0xcef2
movl %eax, %esi
movq %r14, %rdi
callq 0x3120
movq %rax, %rdi
movq %r13, %rsi
callq 0x31d0
movq %rax, %rdi
callq 0x30d0
movq %r14, %rdi
movq %r15, %rsi
callq 0x31d0
movq (%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0xcf06
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movl %eax, %esi
callq 0xbcf1
leaq 0x48(%rsp), %rdi
movq %r15, %rsi
leaq 0xf082(%rip), %rdx      # 0x1b4d4
callq 0xbcd2
movq (%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0xcefc
leaq 0x68(%rsp), %r15
movq %r15, %rdi
movl %eax, %esi
callq 0xbcf1
leaq 0x8(%rsp), %rdi
movq %r15, %r12
leaq 0x48(%rsp), %r15
movq %r15, %rsi
movq %r12, %rdx
callq 0xbc6b
movq %r12, %rdi
callq 0x30c0
movq %r15, %rdi
callq 0x30c0
leaq 0x28(%rsp), %rdi
callq 0x30c0
movq (%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0xcf06
movl %eax, %r15d
movq (%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0xcefc
movl %r15d, %ecx
cvtsi2sd %rcx, %xmm0
movl %eax, %eax
cvtsi2sd %rax, %xmm1
mulsd 0xee22(%rip), %xmm1     # 0x1b2f8
ucomisd %xmm1, %xmm0
leaq 0xf09a(%rip), %rsi      # 0x1b57b
jae 0xc52b
movq (%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0xcf06
movl %eax, %r15d
movq (%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0xcefc
movl %r15d, %ecx
cvtsi2sd %rcx, %xmm0
movl %eax, %eax
cvtsi2sd %rax, %xmm1
mulsd 0xedeb(%rip), %xmm1     # 0x1b300
ucomisd %xmm1, %xmm0
leaq 0xf074(%rip), %rsi      # 0x1b594
leaq 0xf088(%rip), %rax      # 0x1b5af
cmovbq %rax, %rsi
movq %r14, %rdi
callq 0x31d0
movq (%r14), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl %edx, %ecx
orl $0x20, %ecx
movl %ecx, 0x18(%r14,%rax)
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
callq 0x3190
movq %rax, %rdi
movq %r13, %rsi
callq 0x31d0
movq %rax, %rdi
callq 0x30d0
movq %r14, %rdi
leaq 0xf655(%rip), %rsi      # 0x1bbda
callq 0x31d0
movq %r14, %rdi
leaq 0xf034(%rip), %rsi      # 0x1b5c8
callq 0x31d0
movq (%r14), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl %edx, %ecx
orl $0x20, %ecx
movl %ecx, 0x18(%r14,%rax)
movq (%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0xd0a0
movl %eax, %esi
movq %r14, %rdi
callq 0x3120
movq %rax, %rdi
movq %r13, %rsi
callq 0x31d0
movq %rax, %rdi
callq 0x30d0
movq %r14, %rdi
leaq 0xf5e6(%rip), %rsi      # 0x1bbda
callq 0x31d0
movq %r14, %rdi
leaq 0xf5e8(%rip), %rsi      # 0x1bbeb
callq 0x31d0
movq (%r14), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl %edx, %ecx
orl $0x20, %ecx
movl %ecx, 0x18(%r14,%rax)
movq (%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0xd0a8
movl %eax, %esi
movq %r14, %rdi
callq 0x3120
movq %rax, %rdi
movq %r13, %rsi
callq 0x31d0
movq %rax, %rdi
callq 0x30d0
movq %r14, %rdi
leaq 0xf577(%rip), %rsi      # 0x1bbda
callq 0x31d0
movq %r14, %rdi
leaq 0xef66(%rip), %rsi      # 0x1b5d8
callq 0x31d0
movq (%r14), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl %edx, %ecx
orl $0x20, %ecx
movl %ecx, 0x18(%r14,%rax)
movq (%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0xd066
movl %eax, %esi
movq %r14, %rdi
callq 0x3120
movq %rax, %rdi
movq %r13, %rsi
callq 0x31d0
movq %rax, %rdi
callq 0x30d0
movq %r14, %rdi
leaq 0xf508(%rip), %rsi      # 0x1bbda
callq 0x31d0
movq %r14, %rdi
leaq 0xef07(%rip), %rsi      # 0x1b5e8
callq 0x31d0
movq (%r14), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl %edx, %ecx
orl $0x20, %ecx
movl %ecx, 0x18(%r14,%rax)
movq (%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0xd06e
movl %eax, %esi
movq %r14, %rdi
callq 0x3120
movq %rax, %rdi
movq %r13, %rsi
callq 0x31d0
movq %rax, %rdi
callq 0x30d0
movq %r14, %rdi
leaq 0xf499(%rip), %rsi      # 0x1bbda
callq 0x31d0
movq %r14, %rdi
leaq 0xeea8(%rip), %rsi      # 0x1b5f8
callq 0x31d0
movq (%r14), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl %edx, %ecx
orl $0x20, %ecx
movl %ecx, 0x18(%r14,%rax)
movq (%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0xd076
movq %r14, %rdi
callq 0x3140
movq %rax, %rdi
movq %r13, %rsi
callq 0x31d0
movq %rax, %rdi
callq 0x30d0
movq %r14, %rdi
leaq 0xf42c(%rip), %rsi      # 0x1bbda
callq 0x31d0
movq %r14, %rdi
leaq 0xee4b(%rip), %rsi      # 0x1b608
callq 0x31d0
movq (%r14), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl %edx, %ecx
orl $0x20, %ecx
movl %ecx, 0x18(%r14,%rax)
movq (%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0xdb56
movl %eax, %esi
movq %r14, %rdi
callq 0x3120
movq %rax, %rdi
movq %r13, %rsi
callq 0x31d0
movq %rax, %rdi
callq 0x30d0
movq %r14, %rdi
leaq 0xf3bd(%rip), %rsi      # 0x1bbda
callq 0x31d0
movq %r14, %rdi
leaq 0xedec(%rip), %rsi      # 0x1b618
callq 0x31d0
movq (%r14), %rax
movq -0x18(%rax), %rcx
movq $0xf, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl %edx, %ecx
orl $0x20, %ecx
movl %ecx, 0x18(%r14,%rax)
movq (%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0xdb3a
movl %eax, %esi
movq %r14, %rdi
callq 0x3120
movq %rax, %rdi
movq %r13, %rsi
callq 0x31d0
movq %rax, %rdi
callq 0x30d0
leaq 0x8(%rsp), %rdi
callq 0x30c0
incq %rbp
jmp 0xc2f8
movq 0x1a72d(%rip), %rdi     # 0x26fc8
leaq 0xeb39(%rip), %rsi      # 0x1b3db
callq 0x31d0
movq 0x8(%r15), %rcx
subq (%r15), %rcx
sarq $0x3, %rcx
imulq $-0xb, %rcx, %rsi
addq $0x21, %rsi
movq %rax, %rdi
callq 0x3120
leaq 0x116f1(%rip), %rsi     # 0x1dfba
movq %rax, %rdi
callq 0x31d0
movq 0x8(%r15), %rax
subq (%r15), %rax
cmpq $0x18, %rax
jne 0xc8f1
movq 0x1a6e3(%rip), %rdi     # 0x26fc8
leaq 0xf30f(%rip), %rsi      # 0x1bbfb
callq 0x31d0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xc924
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x30c0
jmp 0xc91a
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x30c0
leaq 0x28(%rsp), %rdi
jmp 0xc935
jmp 0xc92d
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x30c0
movq %rbx, %rdi
callq 0x3330