// File: /workspace/github_cpp_makefile_star2_O2/Agusyc[P]CTRPG/src/battle.cpp
// Function: Battle::attack()
int Battle::attack() {
    unsigned int choice;
    if (playerTurn) {
        // The player attacks.
        bool exitLoop = false;
        Attack attack;

        while (!exitLoop) {
            cout << "Attacks: " << endl;

            for (unsigned int i = 0; i < player.attacks.size(); i++) {
                cout << i+1 << ". " << player.attacks.at(i).name << endl;
            }

            cout << player.attacks.size() + 1 << ". Go back" << endl;

            cout << "Your choice: ";

            cin >> choice;

            cout << endl;

            if (choice == player.attacks.size() + 1) {
                return 1;
            }

            if (choice > player.attacks.size() || choice < 1) {
                printMessage("That's not a valid choice...");
                cout << endl;
                continue;
            }

            attack = player.attacks.at(choice - 1);

            if (player.mana < attack.mana) {
                printMessage(string("You don't have enough ") + YELLOW + string("mana ") + WHITE + string("to use that attack!"));
                continue;
            }

            if (player.stamina < attack.stamina) {
                printMessage(string("You don't have enough ") + YELLOW + string("stamina ") + WHITE + string("to use that attack!"));
                continue;
            }

            exitLoop = true;
        }

        // Decrease the user mana and stamina
        player.mana -= attack.mana;
        player.stamina -= attack.stamina;

        // Calculate how much damage is dealt to the enemy
        int damage = (attack.damage + attack.magicDamage + player.attack) - enemy.defense;

        if (damage <= 0) {
            // The attack doesn't do anything
            printMessage("Man... That attack is so lame that it doesn't do anything.");
        } else {
            // The attack is powerful enough to do something
            bool critical = false;
            // 5 % chance of a critical hit
            if (rand() % 100 < 5) {
                critical = true;
                damage *= 2;
            }

            stringstream ss;
            if (critical)
                ss << "With a " << BOLD << "critical hit, ";
            ss << "You deal " << GREEN << damage << WHITE << " to " << RED << enemy.name << WHITE << " with " << YELLOW << attack.name << WHITE  << "!" << endl << "It now has " << GREEN << enemy.hp - damage << WHITE << " HP." << endl;

            printMessage(ss.str());

            enemy.hp -= damage;
        }
    } else {
        // The enemy attacks
        stringstream ss;
        ss << RED << enemy.name << WHITE << " has to attack!";

        printMessage(ss.str());

        bool enemyAttacks = rand() % 2;
        if (enemyAttacks) {
            Attack attack;
            bool exitLoop = false;

            // This loop ensures that the enemy doesn't choose an attack that it can't use because of mana or stamina.
            while (!exitLoop) {
                attack = enemy.attacks.at(rand() % enemy.attacks.size());

                if (enemy.mana >= attack.mana && enemy.stamina >= attack.stamina) {
                    exitLoop = true;
                }
            }

            // Decrease enemy's mana and stamina
            enemy.mana -= attack.mana;
            enemy.stamina -= attack.stamina;

            // Calculate how much damage is dealt to the player
            int damage = (attack.damage + attack.magicDamage + enemy.attack) - player.defense;

            if (defending)
                damage -= player.shieldDefense;

            if (damage <= 0) {
                // The attack doesn't do anything
                ss << RED << enemy.name << WHITE << " tries to hurt you with " << YELLOW << attack.name << WHITE <<  "... But it can't!";
                printMessage(ss.str());
            } else {
                // The attack is powerful enough...
                bool critical = false;
                // 5 % chance of a critical hit
                if (rand() % 100 < 5) {
                    critical = true;
                    damage *= 2;
                }

                // Reset the stringstream
                ss.str("");
                ss.clear();

                if (critical)
                    ss << "With a critical hit, ";
                ss << RED << enemy.name << WHITE << " deals you " << GREEN << damage << WHITE << " with " << YELLOW << attack.name << WHITE << "!"  << endl << "You now have " << GREEN << player.hp - damage << WHITE << " HP." << endl;

                printMessage(ss.str());

                player.hp -= damage;
            }
        } else {
            // The enemy decides not to attack
            printMessage("But it is resting...\n");
        }
    }

    // When the player wins
    if (enemy.hp <= 0) {
        printMessage("You win!");
        over = true;
        if (player.xp + enemy.xp < player.goal) {
            player.xp += enemy.xp;
        } else if (player.xp + enemy.xp >= player.goal) {
            stringstream ss;

            ss << "You leveled up! You are on level " << YELLOW << player.level + 1 << WHITE << " now!";

            player.xp = player.goal - player.xp;

            printMessage(ss.str());

            player.level++;
            player.goal *= 2;

            // To let the user choose what stats to improve
            showLevelUpMenu(parsePlayer());
        }
        // Give the player a random Item:
        Item item;

        bool exitLoop = false;
        while (!exitLoop) {
            item = parseItem(rand() % getItemsNumber());
            if (player.level < item.minLevel || player.level > item.maxLevel) {
                continue;
            }

            exitLoop = true;
        }

        player.items.push_back(item);

        printMessage(string("You found ") + YELLOW + item.name + WHITE + string("!"));

        writeItems();
    }

    // When the enemy wins
    if (player.hp <= 0) {
        printMessage("You lose!");
        over = true;
        exit(0);
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x638, %rsp            # imm = 0x638
movq %rdi, %rbx
cmpb $0x1, 0xd9(%rdi)
leaq -0x90(%rbp), %r13
movq %rdi, -0x58(%rbp)
jne 0x4333
leaq -0xa0(%rbp), %rax
movq %r13, (%rax)
andq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x48(%rbx), %r12
xorl %edx, %edx
movq 0x9059(%rip), %r13      # 0xcfd0
movl %edx, -0x5c(%rbp)
testb $0x1, %dl
jne 0x47d9
movq %r13, %rdi
leaq 0x51b0(%rip), %rsi      # 0x913d
callq 0x3220
movq %rax, %rdi
callq 0x3110
pushq $0x1
popq %rax
movl %eax, %ebx
leal -0x1(%rbx), %r15d
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rsi
subq 0x48(%rax), %rsi
sarq $0x6, %rsi
cmpq %r15, %rsi
jbe 0x3ff6
movl %ebx, %esi
movq %r13, %rdi
callq 0x3170
movq %rax, %rdi
leaq 0x517b(%rip), %rsi      # 0x9147
callq 0x3220
movq %rax, %r14
movq %r12, %rdi
movq %r15, %rsi
callq 0x6244
movq %r14, %rdi
movq %rax, %rsi
callq 0x31d0
incl %ebx
movq %rax, %rdi
callq 0x3110
jmp 0x3f9f
incq %rsi
movq %r13, %rdi
callq 0x3170
movq -0x58(%rbp), %rbx
movq %rax, %rdi
leaq 0x513b(%rip), %rsi      # 0x914a
callq 0x3220
movq %rax, %rdi
callq 0x3110
movq %r13, %rdi
leaq 0x5109(%rip), %rsi      # 0x912f
callq 0x3220
movq 0x8fae(%rip), %rdi      # 0xcfe0
leaq -0x60(%rbp), %rsi
callq 0x3480
movq %r13, %rdi
callq 0x3110
movq 0x50(%rbx), %rax
subq 0x48(%rbx), %rax
movl -0x60(%rbp), %esi
sarq $0x6, %rax
leaq 0x1(%rax), %rcx
cmpq %rsi, %rcx
je 0x4a50
testq %rsi, %rsi
je 0x4179
cmpq %rsi, %rax
jb 0x4179
decl %esi
movq %r12, %rdi
callq 0x6244
leaq -0xa0(%rbp), %rdi
movq %rax, %rsi
callq 0x6266
movl -0x78(%rbp), %eax
cmpl %eax, 0x2c(%rbx)
jge 0x41e8
leaq -0x100(%rbp), %rbx
movq %rbx, %rdi
leaq 0x50ca(%rip), %rsi      # 0x9171
leaq -0x2a(%rbp), %rdx
callq 0x30c0
leaq -0xc0(%rbp), %rdi
movq %rbx, %rsi
leaq 0x4f7f(%rip), %rdx      # 0x9040
callq 0x612a
leaq -0xe0(%rbp), %r14
movq %r14, %rdi
leaq 0x50b1(%rip), %rsi      # 0x9188
leaq -0x29(%rbp), %rdx
callq 0x30c0
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
leaq -0xc0(%rbp), %rsi
movq %r14, %rdx
callq 0x60b9
leaq -0x528(%rbp), %rdi
movq %rbx, %rsi
leaq 0x4f45(%rip), %rdx      # 0x904c
callq 0x612a
leaq -0x120(%rbp), %rbx
movq %rbx, %rdi
leaq 0x5071(%rip), %rsi      # 0x918e
leaq -0x2c(%rbp), %rdx
callq 0x30c0
leaq -0x568(%rbp), %rdi
leaq -0x528(%rbp), %rsi
movq %rbx, %rdx
callq 0x60b9
leaq -0x5c8(%rbp), %r14
movq %r14, %rdi
leaq 0x4eff(%rip), %rsi      # 0x904c
leaq -0x2b(%rbp), %rdx
callq 0x30c0
leaq -0x568(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x23
popq %rdx
movl $0x12c, %ecx            # imm = 0x12C
pushq $0x1
popq %r8
callq 0x8e78
jmp 0x42d2
leaq -0x588(%rbp), %rdi
leaq 0x4fcd(%rip), %rsi      # 0x9154
leaq -0x528(%rbp), %rdx
callq 0x30c0
leaq -0x5e8(%rbp), %r14
movq %r14, %rdi
leaq 0x4ea8(%rip), %rsi      # 0x904c
leaq -0x50(%rbp), %rdx
callq 0x30c0
leaq -0x588(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x23
popq %rdx
movl $0x12c, %ecx            # imm = 0x12C
pushq $0x1
popq %r8
callq 0x8e78
movq %r14, %rdi
callq 0x3100
movq %rbx, %rdi
callq 0x3100
movq %r13, %rdi
callq 0x3110
jmp 0x3f83
movl -0x74(%rbp), %ecx
cmpl %ecx, 0x30(%rbx)
jge 0x432c
leaq -0x100(%rbp), %rbx
movq %rbx, %rdi
leaq 0x4f6c(%rip), %rsi      # 0x9171
leaq -0x2a(%rbp), %rdx
callq 0x30c0
leaq -0xc0(%rbp), %rdi
movq %rbx, %rsi
leaq 0x4e21(%rip), %rdx      # 0x9040
callq 0x612a
leaq -0xe0(%rbp), %r14
movq %r14, %rdi
leaq 0x4f6d(%rip), %rsi      # 0x91a2
leaq -0x29(%rbp), %rdx
callq 0x30c0
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
leaq -0xc0(%rbp), %rsi
movq %r14, %rdx
callq 0x60b9
leaq -0x528(%rbp), %rdi
movq %rbx, %rsi
leaq 0x4de7(%rip), %rdx      # 0x904c
callq 0x612a
leaq -0x120(%rbp), %rbx
movq %rbx, %rdi
leaq 0x4f13(%rip), %rsi      # 0x918e
leaq -0x2c(%rbp), %rdx
callq 0x30c0
leaq -0x548(%rbp), %rdi
leaq -0x528(%rbp), %rsi
movq %rbx, %rdx
callq 0x60b9
leaq -0x5a8(%rbp), %r14
movq %r14, %rdi
leaq 0x4da1(%rip), %rsi      # 0x904c
leaq -0x2b(%rbp), %rdx
callq 0x30c0
leaq -0x548(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x23
popq %rdx
movl $0x12c, %ecx            # imm = 0x12C
pushq $0x1
popq %r8
callq 0x8e78
movq %r14, %rdi
callq 0x3100
movq %rbx, %rdi
callq 0x3100
leaq -0x120(%rbp), %rdi
callq 0x3100
leaq -0x528(%rbp), %rdi
callq 0x3100
leaq -0x50(%rbp), %rdi
callq 0x3100
leaq -0xe0(%rbp), %rdi
callq 0x3100
leaq -0xc0(%rbp), %rdi
callq 0x3100
leaq -0x100(%rbp), %rdi
callq 0x3100
jmp 0x3f83
movb $0x1, %dl
jmp 0x3f77
leaq -0x528(%rbp), %r14
movq %r14, %rdi
callq 0x3180
leaq -0x518(%rbp), %rdi
leaq 0x4cf6(%rip), %rsi      # 0x9046
callq 0x3220
leaq 0x78(%rbx), %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x31d0
leaq 0x4ce1(%rip), %rsi      # 0x904c
movq %rax, %rdi
callq 0x3220
leaq 0x4e9a(%rip), %rsi      # 0x9214
movq %rax, %rdi
callq 0x3220
leaq -0x510(%rbp), %rsi
leaq -0x320(%rbp), %rdi
callq 0x33f0
leaq 0x4cb0(%rip), %rsi      # 0x904c
leaq -0x300(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0x30c0
leaq -0x320(%rbp), %rdi
leaq -0x300(%rbp), %rsi
pushq $0x23
popq %rdx
pushq $0x1
popq %r8
movl $0x12c, %ecx            # imm = 0x12C
callq 0x8e78
leaq -0x300(%rbp), %rdi
callq 0x3100
leaq -0x320(%rbp), %rdi
callq 0x3100
callq 0x3080
testb $0x1, %al
jne 0x4457
leaq 0x4e89(%rip), %rsi      # 0x927f
leaq -0x260(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0x30c0
leaq 0x4c3c(%rip), %rsi      # 0x904c
leaq -0x240(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x30c0
leaq -0x260(%rbp), %rdi
leaq -0x240(%rbp), %rsi
pushq $0x23
popq %rdx
pushq $0x1
popq %r8
movl $0x12c, %ecx            # imm = 0x12C
callq 0x8e78
leaq -0x240(%rbp), %rdi
callq 0x3100
leaq -0x260(%rbp), %rdi
jmp 0x47c3
leaq -0xa0(%rbp), %r15
movq %r13, (%r15)
andq $0x0, 0x8(%r15)
movb $0x0, 0x10(%r15)
leaq 0xc0(%rbx), %r13
callq 0x3080
cltq
movq 0xc8(%rbx), %rcx
subq 0xc0(%rbx), %rcx
sarq $0x6, %rcx
xorl %edx, %edx
divq %rcx
movq %r13, %rdi
movq %rdx, %rsi
callq 0x6244
movq %r15, %rdi
movq %rax, %rsi
callq 0x6266
movl 0xa4(%rbx), %eax
cmpl -0x78(%rbp), %eax
jl 0x4472
movl -0x74(%rbp), %eax
cmpl %eax, 0xa8(%rbx)
jl 0x4472
movl -0x78(%rbp), %eax
subl %eax, 0xa4(%rbx)
movl -0x74(%rbp), %eax
subl %eax, 0xa8(%rbx)
movl -0x7c(%rbp), %r15d
xorl %eax, %eax
cmpb $0x0, 0xda(%rbx)
je 0x44e0
movl 0x28(%rbx), %eax
addl -0x80(%rbp), %r15d
addl 0x98(%rbx), %r15d
addl 0x24(%rbx), %eax
subl %eax, %r15d
testl %r15d, %r15d
jle 0x46e3
callq 0x3080
cltd
pushq $0x64
popq %rcx
idivl %ecx
movl %edx, %r13d
cmpl $0x5, %edx
setl %cl
shll %cl, %r15d
leaq 0x4d7c(%rip), %rsi      # 0x9294
leaq -0x50(%rbp), %rdi
leaq -0xc0(%rbp), %rdx
callq 0x30c0
leaq -0x50(%rbp), %rsi
leaq -0x510(%rbp), %rdi
callq 0x3390
leaq -0x50(%rbp), %rdi
callq 0x3100
movq -0x528(%rbp), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x3460
cmpl $0x4, %r13d
jg 0x456f
leaq 0x4cec(%rip), %rsi      # 0x924f
leaq -0x518(%rbp), %rdi
callq 0x3220
leaq 0x4ad0(%rip), %rsi      # 0x9046
leaq -0x518(%rbp), %rdi
callq 0x3220
movq %rax, %rdi
movq %r12, %rsi
callq 0x31d0
leaq 0x4ab8(%rip), %rsi      # 0x904c
movq %rax, %rdi
callq 0x3220
leaq 0x4cc2(%rip), %rsi      # 0x9265
movq %rax, %rdi
callq 0x3220
leaq 0x4b6d(%rip), %rsi      # 0x911f
movq %rax, %rdi
callq 0x3220
movq %rax, %rdi
movl %r15d, %esi
callq 0x3470
leaq 0x4a80(%rip), %rsi      # 0x904c
movq %rax, %rdi
callq 0x3220
leaq 0x4c5b(%rip), %rsi      # 0x9236
movq %rax, %rdi
callq 0x3220
leaq 0x4a56(%rip), %rsi      # 0x9040
movq %rax, %rdi
callq 0x3220
leaq -0xa0(%rbp), %rsi
movq %rax, %rdi
callq 0x31d0
leaq 0x4a44(%rip), %rsi      # 0x904c
movq %rax, %rdi
callq 0x3220
leaq 0x4cc2(%rip), %rsi      # 0x92d9
movq %rax, %rdi
callq 0x3220
movq %rax, %rdi
callq 0x3110
leaq 0x4c43(%rip), %rsi      # 0x9271
movq %rax, %rdi
callq 0x3220
leaq 0x4ae2(%rip), %rsi      # 0x911f
movq %rax, %rdi
callq 0x3220
movl 0x34(%rbx), %esi
subl %r15d, %esi
movq %rax, %rdi
callq 0x3470
leaq 0x49f2(%rip), %rsi      # 0x904c
movq %rax, %rdi
callq 0x3220
leaq 0x4ba6(%rip), %rsi      # 0x920f
movq %rax, %rdi
callq 0x3220
movq %rax, %rdi
callq 0x3110
leaq -0x2a0(%rbp), %rdi
leaq -0x510(%rbp), %rsi
callq 0x33f0
leaq 0x49b9(%rip), %rsi      # 0x904c
leaq -0x280(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x30c0
leaq -0x2a0(%rbp), %rdi
leaq -0x280(%rbp), %rsi
pushq $0x23
popq %rdx
pushq $0x1
popq %r8
movl $0x12c, %ecx            # imm = 0x12C
callq 0x8e78
leaq -0x280(%rbp), %rdi
callq 0x3100
leaq -0x2a0(%rbp), %rdi
callq 0x3100
subl %r15d, 0x34(%rbx)
jmp 0x47bc
leaq 0x495c(%rip), %rsi      # 0x9046
leaq -0x518(%rbp), %rdi
callq 0x3220
movq %rax, %rdi
movq %r12, %rsi
callq 0x31d0
leaq 0x4944(%rip), %rsi      # 0x904c
movq %rax, %rdi
callq 0x3220
leaq 0x4b0d(%rip), %rsi      # 0x9224
movq %rax, %rdi
callq 0x3220
leaq 0x491a(%rip), %rsi      # 0x9040
movq %rax, %rdi
callq 0x3220
leaq -0xa0(%rbp), %rsi
movq %rax, %rdi
callq 0x31d0
leaq 0x4908(%rip), %rsi      # 0x904c
movq %rax, %rdi
callq 0x3220
leaq 0x4aea(%rip), %rsi      # 0x923d
movq %rax, %rdi
callq 0x3220
leaq -0x2e0(%rbp), %rdi
leaq -0x510(%rbp), %rsi
callq 0x33f0
leaq 0x48d7(%rip), %rsi      # 0x904c
leaq -0x2c0(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x30c0
leaq -0x2e0(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
pushq $0x23
popq %rdx
pushq $0x1
popq %r8
movl $0x12c, %ecx            # imm = 0x12C
callq 0x8e78
leaq -0x2c0(%rbp), %rdi
callq 0x3100
leaq -0x2e0(%rbp), %rdi
callq 0x3100
leaq -0xa0(%rbp), %rdi
callq 0x3100
leaq -0x528(%rbp), %rdi
callq 0x3190
jmp 0x4a66
subl %eax, 0x2c(%rbx)
subl %ecx, 0x30(%rbx)
movl -0x7c(%rbp), %r14d
addl -0x80(%rbp), %r14d
addl 0x20(%rbx), %r14d
subl 0x9c(%rbx), %r14d
testl %r14d, %r14d
jle 0x49e8
callq 0x3080
cltd
pushq $0x64
popq %rcx
idivl %ecx
movl %edx, %r15d
cmpl $0x5, %edx
setl %cl
shll %cl, %r14d
leaq -0x528(%rbp), %rdi
callq 0x3180
cmpl $0x4, %r15d
jg 0x4855
leaq -0x518(%rbp), %rdi
leaq 0x49b4(%rip), %rsi      # 0x91e6
callq 0x3220
leaq 0x49b0(%rip), %rsi      # 0x91ee
movq %rax, %rdi
callq 0x3220
leaq 0x4a09(%rip), %rsi      # 0x9256
movq %rax, %rdi
callq 0x3220
leaq -0x518(%rbp), %rdi
leaq 0x4991(%rip), %rsi      # 0x91f4
callq 0x3220
leaq 0x48b0(%rip), %rsi      # 0x911f
movq %rax, %rdi
callq 0x3220
movq %rax, %rdi
movl %r14d, %esi
callq 0x3470
leaq 0x47c3(%rip), %rsi      # 0x904c
movq %rax, %rdi
callq 0x3220
leaq 0x4966(%rip), %rsi      # 0x91fe
movq %rax, %rdi
callq 0x3220
leaq 0x479f(%rip), %rsi      # 0x9046
movq %rax, %rdi
callq 0x3220
leaq 0x78(%rbx), %rsi
movq %rax, %rdi
callq 0x31d0
leaq 0x478a(%rip), %rsi      # 0x904c
movq %rax, %rdi
callq 0x3220
leaq 0x4965(%rip), %rsi      # 0x9236
movq %rax, %rdi
callq 0x3220
leaq 0x4760(%rip), %rsi      # 0x9040
movq %rax, %rdi
callq 0x3220
leaq -0xa0(%rbp), %rsi
movq %rax, %rdi
callq 0x31d0
leaq 0x474e(%rip), %rsi      # 0x904c
movq %rax, %rdi
callq 0x3220
leaq 0x49cc(%rip), %rsi      # 0x92d9
movq %rax, %rdi
callq 0x3220
movq %rax, %rdi
callq 0x3110
leaq 0x48df(%rip), %rsi      # 0x9203
movq %rax, %rdi
callq 0x3220
leaq 0x47ec(%rip), %rsi      # 0x911f
movq %rax, %rdi
callq 0x3220
movl 0xac(%rbx), %esi
subl %r14d, %esi
movq %rax, %rdi
callq 0x3470
leaq 0x46f9(%rip), %rsi      # 0x904c
movq %rax, %rdi
callq 0x3220
leaq 0x48ad(%rip), %rsi      # 0x920f
movq %rax, %rdi
callq 0x3220
movq %rax, %rdi
callq 0x3110
leaq -0x510(%rbp), %rsi
leaq -0x360(%rbp), %rdi
callq 0x33f0
leaq 0x46c0(%rip), %rsi      # 0x904c
leaq -0x340(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x30c0
leaq -0x360(%rbp), %rdi
leaq -0x340(%rbp), %rsi
pushq $0x23
popq %rdx
pushq $0x1
popq %r8
movl $0x12c, %ecx            # imm = 0x12C
callq 0x8e78
leaq -0x340(%rbp), %rdi
callq 0x3100
leaq -0x360(%rbp), %rdi
callq 0x3100
subl %r14d, 0xac(%rbx)
leaq -0x528(%rbp), %rdi
callq 0x3190
jmp 0x4a50
leaq 0x47bc(%rip), %rsi      # 0x91ab
leaq -0x3a0(%rbp), %rdi
leaq -0x528(%rbp), %rdx
callq 0x30c0
leaq 0x4643(%rip), %rsi      # 0x904c
leaq -0x380(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x30c0
leaq -0x3a0(%rbp), %rdi
leaq -0x380(%rbp), %rsi
pushq $0x23
popq %rdx
pushq $0x1
popq %r8
movl $0x12c, %ecx            # imm = 0x12C
callq 0x8e78
leaq -0x380(%rbp), %rdi
callq 0x3100
leaq -0x3a0(%rbp), %rdi
callq 0x3100
leaq -0xa0(%rbp), %rdi
callq 0x3100
testb $0x1, -0x5c(%rbp)
je 0x4afb
cmpl $0x0, 0xac(%rbx)
jg 0x4da6
leaq 0x481b(%rip), %rsi      # 0x9295
leaq -0x220(%rbp), %rdi
leaq -0x528(%rbp), %rdx
callq 0x30c0
leaq 0x45b8(%rip), %rsi      # 0x904c
leaq -0x200(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0x30c0
leaq -0x220(%rbp), %rdi
leaq -0x200(%rbp), %rsi
pushq $0x23
popq %rdx
pushq $0x1
popq %r8
movl $0x12c, %ecx            # imm = 0x12C
callq 0x8e78
leaq -0x200(%rbp), %rdi
callq 0x3100
leaq -0x220(%rbp), %rdi
callq 0x3100
movb $0x1, 0xd8(%rbx)
movl 0xb0(%rbx), %eax
addl 0x3c(%rbx), %eax
cmpl 0x40(%rbx), %eax
jge 0x4b03
movl %eax, 0x3c(%rbx)
jmp 0x4c02
pushq $0x1
popq %rax
jmp 0x4dae
leaq -0x528(%rbp), %rdi
callq 0x3180
leaq -0x518(%rbp), %rdi
leaq 0x4781(%rip), %rsi      # 0x929e
callq 0x3220
leaq 0x4517(%rip), %rsi      # 0x9040
movq %rax, %rdi
callq 0x3220
movl 0x38(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x3470
leaq 0x4507(%rip), %rsi      # 0x904c
movq %rax, %rdi
callq 0x3220
leaq 0x476c(%rip), %rsi      # 0x92c0
movq %rax, %rdi
callq 0x3220
movl 0x40(%rbx), %eax
subl 0x3c(%rbx), %eax
movl %eax, 0x3c(%rbx)
leaq -0x510(%rbp), %rsi
leaq -0x1e0(%rbp), %rdi
callq 0x33f0
leaq 0x44cd(%rip), %rsi      # 0x904c
leaq -0x1c0(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0x30c0
leaq -0x1e0(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
pushq $0x23
popq %rdx
pushq $0x1
popq %r8
movl $0x12c, %ecx            # imm = 0x12C
callq 0x8e78
leaq -0x1c0(%rbp), %rdi
callq 0x3100
leaq -0x1e0(%rbp), %rdi
callq 0x3100
incl 0x38(%rbx)
shll 0x40(%rbx)
leaq -0x660(%rbp), %rdi
callq 0x7de5
leaq -0x660(%rbp), %rsi
movq %rbx, %rdi
callq 0x577a
leaq -0x660(%rbp), %rdi
callq 0x6090
leaq -0x528(%rbp), %rdi
callq 0x3190
leaq -0x518(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0xa0(%rbp), %r14
leaq -0x528(%rbp), %r15
callq 0x3080
movl %eax, %r12d
callq 0x72e1
movl %eax, %ecx
movl %r12d, %eax
cltd
idivl %ecx
movq %r14, %rdi
movl %edx, %esi
callq 0x7547
movq %r15, %rdi
movq %r14, %rsi
callq 0x6292
movq %r14, %rdi
callq 0x3100
movl 0x38(%rbx), %eax
cmpl -0x4f4(%rbp), %eax
jl 0x4c23
cmpl -0x4f0(%rbp), %eax
jg 0x4c23
leaq 0x60(%rbx), %rdi
leaq -0x528(%rbp), %rsi
callq 0x62be
leaq 0x4647(%rip), %rsi      # 0x92c6
leaq -0x100(%rbp), %rdi
leaq -0x120(%rbp), %rdx
callq 0x30c0
leaq 0x43a7(%rip), %rdx      # 0x9040
leaq -0xc0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x612a
leaq -0x50(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0x528(%rbp), %rdx
callq 0x62f9
leaq 0x4382(%rip), %rdx      # 0x904c
leaq -0xa0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x612a
leaq 0x45f8(%rip), %rsi      # 0x92d9
leaq -0xe0(%rbp), %rdi
leaq -0x2a(%rbp), %rdx
callq 0x30c0
leaq -0x1a0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
callq 0x60b9
leaq 0x433a(%rip), %rsi      # 0x904c
leaq -0x180(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x30c0
leaq -0x1a0(%rbp), %rdi
leaq -0x180(%rbp), %rsi
pushq $0x23
popq %rdx
pushq $0x1
popq %r8
movl $0x12c, %ecx            # imm = 0x12C
callq 0x8e78
leaq -0x180(%rbp), %rdi
callq 0x3100
leaq -0x1a0(%rbp), %rdi
callq 0x3100
leaq -0xe0(%rbp), %rdi
callq 0x3100
leaq -0xa0(%rbp), %rdi
callq 0x3100
leaq -0x50(%rbp), %rdi
callq 0x3100
leaq -0xc0(%rbp), %rdi
callq 0x3100
leaq -0x100(%rbp), %rdi
callq 0x3100
movq %rbx, %rdi
callq 0x55ca
leaq -0x528(%rbp), %rdi
callq 0x3100
xorl %eax, %eax
cmpl $0x0, 0x34(%rbx)
jle 0x4dc0
addq $0x638, %rsp            # imm = 0x638
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x450a(%rip), %rsi      # 0x92d1
leaq -0x160(%rbp), %rdi
leaq -0x528(%rbp), %rdx
callq 0x30c0
leaq 0x426b(%rip), %rsi      # 0x904c
leaq -0x140(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0x30c0
leaq -0x160(%rbp), %rdi
leaq -0x140(%rbp), %rsi
pushq $0x23
popq %rdx
pushq $0x1
popq %r8
movl $0x12c, %ecx            # imm = 0x12C
callq 0x8e78
leaq -0x140(%rbp), %rdi
callq 0x3100
leaq -0x160(%rbp), %rdi
callq 0x3100
movq -0x58(%rbp), %rax
movb $0x1, 0xd8(%rax)
xorl %edi, %edi
callq 0x32b0
movq %rax, %rbx
leaq -0x380(%rbp), %rdi
callq 0x3100
jmp 0x4e51
movq %rax, %rbx
leaq -0x3a0(%rbp), %rdi
jmp 0x5124
jmp 0x5156
movq %rax, %rbx
leaq -0x340(%rbp), %rdi
callq 0x3100
jmp 0x4e76
movq %rax, %rbx
leaq -0x360(%rbp), %rdi
callq 0x3100
jmp 0x4f5b
jmp 0x5156
movq %rax, %rbx
leaq -0x140(%rbp), %rdi
callq 0x3100
jmp 0x4f27
movq %rax, %rbx
leaq -0x2c0(%rbp), %rdi
callq 0x3100
jmp 0x4eb4
movq %rax, %rbx
leaq -0x2e0(%rbp), %rdi
jmp 0x4f15
movq %rax, %rbx
leaq -0x660(%rbp), %rdi
callq 0x6090
jmp 0x513a
movq %rax, %rbx
leaq -0x1c0(%rbp), %rdi
callq 0x3100
jmp 0x4ee5
movq %rax, %rbx
leaq -0x1e0(%rbp), %rdi
jmp 0x5135
movq %rax, %rbx
leaq -0x280(%rbp), %rdi
callq 0x3100
jmp 0x4f05
movq %rax, %rbx
leaq -0x2a0(%rbp), %rdi
jmp 0x4f15
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x3100
jmp 0x512e
jmp 0x512b
movq %rax, %rbx
leaq -0x160(%rbp), %rdi
jmp 0x5160
movq %rax, %rbx
leaq -0x240(%rbp), %rdi
callq 0x3100
jmp 0x4f47
movq %rax, %rbx
leaq -0x260(%rbp), %rdi
jmp 0x5135
jmp 0x503e
movq %rax, %rbx
leaq -0x528(%rbp), %rdi
callq 0x3190
jmp 0x5159
movq %rax, %rbx
leaq -0x180(%rbp), %rdi
callq 0x3100
jmp 0x4f80
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
callq 0x3100
jmp 0x4f91
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
callq 0x3100
jmp 0x4fa2
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x3100
jmp 0x4fb3
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x3100
leaq -0xc0(%rbp), %rdi
callq 0x3100
leaq -0x100(%rbp), %rdi
callq 0x3100
jmp 0x514b
movq %rax, %rbx
jmp 0x4fbc
movq %rax, %rbx
jmp 0x4fc8
jmp 0x5148
movq %rax, %rbx
leaq -0x200(%rbp), %rdi
callq 0x3100
jmp 0x4ffc
movq %rax, %rbx
leaq -0x220(%rbp), %rdi
jmp 0x5160
jmp 0x500a
movq %rax, %rbx
jmp 0x5165
movq %rax, %rbx
leaq -0x300(%rbp), %rdi
callq 0x3100
jmp 0x5026
movq %rax, %rbx
leaq -0x320(%rbp), %rdi
jmp 0x5135
jmp 0x5148
jmp 0x512b
jmp 0x503e
movq %rax, %rbx
jmp 0x513a
jmp 0x512b
jmp 0x50b8
jmp 0x50f1
movq %rax, %rbx
leaq -0x5a8(%rbp), %rdi
callq 0x3100
jmp 0x5066
movq %rax, %rbx
leaq -0x548(%rbp), %rdi
jmp 0x50a0
jmp 0x50a7
jmp 0x50f6
jmp 0x50fb
jmp 0x5100
jmp 0x5156
movq %rax, %rbx
leaq -0x5c8(%rbp), %rdi
callq 0x3100
jmp 0x5099
movq %rax, %rbx
leaq -0x568(%rbp), %rdi
callq 0x3100
jmp 0x50aa
movq %rax, %rbx
leaq -0x120(%rbp), %rdi
callq 0x3100
jmp 0x50bb
movq %rax, %rbx
leaq -0x528(%rbp), %rdi
callq 0x3100
leaq -0x50(%rbp), %rdi
callq 0x3100
leaq -0xe0(%rbp), %rdi
callq 0x3100
leaq -0xc0(%rbp), %rdi
callq 0x3100
leaq -0x100(%rbp), %rdi
jmp 0x5124
movq %rax, %rbx
jmp 0x50c7
movq %rax, %rbx
jmp 0x50d0
movq %rax, %rbx
jmp 0x50dc
movq %rax, %rbx
jmp 0x50e8
jmp 0x5156
jmp 0x5156
movq %rax, %rbx
leaq -0x5e8(%rbp), %rdi
callq 0x3100
jmp 0x511d
movq %rax, %rbx
leaq -0x588(%rbp), %rdi
callq 0x3100
jmp 0x5159
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x3100
leaq -0x528(%rbp), %rdi
callq 0x3190
jmp 0x5165
movq %rax, %rbx
leaq -0x528(%rbp), %rdi
jmp 0x5160
jmp 0x5156
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x3100
movq %rbx, %rdi
callq 0x3490
nop