// File: MichaelXanth[P]RPG_Game/Market/Market.cpp
// Function: Market::Sale(Hero&, int const&)
void Market::Sale(Hero& hero, const int& sellState)
{
    int  column, row;
    char confirmation;
    bool errFlag = false;
    string testSelections[2];

    cout << endl;
    cout << "-------------------------------" << endl << endl;
    cout << "(Type 0 to cancel)" << endl;

    if (sellState == 0) {
        cout << "Choose a Spell by selecting its position in the table(e.g.: \033[1;34m<\033[1;33mcolumn\033[1;34m> <\033[1;33mrow\033[1;34m>\033[0m): ";

        cout << "\n\n\n\n\n\n\n\n";
        cout << "\033[8A\033[77C";
    
    } else if (sellState == 1) {
        cout << "Choose an Item by selecting its position in the table(e.g.: \033[1;34m<\033[1;33mcolumn\033[1;34m> <\033[1;33mrow\033[1;34m>\033[0m): ";

        cout << "\n\n\n\n\n\n\n\n";
        cout << "\033[8A\033[77C";
    
    } else {
        cout << "Choose an Item or a Spell by selecting its position in the table(e.g.: \033[1;34m<\033[1;33mcolumn\033[1;34m> <\033[1;33mrow\033[1;34m>\033[0m): ";

        cout << "\n\n\n\n\n\n\n\n";
        cout << "\033[8A\033[88C";
    }

    cout << "\033[s";

    do {
        if (errFlag)
            usleep(1800000);

        cout << "\033[u";
        cout << "\033[J";
        cout << "\033[s";

        errFlag = true;

        cin >> testSelections[0];

        if (testSelections[0] == "0") {
            column = 0;
            break;
        }

        cin >> testSelections[1];
    } while(!hero.isValidForSale(testSelections,column,row,sellState));

    if (column == 0) {
        cout << endl << "\033[1;32mInfo:\033[0m The sale operation was canceled." << endl << endl;
        return;
    }

    switch(column)
    {
        case 1:
            if (sellState == 1) {
                cout << endl << "Are you sure you want to sell \"\033[1m\033[38;5;166m" << hero.GetWeaponFromSlot(row - 1)->GetName() << "\033[0m\" Weapon? [y/n]: ";

                do {
                    cin >> confirmation;
                } while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');

                if (confirmation == 'n' || confirmation == 'N')
                    break;

                hero.RemoveWeapon(row - 1);
            
            } else {
                cout << endl << "Are you sure you want to sell \"\033[1m\033[38;5;32m" << hero.GetSpellFromSlot(row - 1, 2)->GetName() << "\033[0m\" Ice Spell? [y/n]: ";

                do {
                    cin >> confirmation;
                } while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');

                if (confirmation == 'n' || confirmation == 'N')
                    break;

                hero.RemoveIceSpell(row - 1);
            }

            break;

        case 2:
            if (sellState == 1) {
                cout << endl << "Are you sure you want to sell \"\033[1m\033[38;5;28m" << hero.GetArmorFromSlot(row - 1)->GetName() << "\033[0m\" Armor? [y/n]: ";

                do {
                    cin >> confirmation;
                } while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');

                if (confirmation == 'n' || confirmation == 'N')
                    break;

                hero.RemoveArmor(row - 1);
            
            } else {
                cout << endl << "Are you sure you want to sell \"\033[1m\033[1;31m" << hero.GetSpellFromSlot(row - 1, 3)->GetName() << "\033[0m\" Fire Spell? [y/n]: ";

                do {
                    cin >> confirmation;
                } while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');

                if (confirmation == 'n' || confirmation == 'N')
                    break;

                hero.RemoveFireSpell(row - 1);
            }

            break;

        case 3:
            if (sellState == 1) {
                cout << endl << "Are you sure you want to sell \"\033[1m\033[38;5;90m" << hero.GetPotionFromSlot(row - 1)->GetName() << "\033[0m\" Potion? [y/n]: ";

                do {
                    cin >> confirmation;
                } while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');

                if (confirmation == 'n' || confirmation == 'N')
                    break;

                hero.RemovePotion(row - 1);
            
            } else {
                cout << endl << "Are you sure you want to sell \"\033[1m\033[38;5;15m" << hero.GetSpellFromSlot(row - 1, 1)->GetName() << "\033[0m\" Lighting Spell? [y/n]: ";

                do {
                    cin >> confirmation;
                } while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');

                if (confirmation == 'n' || confirmation == 'N')
                    break;

                hero.RemoveLightingSpell(row - 1);
            }

            break;

        case 4:
            cout << endl << "Are you sure you want to sell \"\033[1m\033[38;5;166m" << hero.GetWeaponFromSlot(row - 1)->GetName() << "\033[0m\" Weapon? [y/n]: ";

            do {
                cin >> confirmation;
            } while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');

            if (confirmation == 'n' || confirmation == 'N')
                break;

            hero.RemoveWeapon(row - 1);

            break;

        case 5:
            cout << endl << "Are you sure you want to sell \"\033[1m\033[38;5;28m" << hero.GetArmorFromSlot(row - 1)->GetName() << "\033[0m\" Armor? [y/n]: ";

            do {
                cin >> confirmation;
            } while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');

            if (confirmation == 'n' || confirmation == 'N')
                break;

            hero.RemoveArmor(row - 1);

            break;

        case 6:
            cout << endl << "Are you sure you want to sell \"\033[1m\033[38;5;90m" << hero.GetPotionFromSlot(row - 1)->GetName() << "\033[0m\" Potion? [y/n]: ";

            do {
                cin >> confirmation;
            } while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');

            if (confirmation == 'n' || confirmation == 'N')
                break;

            hero.RemovePotion(row - 1);

            break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3e0, %rsp            # imm = 0x3E0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movb $0x0, -0x22(%rbp)
leaq -0x70(%rbp), %rax
movq %rax, %rcx
addq $0x40, %rcx
movq %rcx, -0x1f8(%rbp)
movq %rax, -0x1f0(%rbp)
movq -0x1f0(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x4380
movq -0x200(%rbp), %rax
movq -0x1f8(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x1f0(%rbp)
jne 0x38454
movq 0x15b3c(%rip), %rdi     # 0x4dfc8
movq 0x15b25(%rip), %rsi     # 0x4dfb8
callq 0x4290
jmp 0x3849a
movq 0x15b27(%rip), %rdi     # 0x4dfc8
leaq 0x7dea(%rip), %rsi      # 0x40292
callq 0x4260
movq %rax, -0x208(%rbp)
jmp 0x384b6
movq -0x208(%rbp), %rdi
movq 0x15af4(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, -0x210(%rbp)
jmp 0x384d2
movq -0x210(%rbp), %rdi
movq 0x15ad8(%rip), %rsi     # 0x4dfb8
callq 0x4290
jmp 0x384e7
movq 0x15ada(%rip), %rdi     # 0x4dfc8
leaq 0x7ee8(%rip), %rsi      # 0x403dd
callq 0x4260
movq %rax, -0x218(%rbp)
jmp 0x38503
movq -0x218(%rbp), %rdi
movq 0x15aa7(%rip), %rsi     # 0x4dfb8
callq 0x4290
jmp 0x38518
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x38576
movq 0x15aa0(%rip), %rdi     # 0x4dfc8
leaq 0x7ec1(%rip), %rsi      # 0x403f0
callq 0x4260
jmp 0x38536
movq 0x15a8b(%rip), %rdi     # 0x4dfc8
leaq 0x7f21(%rip), %rsi      # 0x40465
callq 0x4260
jmp 0x3854b
movq 0x15a76(%rip), %rdi     # 0x4dfc8
leaq 0x7f15(%rip), %rsi      # 0x4046e
callq 0x4260
jmp 0x38560
jmp 0x38603
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x3945e
movq -0x18(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x385c0
movq 0x15a42(%rip), %rdi     # 0x4dfc8
leaq 0x7eeb(%rip), %rsi      # 0x40478
callq 0x4260
jmp 0x38594
movq 0x15a2d(%rip), %rdi     # 0x4dfc8
leaq 0x7ec3(%rip), %rsi      # 0x40465
callq 0x4260
jmp 0x385a9
movq 0x15a18(%rip), %rdi     # 0x4dfc8
leaq 0x7eb7(%rip), %rsi      # 0x4046e
callq 0x4260
jmp 0x385be
jmp 0x38601
movq 0x15a01(%rip), %rdi     # 0x4dfc8
leaq 0x7f1f(%rip), %rsi      # 0x404ed
callq 0x4260
jmp 0x385d5
movq 0x159ec(%rip), %rdi     # 0x4dfc8
leaq 0x7e82(%rip), %rsi      # 0x40465
callq 0x4260
jmp 0x385ea
movq 0x159d7(%rip), %rdi     # 0x4dfc8
leaq 0x7f75(%rip), %rsi      # 0x4056d
callq 0x4260
jmp 0x385ff
jmp 0x38601
jmp 0x38603
movq 0x159be(%rip), %rdi     # 0x4dfc8
leaq 0x526d(%rip), %rsi      # 0x3d87e
callq 0x4260
jmp 0x38618
jmp 0x3861a
testb $0x1, -0x22(%rbp)
je 0x3862e
movl $0x1b7740, %edi         # imm = 0x1B7740
callq 0x4390
jmp 0x3862c
jmp 0x3862e
movq 0x15993(%rip), %rdi     # 0x4dfc8
leaq 0x526c(%rip), %rsi      # 0x3d8a8
callq 0x4260
jmp 0x38643
movq 0x1597e(%rip), %rdi     # 0x4dfc8
leaq 0x71e2(%rip), %rsi      # 0x3f833
callq 0x4260
jmp 0x38658
movq 0x15969(%rip), %rdi     # 0x4dfc8
leaq 0x5218(%rip), %rsi      # 0x3d87e
callq 0x4260
jmp 0x3866d
movb $0x1, -0x22(%rbp)
movq 0x15960(%rip), %rdi     # 0x4dfd8
leaq -0x70(%rbp), %rsi
callq 0x4340
jmp 0x38683
leaq 0x7eed(%rip), %rsi      # 0x40577
leaq -0x70(%rbp), %rdi
callq 0x3a0c0
movb %al, -0x219(%rbp)
jmp 0x3869b
movb -0x219(%rbp), %al
testb $0x1, %al
jne 0x386a7
jmp 0x386b0
movl $0x0, -0x1c(%rbp)
jmp 0x386f5
leaq -0x50(%rbp), %rsi
movq 0x1591d(%rip), %rdi     # 0x4dfd8
callq 0x4340
jmp 0x386c2
jmp 0x386c4
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %r8
leaq -0x70(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
leaq -0x20(%rbp), %rcx
callq 0x1fc80
movb %al, -0x21a(%rbp)
jmp 0x386e5
movb -0x21a(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3861a
cmpl $0x0, -0x1c(%rbp)
jne 0x38770
movq 0x158c6(%rip), %rdi     # 0x4dfc8
movq 0x158af(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, -0x228(%rbp)
jmp 0x38717
movq -0x228(%rbp), %rdi
leaq 0x817b(%rip), %rsi      # 0x408a0
callq 0x4260
movq %rax, -0x230(%rbp)
jmp 0x38733
movq -0x230(%rbp), %rdi
movq 0x15877(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, -0x238(%rbp)
jmp 0x3874f
movq -0x238(%rbp), %rdi
movq 0x1585b(%rip), %rsi     # 0x4dfb8
callq 0x4290
jmp 0x38764
movl $0x1, -0x80(%rbp)
jmp 0x3940e
movl -0x1c(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x240(%rbp)
subl $0x5, %eax
ja 0x39407
movq -0x240(%rbp), %rax
leaq 0x79a3(%rip), %rcx      # 0x40138
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x38906
movq 0x15816(%rip), %rdi     # 0x4dfc8
movq 0x157ff(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, -0x248(%rbp)
jmp 0x387c7
movq -0x248(%rbp), %rdi
leaq 0x80fd(%rip), %rsi      # 0x408d2
callq 0x4260
movq %rax, -0x250(%rbp)
jmp 0x387e3
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %esi
decl %esi
callq 0x207d0
movq %rax, -0x258(%rbp)
jmp 0x387fa
movq -0x258(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0xa0(%rbp), %rdi
callq *%rax
jmp 0x38812
movq -0x250(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x4210
movq %rax, -0x260(%rbp)
jmp 0x3882e
movq -0x260(%rbp), %rdi
leaq 0x7e6c(%rip), %rsi      # 0x406a8
callq 0x4260
jmp 0x38843
leaq -0xa0(%rbp), %rdi
callq 0x4160
movq 0x15782(%rip), %rdi     # 0x4dfd8
leaq -0x21(%rbp), %rsi
callq 0x4360
jmp 0x38861
jmp 0x38863
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x79, %ecx
movb %al, -0x261(%rbp)
je 0x388a6
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x59, %ecx
movb %al, -0x261(%rbp)
je 0x388a6
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x6e, %ecx
movb %al, -0x261(%rbp)
je 0x388a6
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
setne %al
movb %al, -0x261(%rbp)
movb -0x261(%rbp), %al
testb $0x1, %al
jne 0x3884f
movsbl -0x21(%rbp), %eax
cmpl $0x6e, %eax
je 0x388c2
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
jne 0x388e4
jmp 0x39407
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x4160
jmp 0x3945e
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
decl %eax
movl %eax, -0xa4(%rbp)
leaq -0xa4(%rbp), %rsi
callq 0x1f680
jmp 0x38901
jmp 0x38a64
movq 0x156bb(%rip), %rdi     # 0x4dfc8
movq 0x156a4(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, -0x270(%rbp)
jmp 0x38922
movq -0x270(%rbp), %rdi
leaq 0x7fd1(%rip), %rsi      # 0x40901
callq 0x4260
movq %rax, -0x278(%rbp)
jmp 0x3893e
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %esi
decl %esi
movl $0x2, %edx
callq 0x1fbe0
movq %rax, -0x280(%rbp)
jmp 0x3895a
movq -0x280(%rbp), %rsi
movq (%rsi), %rax
movq 0x8(%rax), %rax
leaq -0xc8(%rbp), %rdi
callq *%rax
jmp 0x38973
movq -0x278(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x4210
movq %rax, -0x288(%rbp)
jmp 0x3898f
movq -0x288(%rbp), %rdi
leaq 0x7c35(%rip), %rsi      # 0x405d2
callq 0x4260
jmp 0x389a4
leaq -0xc8(%rbp), %rdi
callq 0x4160
movq 0x15621(%rip), %rdi     # 0x4dfd8
leaq -0x21(%rbp), %rsi
callq 0x4360
jmp 0x389c2
jmp 0x389c4
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x79, %ecx
movb %al, -0x289(%rbp)
je 0x38a07
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x59, %ecx
movb %al, -0x289(%rbp)
je 0x38a07
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x6e, %ecx
movb %al, -0x289(%rbp)
je 0x38a07
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
setne %al
movb %al, -0x289(%rbp)
movb -0x289(%rbp), %al
testb $0x1, %al
jne 0x389b0
movsbl -0x21(%rbp), %eax
cmpl $0x6e, %eax
je 0x38a23
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
jne 0x38a45
jmp 0x39407
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x4160
jmp 0x3945e
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
decl %eax
movl %eax, -0xcc(%rbp)
leaq -0xcc(%rbp), %rsi
callq 0x1f3e0
jmp 0x38a62
jmp 0x38a64
jmp 0x39407
movq -0x18(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x38bd1
movq 0x1554b(%rip), %rdi     # 0x4dfc8
movq 0x15534(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, -0x298(%rbp)
jmp 0x38a92
movq -0x298(%rbp), %rdi
leaq 0x7e8f(%rip), %rsi      # 0x4092f
callq 0x4260
movq %rax, -0x2a0(%rbp)
jmp 0x38aae
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %esi
decl %esi
callq 0x20740
movq %rax, -0x2a8(%rbp)
jmp 0x38ac5
movq -0x2a8(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0xf0(%rbp), %rdi
callq *%rax
jmp 0x38add
movq -0x2a0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x4210
movq %rax, -0x2b0(%rbp)
jmp 0x38af9
movq -0x2b0(%rbp), %rdi
leaq 0x7be4(%rip), %rsi      # 0x406eb
callq 0x4260
jmp 0x38b0e
leaq -0xf0(%rbp), %rdi
callq 0x4160
movq 0x154b7(%rip), %rdi     # 0x4dfd8
leaq -0x21(%rbp), %rsi
callq 0x4360
jmp 0x38b2c
jmp 0x38b2e
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x79, %ecx
movb %al, -0x2b1(%rbp)
je 0x38b71
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x59, %ecx
movb %al, -0x2b1(%rbp)
je 0x38b71
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x6e, %ecx
movb %al, -0x2b1(%rbp)
je 0x38b71
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
setne %al
movb %al, -0x2b1(%rbp)
movb -0x2b1(%rbp), %al
testb $0x1, %al
jne 0x38b1a
movsbl -0x21(%rbp), %eax
cmpl $0x6e, %eax
je 0x38b8d
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
jne 0x38baf
jmp 0x39407
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x4160
jmp 0x3945e
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
decl %eax
movl %eax, -0xf4(%rbp)
leaq -0xf4(%rbp), %rsi
callq 0x1f770
jmp 0x38bcc
jmp 0x38d2f
movq 0x153f0(%rip), %rdi     # 0x4dfc8
movq 0x153d9(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, -0x2c0(%rbp)
jmp 0x38bed
movq -0x2c0(%rbp), %rdi
leaq 0x7d62(%rip), %rsi      # 0x4095d
callq 0x4260
movq %rax, -0x2c8(%rbp)
jmp 0x38c09
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %esi
decl %esi
movl $0x3, %edx
callq 0x1fbe0
movq %rax, -0x2d0(%rbp)
jmp 0x38c25
movq -0x2d0(%rbp), %rsi
movq (%rsi), %rax
movq 0x8(%rax), %rax
leaq -0x118(%rbp), %rdi
callq *%rax
jmp 0x38c3e
movq -0x2c8(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x4210
movq %rax, -0x2d8(%rbp)
jmp 0x38c5a
movq -0x2d8(%rbp), %rdi
leaq 0x79ad(%rip), %rsi      # 0x40615
callq 0x4260
jmp 0x38c6f
leaq -0x118(%rbp), %rdi
callq 0x4160
movq 0x15356(%rip), %rdi     # 0x4dfd8
leaq -0x21(%rbp), %rsi
callq 0x4360
jmp 0x38c8d
jmp 0x38c8f
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x79, %ecx
movb %al, -0x2d9(%rbp)
je 0x38cd2
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x59, %ecx
movb %al, -0x2d9(%rbp)
je 0x38cd2
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x6e, %ecx
movb %al, -0x2d9(%rbp)
je 0x38cd2
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
setne %al
movb %al, -0x2d9(%rbp)
movb -0x2d9(%rbp), %al
testb $0x1, %al
jne 0x38c7b
movsbl -0x21(%rbp), %eax
cmpl $0x6e, %eax
je 0x38cee
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
jne 0x38d10
jmp 0x39407
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x4160
jmp 0x3945e
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
decl %eax
movl %eax, -0x11c(%rbp)
leaq -0x11c(%rbp), %rsi
callq 0x1f4c0
jmp 0x38d2d
jmp 0x38d2f
jmp 0x39407
movq -0x18(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x38e9c
movq 0x15280(%rip), %rdi     # 0x4dfc8
movq 0x15269(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, -0x2e8(%rbp)
jmp 0x38d5d
movq -0x2e8(%rbp), %rdi
leaq 0x7c1d(%rip), %rsi      # 0x40988
callq 0x4260
movq %rax, -0x2f0(%rbp)
jmp 0x38d79
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %esi
decl %esi
callq 0x205e0
movq %rax, -0x2f8(%rbp)
jmp 0x38d90
movq -0x2f8(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x140(%rbp), %rdi
callq *%rax
jmp 0x38da8
movq -0x2f0(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x4210
movq %rax, -0x300(%rbp)
jmp 0x38dc4
movq -0x300(%rbp), %rdi
leaq 0x795b(%rip), %rsi      # 0x4072d
callq 0x4260
jmp 0x38dd9
leaq -0x140(%rbp), %rdi
callq 0x4160
movq 0x151ec(%rip), %rdi     # 0x4dfd8
leaq -0x21(%rbp), %rsi
callq 0x4360
jmp 0x38df7
jmp 0x38df9
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x79, %ecx
movb %al, -0x301(%rbp)
je 0x38e3c
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x59, %ecx
movb %al, -0x301(%rbp)
je 0x38e3c
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x6e, %ecx
movb %al, -0x301(%rbp)
je 0x38e3c
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
setne %al
movb %al, -0x301(%rbp)
movb -0x301(%rbp), %al
testb $0x1, %al
jne 0x38de5
movsbl -0x21(%rbp), %eax
cmpl $0x6e, %eax
je 0x38e58
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
jne 0x38e7a
jmp 0x39407
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x4160
jmp 0x3945e
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
decl %eax
movl %eax, -0x144(%rbp)
leaq -0x144(%rbp), %rsi
callq 0x1f860
jmp 0x38e97
jmp 0x38ffa
movq 0x15125(%rip), %rdi     # 0x4dfc8
movq 0x1510e(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, -0x310(%rbp)
jmp 0x38eb8
movq -0x310(%rbp), %rdi
leaq 0x7af0(%rip), %rsi      # 0x409b6
callq 0x4260
movq %rax, -0x318(%rbp)
jmp 0x38ed4
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %esi
decl %esi
movl $0x1, %edx
callq 0x1fbe0
movq %rax, -0x320(%rbp)
jmp 0x38ef0
movq -0x320(%rbp), %rsi
movq (%rsi), %rax
movq 0x8(%rax), %rax
leaq -0x168(%rbp), %rdi
callq *%rax
jmp 0x38f09
movq -0x318(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x4210
movq %rax, -0x328(%rbp)
jmp 0x38f25
movq -0x328(%rbp), %rdi
leaq 0x7729(%rip), %rsi      # 0x4065c
callq 0x4260
jmp 0x38f3a
leaq -0x168(%rbp), %rdi
callq 0x4160
movq 0x1508b(%rip), %rdi     # 0x4dfd8
leaq -0x21(%rbp), %rsi
callq 0x4360
jmp 0x38f58
jmp 0x38f5a
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x79, %ecx
movb %al, -0x329(%rbp)
je 0x38f9d
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x59, %ecx
movb %al, -0x329(%rbp)
je 0x38f9d
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x6e, %ecx
movb %al, -0x329(%rbp)
je 0x38f9d
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
setne %al
movb %al, -0x329(%rbp)
movb -0x329(%rbp), %al
testb $0x1, %al
jne 0x38f46
movsbl -0x21(%rbp), %eax
cmpl $0x6e, %eax
je 0x38fb9
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
jne 0x38fdb
jmp 0x39407
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x4160
jmp 0x3945e
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
decl %eax
movl %eax, -0x16c(%rbp)
leaq -0x16c(%rbp), %rsi
callq 0x1f5a0
jmp 0x38ff8
jmp 0x38ffa
jmp 0x39407
movq 0x14fc2(%rip), %rdi     # 0x4dfc8
movq 0x14fab(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, -0x338(%rbp)
jmp 0x3901b
movq -0x338(%rbp), %rdi
leaq 0x78a9(%rip), %rsi      # 0x408d2
callq 0x4260
movq %rax, -0x340(%rbp)
jmp 0x39037
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %esi
decl %esi
callq 0x207d0
movq %rax, -0x348(%rbp)
jmp 0x3904e
movq -0x348(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x190(%rbp), %rdi
callq *%rax
jmp 0x39066
movq -0x340(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x4210
movq %rax, -0x350(%rbp)
jmp 0x39082
movq -0x350(%rbp), %rdi
leaq 0x7618(%rip), %rsi      # 0x406a8
callq 0x4260
jmp 0x39097
leaq -0x190(%rbp), %rdi
callq 0x4160
movq 0x14f2e(%rip), %rdi     # 0x4dfd8
leaq -0x21(%rbp), %rsi
callq 0x4360
jmp 0x390b5
jmp 0x390b7
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x79, %ecx
movb %al, -0x351(%rbp)
je 0x390fa
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x59, %ecx
movb %al, -0x351(%rbp)
je 0x390fa
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x6e, %ecx
movb %al, -0x351(%rbp)
je 0x390fa
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
setne %al
movb %al, -0x351(%rbp)
movb -0x351(%rbp), %al
testb $0x1, %al
jne 0x390a3
movsbl -0x21(%rbp), %eax
cmpl $0x6e, %eax
je 0x39116
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
jne 0x39138
jmp 0x39407
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x4160
jmp 0x3945e
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
decl %eax
movl %eax, -0x194(%rbp)
leaq -0x194(%rbp), %rsi
callq 0x1f680
jmp 0x39155
jmp 0x39407
movq 0x14e67(%rip), %rdi     # 0x4dfc8
movq 0x14e50(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, -0x360(%rbp)
jmp 0x39176
movq -0x360(%rbp), %rdi
leaq 0x77ab(%rip), %rsi      # 0x4092f
callq 0x4260
movq %rax, -0x368(%rbp)
jmp 0x39192
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %esi
decl %esi
callq 0x20740
movq %rax, -0x370(%rbp)
jmp 0x391a9
movq -0x370(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x1b8(%rbp), %rdi
callq *%rax
jmp 0x391c1
movq -0x368(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x4210
movq %rax, -0x378(%rbp)
jmp 0x391dd
movq -0x378(%rbp), %rdi
leaq 0x7500(%rip), %rsi      # 0x406eb
callq 0x4260
jmp 0x391f2
leaq -0x1b8(%rbp), %rdi
callq 0x4160
movq 0x14dd3(%rip), %rdi     # 0x4dfd8
leaq -0x21(%rbp), %rsi
callq 0x4360
jmp 0x39210
jmp 0x39212
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x79, %ecx
movb %al, -0x379(%rbp)
je 0x39255
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x59, %ecx
movb %al, -0x379(%rbp)
je 0x39255
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x6e, %ecx
movb %al, -0x379(%rbp)
je 0x39255
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
setne %al
movb %al, -0x379(%rbp)
movb -0x379(%rbp), %al
testb $0x1, %al
jne 0x391fe
movsbl -0x21(%rbp), %eax
cmpl $0x6e, %eax
je 0x39271
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
jne 0x39293
jmp 0x39407
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x4160
jmp 0x3945e
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
decl %eax
movl %eax, -0x1bc(%rbp)
leaq -0x1bc(%rbp), %rsi
callq 0x1f770
jmp 0x392b0
jmp 0x39407
movq 0x14d0c(%rip), %rdi     # 0x4dfc8
movq 0x14cf5(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, -0x388(%rbp)
jmp 0x392d1
movq -0x388(%rbp), %rdi
leaq 0x76a9(%rip), %rsi      # 0x40988
callq 0x4260
movq %rax, -0x390(%rbp)
jmp 0x392ed
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %esi
decl %esi
callq 0x205e0
movq %rax, -0x398(%rbp)
jmp 0x39304
movq -0x398(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x1e0(%rbp), %rdi
callq *%rax
jmp 0x3931c
movq -0x390(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x4210
movq %rax, -0x3a0(%rbp)
jmp 0x39338
movq -0x3a0(%rbp), %rdi
leaq 0x73e7(%rip), %rsi      # 0x4072d
callq 0x4260
jmp 0x3934d
leaq -0x1e0(%rbp), %rdi
callq 0x4160
movq 0x14c78(%rip), %rdi     # 0x4dfd8
leaq -0x21(%rbp), %rsi
callq 0x4360
jmp 0x3936b
jmp 0x3936d
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x79, %ecx
movb %al, -0x3a1(%rbp)
je 0x393b0
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x59, %ecx
movb %al, -0x3a1(%rbp)
je 0x393b0
movsbl -0x21(%rbp), %ecx
xorl %eax, %eax
cmpl $0x6e, %ecx
movb %al, -0x3a1(%rbp)
je 0x393b0
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
setne %al
movb %al, -0x3a1(%rbp)
movb -0x3a1(%rbp), %al
testb $0x1, %al
jne 0x39359
movsbl -0x21(%rbp), %eax
cmpl $0x6e, %eax
je 0x393cc
movsbl -0x21(%rbp), %eax
cmpl $0x4e, %eax
jne 0x393e8
jmp 0x39407
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x4160
jmp 0x3945e
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
decl %eax
movl %eax, -0x1e4(%rbp)
leaq -0x1e4(%rbp), %rsi
callq 0x1f860
jmp 0x39405
jmp 0x39407
movl $0x0, -0x80(%rbp)
leaq -0x70(%rbp), %rax
movq %rax, -0x3b8(%rbp)
addq $0x40, %rax
movq %rax, -0x3b0(%rbp)
movq -0x3b0(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x3c0(%rbp)
callq 0x4160
movq -0x3b8(%rbp), %rcx
movq -0x3c0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x3b0(%rbp)
jne 0x39424
addq $0x3e0, %rsp            # imm = 0x3E0
popq %rbp
retq
leaq -0x70(%rbp), %rax
movq %rax, -0x3d0(%rbp)
addq $0x40, %rax
movq %rax, -0x3c8(%rbp)
movq -0x3c8(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x3d8(%rbp)
callq 0x4160
movq -0x3d0(%rbp), %rcx
movq -0x3d8(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x3c8(%rbp)
jne 0x39474
jmp 0x394a7
movq -0x78(%rbp), %rdi
callq 0x4440