// File: MichaelXanth[P]RPG_Game/Market/Market.cpp
// Function: Market::isAbleToBuy(Hero const*, bool const&)
int Market::isAbleToBuy(const Hero* hero, const bool& info = true)
{
    int buyState = 2;
    bool found = false;

    if (hero->GetMoney() == 0) {
        if (info) {
            if (lightingSpellsForSale || fireSpellsForSale || iceSpellsForSale || weaponsForSale || potionsForSale || armorsForSale) {
                
                DisplayMarket(false, hero, 3);
                cerr << endl;
                cerr << "-------------------------------" << endl << endl;
                cerr << "\033[35mWarning:\033[0m Hero \033[38;5;220m" << hero->Living::GetName() << "\033[0m has no money. The minimum required amount is: " << minPrice << endl;
                usleep(2500000);
            
            } else
                cerr << endl << "\033[31mError:\033[0m Hero \033[38;5;220m" << hero->Living::GetName() << "\033[0m has no money. The minimum required amount is: " << minPrice << endl;
        }
        return -1;
    }

    if (hero->GetMoney() < minPrice) {
        if (info) {
            if (lightingSpellsForSale || fireSpellsForSale || iceSpellsForSale || weaponsForSale || potionsForSale || armorsForSale) {

                DisplayMarket(false,hero,3);
                cerr << endl;
                cerr << "-------------------------------" << endl << endl;
                cerr << "\033[35mWarning:\033[0m Hero \033[38;5;220m" << hero->Living::GetName() << "\033[0m doesn't have enough money. The minimum required amount is: " << minPrice << endl;
                usleep(2500000);
            
            } else
                cerr << endl << "\033[31mError:\033[0m Hero \033[38;5;220m" << hero->Living::GetName() << "\033[0m doesn't have enough money. The minimum required amount is: " << minPrice << endl;
        }
        return -1;
    }

    if (hero->GetAvailableItemSlots() == 0 || hero->GetMoney() < minItemPrice) {
        if (hero->GetAvailableSpellSlots() == 0 || hero->GetMoney() < minSpellPrice) {
            if (info) {
                if (lightingSpellsForSale || fireSpellsForSale || iceSpellsForSale || weaponsForSale || potionsForSale || armorsForSale) {
                    
                    DisplayMarket(false,hero,3);
                    cerr << endl;
                    cerr << "-------------------------------" << endl << endl;
                    cerr << "\033[35mWarning:\033[0m Hero \033[38;5;220m" << hero->Living::GetName() << "\033[0m doesn't have any other available Item and Spell slots." << endl;
                    usleep(2500000);
                
                } else
                    cerr << endl << "\033[31mError:\033[0m Hero \033[38;5;220m" << hero->Living::GetName() << "\033[0m doesn't have enough money. The minimum required amount is: " << minPrice << endl;
            }
            return -1;
        }
        buyState = 0;   //Means that he can buy Spells only
    
    } else if (hero->GetAvailableSpellSlots() == 0 || hero->GetMoney() < minSpellPrice) {
        buyState = 1;   //Means that he can buy Items only
    }

    if (buyState != 1) {
        
        unsigned int i;

        for (i = 0; i < iceSpellsArray.size() && !canBeBought(iceSpellsArray[i],hero); i++)
            ;
        if (i < iceSpellsArray.size())
            found = true;

        for (i = 0; i < fireSpellsArray.size() && !canBeBought(fireSpellsArray[i],hero); i++)
            ;
        if (i < fireSpellsArray.size())
            found = true;

        for (i = 0; i < lightingSpellsArray.size() && !canBeBought(lightingSpellsArray[i],hero); i++)
            ;
        if (i < lightingSpellsArray.size())
            found = true;
    }

    if (buyState != 0) {

        unsigned int i;

        for (i = 0; i < weaponsArray.size() && !canBeBought(weaponsArray[i],hero); i++)
            ;
        if (i < weaponsArray.size())
            found = true;

        for (i = 0; i < armorsArray.size() && !canBeBought(armorsArray[i],hero); i++)
            ;
        if (i < armorsArray.size())
            found = true;

        for (i = 0; i < potionsArray.size() && !canBeBought(potionsArray[i],hero); i++)
            ;
        if (i < potionsArray.size())
            found = true;
    }

    if (!found) {
        if (info) {
            cerr << endl << "\033[31mError:\033[0m There are no available Items or Spells for Hero \033[38;5;220m" << hero->Living::GetName() << "\033[0m to buy." << endl;
            usleep(3000000);
        }
        return -1;
    }

    return buyState;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x138(%rbp)
movl $0x2, -0x24(%rbp)
movb $0x0, -0x25(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1eeb0
cmpl $0x0, %eax
jne 0x318dd
movq -0x20(%rbp), %rax
testb $0x1, (%rax)
je 0x318d1
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1c8(%rax)
jne 0x316c0
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1cc(%rax)
jne 0x316c0
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1d0(%rax)
jne 0x316c0
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1d4(%rax)
jne 0x316c0
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1d8(%rax)
jne 0x316c0
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1dc(%rax)
je 0x317fe
movq -0x138(%rbp), %rdi
movb $0x0, -0x26(%rbp)
movq -0x18(%rbp), %rdx
leaq -0x26(%rbp), %rsi
movl $0x3, %ecx
callq 0x32490
movq 0x1c90c(%rip), %rdi     # 0x4dff0
movq %rdi, -0x158(%rbp)
movq 0x1c8c6(%rip), %rsi     # 0x4dfb8
movq %rsi, -0x160(%rbp)
callq 0x4290
movq -0x158(%rbp), %rdi
leaq 0xeb86(%rip), %rsi      # 0x40292
callq 0x4260
movq -0x160(%rbp), %rsi
movq %rax, %rdi
callq 0x4290
movq -0x160(%rbp), %rsi
movq %rax, %rdi
callq 0x4290
movq -0x158(%rbp), %rdi
leaq 0xbd02(%rip), %rsi      # 0x3d43f
callq 0x4260
movq %rax, -0x150(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x48(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0x1ea60
movq -0x150(%rbp), %rdi
movq -0x148(%rbp), %rsi
callq 0x4210
movq %rax, -0x140(%rbp)
jmp 0x31779
movq -0x140(%rbp), %rdi
leaq 0xeb2b(%rip), %rsi      # 0x402b2
callq 0x4260
movq %rax, -0x168(%rbp)
jmp 0x31795
movq -0x168(%rbp), %rdi
movq -0x138(%rbp), %rax
movl 0x1e8(%rax), %esi
callq 0x4370
movq %rax, -0x170(%rbp)
jmp 0x317b7
movq -0x170(%rbp), %rdi
movq 0x1c7f3(%rip), %rsi     # 0x4dfb8
callq 0x4290
jmp 0x317cc
leaq -0x48(%rbp), %rdi
callq 0x4160
movl $0x2625a0, %edi         # imm = 0x2625A0
callq 0x4390
jmp 0x318cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x4160
jmp 0x3247a
movq 0x1c7eb(%rip), %rdi     # 0x4dff0
movq 0x1c7ac(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
leaq 0xeacb(%rip), %rsi      # 0x402e6
callq 0x4260
movq %rax, -0x188(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x78(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x1ea60
movq -0x188(%rbp), %rdi
movq -0x180(%rbp), %rsi
callq 0x4210
movq %rax, -0x178(%rbp)
jmp 0x31857
movq -0x178(%rbp), %rdi
leaq 0xea4d(%rip), %rsi      # 0x402b2
callq 0x4260
movq %rax, -0x190(%rbp)
jmp 0x31873
movq -0x190(%rbp), %rdi
movq -0x138(%rbp), %rax
movl 0x1e8(%rax), %esi
callq 0x4370
movq %rax, -0x198(%rbp)
jmp 0x31895
movq -0x198(%rbp), %rdi
movq 0x1c715(%rip), %rsi     # 0x4dfb8
callq 0x4290
jmp 0x318aa
leaq -0x78(%rbp), %rdi
callq 0x4160
jmp 0x318cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x4160
jmp 0x3247a
jmp 0x318d1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3246e
movq -0x18(%rbp), %rdi
callq 0x1eeb0
movq -0x138(%rbp), %rcx
cmpl 0x1e8(%rcx), %eax
jae 0x31b99
movq -0x20(%rbp), %rax
testb $0x1, (%rax)
je 0x31b8d
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1c8(%rax)
jne 0x3196a
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1cc(%rax)
jne 0x3196a
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1d0(%rax)
jne 0x3196a
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1d4(%rax)
jne 0x3196a
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1d8(%rax)
jne 0x3196a
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1dc(%rax)
je 0x31ab1
movq -0x138(%rbp), %rdi
movb $0x0, -0x79(%rbp)
movq -0x18(%rbp), %rdx
leaq -0x79(%rbp), %rsi
movl $0x3, %ecx
callq 0x32490
movq 0x1c662(%rip), %rdi     # 0x4dff0
movq %rdi, -0x1b8(%rbp)
movq 0x1c61c(%rip), %rsi     # 0x4dfb8
movq %rsi, -0x1c0(%rbp)
callq 0x4290
movq -0x1b8(%rbp), %rdi
leaq 0xe8dc(%rip), %rsi      # 0x40292
callq 0x4260
movq -0x1c0(%rbp), %rsi
movq %rax, %rdi
callq 0x4290
movq -0x1c0(%rbp), %rsi
movq %rax, %rdi
callq 0x4290
movq -0x1b8(%rbp), %rdi
leaq 0xba58(%rip), %rsi      # 0x3d43f
callq 0x4260
movq %rax, -0x1b0(%rbp)
movq -0x18(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x1ea60
movq -0x1b0(%rbp), %rdi
movq -0x1a8(%rbp), %rsi
callq 0x4210
movq %rax, -0x1a0(%rbp)
jmp 0x31a26
movq -0x1a0(%rbp), %rdi
leaq 0xe8d3(%rip), %rsi      # 0x40307
callq 0x4260
movq %rax, -0x1c8(%rbp)
jmp 0x31a42
movq -0x1c8(%rbp), %rdi
movq -0x138(%rbp), %rax
movl 0x1e8(%rax), %esi
callq 0x4370
movq %rax, -0x1d0(%rbp)
jmp 0x31a64
movq -0x1d0(%rbp), %rdi
movq 0x1c546(%rip), %rsi     # 0x4dfb8
callq 0x4290
jmp 0x31a79
leaq -0xa0(%rbp), %rdi
callq 0x4160
movl $0x2625a0, %edi         # imm = 0x2625A0
callq 0x4390
jmp 0x31b8b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x4160
jmp 0x3247a
movq 0x1c538(%rip), %rdi     # 0x4dff0
movq 0x1c4f9(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
leaq 0xe818(%rip), %rsi      # 0x402e6
callq 0x4260
movq %rax, -0x1e8(%rbp)
movq -0x18(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
callq 0x1ea60
movq -0x1e8(%rbp), %rdi
movq -0x1e0(%rbp), %rsi
callq 0x4210
movq %rax, -0x1d8(%rbp)
jmp 0x31b0d
movq -0x1d8(%rbp), %rdi
leaq 0xe7ec(%rip), %rsi      # 0x40307
callq 0x4260
movq %rax, -0x1f0(%rbp)
jmp 0x31b29
movq -0x1f0(%rbp), %rdi
movq -0x138(%rbp), %rax
movl 0x1e8(%rax), %esi
callq 0x4370
movq %rax, -0x1f8(%rbp)
jmp 0x31b4b
movq -0x1f8(%rbp), %rdi
movq 0x1c45f(%rip), %rsi     # 0x4dfb8
callq 0x4290
jmp 0x31b60
leaq -0xc0(%rbp), %rdi
callq 0x4160
jmp 0x31b8b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x4160
jmp 0x3247a
jmp 0x31b8d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3246e
movq -0x18(%rbp), %rdi
callq 0x1ee30
cmpl $0x0, %eax
je 0x31bc3
movq -0x18(%rbp), %rdi
callq 0x1eeb0
movq -0x138(%rbp), %rcx
cmpl 0x1e4(%rcx), %eax
jae 0x31e7a
movq -0x18(%rbp), %rdi
callq 0x1ee10
cmpl $0x0, %eax
je 0x31bed
movq -0x18(%rbp), %rdi
callq 0x1eeb0
movq -0x138(%rbp), %rcx
cmpl 0x1e0(%rcx), %eax
jae 0x31e71
movq -0x20(%rbp), %rax
testb $0x1, (%rax)
je 0x31e65
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1c8(%rax)
jne 0x31c5e
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1cc(%rax)
jne 0x31c5e
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1d0(%rax)
jne 0x31c5e
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1d4(%rax)
jne 0x31c5e
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1d8(%rax)
jne 0x31c5e
movq -0x138(%rbp), %rax
cmpl $0x0, 0x1dc(%rax)
je 0x31d89
movq -0x138(%rbp), %rdi
movb $0x0, -0xc1(%rbp)
movq -0x18(%rbp), %rdx
leaq -0xc1(%rbp), %rsi
movl $0x3, %ecx
callq 0x32490
movq 0x1c368(%rip), %rdi     # 0x4dff0
movq %rdi, -0x218(%rbp)
movq 0x1c322(%rip), %rsi     # 0x4dfb8
movq %rsi, -0x220(%rbp)
callq 0x4290
movq -0x218(%rbp), %rdi
leaq 0xe5e2(%rip), %rsi      # 0x40292
callq 0x4260
movq -0x220(%rbp), %rsi
movq %rax, %rdi
callq 0x4290
movq -0x220(%rbp), %rsi
movq %rax, %rdi
callq 0x4290
movq -0x218(%rbp), %rdi
leaq 0xb75e(%rip), %rsi      # 0x3d43f
callq 0x4260
movq %rax, -0x210(%rbp)
movq -0x18(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x1ea60
movq -0x210(%rbp), %rdi
movq -0x208(%rbp), %rsi
callq 0x4210
movq %rax, -0x200(%rbp)
jmp 0x31d20
movq -0x200(%rbp), %rdi
leaq 0xe61a(%rip), %rsi      # 0x40348
callq 0x4260
movq %rax, -0x228(%rbp)
jmp 0x31d3c
movq -0x228(%rbp), %rdi
movq 0x1c26e(%rip), %rsi     # 0x4dfb8
callq 0x4290
jmp 0x31d51
leaq -0xe8(%rbp), %rdi
callq 0x4160
movl $0x2625a0, %edi         # imm = 0x2625A0
callq 0x4390
jmp 0x31e63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x4160
jmp 0x3247a
movq 0x1c260(%rip), %rdi     # 0x4dff0
movq 0x1c221(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
leaq 0xe540(%rip), %rsi      # 0x402e6
callq 0x4260
movq %rax, -0x240(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x108(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0x1ea60
movq -0x240(%rbp), %rdi
movq -0x238(%rbp), %rsi
callq 0x4210
movq %rax, -0x230(%rbp)
jmp 0x31de5
movq -0x230(%rbp), %rdi
leaq 0xe514(%rip), %rsi      # 0x40307
callq 0x4260
movq %rax, -0x248(%rbp)
jmp 0x31e01
movq -0x248(%rbp), %rdi
movq -0x138(%rbp), %rax
movl 0x1e8(%rax), %esi
callq 0x4370
movq %rax, -0x250(%rbp)
jmp 0x31e23
movq -0x250(%rbp), %rdi
movq 0x1c187(%rip), %rsi     # 0x4dfb8
callq 0x4290
jmp 0x31e38
leaq -0x108(%rbp), %rdi
callq 0x4160
jmp 0x31e63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x4160
jmp 0x3247a
jmp 0x31e65
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3246e
movl $0x0, -0x24(%rbp)
jmp 0x31ea9
movq -0x18(%rbp), %rdi
callq 0x1ee10
cmpl $0x0, %eax
je 0x31ea0
movq -0x18(%rbp), %rdi
callq 0x1eeb0
movq -0x138(%rbp), %rcx
cmpl 0x1e0(%rcx), %eax
jae 0x31ea7
movl $0x1, -0x24(%rbp)
jmp 0x31ea9
cmpl $0x1, -0x24(%rbp)
je 0x32119
movl $0x0, -0x10c(%rbp)
movq -0x138(%rbp), %rdi
movl -0x10c(%rbp), %eax
movq %rax, -0x260(%rbp)
addq $0xd8, %rdi
callq 0x26e60
movq -0x260(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x251(%rbp)
jae 0x31f2a
movq -0x138(%rbp), %rdi
addq $0xd8, %rdi
movl -0x10c(%rbp), %eax
movl %eax, %esi
callq 0x27180
movq -0x138(%rbp), %rdi
movq (%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x363f0
xorb $-0x1, %al
movb %al, -0x251(%rbp)
movb -0x251(%rbp), %al
testb $0x1, %al
jne 0x31f36
jmp 0x31f4c
jmp 0x31f38
movl -0x10c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
jmp 0x31ebd
movq -0x138(%rbp), %rdi
movl -0x10c(%rbp), %eax
movq %rax, -0x268(%rbp)
addq $0xd8, %rdi
callq 0x26e60
movq %rax, %rcx
movq -0x268(%rbp), %rax
cmpq %rcx, %rax
jae 0x31f7f
movb $0x1, -0x25(%rbp)
movl $0x0, -0x10c(%rbp)
movq -0x138(%rbp), %rdi
movl -0x10c(%rbp), %eax
movq %rax, -0x278(%rbp)
addq $0xc0, %rdi
callq 0x26e40
movq -0x278(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x269(%rbp)
jae 0x31ff6
movq -0x138(%rbp), %rdi
addq $0xc0, %rdi
movl -0x10c(%rbp), %eax
movl %eax, %esi
callq 0x272c0
movq -0x138(%rbp), %rdi
movq (%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x363f0
xorb $-0x1, %al
movb %al, -0x269(%rbp)
movb -0x269(%rbp), %al
testb $0x1, %al
jne 0x32002
jmp 0x32018
jmp 0x32004
movl -0x10c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
jmp 0x31f89
movq -0x138(%rbp), %rdi
movl -0x10c(%rbp), %eax
movq %rax, -0x280(%rbp)
addq $0xc0, %rdi
callq 0x26e40
movq %rax, %rcx
movq -0x280(%rbp), %rax
cmpq %rcx, %rax
jae 0x3204b
movb $0x1, -0x25(%rbp)
movl $0x0, -0x10c(%rbp)
movq -0x138(%rbp), %rdi
movl -0x10c(%rbp), %eax
movq %rax, -0x290(%rbp)
addq $0xa8, %rdi
callq 0x26e20
movq -0x290(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x281(%rbp)
jae 0x320c2
movq -0x138(%rbp), %rdi
addq $0xa8, %rdi
movl -0x10c(%rbp), %eax
movl %eax, %esi
callq 0x27400
movq -0x138(%rbp), %rdi
movq (%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x363f0
xorb $-0x1, %al
movb %al, -0x281(%rbp)
movb -0x281(%rbp), %al
testb $0x1, %al
jne 0x320ce
jmp 0x320e4
jmp 0x320d0
movl -0x10c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
jmp 0x32055
movq -0x138(%rbp), %rdi
movl -0x10c(%rbp), %eax
movq %rax, -0x298(%rbp)
addq $0xa8, %rdi
callq 0x26e20
movq %rax, %rcx
movq -0x298(%rbp), %rax
cmpq %rcx, %rax
jae 0x32117
movb $0x1, -0x25(%rbp)
jmp 0x32119
cmpl $0x0, -0x24(%rbp)
je 0x32389
movl $0x0, -0x110(%rbp)
movq -0x138(%rbp), %rdi
movl -0x110(%rbp), %eax
movq %rax, -0x2a8(%rbp)
addq $0xf0, %rdi
callq 0x26e80
movq -0x2a8(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x299(%rbp)
jae 0x3219a
movq -0x138(%rbp), %rdi
addq $0xf0, %rdi
movl -0x110(%rbp), %eax
movl %eax, %esi
callq 0x27540
movq -0x138(%rbp), %rdi
movq (%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x36460
xorb $-0x1, %al
movb %al, -0x299(%rbp)
movb -0x299(%rbp), %al
testb $0x1, %al
jne 0x321a6
jmp 0x321bc
jmp 0x321a8
movl -0x110(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x110(%rbp)
jmp 0x3212d
movq -0x138(%rbp), %rdi
movl -0x110(%rbp), %eax
movq %rax, -0x2b0(%rbp)
addq $0xf0, %rdi
callq 0x26e80
movq %rax, %rcx
movq -0x2b0(%rbp), %rax
cmpq %rcx, %rax
jae 0x321ef
movb $0x1, -0x25(%rbp)
movl $0x0, -0x110(%rbp)
movq -0x138(%rbp), %rdi
movl -0x110(%rbp), %eax
movq %rax, -0x2c0(%rbp)
addq $0x120, %rdi            # imm = 0x120
callq 0x26ec0
movq -0x2c0(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x2b1(%rbp)
jae 0x32266
movq -0x138(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
movl -0x110(%rbp), %eax
movl %eax, %esi
callq 0x27680
movq -0x138(%rbp), %rdi
movq (%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x36460
xorb $-0x1, %al
movb %al, -0x2b1(%rbp)
movb -0x2b1(%rbp), %al
testb $0x1, %al
jne 0x32272
jmp 0x32288
jmp 0x32274
movl -0x110(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x110(%rbp)
jmp 0x321f9
movq -0x138(%rbp), %rdi
movl -0x110(%rbp), %eax
movq %rax, -0x2c8(%rbp)
addq $0x120, %rdi            # imm = 0x120
callq 0x26ec0
movq %rax, %rcx
movq -0x2c8(%rbp), %rax
cmpq %rcx, %rax
jae 0x322bb
movb $0x1, -0x25(%rbp)
movl $0x0, -0x110(%rbp)
movq -0x138(%rbp), %rdi
movl -0x110(%rbp), %eax
movq %rax, -0x2d8(%rbp)
addq $0x108, %rdi            # imm = 0x108
callq 0x26ea0
movq -0x2d8(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x2c9(%rbp)
jae 0x32332
movq -0x138(%rbp), %rdi
addq $0x108, %rdi            # imm = 0x108
movl -0x110(%rbp), %eax
movl %eax, %esi
callq 0x277c0
movq -0x138(%rbp), %rdi
movq (%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x36460
xorb $-0x1, %al
movb %al, -0x2c9(%rbp)
movb -0x2c9(%rbp), %al
testb $0x1, %al
jne 0x3233e
jmp 0x32354
jmp 0x32340
movl -0x110(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x110(%rbp)
jmp 0x322c5
movq -0x138(%rbp), %rdi
movl -0x110(%rbp), %eax
movq %rax, -0x2e0(%rbp)
addq $0x108, %rdi            # imm = 0x108
callq 0x26ea0
movq %rax, %rcx
movq -0x2e0(%rbp), %rax
cmpq %rcx, %rax
jae 0x32387
movb $0x1, -0x25(%rbp)
jmp 0x32389
testb $0x1, -0x25(%rbp)
jne 0x32468
movq -0x20(%rbp), %rax
testb $0x1, (%rax)
je 0x3245f
movq 0x1bc49(%rip), %rdi     # 0x4dff0
movq 0x1bc0a(%rip), %rsi     # 0x4dfb8
callq 0x4290
movq %rax, %rdi
leaq 0xdfc7(%rip), %rsi      # 0x40384
callq 0x4260
movq %rax, -0x2f8(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x130(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0x1ea60
movq -0x2f8(%rbp), %rdi
movq -0x2f0(%rbp), %rsi
callq 0x4210
movq %rax, -0x2e8(%rbp)
jmp 0x323fc
movq -0x2e8(%rbp), %rdi
leaq 0xdfc6(%rip), %rsi      # 0x403d0
callq 0x4260
movq %rax, -0x300(%rbp)
jmp 0x32418
movq -0x300(%rbp), %rdi
movq 0x1bb92(%rip), %rsi     # 0x4dfb8
callq 0x4290
jmp 0x3242d
leaq -0x130(%rbp), %rdi
callq 0x4160
movl $0x2dc6c0, %edi         # imm = 0x2DC6C0
callq 0x4390
jmp 0x3245f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x4160
jmp 0x3247a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3246e
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x4440
nopw %cs:(%rax,%rax)