// File: /workspace/github_cpp_makefile_star2_O1/Thilotilo[P]DoaERando/Randomizer.cpp
// Function: DoaERando::Randomizer::CaveShuffle()
void Randomizer::CaveShuffle()
{
    // These are world map offsets
    const int XU_ZHE_CAVE_OFFSET = 0x07;
    const int MT_GANG_TAI_ENTRANCE_OFFSET = 0x0B;
    const int MT_GANG_TAI_EXIT_OFFSET = 0x1F;
    const int WU_CAVE_EXIT_OFFSET = 0x26;
    const int WU_CAVE_ENTRANCE_OFFSET = 0x39;
    const int GOLD_KEY_CAVE_OFFSET = 0x46;
    const int CHANG_AN_ENTRANCE_OFFSET = 0x58;
    const int CHANG_AN_EXIT_OFFSET = 0x61;
    const int NAN_YANG_CAVE_OFFSET = 0x63;
    const int WEI_CAVE_2_ENTRANCE_OFFSET = 0x6C;
    const int WEI_CAVE_2_EXIT_OFFSET = 0x7B;
    const int WEI_CAVE_1_EXIT_OFFSET = 0x7E;
    const int WEI_CAVE_1_ENTRANCE_OFFSET = 0x93;
    const int SALTPETER_CAVE_OFFSET = 0x99;

    // Magic numbers are bad, but 8 million consts to start a method are obnoxious.
    vector<vector<BYTE>> CaveWarpOffsets = {
        {XU_ZHE_CAVE_OFFSET,          0x08, 0x09},
        {MT_GANG_TAI_ENTRANCE_OFFSET, 0x0A},
        {MT_GANG_TAI_EXIT_OFFSET,     0x1E},
        {WU_CAVE_EXIT_OFFSET,         0x27},
        {WU_CAVE_ENTRANCE_OFFSET,     0x38},
        {GOLD_KEY_CAVE_OFFSET,        0x47, 0x48},
        {CHANG_AN_ENTRANCE_OFFSET,    0x57, 0x59},
        {CHANG_AN_EXIT_OFFSET,        0x60, 0x62},
        {NAN_YANG_CAVE_OFFSET,        0x64, 0x65},
        {WEI_CAVE_2_ENTRANCE_OFFSET,  0x6D, 0x7D},
        {WEI_CAVE_2_EXIT_OFFSET,      0x7A, 0x7C},
        {WEI_CAVE_1_EXIT_OFFSET,      0x7F, 0x80},
        {WEI_CAVE_1_ENTRANCE_OFFSET,  0x94, 0x95},
        {SALTPETER_CAVE_OFFSET,       0x9A, 0x9B}
    };

    vector<vector<BYTE>> ShuffledOffsets = CaveWarpOffsets;

    for (int i = 0; i < 10000; ++i)
    {
        int location1 = myRNG.GetRandomInt(0, ShuffledOffsets.size() - 1);
        int location2 = myRNG.GetRandomInt(0, ShuffledOffsets.size() - 1);
        swap(ShuffledOffsets[location1], ShuffledOffsets[location2]);
    }

    // Now do sanity checks
    // For now, let's prevent the following:
    // 1) Wu Cave entrance should not be a single-entrance cave to prevent softlocks from canal
    // 2) Mt Gang Tai Exit cannot be a single-entrance cave, and it's other side cannot come to
    //    one of the Wei caves if the other is a Single Exit cave
    // 3) Wei1 Exit & Wei2 Entrance can't be opposite ends of the same cave
    // 4) Wei1 Exit & Wei2 Entrance can't both be single-entrance caves.
    while (IsSingleExitCave(ShuffledOffsets[4][0]) ||
           IsSingleExitCave(ShuffledOffsets[2][0]) ||
           (AreExitsFromSameCave(ShuffledOffsets[2][0], ShuffledOffsets[9][0]) &&
            IsSingleExitCave(ShuffledOffsets[11][0])) ||
           (AreExitsFromSameCave(ShuffledOffsets[2][0], ShuffledOffsets[11][0]) &&
            IsSingleExitCave(ShuffledOffsets[9][0])) ||
           AreExitsFromSameCave(ShuffledOffsets[9][0], ShuffledOffsets[11][0]) ||
           (IsSingleExitCave(ShuffledOffsets[9][0]) && IsSingleExitCave(ShuffledOffsets[11][0])))
    {
        int location1 = myRNG.GetRandomInt(0, ShuffledOffsets.size() - 1);
        int location2 = myRNG.GetRandomInt(0, ShuffledOffsets.size() - 1);
        swap(ShuffledOffsets[location1], ShuffledOffsets[location2]);
    }

    // Collect all the bytes we need to update
    std::vector<std::vector<BYTE>> bytesToWrite;
    for (int i = 0; i < ShuffledOffsets.size(); ++i)
    {
        printf("Putting cave id 0x%02X in the vanilla 0x%02X location\n",
               ShuffledOffsets[i][0], CaveWarpOffsets[i][0]);
        int lsb = myRom->ReadByte(0x1C210 + ShuffledOffsets[i][0]);
        int msb = myRom->ReadByte(0x1C2C0 + ShuffledOffsets[i][0]);
        int shuffledAddressInBank = (msb << 8) | lsb;

        lsb = myRom->ReadByte(0x1C210 + CaveWarpOffsets[i][1]);
        msb = myRom->ReadByte(0x1C2C0 + CaveWarpOffsets[i][1]);
        int caveExitAddressInBank = (msb << 8) | lsb;

        // This puts the destination of the shuffled world map address into the vanilla location
        std::vector<BYTE> updateToWrite;
        updateToWrite.push_back(CaveWarpOffsets[i][0]);
        for (int j = 4; j < 9; ++j)
        {
            updateToWrite.push_back(myRom->ReadByteAtBank(0x7, shuffledAddressInBank + j));
        }

        bytesToWrite.push_back(updateToWrite);

        // This puts the destination of the vanilla cave exits to the shuffled world map location
        for (int j = 1; j < ShuffledOffsets[i].size(); ++j)
        {
            std::vector<BYTE> updatedCaveEntrance;
            updatedCaveEntrance.push_back(ShuffledOffsets[i][j]);
            for (int k = 4; k < 9; ++k)
            {
                updatedCaveEntrance.push_back(myRom->ReadByteAtBank(0x7, caveExitAddressInBank + k));
            }
            bytesToWrite.push_back(updatedCaveEntrance);
        }
    }

    // Now write everything
    for (auto& entry : bytesToWrite)
    {
        int lsb = myRom->ReadByte(0x1C210 + entry[0]);
        int msb = myRom->ReadByte(0x1C2C0 + entry[0]);
        int addressInBank = (msb << 8) | lsb;

        for (int i = 1; i < entry.size(); ++i)
        {
            myRom->WriteByteAtBank(0x7, addressInBank + i + 3, entry[i]);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rdi, %rbx
leaq -0xb0(%rbp), %rsi
movw $0x807, (%rsi)          # imm = 0x807
movb $0x9, 0x2(%rsi)
leaq -0x240(%rbp), %r14
leaq -0x3b(%rbp), %rcx
movl $0x3, %edx
movq %r14, %rdi
callq 0x40a9c2
leaq -0x228(%rbp), %r15
leaq -0x98(%rbp), %rsi
movw $0xa0b, (%rsi)          # imm = 0xA0B
leaq -0x3a(%rbp), %rcx
movl $0x2, %edx
movq %r15, %rdi
callq 0x40a9c2
leaq -0x210(%rbp), %r15
leaq -0x96(%rbp), %rsi
movw $0x1e1f, (%rsi)         # imm = 0x1E1F
leaq -0x39(%rbp), %rcx
movl $0x2, %edx
movq %r15, %rdi
callq 0x40a9c2
leaq -0x1f8(%rbp), %r15
leaq -0x94(%rbp), %rsi
movw $0x2726, (%rsi)         # imm = 0x2726
leaq -0x38(%rbp), %rcx
movl $0x2, %edx
movq %r15, %rdi
callq 0x40a9c2
leaq -0x1e0(%rbp), %r15
leaq -0x92(%rbp), %rsi
movw $0x3839, (%rsi)         # imm = 0x3839
leaq -0x37(%rbp), %rcx
movl $0x2, %edx
movq %r15, %rdi
callq 0x40a9c2
leaq -0x1c8(%rbp), %r15
leaq -0x60(%rbp), %rsi
movw $0x4746, (%rsi)         # imm = 0x4746
movb $0x48, 0x2(%rsi)
leaq -0x36(%rbp), %rcx
movl $0x3, %edx
movq %r15, %rdi
callq 0x40a9c2
leaq -0x1b0(%rbp), %r15
leaq -0x80(%rbp), %rsi
movw $0x5758, (%rsi)         # imm = 0x5758
movb $0x59, 0x2(%rsi)
leaq -0x35(%rbp), %rcx
movl $0x3, %edx
movq %r15, %rdi
callq 0x40a9c2
leaq -0x198(%rbp), %r15
leaq -0x34(%rbp), %rsi
movw $0x6061, (%rsi)         # imm = 0x6061
movb $0x62, 0x2(%rsi)
leaq -0x31(%rbp), %rcx
movl $0x3, %edx
movq %r15, %rdi
callq 0x40a9c2
leaq -0x180(%rbp), %r15
leaq -0xda(%rbp), %rsi
movw $0x6463, (%rsi)         # imm = 0x6463
movb $0x65, 0x2(%rsi)
leaq -0x30(%rbp), %rcx
movl $0x3, %edx
movq %r15, %rdi
callq 0x40a9c2
leaq -0x168(%rbp), %r15
leaq -0xd7(%rbp), %rsi
movw $0x6d6c, (%rsi)         # imm = 0x6D6C
movb $0x7d, 0x2(%rsi)
leaq -0x2f(%rbp), %rcx
movl $0x3, %edx
movq %r15, %rdi
callq 0x40a9c2
leaq -0x150(%rbp), %r15
leaq -0xd4(%rbp), %rsi
movw $0x7a7b, (%rsi)         # imm = 0x7A7B
movb $0x7c, 0x2(%rsi)
leaq -0x2e(%rbp), %rcx
movl $0x3, %edx
movq %r15, %rdi
callq 0x40a9c2
leaq -0x138(%rbp), %r15
leaq -0xd1(%rbp), %rsi
movw $0x7f7e, (%rsi)         # imm = 0x7F7E
movb $-0x80, 0x2(%rsi)
leaq -0x2d(%rbp), %rcx
movl $0x3, %edx
movq %r15, %rdi
callq 0x40a9c2
leaq -0x120(%rbp), %r15
leaq -0xce(%rbp), %rsi
movw $0x9493, (%rsi)         # imm = 0x9493
movb $-0x6b, 0x2(%rsi)
leaq -0x2c(%rbp), %rcx
movl $0x3, %edx
movq %r15, %rdi
callq 0x40a9c2
leaq -0x108(%rbp), %r15
leaq -0xcb(%rbp), %rsi
movw $0x9a99, (%rsi)         # imm = 0x9A99
movb $-0x65, 0x2(%rsi)
leaq -0x2b(%rbp), %rcx
movl $0x3, %edx
movq %r15, %rdi
callq 0x40a9c2
leaq -0xc8(%rbp), %rdi
leaq -0x240(%rbp), %rsi
leaq -0x2a(%rbp), %rcx
movl $0xe, %edx
callq 0x40aa00
movl $0x138, %r14d           # imm = 0x138
movq -0x240(%rbp,%r14), %rdi
testq %rdi, %rdi
je 0x40532e
callq 0x410b90
addq $-0x18, %r14
cmpq $-0x18, %r14
jne 0x40531c
leaq -0x240(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x40aa42
leaq 0x8(%rbx), %r14
movl $0x2710, %r12d          # imm = 0x2710
movq -0x238(%rbp), %rax
subq -0x240(%rbp), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %edx # imm = 0xAAAAAAAB
decl %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x41086c
movl %eax, %r15d
movq -0x238(%rbp), %rax
subq -0x240(%rbp), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %edx # imm = 0xAAAAAAAB
decl %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x41086c
movslq %r15d, %rcx
movq -0x240(%rbp), %rdx
leaq (%rcx,%rcx,2), %rcx
cltq
leaq (%rax,%rax,2), %rax
movups (%rdx,%rcx,8), %xmm0
movq 0x10(%rdx,%rcx,8), %rsi
movq (%rdx,%rax,8), %rdi
movq %rdi, (%rdx,%rcx,8)
movq 0x8(%rdx,%rax,8), %rdi
movq %rdi, 0x8(%rdx,%rcx,8)
movq 0x10(%rdx,%rax,8), %rdi
movq %rdi, 0x10(%rdx,%rcx,8)
movups %xmm0, (%rdx,%rax,8)
movq %rsi, 0x10(%rdx,%rax,8)
decl %r12d
jne 0x405355
jmp 0x40542b
cmpl $0x99, %r15d
je 0x405400
cmpl $0x63, %r15d
jne 0x4055fb
cmpl $0x62, %r13d
jg 0x405417
cmpl $0x7, %r13d
je 0x40545e
cmpl $0x46, %r13d
je 0x40545e
jmp 0x4055fb
cmpl $0x99, %r13d
je 0x40545e
cmpl $0x63, %r13d
je 0x40545e
jmp 0x4055fb
movq -0x240(%rbp), %r12
movq 0x60(%r12), %rax
movzbl (%rax), %eax
cmpl $0x62, %eax
jg 0x40544e
cmpl $0x7, %eax
je 0x40545e
cmpl $0x46, %eax
je 0x40545e
jmp 0x4054ec
cmpl $0x63, %eax
je 0x40545e
cmpl $0x99, %eax
jne 0x4054ec
movq -0x238(%rbp), %rax
subq %r12, %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %edx # imm = 0xAAAAAAAB
decl %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x41086c
movl %eax, %r15d
movq -0x238(%rbp), %rax
subq -0x240(%rbp), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %edx # imm = 0xAAAAAAAB
decl %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x41086c
movslq %r15d, %rcx
movq -0x240(%rbp), %rdx
leaq (%rcx,%rcx,2), %rcx
cltq
leaq (%rax,%rax,2), %rax
movups (%rdx,%rcx,8), %xmm0
movq 0x10(%rdx,%rcx,8), %rsi
movq (%rdx,%rax,8), %rdi
movq %rdi, (%rdx,%rcx,8)
movq 0x8(%rdx,%rax,8), %rdi
movq %rdi, 0x8(%rdx,%rcx,8)
movq 0x10(%rdx,%rax,8), %rdi
movq %rdi, 0x10(%rdx,%rcx,8)
movups %xmm0, (%rdx,%rax,8)
movq %rsi, 0x10(%rdx,%rax,8)
jmp 0x40542b
movq 0x30(%r12), %rax
movzbl (%rax), %r13d
cmpl $0x62, %r13d
jg 0x405511
cmpl $0x7, %r13d
je 0x40545e
cmpl $0x46, %r13d
je 0x40545e
jmp 0x405528
cmpl $0x63, %r13d
je 0x40545e
cmpl $0x99, %r13d
je 0x40545e
movq 0xd8(%r12), %rax
movzbl (%rax), %r15d
movl %r13d, %edi
movl %r15d, %esi
callq 0x405a9f
testb %al, %al
je 0x40557b
movq 0x108(%r12), %rax
movzbl (%rax), %eax
cmpl $0x62, %eax
jg 0x405567
cmpl $0x7, %eax
je 0x40545e
cmpl $0x46, %eax
je 0x40545e
jmp 0x40557b
cmpl $0x63, %eax
je 0x40545e
cmpl $0x99, %eax
je 0x40545e
movq 0x108(%r12), %rax
movzbl (%rax), %eax
movl %r13d, %edi
movl %eax, %r13d
movl %eax, %esi
callq 0x405a9f
testb %al, %al
je 0x4055ca
cmpl $0x62, %r15d
jg 0x4055b3
cmpl $0x7, %r15d
je 0x40545e
cmpl $0x46, %r15d
je 0x40545e
jmp 0x4055ca
cmpl $0x63, %r15d
je 0x40545e
cmpl $0x99, %r15d
je 0x40545e
movl %r15d, %edi
movl %r13d, %esi
callq 0x405a9f
testb %al, %al
jne 0x40545e
cmpl $0x62, %r15d
jg 0x4053ed
cmpl $0x7, %r15d
je 0x405400
cmpl $0x46, %r15d
je 0x405400
xorps %xmm0, %xmm0
movaps %xmm0, -0xb0(%rbp)
movq $0x0, -0xa0(%rbp)
movq -0x240(%rbp), %rax
cmpq %rax, -0x238(%rbp)
je 0x4058d4
leaq -0x80(%rbp), %r12
xorl %r15d, %r15d
leaq (,%r15,8), %rcx
leaq (%rcx,%rcx,2), %r14
movq (%rax,%r14), %rax
movzbl (%rax), %esi
movq -0xc8(%rbp), %rax
movq (%rax,%r14), %rax
movzbl (%rax), %edx
leaq 0x186aa6(%rip), %rdi    # 0x58c0f9
xorl %eax, %eax
callq 0x4e21a0
movq (%rbx), %rdi
movq -0x240(%rbp), %rax
movq (%rax,%r14), %rax
movzbl (%rax), %esi
addl $0x1c210, %esi          # imm = 0x1C210
callq 0x4049fe
movb %al, -0x90(%rbp)
movq (%rbx), %rdi
movq -0x240(%rbp), %rax
leaq (%r15,%r15,2), %r14
movq (%rax,%r14,8), %rax
movzbl (%rax), %esi
addl $0x1c2c0, %esi          # imm = 0x1C2C0
callq 0x4049fe
movb %al, -0x88(%rbp)
movq (%rbx), %rdi
movq -0xc8(%rbp), %rax
movq (%rax,%r14,8), %rax
movzbl 0x1(%rax), %esi
addl $0x1c210, %esi          # imm = 0x1C210
callq 0x4049fe
movb %al, -0x29(%rbp)
movq (%rbx), %rdi
movq -0xc8(%rbp), %rax
movq (%rax,%r14,8), %rax
movzbl 0x1(%rax), %esi
addl $0x1c2c0, %esi          # imm = 0x1C2C0
callq 0x4049fe
movl %eax, %r13d
movq %r15, -0xe8(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movq $0x0, -0x50(%rbp)
movq -0xc8(%rbp), %rax
movq (%rax,%r14,8), %rdx
movq -0x58(%rbp), %rsi
testq %rsi, %rsi
je 0x405716
movb (%rdx), %al
movb %al, (%rsi)
incq -0x58(%rbp)
jmp 0x40571f
leaq -0x60(%rbp), %rdi
callq 0x40adf8
movzbl -0x90(%rbp), %eax
movzbl -0x88(%rbp), %ecx
shll $0x8, %ecx
movzbl -0x29(%rbp), %edx
movq %rdx, -0x90(%rbp)
movzbl %r13b, %edx
shll $0x8, %edx
movq %rdx, -0x88(%rbp)
leal (%rcx,%rax), %r15d
addl $0x4, %r15d
xorl %r13d, %r13d
movq (%rbx), %rdi
leal (%r15,%r13), %edx
movl $0x7, %esi
callq 0x404a0e
movb %al, -0x80(%rbp)
movq -0x58(%rbp), %rsi
cmpq -0x50(%rbp), %rsi
je 0x40577a
movb %al, (%rsi)
incq -0x58(%rbp)
jmp 0x405786
leaq -0x60(%rbp), %rdi
movq %r12, %rdx
callq 0x40ad06
incl %r13d
cmpl $0x5, %r13d
jne 0x405754
leaq -0xb0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x40aade
movq -0x240(%rbp), %rax
movq 0x8(%rax,%r14,8), %rcx
subq (%rax,%r14,8), %rcx
cmpq $0x2, %rcx
jb 0x405890
leaq (%rax,%r14,8), %rax
movq -0x90(%rbp), %rcx
movq -0x88(%rbp), %rdx
leal (%rdx,%rcx), %r13d
addl $0x4, %r13d
movl $0x1, %r15d
movq %r14, -0xf0(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x80(%rbp)
movq $0x0, -0x70(%rbp)
movq (%rax), %rdx
addq %r15, %rdx
movq -0x78(%rbp), %rsi
testq %rsi, %rsi
je 0x405808
movb (%rdx), %al
movb %al, (%rsi)
incq -0x78(%rbp)
jmp 0x405810
movq %r12, %rdi
callq 0x40adf8
xorl %r14d, %r14d
movq (%rbx), %rdi
leal (%r14,%r13), %edx
movl $0x7, %esi
callq 0x404a0e
movb %al, -0x34(%rbp)
movq -0x78(%rbp), %rsi
cmpq -0x70(%rbp), %rsi
je 0x405839
movb %al, (%rsi)
incq -0x78(%rbp)
jmp 0x405845
movq %r12, %rdi
leaq -0x34(%rbp), %rdx
callq 0x40ad06
incl %r14d
cmpl $0x5, %r14d
jne 0x405813
leaq -0xb0(%rbp), %rdi
movq %r12, %rsi
callq 0x40aade
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x40586b
callq 0x410b90
incq %r15
movq -0x240(%rbp), %rax
movq -0xf0(%rbp), %r14
leaq (%rax,%r14,8), %rax
movq 0x8(%rax), %rcx
subq (%rax), %rcx
cmpq %r15, %rcx
ja 0x4057e0
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x40589e
callq 0x410b90
movq -0xe8(%rbp), %r15
incq %r15
movq -0x240(%rbp), %rax
movq -0x238(%rbp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
cmpq %r15, %rcx
ja 0x40562b
movq -0xb0(%rbp), %r15
movq -0xa8(%rbp), %r12
cmpq %r12, %r15
je 0x40596d
movq (%rbx), %rdi
movq (%r15), %rax
movzbl (%rax), %esi
addl $0x1c210, %esi          # imm = 0x1C210
callq 0x4049fe
movl %eax, %r14d
movq (%rbx), %rdi
movq (%r15), %rax
movzbl (%rax), %esi
addl $0x1c2c0, %esi          # imm = 0x1C2C0
callq 0x4049fe
movq (%r15), %rcx
movq 0x8(%r15), %rdx
subq %rcx, %rdx
cmpq $0x2, %rdx
jb 0x405964
movzbl %al, %eax
shll $0x8, %eax
movzbl %r14b, %r14d
orl %eax, %r14d
movl $0x1, %r13d
movq (%rbx), %rdi
movzbl (%rcx,%r13), %ecx
leal (%r14,%r13), %edx
addl $0x3, %edx
movl $0x7, %esi
callq 0x404a38
incq %r13
movq (%r15), %rcx
movq 0x8(%r15), %rax
subq %rcx, %rax
cmpq %r13, %rax
ja 0x405939
addq $0x18, %r15
jmp 0x4058e2
leaq -0xb0(%rbp), %rdi
callq 0x40ab1a
leaq -0x240(%rbp), %rdi
callq 0x40ab1a
leaq -0xc8(%rbp), %rdi
callq 0x40ab1a
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x405a8b
movq %rax, %rbx
movl $0x138, %r12d           # imm = 0x138
movq -0x240(%rbp,%r12), %rdi
testq %rdi, %rdi
je 0x4059c6
callq 0x410b90
addq $-0x18, %r12
cmpq $-0x18, %r12
jne 0x4059b4
movb $0x1, %al
jmp 0x4059f1
jmp 0x4059ec
jmp 0x4059ec
jmp 0x4059ec
jmp 0x4059ec
jmp 0x4059ec
jmp 0x4059ec
jmp 0x4059ec
jmp 0x4059ec
jmp 0x4059ec
jmp 0x4059ec
jmp 0x4059ec
jmp 0x4059ec
movq %rax, %rbx
xorl %eax, %eax
cmpq %r15, %r14
sete %cl
testb %al, %al
jne 0x405a97
testb %cl, %cl
jne 0x405a97
leaq -0x240(%rbp), %r14
movq -0x18(%r15), %rdi
testq %rdi, %rdi
je 0x405a1c
callq 0x410b90
addq $-0x18, %r15
cmpq %r14, %r15
jne 0x405a0e
jmp 0x405a97
movq %rax, %rbx
xorl %eax, %eax
movq %r14, %r15
jmp 0x4059f1
jmp 0x405a41
jmp 0x405a41
jmp 0x405a41
jmp 0x405a41
jmp 0x405a48
jmp 0x405a4f
jmp 0x405a4f
jmp 0x405a41
movq %rax, %rbx
jmp 0x405a73
jmp 0x405a54
movq %rax, %rbx
jmp 0x405a65
jmp 0x405a4f
movq %rax, %rbx
jmp 0x405a7f
movq %rax, %rbx
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x405a65
callq 0x410b90
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x405a73
callq 0x410b90
leaq -0xb0(%rbp), %rdi
callq 0x40ab1a
leaq -0x240(%rbp), %rdi
callq 0x40ab1a
leaq -0xc8(%rbp), %rdi
callq 0x40ab1a
movq %rbx, %rdi
callq 0x4bb660