// File: /workspace/github_cpp_makefile_star2_O1/MichaelXanth[P]RPG_Game/Market/Market.cpp
// Function: Market::Purchase(Hero&, int const&)
void Market::Purchase(Hero& hero, const int& buyState)
{
    int  column, row;
    char confirmation;
    bool errFlag = false;
    string testSelections[2];

    cout << endl;
    cout << "-------------------------------" << endl << endl;
    cout << "(Type 0 to cancel)" << endl;

    if (buyState == 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 (buyState == 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(!isValidForPurchase(testSelections,column,row,buyState));

    if (column == 0) {
        cout << endl << "\033[1;32mInfo:\033[0m The purchase was canceled." << endl << endl;
        return;
    }

    switch(column)
    {
        case 1:
            cout << endl << "Are you sure you want to buy \"\033[1m\033[38;5;32m" << iceSpellsArray[iceSpellsIndexes[row - 1]]->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.ChangeMoney(-iceSpellsArray[iceSpellsIndexes[row - 1]]->GetPrice());
            hero.AddNewSpell(iceSpellsArray[iceSpellsIndexes[row - 1]]);
            iceSpellsArray.erase(iceSpellsArray.begin() + iceSpellsIndexes[row - 1]);
            RecalcMostItems();

            break;

        case 2:
            cout << endl << "Are you sure you want to buy \"\033[1m\033[1;31m" << fireSpellsArray[fireSpellsIndexes[row - 1]]->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.ChangeMoney(-fireSpellsArray[fireSpellsIndexes[row - 1]]->GetPrice());
            hero.AddNewSpell(fireSpellsArray[fireSpellsIndexes[row - 1]]);
            fireSpellsArray.erase(fireSpellsArray.begin() + fireSpellsIndexes[row - 1]);
            RecalcMostItems();

            break;

        case 3:
            cout << endl << "Are you sure you want to buy \"\033[1m\033[38;5;15m" << lightingSpellsArray[lightingSpellsIndexes[row - 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.ChangeMoney(-lightingSpellsArray[lightingSpellsIndexes[row - 1]]->GetPrice());
            hero.AddNewSpell(lightingSpellsArray[lightingSpellsIndexes[row - 1]]);
            lightingSpellsArray.erase(lightingSpellsArray.begin() + lightingSpellsIndexes[row - 1]);
            RecalcMostItems();

            break;

        case 4:
            cout << endl << "Are you sure you want to buy \"\033[1m\033[38;5;166m" << weaponsArray[weaponsIndexes[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.ChangeMoney(-weaponsArray[weaponsIndexes[row - 1]]->GetPrice());
            hero.AddNewItem(weaponsArray[weaponsIndexes[row - 1]]);
            weaponsArray.erase(weaponsArray.begin() + weaponsIndexes[row - 1]);
            RecalcMostItems();

            break;

        case 5:
            cout << endl << "Are you sure you want to buy \"\033[1m\033[38;5;28m" << armorsArray[armorsIndexes[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.ChangeMoney(-(armorsArray[armorsIndexes[row - 1]]->GetPrice()));
            hero.AddNewItem(armorsArray[armorsIndexes[row - 1]]);
            armorsArray.erase(armorsArray.begin() + armorsIndexes[row - 1]);
            RecalcMostItems();

            break;

        case 6:
            cout << endl << "Are you sure you want to buy \"\033[1m\033[38;5;90m" << potionsArray[potionsIndexes[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.ChangeMoney(-potionsArray[potionsIndexes[row - 1]]->GetPrice());
            hero.AddNewItem(potionsArray[potionsIndexes[row - 1]]);
            potionsArray.erase(potionsArray.begin() + potionsIndexes[row - 1]);
            RecalcMostItems();

            break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, -0x70(%rbp)
movq %rsi, -0x40(%rbp)
movq %rdi, -0x38(%rbp)
movl $0x10, %eax
leaq (%rax,%rbp), %rcx
addq $-0xb0, %rcx
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
addq $0x20, %rax
cmpq $0x50, %rax
jne 0x1fb19
movq 0xf484(%rip), %rdi      # 0x2efc8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq 0xf469(%rip), %rdi      # 0x2efc8
callq 0x3040
movq %rax, %rdi
callq 0x3100
movq 0xf455(%rip), %rbx      # 0x2efc8
leaq 0x76a8(%rip), %rsi      # 0x27222
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x31e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq 0xf423(%rip), %rdi      # 0x2efc8
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
movq 0xf3e5(%rip), %rbx      # 0x2efc8
leaq 0x7783(%rip), %rsi      # 0x2736d
movl $0x12, %edx
movq %rbx, %rdi
callq 0x31e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq 0xf3b3(%rip), %rdi      # 0x2efc8
callq 0x3040
movq %rax, %rdi
callq 0x3100
movq -0x70(%rbp), %rax
movl (%rax), %eax
cmpl $0x1, %eax
je 0x1fc3a
testl %eax, %eax
jne 0x1fc73
leaq 0x7748(%rip), %rsi      # 0x27380
jmp 0x1fc41
leaq 0x77c7(%rip), %rsi      # 0x27408
movq 0xf380(%rip), %rdi      # 0x2efc8
movl $0x74, %edx
callq 0x31e0
movq 0xf36f(%rip), %rdi      # 0x2efc8
leaq 0x7795(%rip), %rsi      # 0x273f5
movl $0x8, %edx
callq 0x31e0
leaq 0x778d(%rip), %rsi      # 0x273fe
jmp 0x1fcaa
movq 0xf34e(%rip), %rdi      # 0x2efc8
leaq 0x77fc(%rip), %rsi      # 0x2747d
movl $0x7f, %edx
callq 0x31e0
movq 0xf336(%rip), %rdi      # 0x2efc8
leaq 0x775c(%rip), %rsi      # 0x273f5
movl $0x8, %edx
callq 0x31e0
leaq 0x7853(%rip), %rsi      # 0x274fd
movq 0xf317(%rip), %rdi      # 0x2efc8
movl $0x9, %edx
callq 0x31e0
movq 0xf306(%rip), %rdi      # 0x2efc8
leaq 0x4bb5(%rip), %rsi      # 0x2487e
movl $0x3, %edx
callq 0x31e0
movq 0xf2ee(%rip), %r12      # 0x2efc8
movq 0xf2f7(%rip), %r13      # 0x2efd8
leaq -0xb0(%rbp), %r14
leaq 0x7818(%rip), %rbx      # 0x27507
leaq -0x30(%rbp), %r15
movl $0x3, %edx
movq %r12, %rdi
leaq 0x4ba6(%rip), %rsi      # 0x248a8
callq 0x31e0
movl $0x3, %edx
movq %r12, %rdi
leaq 0x6a8d(%rip), %rsi      # 0x267a3
callq 0x31e0
movl $0x3, %edx
movq %r12, %rdi
leaq 0x4b54(%rip), %rsi      # 0x2487e
callq 0x31e0
movq %r13, %rdi
movq %r14, %rsi
callq 0x3230
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3070
testl %eax, %eax
je 0x1fd82
movq %r13, %rdi
leaq -0x90(%rbp), %rsi
callq 0x3230
movq -0x38(%rbp), %rdi
movq %r14, %rsi
leaq -0x64(%rbp), %rdx
movq %r15, %rcx
movq -0x70(%rbp), %r8
callq 0x191ba
testb %al, %al
jne 0x1fd89
movl $0x1b7740, %edi         # imm = 0x1B7740
callq 0x3260
jmp 0x1fcf3
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpq $0x6, %rax
ja 0x206e9
leaq 0x72f3(%rip), %rcx      # 0x27090
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq 0xf203(%rip), %rdi      # 0x2efc8
callq 0x3040
movq %rax, %rdi
callq 0x3100
movq %rax, %rbx
leaq 0x772d(%rip), %rsi      # 0x27509
movl $0x2b, %edx
movq %rax, %rdi
callq 0x31e0
movq (%rbx), %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
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
jmp 0x206e9
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq 0xf16a(%rip), %rdi      # 0x2efc8
callq 0x3040
movq %rax, %rdi
callq 0x3100
movq %rax, %rbx
leaq 0x7795(%rip), %rsi      # 0x2760a
movl $0x2d, %edx
movq %rax, %rdi
callq 0x31e0
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0xf0(%rdx), %rcx
movq 0x180(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rsi
movq (%rsi), %rax
leaq -0x60(%rbp), %rdi
callq *(%rax)
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq %rbx, %rdi
callq 0x31e0
leaq 0x7777(%rip), %rsi      # 0x27638
movl $0x15, %edx
movq %rax, %rdi
callq 0x31e0
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1fee0
callq 0x3170
movq 0xf0f1(%rip), %rbx      # 0x2efd8
leaq -0x29(%rbp), %r14
movabsq $0x80100000801, %r15    # imm = 0x80100000801
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3250
movzbl -0x29(%rbp), %eax
leal -0x4e(%rax), %ecx
cmpl $0x2b, %ecx
ja 0x1fef5
btq %rcx, %r15
jae 0x1fef5
andb $0x5f, %al
cmpb $0x4e, %al
je 0x206e9
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0xf0(%rdx), %rcx
movq 0x180(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
negl %eax
movq -0x40(%rbp), %rdi
movl %eax, %esi
callq 0x11164
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0xf0(%rdx), %rcx
movq 0x180(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rsi
movq -0x40(%rbp), %rdi
callq 0x10cfc
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdi
movq 0x180(%rdi), %rcx
movslq -0x4(%rcx,%rax,4), %rax
movq 0xf0(%rdi), %rcx
movq 0xf8(%rdi), %rdx
leaq (%rcx,%rax,8), %rsi
addq $0x8, %rsi
leaq 0xf8(%rdi), %rbx
jmp 0x206cb
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq 0xeffd(%rip), %rdi      # 0x2efc8
callq 0x3040
movq %rax, %rdi
callq 0x3100
movq %rax, %rbx
leaq 0x7599(%rip), %rsi      # 0x2757b
movl $0x29, %edx
movq %rax, %rdi
callq 0x31e0
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0xc0(%rdx), %rcx
movq 0x150(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rsi
movq (%rsi), %rax
leaq -0x60(%rbp), %rdi
callq *0x8(%rax)
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq %rbx, %rdi
callq 0x31e0
leaq 0x7576(%rip), %rsi      # 0x275a5
movl $0x19, %edx
movq %rax, %rdi
callq 0x31e0
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2004e
callq 0x3170
movq 0xef83(%rip), %rbx      # 0x2efd8
leaq -0x29(%rbp), %r14
movabsq $0x80100000801, %r15    # imm = 0x80100000801
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3250
movzbl -0x29(%rbp), %eax
leal -0x4e(%rax), %ecx
cmpl $0x2b, %ecx
ja 0x20063
btq %rcx, %r15
jae 0x20063
andb $0x5f, %al
cmpb $0x4e, %al
je 0x206e9
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0xc0(%rdx), %rcx
movq 0x150(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
negl %eax
movq -0x40(%rbp), %rdi
movl %eax, %esi
callq 0x11164
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0xc0(%rdx), %rcx
movq 0x150(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rsi
movq -0x40(%rbp), %rdi
callq 0x10c44
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdi
movq 0x150(%rdi), %rcx
movslq -0x4(%rcx,%rax,4), %rax
movq 0xc0(%rdi), %rcx
movq 0xc8(%rdi), %rdx
leaq (%rcx,%rax,8), %rsi
addq $0x8, %rsi
leaq 0xc8(%rdi), %rbx
jmp 0x206cb
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq 0xee8f(%rip), %rdi      # 0x2efc8
callq 0x3040
movq %rax, %rdi
callq 0x3100
movq %rax, %rbx
leaq 0x746f(%rip), %rsi      # 0x275bf
movl $0x2c, %edx
movq %rax, %rdi
callq 0x31e0
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0xa8(%rdx), %rcx
movq 0x138(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rsi
movq (%rsi), %rax
leaq -0x60(%rbp), %rdi
callq *0x8(%rax)
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq %rbx, %rdi
callq 0x31e0
leaq 0x744f(%rip), %rsi      # 0x275ec
movl $0x1d, %edx
movq %rax, %rdi
callq 0x31e0
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x201bc
callq 0x3170
movq 0xee15(%rip), %rbx      # 0x2efd8
leaq -0x29(%rbp), %r14
movabsq $0x80100000801, %r15    # imm = 0x80100000801
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3250
movzbl -0x29(%rbp), %eax
leal -0x4e(%rax), %ecx
cmpl $0x2b, %ecx
ja 0x201d1
btq %rcx, %r15
jae 0x201d1
andb $0x5f, %al
cmpb $0x4e, %al
je 0x206e9
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0xa8(%rdx), %rcx
movq 0x138(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
negl %eax
movq -0x40(%rbp), %rdi
movl %eax, %esi
callq 0x11164
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0xa8(%rdx), %rcx
movq 0x138(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rsi
movq -0x40(%rbp), %rdi
callq 0x10ca0
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdi
movq 0x138(%rdi), %rcx
movslq -0x4(%rcx,%rax,4), %rax
movq 0xa8(%rdi), %rcx
movq 0xb0(%rdi), %rdx
leaq (%rcx,%rax,8), %rsi
addq $0x8, %rsi
leaq 0xb0(%rdi), %rbx
jmp 0x206cb
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq 0xed21(%rip), %rdi      # 0x2efc8
callq 0x3040
movq %rax, %rdi
callq 0x3100
movq %rax, %rbx
leaq 0x7277(%rip), %rsi      # 0x27535
movl $0x2c, %edx
movq %rax, %rdi
callq 0x31e0
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0xd8(%rdx), %rcx
movq 0x168(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rsi
movq (%rsi), %rax
leaq -0x60(%rbp), %rdi
callq *0x8(%rax)
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq %rbx, %rdi
callq 0x31e0
leaq 0x7257(%rip), %rsi      # 0x27562
movl $0x18, %edx
movq %rax, %rdi
callq 0x31e0
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2032a
callq 0x3170
movq 0xeca7(%rip), %rbx      # 0x2efd8
leaq -0x29(%rbp), %r14
movabsq $0x80100000801, %r15    # imm = 0x80100000801
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3250
movzbl -0x29(%rbp), %eax
leal -0x4e(%rax), %ecx
cmpl $0x2b, %ecx
ja 0x2033f
btq %rcx, %r15
jae 0x2033f
andb $0x5f, %al
cmpb $0x4e, %al
je 0x206e9
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0xd8(%rdx), %rcx
movq 0x168(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
negl %eax
movq -0x40(%rbp), %rdi
movl %eax, %esi
callq 0x11164
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0xd8(%rdx), %rcx
movq 0x168(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rsi
movq -0x40(%rbp), %rdi
callq 0x10be8
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdi
movq 0x168(%rdi), %rcx
movslq -0x4(%rcx,%rax,4), %rax
movq 0xd8(%rdi), %rcx
movq 0xe0(%rdi), %rdx
leaq (%rcx,%rax,8), %rsi
addq $0x8, %rsi
leaq 0xe0(%rdi), %rbx
jmp 0x206cb
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq 0xebb3(%rip), %rdi      # 0x2efc8
callq 0x3040
movq %rax, %rdi
callq 0x3100
movq %rax, %rbx
leaq 0x7222(%rip), %rsi      # 0x2764e
movl $0x2c, %edx
movq %rax, %rdi
callq 0x31e0
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0x120(%rdx), %rcx
movq 0x1b0(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rsi
movq (%rsi), %rax
leaq -0x60(%rbp), %rdi
callq *(%rax)
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq %rbx, %rdi
callq 0x31e0
leaq 0x7203(%rip), %rsi      # 0x2767b
movl $0x14, %edx
movq %rax, %rdi
callq 0x31e0
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x20497
callq 0x3170
movq 0xeb3a(%rip), %rbx      # 0x2efd8
leaq -0x29(%rbp), %r14
movabsq $0x80100000801, %r15    # imm = 0x80100000801
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3250
movzbl -0x29(%rbp), %eax
leal -0x4e(%rax), %ecx
cmpl $0x2b, %ecx
ja 0x204ac
btq %rcx, %r15
jae 0x204ac
andb $0x5f, %al
cmpb $0x4e, %al
je 0x206e9
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0x120(%rdx), %rcx
movq 0x1b0(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
negl %eax
movq -0x40(%rbp), %rdi
movl %eax, %esi
callq 0x11164
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0x120(%rdx), %rcx
movq 0x1b0(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rsi
movq -0x40(%rbp), %rdi
callq 0x10d6a
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdi
movq 0x1b0(%rdi), %rcx
movslq -0x4(%rcx,%rax,4), %rax
movq 0x120(%rdi), %rcx
movq 0x128(%rdi), %rdx
leaq (%rcx,%rax,8), %rsi
addq $0x8, %rsi
leaq 0x128(%rdi), %rbx
jmp 0x206cb
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq 0xea46(%rip), %rdi      # 0x2efc8
callq 0x3040
movq %rax, %rdi
callq 0x3100
movq %rax, %rbx
leaq 0x70f7(%rip), %rsi      # 0x27690
movl $0x2c, %edx
movq %rax, %rdi
callq 0x31e0
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0x108(%rdx), %rcx
movq 0x198(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rsi
movq (%rsi), %rax
leaq -0x60(%rbp), %rdi
callq *(%rax)
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq %rbx, %rdi
callq 0x31e0
leaq 0x70d8(%rip), %rsi      # 0x276bd
movl $0x15, %edx
movq %rax, %rdi
callq 0x31e0
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x20604
callq 0x3170
movq 0xe9cd(%rip), %rbx      # 0x2efd8
leaq -0x29(%rbp), %r14
movabsq $0x80100000801, %r15    # imm = 0x80100000801
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3250
movzbl -0x29(%rbp), %eax
leal -0x4e(%rax), %ecx
cmpl $0x2b, %ecx
ja 0x20619
btq %rcx, %r15
jae 0x20619
andb $0x5f, %al
cmpb $0x4e, %al
je 0x206e9
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0x108(%rdx), %rcx
movq 0x198(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
negl %eax
movq -0x40(%rbp), %rdi
movl %eax, %esi
callq 0x11164
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
movq 0x108(%rdx), %rcx
movq 0x198(%rdx), %rdx
movslq -0x4(%rdx,%rax,4), %rax
movq (%rcx,%rax,8), %rsi
movq -0x40(%rbp), %rdi
callq 0x10dd8
movslq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdi
movq 0x198(%rdi), %rcx
movslq -0x4(%rcx,%rax,4), %rax
movq 0x108(%rdi), %rcx
movq 0x110(%rdi), %rdx
leaq (%rcx,%rax,8), %rsi
addq $0x8, %rsi
leaq 0x110(%rdi), %rbx
cmpq %rdx, %rsi
je 0x206dc
leaq (%rcx,%rax,8), %rdi
subq %rsi, %rdx
callq 0x32b0
addq $-0x8, (%rbx)
movq -0x38(%rbp), %rdi
callq 0x190c4
leaq -0x80(%rbp), %rbx
xorl %r14d, %r14d
movq -0x90(%rbp,%r14), %rdi
leaq (%rbx,%r14), %rax
cmpq %rdi, %rax
je 0x20706
callq 0x3170
addq $-0x20, %r14
cmpq $-0x40, %r14
jne 0x206f0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2075d
jmp 0x2075d
jmp 0x2075d
jmp 0x2075d
jmp 0x2075d
jmp 0x2075d
jmp 0x20738
jmp 0x20738
jmp 0x20738
jmp 0x20738
jmp 0x20738
movq %rax, %rbx
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x20760
callq 0x3170
jmp 0x20760
jmp 0x2075d
jmp 0x2075d
jmp 0x2075d
jmp 0x2075d
jmp 0x2075d
jmp 0x2075d
jmp 0x2075d
movq %rax, %rbx
leaq -0x80(%rbp), %r14
xorl %r15d, %r15d
movq -0x90(%rbp,%r15), %rdi
leaq (%r14,%r15), %rax
cmpq %rdi, %rax
je 0x2077d
callq 0x3170
addq $-0x20, %r15
cmpq $-0x40, %r15
jne 0x20767
movq %rbx, %rdi
callq 0x32f0
nop