// File: /workspace/github_cpp_makefile_star2_O1/kaiming[P]Chamber-Crawler-3k/Board/board.cc
// Function: Board::generateFloor()
void Board::generateFloor() {
    // Begin RNG piece generation


    // Generate player
    int pChamber = std::rand() % static_cast<int>(chambers.size());
    int tile = std::rand() % static_cast<int>(chambers[pChamber].size());

    // Insert Player
    chambers[pChamber][tile]->setOccupant(playerPtr);
    player = chambers[pChamber][tile];


    // Generate exit stairs
    int chamber;

    // Ensure exit stairs are not in the same chamber as the player
    do {
        chamber = std::rand() % static_cast<int>(chambers.size());
    } while (chamber == pChamber);

    tile = std::rand() % static_cast<int>(chambers[chamber].size());

        // Insert exit stairs
    chambers[chamber][tile]->setExit(true);


    // Generate 10 Potions
    for (int i = 0; i < 10; i++) {
        // Generate type
        int type = std::rand() % 6;
        std::shared_ptr<Potion> temp;

        if (type == 0) {
            temp = std::make_shared<RH>();
        } else if (type == 1) {
            temp = std::make_shared<BA>();
        } else if (type == 2) {
            temp = std::make_shared<BD>();
        } else if (type == 3) {
            temp = std::make_shared<PH>();
        } else if (type == 4) {
            temp = std::make_shared<WA>();
        } else if (type == 5) {
            temp = std::make_shared<WD>();
        }

        // Generate location (make sure not occupied)
        do {
            chamber = std::rand() % static_cast<int>(chambers.size());
            tile = std::rand() % static_cast<int>(chambers[chamber].size());
        } while (chambers[chamber][tile]->getPotion() || chambers[chamber][tile]->isExit() || chambers[chamber][tile]->getOccupant());

        // Place type at location
        chambers[chamber][tile]->setPotion(temp);
    }


    // Generate 10 Gold
    for (int i = 0; i < 10; i++) {
        // Generate type
        int type = std::rand() % 8;
        std::shared_ptr<Gold> temp;

        if (type >= 0 && type <= 4) {
            temp = std::make_shared<Gold>("Normal Hoard", 2);
        } else if (type == 5 || type == 6) {
            temp = std::make_shared<Gold>("Small Hoard", 1);
        } else if (type == 7) {
            temp = std::make_shared<DragonHoard>();
        }

        // Generate location (make sure not occupied)
        do {
            chamber = std::rand() % static_cast<int>(chambers.size());
            tile = std::rand() % static_cast<int>(chambers[chamber].size());
        } while (chambers[chamber][tile]->getPotion() || chambers[chamber][tile]->getGold() || chambers[chamber][tile]->isExit() || chambers[chamber][tile]->getOccupant()); // DLC EXTENSION HERE: if gold can stack, remove second if clause
        

        // Place type at location
        chambers[chamber][tile]->setGold(temp);

        // If dragonHoard type, place Dragon around it
        if (type == 7) {
            // Add to dragonHoards
            dragonHoards[floorNum-1].emplace_back(std::dynamic_pointer_cast<WalkableTile>(chambers[chamber][tile])); 

            // Allocate dragon spawn destination
            std::shared_ptr<WalkableTile> destination = nullptr;

            // Generate direction around DragonHoard
            std::vector<std::string> directions;
            directions.push_back("no");
            directions.push_back("ea");
            directions.push_back("so");
            directions.push_back("we");
            directions.push_back("ne");
            directions.push_back("nw");
            directions.push_back("se");
            directions.push_back("sw");
            int i = 0;

            do {
                // Exit case in event that no suitable location found
                if (i > 80) {
                    break;
                } else {
                    i++;
                }
                
                int rng = std::rand() % 8;

                destination = validDest(chambers[chamber][tile], directions[rng]);

            } while (!destination || !isUnoccupied(destination)); 


            // Place dragon at location and store in DragonHoard
            destination->setOccupant(std::dynamic_pointer_cast<DragonHoard>(temp)->getDragon());
            std::dynamic_pointer_cast<DragonHoard>(temp)->setDragonTile(destination);
        }
    }


    // Generate 20 Enemies
    for (int i = 0; i < 20; i++) {
        // Generate type
        int type = std::rand() % 18;
        std::shared_ptr<Enemy> temp;

        if (type >= 0 && type <= 3) {
            temp = std::make_shared<Human>();
        } else if (type >= 4 && type <= 6) {
            temp = std::make_shared<Dwarf>();
        } else if (type >= 7 && type <= 11) {
            temp = std::make_shared<Halfling>();
        } else if (type >= 12 && type <= 13) {
            temp = std::make_shared<Elf>();
        } else if (type >= 14 && type <= 15) {
            temp = std::make_shared<Orc>();
        } else if (type >= 16 && type <= 17) {
            temp = std::make_shared<Merchant>();
        }

        // Generate location (make sure not occupied)
        do {
            chamber = std::rand() % static_cast<int>(chambers.size());
            tile = std::rand() % static_cast<int>(chambers[chamber].size());
        } while (chambers[chamber][tile]->getPotion() || chambers[chamber][tile]->getGold() || chambers[chamber][tile]->getOccupant() || chambers[chamber][tile]->isExit());

        // Place type at location
        chambers[chamber][tile]->setOccupant(temp);
        enemies[floorNum-1].emplace_back(chambers[chamber][tile]);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rdi, %r14
callq 0x5080
movq 0xe8(%r14), %rcx
subq 0xe0(%r14), %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %ecx # imm = 0xAAAAAAAB
cltd
idivl %ecx
movl %edx, %ebx
callq 0x5080
movslq %ebx, %rcx
leaq (%rcx,%rcx,2), %r15
movq 0xe0(%r14), %rcx
movq 0xf8(%r14), %rsi
movq (%rcx,%r15,8), %rdi
movq 0x8(%rcx,%r15,8), %rcx
subq %rdi, %rcx
shrq $0x4, %rcx
cltd
idivl %ecx
movslq %edx, %r12
shlq $0x4, %r12
movq (%rdi,%r12), %rdi
movq %rsi, 0xe0(%rsp)
movq %r14, 0x48(%rsp)
movq 0x100(%r14), %rax
movq %rax, 0xe8(%rsp)
testq %rax, %rax
je 0xd9e2
movq 0x185ec(%rip), %rcx     # 0x25fc0
cmpb $0x0, (%rcx)
je 0xd9de
incl 0x8(%rax)
jmp 0xd9e2
lock
incl 0x8(%rax)
leaq 0xe0(%rsp), %rsi
callq 0x1ae7a
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0xda01
callq 0x78e4
movq 0x48(%rsp), %r14
movq 0xe0(%r14), %rax
movq (%rax,%r15,8), %rax
leaq (%rax,%r12), %rsi
addq $0x8, %rsi
movq -0x8(%rsi), %rax
movq %rax, 0xb8(%r14)
leaq 0xc0(%r14), %rdi
callq 0xbc6e
callq 0x5080
movq 0xe8(%r14), %rcx
subq 0xe0(%r14), %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %ecx # imm = 0xAAAAAAAB
cltd
idivl %ecx
cmpl %ebx, %edx
je 0xda30
movl %edx, %ebp
callq 0x5080
movslq %ebp, %rcx
movq 0xe0(%r14), %rdx
leaq (%rcx,%rcx,2), %rcx
movq (%rdx,%rcx,8), %rsi
movq 0x8(%rdx,%rcx,8), %rcx
subq %rsi, %rcx
shrq $0x4, %rcx
cltd
idivl %ecx
movslq %edx, %rax
shlq $0x4, %rax
movq (%rsi,%rax), %rdi
movl $0x1, %esi
callq 0x1af12
xorl %r12d, %r12d
leaq 0x10(%rsp), %r13
movq 0x48(%rsp), %r14
callq 0x5080
cltq
imulq $0x2aaaaaab, %rax, %rcx # imm = 0x2AAAAAAB
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
addl %edx, %ecx
addl %ecx, %ecx
leal (%rcx,%rcx,2), %ecx
subl %ecx, %eax
cmpl $0x5, %eax
ja 0xdbb5
leaq 0xf1c0(%rip), %rcx      # 0x1cc90
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %r13, %rsi
leaq 0x50(%rsp), %rdx
callq 0xbe24
jmp 0xdb88
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %r13, %rsi
leaq 0x50(%rsp), %rdx
callq 0xc1e4
jmp 0xdb88
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %r13, %rsi
leaq 0x50(%rsp), %rdx
callq 0xc004
jmp 0xdb88
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %r13, %rsi
leaq 0x50(%rsp), %rdx
callq 0xc0f4
jmp 0xdb88
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %r13, %rsi
leaq 0x50(%rsp), %rdx
callq 0xbf14
jmp 0xdb88
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %r13, %rsi
leaq 0x50(%rsp), %rdx
callq 0xc2d4
movq 0x10(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x18(%rsp), %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xdbae
callq 0x78e4
movq %rbx, 0x38(%rsp)
jmp 0xdbfe
movq $0x0, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
jmp 0xdbfe
movq 0x48(%rsp), %rax
movq 0xe0(%rax), %rax
movq (%rax,%rbx,8), %rax
movq (%rax,%rbp), %rsi
leaq 0x148(%rsp), %rdi
callq 0x1ae4e
cmpq $0x0, 0x148(%rsp)
setne %r15b
movb $0x1, %al
jmp 0xdc88
callq 0x5080
movq 0xe8(%r14), %rcx
subq 0xe0(%r14), %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %ecx # imm = 0xAAAAAAAB
cltd
idivl %ecx
movl %edx, %ebx
callq 0x5080
movslq %ebx, %rcx
movq 0xe0(%r14), %rsi
leaq (%rcx,%rcx,2), %rbx
movq 0x8(%rsi,%rbx,8), %rcx
subq (%rsi,%rbx,8), %rcx
shrq $0x4, %rcx
cltd
idivl %ecx
movslq %edx, %rbp
movq (%rsi,%rbx,8), %rax
shlq $0x4, %rbp
movq (%rax,%rbp), %rsi
movq %r13, %rdi
callq 0x1ae8e
movb $0x1, %r15b
cmpq $0x0, 0x10(%rsp)
jne 0xdc86
movq 0x48(%rsp), %rax
movq 0xe0(%rax), %rax
movq (%rax,%rbx,8), %rax
movq (%rax,%rbp), %rdi
callq 0x1af0e
testb %al, %al
je 0xdbc9
xorl %eax, %eax
testb %al, %al
je 0xdc9e
movq 0x150(%rsp), %rdi
testq %rdi, %rdi
je 0xdc9e
callq 0x78e4
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xdcad
callq 0x78e4
testb %r15b, %r15b
jne 0xdbfe
movq 0x48(%rsp), %rax
movq 0xe0(%rax), %rax
movq (%rax,%rbx,8), %rax
movq (%rax,%rbp), %rdi
movq 0x40(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq 0x38(%rsp), %rbx
movq %rbx, 0xd8(%rsp)
testq %rbx, %rbx
je 0xdcfe
movq 0x182d0(%rip), %rax     # 0x25fc0
cmpb $0x0, (%rax)
je 0xdcfa
incl 0x8(%rbx)
jmp 0xdcfe
lock
incl 0x8(%rbx)
leaq 0xd0(%rsp), %rsi
callq 0x1aeba
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0xdd1d
callq 0x78e4
testq %rbx, %rbx
je 0xdd2a
movq %rbx, %rdi
callq 0x78e4
incl %r12d
cmpl $0xa, %r12d
jne 0xda9e
xorl %ebx, %ebx
leaq 0x10(%rsp), %r14
callq 0x5080
movl %eax, %r12d
leal 0x7(%r12), %eax
testl %r12d, %r12d
cmovnsl %r12d, %eax
andl $-0x8, %eax
subl %eax, %r12d
cmpl $0x4, %r12d
movq %rbx, 0x110(%rsp)
movq %r12, 0x40(%rsp)
ja 0xdd9c
movl $0x2, 0x50(%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
leaq 0x70(%rsp), %rdx
leaq 0xe85a(%rip), %rcx      # 0x1c5ea
leaq 0x50(%rsp), %r8
callq 0xc3c4
jmp 0xddf8
leal -0x5(%r12), %eax
cmpl $0x1, %eax
ja 0xddd7
movl $0x1, 0x50(%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
leaq 0x70(%rsp), %rdx
leaq 0xe82c(%rip), %rcx      # 0x1c5f7
leaq 0x50(%rsp), %r8
callq 0xc53a
jmp 0xddf8
cmpl $0x7, %r12d
jne 0xde25
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
leaq 0x50(%rsp), %rdx
callq 0xc75a
movq 0x10(%rsp), %r15
movq 0x18(%rsp), %rax
movq %rax, 0x38(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xde1e
callq 0x78e4
movq %r15, 0x68(%rsp)
jmp 0xde6d
movq $0x0, 0x38(%rsp)
movq $0x0, 0x68(%rsp)
jmp 0xde6d
movq 0x48(%rsp), %rax
movq 0xe0(%rax), %rax
movq (%rax,%r12,8), %rax
movq (%rax,%r15), %rsi
leaq 0x138(%rsp), %rdi
callq 0x1ae4e
cmpq $0x0, 0x138(%rsp)
setne %bl
movb $0x1, %al
jmp 0xdf2f
callq 0x5080
movq %r14, %rbp
movq 0x48(%rsp), %r14
movq 0xe8(%r14), %rcx
subq 0xe0(%r14), %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %ecx # imm = 0xAAAAAAAB
cltd
idivl %ecx
movl %edx, %ebx
callq 0x5080
movslq %ebx, %rcx
movq 0xe0(%r14), %rsi
movq %rbp, %r14
leaq (%rcx,%rcx,2), %r12
movq 0x8(%rsi,%r12,8), %rcx
subq (%rsi,%r12,8), %rcx
shrq $0x4, %rcx
cltd
idivl %ecx
movslq %edx, %r15
movq (%rsi,%r12,8), %rax
shlq $0x4, %r15
movq (%rax,%r15), %rsi
movq %rbp, %rdi
callq 0x1ae8e
movq 0x10(%rsp), %r13
movb $0x1, %bl
testq %r13, %r13
jne 0xdf2d
movq 0x48(%rsp), %rax
movq 0xe0(%rax), %rax
movq (%rax,%r12,8), %rax
movq (%rax,%r15), %rsi
leaq 0x128(%rsp), %rdi
callq 0x1aece
cmpq $0x0, 0x128(%rsp)
jne 0xdf2d
movq 0x48(%rsp), %rax
movq 0xe0(%rax), %rax
movq (%rax,%r12,8), %rax
movq (%rax,%r15), %rdi
callq 0x1af0e
testb %al, %al
je 0xde39
xorl %eax, %eax
testb %al, %al
je 0xdf45
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0xdf45
callq 0x78e4
testq %r13, %r13
jne 0xdf5c
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0xdf5c
callq 0x78e4
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xdf6b
callq 0x78e4
testb %bl, %bl
jne 0xde6d
movq 0x48(%rsp), %rax
movq 0xe0(%rax), %rax
movq (%rax,%r12,8), %rax
movq (%rax,%r15), %rdi
movq 0x68(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0xc8(%rsp)
testq %rax, %rax
je 0xdfc5
movq 0x18013(%rip), %rax     # 0x25fc0
cmpb $0x0, (%rax)
je 0xdfbc
movq 0x38(%rsp), %rax
incl 0x8(%rax)
jmp 0xdfc5
movq 0x38(%rsp), %rax
lock
incl 0x8(%rax)
leaq 0xc0(%rsp), %rsi
callq 0x1aefa
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0xdfe4
callq 0x78e4
cmpl $0x7, 0x40(%rsp)
jne 0xe5a7
movq 0x48(%rsp), %rdx
movslq 0x108(%rdx), %rax
movq 0x70(%rdx), %rcx
movq 0xe0(%rdx), %rdx
movq (%rdx,%r12,8), %rdx
movq (%rdx,%r15), %rsi
testq %rsi, %rsi
leaq 0x20(%rsp), %r14
je 0xe03f
addq %r15, %rdx
movq %rsi, 0x10(%rsp)
movq 0x8(%rdx), %rdx
movq %rdx, 0x18(%rsp)
testq %rdx, %rdx
je 0xe04d
movq 0x17f8b(%rip), %rsi     # 0x25fc0
cmpb $0x0, (%rsi)
je 0xe049
incl 0x8(%rdx)
jmp 0xe04d
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
jmp 0xe04d
lock
incl 0x8(%rdx)
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rdi
addq $-0x18, %rdi
movq %rbp, %rsi
callq 0xca46
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xe070
callq 0x78e4
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movq %r14, 0x10(%rsp)
movq %rbp, %rbx
movq %rbp, %rdi
leaq 0xe26e(%rip), %rsi      # 0x1c301
leaq 0xe269(%rip), %rdx      # 0x1c303
callq 0x7a9c
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x1618e
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0xe0c3
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5200
movq %r14, 0x10(%rsp)
movq %rbp, %rbx
movq %rbp, %rdi
leaq 0xe232(%rip), %rsi      # 0x1c307
leaq 0xe22d(%rip), %rdx      # 0x1c309
callq 0x7a9c
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x1618e
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0xe105
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5200
movq %r14, 0x10(%rsp)
movq %rbp, %rbx
movq %rbp, %rdi
leaq 0xe1ed(%rip), %rsi      # 0x1c304
leaq 0xe1e8(%rip), %rdx      # 0x1c306
callq 0x7a9c
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x1618e
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0xe147
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5200
movq %r14, 0x10(%rsp)
movq %rbp, %rbx
movq %rbp, %rdi
leaq 0xe1b1(%rip), %rsi      # 0x1c30a
leaq 0xe1ac(%rip), %rdx      # 0x1c30c
callq 0x7a9c
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x1618e
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0xe189
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5200
movq %r14, 0x10(%rsp)
movq %rbp, %rbx
movq %rbp, %rdi
leaq 0xe172(%rip), %rsi      # 0x1c30d
leaq 0xe16d(%rip), %rdx      # 0x1c30f
callq 0x7a9c
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x1618e
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0xe1cb
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5200
movq %r14, 0x10(%rsp)
movq %rbp, %rbx
movq %rbp, %rdi
leaq 0xe133(%rip), %rsi      # 0x1c310
leaq 0xe12e(%rip), %rdx      # 0x1c312
callq 0x7a9c
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x1618e
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0xe20d
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5200
movq %r14, 0x10(%rsp)
movq %rbp, %rbx
movq %rbp, %rdi
leaq 0xe0f4(%rip), %rsi      # 0x1c313
leaq 0xe0ef(%rip), %rdx      # 0x1c315
callq 0x7a9c
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x1618e
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0xe24f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5200
movq %r14, 0x10(%rsp)
movq %rbp, %rbx
movq %rbp, %rdi
leaq 0xe0b5(%rip), %rsi      # 0x1c316
leaq 0xe0b0(%rip), %rdx      # 0x1c318
callq 0x7a9c
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x1618e
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0xe291
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5200
movq $0x0, 0x40(%rsp)
xorl %ebx, %ebx
movq %rbp, %r14
movq 0x40(%rsp), %rbp
callq 0x5080
leal 0x7(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
movq 0x48(%rsp), %rdx
movq 0xe0(%rdx), %rdx
movq (%rdx,%r12,8), %rdx
movq (%rdx,%r15), %rsi
movq %rsi, 0xb0(%rsp)
movq 0x8(%rdx,%r15), %rdx
movq %rdx, 0xb8(%rsp)
testq %rdx, %rdx
leaq 0xf0(%rsp), %r13
je 0xe2fc
movq 0x17cd2(%rip), %rsi     # 0x25fc0
cmpb $0x0, (%rsi)
je 0xe2f8
incl 0x8(%rdx)
jmp 0xe2fc
lock
incl 0x8(%rdx)
andl $-0x8, %ecx
subl %ecx, %eax
cltq
movq 0x50(%rsp), %rcx
shlq $0x5, %rax
leaq 0x100(%rsp), %rdx
movq %rdx, 0xf0(%rsp)
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x7954
movq %r14, %rdi
movq 0x48(%rsp), %rsi
leaq 0xb0(%rsp), %rdx
movq %r13, %rcx
callq 0xebb4
movq 0x10(%rsp), %r13
movq 0x18(%rsp), %rax
movq %rax, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
testq %rbp, %rbp
je 0xe36c
movq %rbp, %rdi
callq 0x78e4
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xe37b
callq 0x78e4
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0xe3a0
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x5200
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0xe3b2
callq 0x78e4
testq %r13, %r13
je 0xe3e7
movq %r13, 0xa0(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0xa8(%rsp)
testq %rax, %rax
je 0xe3f4
movq 0x17be8(%rip), %rax     # 0x25fc0
cmpb $0x0, (%rax)
je 0xe3eb
movq 0x40(%rsp), %rax
incl 0x8(%rax)
jmp 0xe3f4
xorl %ebp, %ebp
jmp 0xe403
movq 0x40(%rsp), %rax
lock
incl 0x8(%rax)
leaq 0xa0(%rsp), %rsi
callq 0xf5ac
movl %eax, %ebp
testq %r13, %r13
je 0xe41a
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0xe41a
callq 0x78e4
cmpl $0x50, %ebx
setae %al
orb %al, %bpl
incl %ebx
cmpb $0x1, %bpl
jne 0xe29f
movq 0x68(%rsp), %r15
testq %r15, %r15
je 0xe456
movq %r15, %rdi
leaq 0x174fd(%rip), %rsi     # 0x25940
leaq 0x17066(%rip), %rdx     # 0x254b0
xorl %ecx, %ecx
callq 0x5240
movq %rax, %rsi
jmp 0xe458
xorl %esi, %esi
movq 0x38(%rsp), %rbx
testq %rbx, %rbx
je 0xe477
movq 0x17b57(%rip), %rax     # 0x25fc0
cmpb $0x0, (%rax)
je 0xe473
incl 0x8(%rbx)
jmp 0xe477
lock
incl 0x8(%rbx)
movq %r14, %rdi
callq 0x187b2
movups 0x10(%rsp), %xmm0
movups %xmm0, 0x118(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movq %r13, %rdi
leaq 0x118(%rsp), %rsi
callq 0x1ae7a
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0xe4b6
callq 0x78e4
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xe4c5
callq 0x78e4
testq %rbx, %rbx
je 0xe4d2
movq %rbx, %rdi
callq 0x78e4
testq %r15, %r15
je 0xe4f4
movq %r15, %rdi
leaq 0x1745f(%rip), %rsi     # 0x25940
leaq 0x16fc8(%rip), %rdx     # 0x254b0
xorl %ecx, %ecx
callq 0x5240
movq %rax, %rdi
jmp 0xe4f6
xorl %edi, %edi
testq %rdi, %rdi
movq %rbx, %rbp
cmoveq %rdi, %rbp
testq %rbx, %rbx
je 0xe529
testq %rdi, %rdi
je 0xe529
movq 0x17aaf(%rip), %rax     # 0x25fc0
cmpb $0x0, (%rax)
je 0xe520
movq 0x38(%rsp), %rbp
incl 0x8(%rbp)
jmp 0xe529
movq 0x38(%rsp), %rbp
lock
incl 0x8(%rbp)
movq %r13, 0x90(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x98(%rsp)
testq %rax, %rax
je 0xe562
movq 0x17a76(%rip), %rax     # 0x25fc0
cmpb $0x0, (%rax)
je 0xe559
movq 0x40(%rsp), %rax
incl 0x8(%rax)
jmp 0xe562
movq 0x40(%rsp), %rax
lock
incl 0x8(%rax)
leaq 0x90(%rsp), %rsi
callq 0x1880a
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0xe581
callq 0x78e4
testq %rbp, %rbp
je 0xe58e
movq %rbp, %rdi
callq 0x78e4
leaq 0x50(%rsp), %rdi
callq 0x7888
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0xe5a7
callq 0x78e4
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
movq 0x110(%rsp), %rbx
je 0xe5be
callq 0x78e4
incl %ebx
cmpl $0xa, %ebx
movq 0x48(%rsp), %r12
jne 0xdd3e
xorl %ebx, %ebx
callq 0x5080
cltq
imulq $0x38e38e39, %rax, %rcx # imm = 0x38E38E39
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x22, %rcx
addl %edx, %ecx
addl %ecx, %ecx
leal (%rcx,%rcx,8), %ecx
subl %ecx, %eax
cmpl $0x3, %eax
movq %rbx, 0x38(%rsp)
ja 0xe61e
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
callq 0xccbe
jmp 0xe6de
leal -0x4(%rax), %ecx
cmpl $0x2, %ecx
ja 0xe648
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
callq 0xcd88
jmp 0xe6de
leal -0x7(%rax), %ecx
cmpl $0x4, %ecx
ja 0xe66f
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
callq 0xd0b0
jmp 0xe6de
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0xe, %ecx
je 0xe69d
cmpl $0xc, %ecx
jne 0xe6bc
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
callq 0xce52
jmp 0xe6de
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
callq 0xcf1c
jmp 0xe6de
cmpl $0x10, %eax
jl 0xe706
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
callq 0xcfe6
movq 0x10(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x18(%rsp), %r15
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xe761
callq 0x78e4
jmp 0xe761
movq $0x0, 0x40(%rsp)
xorl %r15d, %r15d
jmp 0xe761
movq 0xe0(%r12), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%rbx), %rsi
leaq 0x70(%rsp), %rdi
callq 0x1ae4e
movb $0x1, %r12b
cmpq $0x0, 0x70(%rsp)
je 0xe741
movb $0x1, %bpl
jmp 0xe7fb
movq 0x48(%rsp), %rax
movq 0xe0(%rax), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%rbx), %rdi
callq 0x1af0e
movl %eax, %ebp
jmp 0xe7fb
callq 0x5080
movq 0xe8(%r12), %rcx
subq 0xe0(%r12), %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %ecx # imm = 0xAAAAAAAB
cltd
idivl %ecx
movl %edx, %ebx
callq 0x5080
movslq %ebx, %rcx
movq 0xe0(%r12), %rsi
leaq (%rcx,%rcx,2), %r13
movq 0x8(%rsi,%r13,8), %rcx
subq (%rsi,%r13,8), %rcx
shrq $0x4, %rcx
cltd
idivl %ecx
movslq %edx, %rbx
movq (%rsi,%r13,8), %rax
shlq $0x4, %rbx
movq (%rax,%rbx), %rsi
leaq 0x10(%rsp), %rdi
callq 0x1ae8e
movq %r15, %r14
movq 0x10(%rsp), %r15
movb $0x1, %bpl
testq %r15, %r15
jne 0xe7f8
movq 0xe0(%r12), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%rbx), %rsi
leaq 0x50(%rsp), %rdi
callq 0x1aece
cmpq $0x0, 0x50(%rsp)
je 0xe714
xorl %r12d, %r12d
testb %r12b, %r12b
movq 0x48(%rsp), %r12
je 0xe814
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0xe814
callq 0x78e4
testq %r15, %r15
jne 0xe828
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0xe828
callq 0x78e4
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xe837
callq 0x78e4
testb %bpl, %bpl
movq %r14, %r15
jne 0xe761
movq 0xe0(%r12), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%rbx), %rdi
movq 0x40(%rsp), %rax
movq %rax, 0x80(%rsp)
movq %r15, 0x88(%rsp)
testq %r15, %r15
je 0xe884
movq 0x1774c(%rip), %rax     # 0x25fc0
cmpb $0x0, (%rax)
je 0xe87f
incl 0x8(%r15)
jmp 0xe884
lock
incl 0x8(%r15)
leaq 0x80(%rsp), %rsi
callq 0x1ae7a
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0xe8a3
callq 0x78e4
movslq 0x108(%r12), %rax
leaq (%rax,%rax,2), %rax
movq 0x58(%r12), %rcx
movq 0xe0(%r12), %rdx
leaq (%rcx,%rax,8), %rdi
addq $-0x18, %rdi
addq (%rdx,%r13,8), %rbx
movq %rbx, %rsi
callq 0x161f4
testq %r15, %r15
movq 0x38(%rsp), %rbx
je 0xe8e2
movq %r15, %rdi
callq 0x78e4
incl %ebx
cmpl $0x14, %ebx
jne 0xe5d0
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xea09
movq %rax, %rbx
movq 0xe8(%rsp), %r15
jmp 0xeb5d
jmp 0xea09
jmp 0xea09
jmp 0xea09
jmp 0xea09
jmp 0xea09
jmp 0xea09
jmp 0xea09
jmp 0xea09
jmp 0xea09
jmp 0xea09
jmp 0xea09
jmp 0xea09
jmp 0xea09
movq %rax, %rbx
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0xe96a
callq 0x78e4
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xe97e
callq 0x78e4
jmp 0xe97e
movq %rax, %rbx
cmpq $0x0, 0x38(%rsp)
je 0xeab7
movq 0x38(%rsp), %rdi
jmp 0xeab2
movq %rax, %rbx
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0xe9a9
callq 0x78e4
testq %rbp, %rbp
je 0xeab7
movq %rbp, %rdi
jmp 0xeab2
movq %rax, %rbx
movq 0x18(%rsp), %rdi
jmp 0xea4e
jmp 0xe9d5
jmp 0xe9d5
jmp 0xe9d5
jmp 0xe9d5
jmp 0xe9d5
jmp 0xe9d5
jmp 0xe9d5
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0xea02
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5200
jmp 0xea02
jmp 0xe9ff
jmp 0xe9ff
jmp 0xe9ff
jmp 0xe9ff
jmp 0xe9ff
jmp 0xe9ff
jmp 0xe9ff
movq %rax, %rbx
xorl %ebp, %ebp
jmp 0xeb35
movq %rax, %rbx
xorl %r15d, %r15d
jmp 0xeb5d
movq %rax, %rbx
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0xea29
callq 0x78e4
movq %r14, %r15
jmp 0xeb5d
jmp 0xeb4e
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
jmp 0xea4e
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
jne 0xeb47
jmp 0xeb58
movq %rax, %rbx
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0xea75
callq 0x78e4
jmp 0xea75
jmp 0xea84
movq %rax, %rbx
movq %r14, %r15
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
jne 0xea99
jmp 0xeace
movq %rax, %rbx
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
movq 0x38(%rsp), %r15
je 0xeace
callq 0x78e4
jmp 0xeace
jmp 0xeadd
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0xeab7
callq 0x78e4
movq 0x40(%rsp), %rbp
jmp 0xeb35
movq %rax, %rbx
movq %r14, %r15
jmp 0xeace
movq %rax, %rbx
movq 0x38(%rsp), %r15
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
jne 0xeaef
jmp 0xeb5d
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
movq 0x38(%rsp), %r15
je 0xeb5d
callq 0x78e4
jmp 0xeb5d
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0xeb23
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x5200
jmp 0xeb23
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0xeb35
callq 0x78e4
leaq 0x50(%rsp), %rdi
callq 0x7888
testq %rbp, %rbp
je 0xeb58
movq %rbp, %rdi
callq 0x78e4
jmp 0xeb58
movq %rax, %rbx
jmp 0xeb5d
jmp 0xeb55
movq %rax, %rbx
movq 0x38(%rsp), %r15
testq %r15, %r15
je 0xeb6a
movq %r15, %rdi
callq 0x78e4
movq %rbx, %rdi
callq 0x5390