// File: gulamf[P]NRF24LE1Flash/main.cpp
// Function: ProgramUC()
bool ProgramUC()
{
    string debugInfo = "";
    vector<HexRecord> *hexRecords;
    BLCommandReturnType blCommandReturnVal;
    uint8_t readData[512] ;
    bool pageErased[31];
    bool dataInPage[31];
    uint8_t ucFlash [0x4000];
    uint8_t jumpInstruction[] = {0x02, 0x3E, 0x00};

    ucFlash[0] = jumpInstruction[0];
    ucFlash[1] = jumpInstruction[1];
    ucFlash[2] = jumpInstruction[2];

    #if DEBUG_MSG_BOX_ENABLED
    outputString = "";
    #endif


    cout << "Initiating program/verify sequence...\r\n";

    if (resetpin == blenabled)
    {
        cout << "Reset and bootloader enable pins cannot be the same!";
        return false;
    }

    cout << "Parsing hex file...\r\n";

    //begin parse hex file
    hexRecords = HexUtils::ParseHexFile(hexfile, debugInfo);

    //If hexRecords is null, then the file could not be found
    if (hexRecords == NULL)
    {
        cout << "Could not open hex file!";
        return false;
    }

    for (unsigned int  x = 0; x < sizeof(pageErased); x++)
    {
        pageErased[x] = false;
        dataInPage[x] = false;
    }

    for (unsigned int x = 0; x < sizeof(ucFlash); x++)
    {
        ucFlash[x] = 0xFF;
    }

    //Loop through each of the individual hex records to build the complete flash image
    for (unsigned int x = 0; x < hexRecords->size(); x++)
    {
        HexRecord curHexRecord = (HexRecord)hexRecords->at((int)x);

        //If an address is found that is in the bootloader's address space, then throw an error
        if ((curHexRecord.address + curHexRecord.len) >= 0x3E00)
        {
            cout << "Attempting to program address in bootloader's address space (0x3E00 through 0x3FFF)!";
            return false;
        }

        //Loop through the data in the hex record to build the flash image
        for (unsigned int y = 0; y < curHexRecord.len; y++)
        {
            uint8_t curPage = (uint8_t)((curHexRecord.address + y) / 512);

            uint8_t data = curHexRecord.data[y];
            int addr = curHexRecord.address;
            ucFlash[ addr + y] = data;

            if (!dataInPage[curPage] && (ucFlash[curHexRecord.address + y] != 0xFF))
                dataInPage[curPage] = true;
        }
    }
    //end parse hex file

    cout << "Parsing hex file complete!\r\n";
    cout << "Programming device flash...\r\n";

    //begin start bootloader
    blCommandReturnVal = ExecuteCommandStartBootloader();

    if (blCommandReturnVal == BLCommandReturnType_SerialPortFailure)
    {
        cout << "Could not open COM port!";
        return false;
    }
    else if (blCommandReturnVal != BLCommandReturnType_OK)
    {
        cout << "Device not connected!\n";
        return false;
    }
    //end start	bootloader

    //begin device id check
    uint16_t devId = 0;

    blCommandReturnVal = ExecuteCommandGetDevID(&devId);

    if (blCommandReturnVal != BLCommandReturnType_OK)
    {
        cout << "Lost communications with device!";
        return false;
    }
    //end device id check

    //begin bootloader version check
    uint8_t blVersion = 0;

    blCommandReturnVal = ExecuteCommandGetBLVersion(&blVersion);

    if (blCommandReturnVal != BLCommandReturnType_OK)
    {
        cout << "Lost communications with device!";
        return false;
    }
    //end device id check

    cout << ConvertBLDevIDToString(devId);

    //begin write hex file data
    for (uint8_t curPage = 0; curPage < 31; curPage++)
    {
        unsigned int writeStartAddress = 0;
        unsigned int writeEndAddress = 0;
        unsigned int curPageStartAddress = (unsigned int )curPage * 512;
        unsigned int curPageEndAddress = curPageStartAddress + 512 - 1;
        unsigned int curRWAddress = 0;

        //If there is data in the page, then we will do some writing
        if (dataInPage[curPage])
        {
            //Page 0 is a special case because it contains the jump to bootloader code
            if (curPage == 0)
            {
                //Erase page 0 here
                if (ExecuteCommandErasePage(0) != BLCommandReturnType_OK)
                {
                    cout << "Lost communications with device!";
                    return false;
                }

                //Mark page erased
                pageErased[0] = true;

                //Set the RW address so we can write the jump instruction
                if (ExecuteCommandSetRWAddress(0) != BLCommandReturnType_OK)
                {
                    cout << "Lost communications with device!";
                    return false;
                }

                //Update our shadow copy of the chip's RW address
                curRWAddress = 0;

                //Write the jump instruction
                if (ExecuteCommandWrite(jumpInstruction, 0, 3) != BLCommandReturnType_OK)
                {
                    cout << "Lost communications with device!";
                    return false;
                }

                //Update our shadow copy of the chip's RW address
                curRWAddress += 3;

                //Set the user main address that lived in the jump instruction of the user's hex file (bytes 1 (MSB) and 2 (LSB))
                if (ExecuteCommandSetUsrMainAddress((uint16_t)(ucFlash[1] << 8) + ucFlash[2]) != BLCommandReturnType_OK)
                {
                    cout << "Lost communications with device!";
                    return false;
                }

                //Since we've already written the first 3 bytes in the page, update the start address for the rest of the page accordingly
                writeStartAddress = 3;
            }
            else
            {
                //Erase the page if it hasn't been erased
                if (!pageErased[curPage])
                {
                    if (ExecuteCommandErasePage(curPage) != BLCommandReturnType_OK)
                    {
                        cout << "Lost communications with device!";
                        return false;
                    }

                    pageErased[curPage] = true;
                }

                //We haven't written any data, so the start address is just the first address of the page
                writeStartAddress = curPageStartAddress;
            }

            //Loop through this page
            while (writeStartAddress <= curPageEndAddress)
            {
                //Check to see if the current byte is 0xFF or not (FLASH erases to 0xFF, so we do not have to write that value)
                if (ucFlash[writeStartAddress] != 0xFF)
                {
                    uint endFFhCount = 0; //Counter for number of 0xFF values seen after the last non-0xFF value

                    //We have found a non-0xFF value, so now we will try to find where we will end this write operation
                    writeEndAddress = writeStartAddress;

                    //curViewingAddress is the address we're inspecting to see if we want to write the value or not
                    uint curViewingAddress = writeEndAddress + 1;

                    //Check if curViewingAddress is within the current page boundary
                    while (curViewingAddress <= curPageEndAddress)
                    {
                        //We're in the current page boundary, so check if the next value in the flash image is non-0xFF
                        if (ucFlash[writeEndAddress + 1] != 0xFF)
                        {
                            //The next value is non-0xFF, so set writeEndAddress to curViewingAddress and zero out endFFhCount
                            writeEndAddress = curViewingAddress;
                            endFFhCount = 0;
                        }
                        else
                        {
                            //The next value is 0xFF, so increment endFFhCount
                            endFFhCount++;

                            //We have to write at least 8 0xFF values before it makes sense to break a single write into two
                            if (endFFhCount >= 8)
                            {
                                //We are on our 8th 0xFF, so we will break this write
                                break;
                            }
                        }

                        //curViewingAddress is always one location ahead of writeEndAddress plus endFFhCount
                        curViewingAddress = writeEndAddress + endFFhCount + 1;
                    }

                    //Update the chip's RW address if it isn't equal to writeStartAddress
                    if (curRWAddress != writeStartAddress)
                    {
                        if (ExecuteCommandSetRWAddress((uint16_t)writeStartAddress) != BLCommandReturnType_OK)
                        {
                            cout << "Lost communications with device!";
                            return false;
                        }
                    }

                    //Update our shadow copy of the chip's RW address
                    curRWAddress = writeStartAddress;

                    //Write the curent block to the chip
                    uint numBytesToWrite = writeEndAddress - writeStartAddress + 1;

                    if (ExecuteCommandWrite(ucFlash, (uint16_t)curRWAddress, (uint16_t)numBytesToWrite) != BLCommandReturnType_OK)
                    {
                        cout << "Lost communications with device!";
                        return false;
                    }

                    //Update shadow copy of chip's RW address
                    curRWAddress += numBytesToWrite;

                    //Update writeStartAddress
                    writeStartAddress = writeEndAddress + 1;
                }
                else
                {
                    //The value was 0xFF, so look at the next value to try to start the write
                    writeStartAddress++;
                }
            }
        }
        else
        {
            //There is no data in the page, so erase it if it hasn't already been erased
            if (!pageErased[curPage])
            {
                //Erase current page
                if (ExecuteCommandErasePage(curPage) != BLCommandReturnType_OK)
                {
                    cout << "Lost communications with device!";
                    return false;
                }

                //Mark page erased
                pageErased[curPage] = true;
            }
        }
        //Update the progress bar
        //cout << (((curPage + 1) * 100) / 32) << "% complete\n";
    }
    //end write hex file data

    cout << "Programming device flash complete!\r\n";
    cout << "Verifying device flash...\r\n";

    //begin verify hex file data
    for (uint8_t curPage = 0; curPage < 31; curPage++)
    {
        uint readStartAddress = 0;
        uint readEndAddress = 0;
        uint curPageStartAddress = (uint)curPage * 512;
        uint curPageEndAddress = curPageStartAddress + 512 - 1;
        uint curRWAddress = 0;
        uint userMainJumpInstLoc = 0x3E09;

        //If there is data in the page, then we will do some writing
        if (dataInPage[curPage])
        {
            //Page 0 is a special case because it contains the jump to user code
            if (curPage == 0)
            {
                //Set the RW address so we can read the jump to user main instruction
                if (ExecuteCommandSetRWAddress((uint16_t)userMainJumpInstLoc) != BLCommandReturnType_OK)
                {
                    cout << "Lost communications with device!";
                    return false;
                }

                curRWAddress = userMainJumpInstLoc;

                //Read the jump to user main instruction from the chip
                if (ExecuteCommandRead(readData, 0, 3) != BLCommandReturnType_OK)
                {
                    cout << "Lost communications with device!";
                    return false;
                }

                //Update our shadow copy of the chip's RW address
                curRWAddress += 3;

                //Verify jump to user main instruction
                if ((readData[0] != 0x02) || (readData[1] != ucFlash[1]) || (readData[2] != ucFlash[2]))
                {
                    cout << "Programming error in jump to user main instruction starting at 0x" + ToHexString(userMainJumpInstLoc) + ": expected [0x02 0x" + ToHexString(ucFlash[1]) + " 0x" + ToHexString(ucFlash[2]) + "], zzbut received [0x" + ToHexString(readData[0]) + " 0x" + ToHexString(readData[1])+ " 0x" + ToHexString(readData[2]) + "]!";
                    return false;
                }

                //Set the RW address so we can read the jump to bootloader instruction
                if (ExecuteCommandSetRWAddress(0) != BLCommandReturnType_OK)
                {
                    cout << "Lost communications with device!";
                    return false;
                }

                //Update our shadow copy of the chip's RW address
                curRWAddress = 0;

                //Read the jump instruction
                if (ExecuteCommandRead(readData, 0, 3) != BLCommandReturnType_OK)
                {
                    cout << "Lost communications with device!";
                    return false;
                }

                //Update our shadow copy of the chip's RW address
                curRWAddress += 3;

                //Verify jump to bootloader instruction
                if ((readData[0] != jumpInstruction[0]) || (readData[1] != jumpInstruction[1]) || (readData[2] != jumpInstruction[2]))
                {
                    cout << "Programming error in jump to bootloader instruction starting at 0x0000: expected [0x" + ToHexString(jumpInstruction[0]) + " 0x" + ToHexString(jumpInstruction[1]) + " 0x" + ToHexString(jumpInstruction[2]) + "], xxbut received [0x" + ToHexString(readData[0]) + " 0x" + ToHexString(readData[1]) + " 0x" + ToHexString(readData[2]) + "]!";
                    return false;
                }

                //Since we've already read the first 3 bytes in the page, update the start address for the rest of the page accordingly
                readStartAddress = 3;
            }
            else
            {
                //We haven't read any data, so the start address is just the first address of the page
                readStartAddress = curPageStartAddress;
            }

            //Loop through this page
            while (readStartAddress <= curPageEndAddress)
            {
                //Check to see if the current byte is 0xFF or not (FLASH erases to 0xFF, so we do not have to read that value since it automatically matches)
                if (ucFlash[readStartAddress] != 0xFF)
                {
                    uint endFFhCount = 0; //Counter for number of 0xFF values seen after the last non-0xFF value

                    //We have found a non-0xFF value, so now we will try to find where we will end this read operation
                    readEndAddress = readStartAddress;

                    //curViewingAddress is the address we're inspecting to see if we want to read the value or not
                    uint curViewingAddress = readEndAddress + 1;

                    //Check if curViewingAddress is within the current page boundary
                    while (curViewingAddress <= curPageEndAddress)
                    {
                        //We're in the current page boundary, so check if the next value in the flash image is non-0xFF
                        if (ucFlash[readEndAddress + 1] != 0xFF)
                        {
                            //The next value is non-0xFF, so set readEndAddress to curViewingAddress and zero out endFFhCount
                            readEndAddress = curViewingAddress;
                            endFFhCount = 0;
                        }
                        else
                        {
                            //The next value is 0xFF, so increment endFFhCount
                            endFFhCount++;

                            //We have to read at least 8 0xFF values before it makes sense to break a single read into two
                            if (endFFhCount >= 8)
                            {
                                //We are on our 8th 0xFF, so we will break this read
                                break;
                            }
                        }

                        //curViewingAddress is always one location ahead of readEndAddress plus endFFhCount
                        curViewingAddress = readEndAddress + endFFhCount + 1;
                    }

                    //Update the chip's RW address if it isn't equal to readStartAddress
                    if (curRWAddress != readStartAddress)
                    {
                        if (ExecuteCommandSetRWAddress((uint16_t)(readStartAddress)) != BLCommandReturnType_OK)
                        {
                            cout << "Lost communications with device!";
                            return false;
                        }
                    }

                    //Update our shadow copy of the chip's RW address
                    curRWAddress = readStartAddress;

                    //Read the curent block to the chip
                    uint numBytesToRead = readEndAddress - readStartAddress + 1;


                    if (ExecuteCommandRead(readData, readStartAddress, (uint16_t)numBytesToRead) != BLCommandReturnType_OK)
                    {
                        cout << "Lost communications with device!";
                        return false;
                    }

                    //Verify read data
                    for (unsigned int x = 0; x < numBytesToRead; x++)
                    {
                        //Check the current byte against the flash image
                        if (readData[readStartAddress + x] != ucFlash[curRWAddress])
                        {
                            cout << "Programming error at address 0x";
                            cout << ToHexString(curRWAddress);
                            cout << ": expected 0x";
                            cout << ToHexString(ucFlash[curRWAddress]);
                            cout << " but received 0x";
                            cout << ToHexString(readData[x])+ "!";
                            return false;
                        }

                        //Increment shadow copy of chip's RW address
                        curRWAddress++;
                    }

                    //Update readStartAddress
                    readStartAddress = readEndAddress + 1;
                }
                else
                {
                    //The value was 0xFF, so look at the next value to try to start the write
                    readStartAddress++;
                }
            }
        }
        //Update the progress bar
        //cout << (((curPage + 1) * 100) / 32) << "% complete\n";
    }
    //end verify hex file data


    //begin exit bootloader
    if (ExecuteCommandExitBootloader() != BLCommandReturnType_OK)
    {
        cout << "Lost communications with device!";
        return false;
    }
    //end exit bootloader

    cout << "Verifying device flash complete!\r\n";
    cout << "Program/verify sequence completed successfully!\n";

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x48f0, %rsp           # imm = 0x48F0
leaq -0x29(%rbp), %rdi
movq %rdi, -0x4888(%rbp)
callq 0x34d0
movq -0x4888(%rbp), %rdx
leaq 0x51fe(%rip), %rsi      # 0xaa97
leaq -0x28(%rbp), %rdi
callq 0x7370
jmp 0x58a4
leaq -0x29(%rbp), %rdi
callq 0x3300
movb $0x0, -0x4292(%rbp)
movw $0x3e02, -0x4294(%rbp)  # imm = 0x3E02
movb -0x4294(%rbp), %al
movb %al, -0x4290(%rbp)
movb -0x4293(%rbp), %al
movb %al, -0x428f(%rbp)
movb -0x4292(%rbp), %al
movb %al, -0x428e(%rbp)
movq 0x86f0(%rip), %rdi      # 0xdfd8
leaq 0x4c92(%rip), %rsi      # 0xa581
callq 0x32a0
jmp 0x58f6
movl 0x89c8(%rip), %eax      # 0xe2c4
cmpl 0x8ace(%rip), %eax      # 0xe3d0
jne 0x5957
movq 0x86cd(%rip), %rdi      # 0xdfd8
leaq 0x4c97(%rip), %rsi      # 0xa5a9
callq 0x32a0
jmp 0x5919
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x29(%rbp), %rdi
callq 0x3300
jmp 0x72e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x72dd
movq 0x867a(%rip), %rdi      # 0xdfd8
leaq 0x4c79(%rip), %rsi      # 0xa5de
callq 0x32a0
jmp 0x596c
leaq 0x8a1d(%rip), %rsi      # 0xe390
leaq -0x42b8(%rbp), %rdi
callq 0x3170
jmp 0x5981
leaq -0x42b8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x7c10
movq %rax, -0x4890(%rbp)
jmp 0x599a
movq -0x4890(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x42b8(%rbp), %rdi
callq 0x3568
cmpq $0x0, -0x48(%rbp)
jne 0x59fd
movq 0x8619(%rip), %rdi      # 0xdfd8
leaq 0x4c2e(%rip), %rsi      # 0xa5f4
callq 0x32a0
jmp 0x59cd
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x42b8(%rbp), %rdi
callq 0x3568
jmp 0x72dd
movl $0x0, -0x42bc(%rbp)
movl -0x42bc(%rbp), %eax
cmpq $0x1f, %rax
jae 0x5a40
movl -0x42bc(%rbp), %eax
movb $0x0, -0x270(%rbp,%rax)
movl -0x42bc(%rbp), %eax
movb $0x0, -0x290(%rbp,%rax)
movl -0x42bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x42bc(%rbp)
jmp 0x5a07
movl $0x0, -0x42c0(%rbp)
movl -0x42c0(%rbp), %eax
cmpq $0x4000, %rax           # imm = 0x4000
jae 0x5a77
movl -0x42c0(%rbp), %eax
movb $-0x1, -0x4290(%rbp,%rax)
movl -0x42c0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x42c0(%rbp)
jmp 0x5a4a
movl $0x0, -0x42c4(%rbp)
movl -0x42c4(%rbp), %eax
movq %rax, -0x4898(%rbp)
movq -0x48(%rbp), %rdi
callq 0x7690
movq %rax, %rcx
movq -0x4898(%rbp), %rax
cmpq %rcx, %rax
jae 0x5c37
movq -0x48(%rbp), %rdi
movslq -0x42c4(%rbp), %rsi
callq 0x76c0
movq %rax, -0x48a0(%rbp)
jmp 0x5ac3
movq -0x48a0(%rbp), %rsi
leaq -0x4300(%rbp), %rdi
callq 0x7700
jmp 0x5ad8
movzwl -0x42de(%rbp), %eax
movzwl -0x42e0(%rbp), %ecx
addl %ecx, %eax
cmpl $0x3e00, %eax           # imm = 0x3E00
jl 0x5b34
movq 0x84e2(%rip), %rdi      # 0xdfd8
leaq 0x4b10(%rip), %rsi      # 0xa60d
callq 0x32a0
jmp 0x5b04
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x5c05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x4300(%rbp), %rdi
callq 0x7750
jmp 0x72dd
movl $0x0, -0x4304(%rbp)
movl -0x4304(%rbp), %eax
movzwl -0x42e0(%rbp), %ecx
cmpl %ecx, %eax
jae 0x5bfb
movzwl -0x42de(%rbp), %eax
addl -0x4304(%rbp), %eax
shrl $0x9, %eax
movb %al, -0x4305(%rbp)
movq -0x42d8(%rbp), %rax
movl -0x4304(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x4306(%rbp)
movzwl -0x42de(%rbp), %eax
movl %eax, -0x430c(%rbp)
movb -0x4306(%rbp), %cl
movl -0x430c(%rbp), %eax
addl -0x4304(%rbp), %eax
movl %eax, %eax
movb %cl, -0x4290(%rbp,%rax)
movzbl -0x4305(%rbp), %eax
testb $0x1, -0x290(%rbp,%rax)
jne 0x5be5
movzwl -0x42de(%rbp), %eax
addl -0x4304(%rbp), %eax
movl %eax, %eax
movzbl -0x4290(%rbp,%rax), %eax
cmpl $0xff, %eax
je 0x5be5
movzbl -0x4305(%rbp), %eax
movb $0x1, -0x290(%rbp,%rax)
jmp 0x5be7
movl -0x4304(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4304(%rbp)
jmp 0x5b3e
movl $0x0, -0x4298(%rbp)
leaq -0x4300(%rbp), %rdi
callq 0x7750
movl -0x4298(%rbp), %eax
testl %eax, %eax
jne 0x72c6
jmp 0x5c21
jmp 0x5c23
movl -0x42c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x42c4(%rbp)
jmp 0x5a81
movq 0x839a(%rip), %rdi      # 0xdfd8
leaq 0x4a1d(%rip), %rsi      # 0xa662
callq 0x32a0
jmp 0x5c4c
movq 0x8385(%rip), %rdi      # 0xdfd8
leaq 0x4a25(%rip), %rsi      # 0xa67f
callq 0x32a0
jmp 0x5c61
callq 0x4fe0
movl %eax, -0x48a4(%rbp)
jmp 0x5c6e
movl -0x48a4(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x3, -0x4c(%rbp)
jne 0x5ca5
movq 0x8354(%rip), %rdi      # 0xdfd8
leaq 0x4a12(%rip), %rsi      # 0xa69d
callq 0x32a0
jmp 0x5c92
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
cmpl $0x0, -0x4c(%rbp)
je 0x5cd3
movq 0x8326(%rip), %rdi      # 0xdfd8
leaq 0x487d(%rip), %rsi      # 0xa536
callq 0x32a0
jmp 0x5cc0
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
jmp 0x5cd5
movw $0x0, -0x430e(%rbp)
leaq -0x430e(%rbp), %rdi
callq 0x5040
movl %eax, -0x48a8(%rbp)
jmp 0x5cf2
movl -0x48a8(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
je 0x5d29
movq 0x82d0(%rip), %rdi      # 0xdfd8
leaq 0x49a7(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x5d16
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movb $0x0, -0x430f(%rbp)
leaq -0x430f(%rbp), %rdi
callq 0x50d0
movl %eax, -0x48ac(%rbp)
jmp 0x5d44
movl -0x48ac(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
je 0x5d7b
movq 0x827e(%rip), %rdi      # 0xdfd8
leaq 0x4955(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x5d68
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movzwl -0x430e(%rbp), %esi
leaq -0x4330(%rbp), %rdi
callq 0x5180
jmp 0x5d90
movq 0x8241(%rip), %rdi      # 0xdfd8
leaq -0x4330(%rbp), %rsi
callq 0x3270
jmp 0x5da5
leaq -0x4330(%rbp), %rdi
callq 0x3568
movb $0x0, -0x4331(%rbp)
movzbl -0x4331(%rbp), %eax
cmpl $0x1f, %eax
jge 0x6255
movl $0x0, -0x4338(%rbp)
movl $0x0, -0x433c(%rbp)
movzbl -0x4331(%rbp), %eax
shll $0x9, %eax
movl %eax, -0x4340(%rbp)
movl -0x4340(%rbp), %eax
addl $0x200, %eax            # imm = 0x200
subl $0x1, %eax
movl %eax, -0x4344(%rbp)
movl $0x0, -0x4348(%rbp)
movzbl -0x4331(%rbp), %eax
testb $0x1, -0x290(%rbp,%rax)
je 0x61d7
movzbl -0x4331(%rbp), %eax
cmpl $0x0, %eax
jne 0x5f98
xorl %edi, %edi
callq 0x5510
movl %eax, -0x48b0(%rbp)
jmp 0x5e3e
movl -0x48b0(%rbp), %eax
cmpl $0x0, %eax
je 0x5e8e
movq 0x8188(%rip), %rdi      # 0xdfd8
leaq 0x485f(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x5e5e
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x4330(%rbp), %rdi
callq 0x3568
jmp 0x72dd
movb $0x1, -0x270(%rbp)
xorl %edi, %edi
callq 0x5570
movl %eax, -0x48b4(%rbp)
jmp 0x5ea4
movl -0x48b4(%rbp), %eax
cmpl $0x0, %eax
je 0x5ed7
movq 0x8122(%rip), %rdi      # 0xdfd8
leaq 0x47f9(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x5ec4
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movl $0x0, -0x4348(%rbp)
leaq -0x4294(%rbp), %rdi
xorl %esi, %esi
movl $0x3, %edx
callq 0x55f0
movl %eax, -0x48b8(%rbp)
jmp 0x5efc
movl -0x48b8(%rbp), %eax
cmpl $0x0, %eax
je 0x5f2f
movq 0x80ca(%rip), %rdi      # 0xdfd8
leaq 0x47a1(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x5f1c
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movl -0x4348(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x4348(%rbp)
movw -0x428f(%rbp), %ax
rolw $0x8, %ax
movzwl %ax, %edi
callq 0x56f0
movl %eax, -0x48bc(%rbp)
jmp 0x5f59
movl -0x48bc(%rbp), %eax
cmpl $0x0, %eax
je 0x5f8c
movq 0x806d(%rip), %rdi      # 0xdfd8
leaq 0x4744(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x5f79
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movl $0x3, -0x4338(%rbp)
jmp 0x600b
movzbl -0x4331(%rbp), %eax
testb $0x1, -0x270(%rbp,%rax)
jne 0x5fff
movzbl -0x4331(%rbp), %edi
callq 0x5510
movl %eax, -0x48c0(%rbp)
jmp 0x5fbd
movl -0x48c0(%rbp), %eax
cmpl $0x0, %eax
je 0x5ff0
movq 0x8009(%rip), %rdi      # 0xdfd8
leaq 0x46e0(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x5fdd
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movzbl -0x4331(%rbp), %eax
movb $0x1, -0x270(%rbp,%rax)
movl -0x4340(%rbp), %eax
movl %eax, -0x4338(%rbp)
jmp 0x600d
movl -0x4338(%rbp), %eax
cmpl -0x4344(%rbp), %eax
ja 0x61d5
movl -0x4338(%rbp), %eax
movzbl -0x4290(%rbp,%rax), %eax
cmpl $0xff, %eax
je 0x61c1
movl $0x0, -0x434c(%rbp)
movl -0x4338(%rbp), %eax
movl %eax, -0x433c(%rbp)
movl -0x433c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4350(%rbp)
movl -0x4350(%rbp), %eax
cmpl -0x4344(%rbp), %eax
ja 0x60d0
movl -0x433c(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movzbl -0x4290(%rbp,%rax), %eax
cmpl $0xff, %eax
je 0x609d
movl -0x4350(%rbp), %eax
movl %eax, -0x433c(%rbp)
movl $0x0, -0x434c(%rbp)
jmp 0x60b9
movl -0x434c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x434c(%rbp)
cmpl $0x8, -0x434c(%rbp)
jb 0x60b7
jmp 0x60d0
jmp 0x60b9
movl -0x433c(%rbp), %eax
addl -0x434c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4350(%rbp)
jmp 0x605d
movl -0x4348(%rbp), %eax
cmpl -0x4338(%rbp), %eax
je 0x6127
movzwl -0x4338(%rbp), %edi
callq 0x5570
movl %eax, -0x48c4(%rbp)
jmp 0x60f2
movl -0x48c4(%rbp), %eax
cmpl $0x0, %eax
je 0x6125
movq 0x7ed4(%rip), %rdi      # 0xdfd8
leaq 0x45ab(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x6112
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
jmp 0x6127
movl -0x4338(%rbp), %eax
movl %eax, -0x4348(%rbp)
movl -0x433c(%rbp), %eax
movl -0x4338(%rbp), %ecx
subl %ecx, %eax
incl %eax
movl %eax, -0x4354(%rbp)
movzwl -0x4348(%rbp), %esi
movzwl -0x4354(%rbp), %edx
leaq -0x4290(%rbp), %rdi
callq 0x55f0
movl %eax, -0x48c8(%rbp)
jmp 0x616b
movl -0x48c8(%rbp), %eax
cmpl $0x0, %eax
je 0x619e
movq 0x7e5b(%rip), %rdi      # 0xdfd8
leaq 0x4532(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x618b
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movl -0x4354(%rbp), %eax
addl -0x4348(%rbp), %eax
movl %eax, -0x4348(%rbp)
movl -0x433c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4338(%rbp)
jmp 0x61d0
movl -0x4338(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4338(%rbp)
jmp 0x600d
jmp 0x6240
movzbl -0x4331(%rbp), %eax
testb $0x1, -0x270(%rbp,%rax)
jne 0x623e
movzbl -0x4331(%rbp), %edi
callq 0x5510
movl %eax, -0x48cc(%rbp)
jmp 0x61fc
movl -0x48cc(%rbp), %eax
cmpl $0x0, %eax
je 0x622f
movq 0x7dca(%rip), %rdi      # 0xdfd8
leaq 0x44a1(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x621c
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movzbl -0x4331(%rbp), %eax
movb $0x1, -0x270(%rbp,%rax)
jmp 0x6240
jmp 0x6242
movb -0x4331(%rbp), %al
addb $0x1, %al
movb %al, -0x4331(%rbp)
jmp 0x5db8
movq 0x7d7c(%rip), %rdi      # 0xdfd8
leaq 0x4474(%rip), %rsi      # 0xa6d7
callq 0x32a0
jmp 0x626a
movq 0x7d67(%rip), %rdi      # 0xdfd8
leaq 0x4484(%rip), %rsi      # 0xa6fc
callq 0x32a0
jmp 0x627f
movb $0x0, -0x4355(%rbp)
movzbl -0x4355(%rbp), %eax
cmpl $0x1f, %eax
jge 0x7251
movl $0x0, -0x435c(%rbp)
movl $0x0, -0x4360(%rbp)
movzbl -0x4355(%rbp), %eax
shll $0x9, %eax
movl %eax, -0x4364(%rbp)
movl -0x4364(%rbp), %eax
addl $0x200, %eax            # imm = 0x200
subl $0x1, %eax
movl %eax, -0x4368(%rbp)
movl $0x0, -0x436c(%rbp)
movl $0x3e09, -0x4370(%rbp)  # imm = 0x3E09
movzbl -0x4355(%rbp), %eax
testb $0x1, -0x290(%rbp,%rax)
je 0x723c
movzbl -0x4355(%rbp), %eax
cmpl $0x0, %eax
jne 0x6e71
movzwl -0x4370(%rbp), %edi
callq 0x5570
movl %eax, -0x48d0(%rbp)
jmp 0x631b
movl -0x48d0(%rbp), %eax
cmpl $0x0, %eax
je 0x634e
movq 0x7cab(%rip), %rdi      # 0xdfd8
leaq 0x4382(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x633b
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movl -0x4370(%rbp), %eax
movl %eax, -0x436c(%rbp)
leaq -0x250(%rbp), %rdi
xorl %esi, %esi
movl $0x3, %edx
callq 0x5770
movl %eax, -0x48d4(%rbp)
jmp 0x6375
movl -0x48d4(%rbp), %eax
cmpl $0x0, %eax
je 0x63a8
movq 0x7c51(%rip), %rdi      # 0xdfd8
leaq 0x4328(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x6395
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movl -0x436c(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x436c(%rbp)
movzbl -0x250(%rbp), %eax
cmpl $0x2, %eax
jne 0x63eb
movzbl -0x24f(%rbp), %eax
movzbl -0x428f(%rbp), %ecx
cmpl %ecx, %eax
jne 0x63eb
movzbl -0x24e(%rbp), %eax
movzbl -0x428e(%rbp), %ecx
cmpl %ecx, %eax
je 0x68b6
movl -0x4370(%rbp), %esi
leaq -0x4510(%rbp), %rdi
callq 0x9700
jmp 0x63ff
leaq 0x4312(%rip), %rsi      # 0xa718
leaq -0x44f0(%rbp), %rdi
leaq -0x4510(%rbp), %rdx
callq 0x7590
jmp 0x641b
leaq 0x4338(%rip), %rdx      # 0xa75a
leaq -0x44d0(%rbp), %rdi
leaq -0x44f0(%rbp), %rsi
callq 0x7530
jmp 0x6437
movzbl -0x428f(%rbp), %esi
leaq -0x4530(%rbp), %rdi
callq 0x9700
jmp 0x644c
leaq -0x44b0(%rbp), %rdi
leaq -0x44d0(%rbp), %rsi
leaq -0x4530(%rbp), %rdx
callq 0x7770
jmp 0x6468
leaq 0x42fb(%rip), %rdx      # 0xa76a
leaq -0x4490(%rbp), %rdi
leaq -0x44b0(%rbp), %rsi
callq 0x7530
jmp 0x6484
movzbl -0x428e(%rbp), %esi
leaq -0x4550(%rbp), %rdi
callq 0x9700
jmp 0x6499
leaq -0x4470(%rbp), %rdi
leaq -0x4490(%rbp), %rsi
leaq -0x4550(%rbp), %rdx
callq 0x7770
jmp 0x64b5
leaq 0x42b2(%rip), %rdx      # 0xa76e
leaq -0x4450(%rbp), %rdi
leaq -0x4470(%rbp), %rsi
callq 0x7530
jmp 0x64d1
movzbl -0x250(%rbp), %esi
leaq -0x4570(%rbp), %rdi
callq 0x9700
jmp 0x64e6
leaq -0x4430(%rbp), %rdi
leaq -0x4450(%rbp), %rsi
leaq -0x4570(%rbp), %rdx
callq 0x7770
jmp 0x6502
leaq 0x4261(%rip), %rdx      # 0xa76a
leaq -0x4410(%rbp), %rdi
leaq -0x4430(%rbp), %rsi
callq 0x7530
jmp 0x651e
movzbl -0x24f(%rbp), %esi
leaq -0x4590(%rbp), %rdi
callq 0x9700
jmp 0x6533
leaq -0x43f0(%rbp), %rdi
leaq -0x4410(%rbp), %rsi
leaq -0x4590(%rbp), %rdx
callq 0x7770
jmp 0x654f
leaq 0x4214(%rip), %rdx      # 0xa76a
leaq -0x43d0(%rbp), %rdi
leaq -0x43f0(%rbp), %rsi
callq 0x7530
jmp 0x656b
movzbl -0x24e(%rbp), %esi
leaq -0x45b0(%rbp), %rdi
callq 0x9700
jmp 0x6580
leaq -0x43b0(%rbp), %rdi
leaq -0x43d0(%rbp), %rsi
leaq -0x45b0(%rbp), %rdx
callq 0x7770
jmp 0x659c
leaq 0x41e1(%rip), %rdx      # 0xa784
leaq -0x4390(%rbp), %rdi
leaq -0x43b0(%rbp), %rsi
callq 0x7530
jmp 0x65b8
movq 0x7a19(%rip), %rdi      # 0xdfd8
leaq -0x4390(%rbp), %rsi
callq 0x3270
jmp 0x65cd
leaq -0x4390(%rbp), %rdi
callq 0x3568
leaq -0x43b0(%rbp), %rdi
callq 0x3568
leaq -0x45b0(%rbp), %rdi
callq 0x3568
leaq -0x43d0(%rbp), %rdi
callq 0x3568
leaq -0x43f0(%rbp), %rdi
callq 0x3568
leaq -0x4590(%rbp), %rdi
callq 0x3568
leaq -0x4410(%rbp), %rdi
callq 0x3568
leaq -0x4430(%rbp), %rdi
callq 0x3568
leaq -0x4570(%rbp), %rdi
callq 0x3568
leaq -0x4450(%rbp), %rdi
callq 0x3568
leaq -0x4470(%rbp), %rdi
callq 0x3568
leaq -0x4550(%rbp), %rdi
callq 0x3568
leaq -0x4490(%rbp), %rdi
callq 0x3568
leaq -0x44b0(%rbp), %rdi
callq 0x3568
leaq -0x4530(%rbp), %rdi
callq 0x3568
leaq -0x44d0(%rbp), %rdi
callq 0x3568
leaq -0x44f0(%rbp), %rdi
callq 0x3568
leaq -0x4510(%rbp), %rdi
callq 0x3568
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x68a5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6899
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x688d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6881
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6875
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6869
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x685d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6851
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6845
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6839
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x682d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6821
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6815
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6809
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x67fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x67f1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x67e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x4390(%rbp), %rdi
callq 0x3568
leaq -0x43b0(%rbp), %rdi
callq 0x3568
leaq -0x45b0(%rbp), %rdi
callq 0x3568
leaq -0x43d0(%rbp), %rdi
callq 0x3568
leaq -0x43f0(%rbp), %rdi
callq 0x3568
leaq -0x4590(%rbp), %rdi
callq 0x3568
leaq -0x4410(%rbp), %rdi
callq 0x3568
leaq -0x4430(%rbp), %rdi
callq 0x3568
leaq -0x4570(%rbp), %rdi
callq 0x3568
leaq -0x4450(%rbp), %rdi
callq 0x3568
leaq -0x4470(%rbp), %rdi
callq 0x3568
leaq -0x4550(%rbp), %rdi
callq 0x3568
leaq -0x4490(%rbp), %rdi
callq 0x3568
leaq -0x44b0(%rbp), %rdi
callq 0x3568
leaq -0x4530(%rbp), %rdi
callq 0x3568
leaq -0x44d0(%rbp), %rdi
callq 0x3568
leaq -0x44f0(%rbp), %rdi
callq 0x3568
leaq -0x4510(%rbp), %rdi
callq 0x3568
jmp 0x72dd
xorl %edi, %edi
callq 0x5570
movl %eax, -0x48d8(%rbp)
jmp 0x68c5
movl -0x48d8(%rbp), %eax
cmpl $0x0, %eax
je 0x68f8
movq 0x7701(%rip), %rdi      # 0xdfd8
leaq 0x3dd8(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x68e5
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movl $0x0, -0x436c(%rbp)
leaq -0x250(%rbp), %rdi
xorl %esi, %esi
movl $0x3, %edx
callq 0x5770
movl %eax, -0x48dc(%rbp)
jmp 0x691d
movl -0x48dc(%rbp), %eax
cmpl $0x0, %eax
je 0x6950
movq 0x76a9(%rip), %rdi      # 0xdfd8
leaq 0x3d80(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x693d
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movl -0x436c(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x436c(%rbp)
movzbl -0x250(%rbp), %eax
movzbl -0x4294(%rbp), %ecx
cmpl %ecx, %eax
jne 0x6999
movzbl -0x24f(%rbp), %eax
movzbl -0x4293(%rbp), %ecx
cmpl %ecx, %eax
jne 0x6999
movzbl -0x24e(%rbp), %eax
movzbl -0x4292(%rbp), %ecx
cmpl %ecx, %eax
je 0x6e65
movzbl -0x4294(%rbp), %esi
leaq -0x4750(%rbp), %rdi
callq 0x9700
jmp 0x69ae
leaq 0x3dd2(%rip), %rsi      # 0xa787
leaq -0x4730(%rbp), %rdi
leaq -0x4750(%rbp), %rdx
callq 0x7590
jmp 0x69ca
leaq 0x3d99(%rip), %rdx      # 0xa76a
leaq -0x4710(%rbp), %rdi
leaq -0x4730(%rbp), %rsi
callq 0x7530
jmp 0x69e6
movzbl -0x4293(%rbp), %esi
leaq -0x4770(%rbp), %rdi
callq 0x9700
jmp 0x69fb
leaq -0x46f0(%rbp), %rdi
leaq -0x4710(%rbp), %rsi
leaq -0x4770(%rbp), %rdx
callq 0x7770
jmp 0x6a17
leaq 0x3d4c(%rip), %rdx      # 0xa76a
leaq -0x46d0(%rbp), %rdi
leaq -0x46f0(%rbp), %rsi
callq 0x7530
jmp 0x6a33
movzbl -0x4292(%rbp), %esi
leaq -0x4790(%rbp), %rdi
callq 0x9700
jmp 0x6a48
leaq -0x46b0(%rbp), %rdi
leaq -0x46d0(%rbp), %rsi
leaq -0x4790(%rbp), %rdx
callq 0x7770
jmp 0x6a64
leaq 0x3d71(%rip), %rdx      # 0xa7dc
leaq -0x4690(%rbp), %rdi
leaq -0x46b0(%rbp), %rsi
callq 0x7530
jmp 0x6a80
movzbl -0x250(%rbp), %esi
leaq -0x47b0(%rbp), %rdi
callq 0x9700
jmp 0x6a95
leaq -0x4670(%rbp), %rdi
leaq -0x4690(%rbp), %rsi
leaq -0x47b0(%rbp), %rdx
callq 0x7770
jmp 0x6ab1
leaq 0x3cb2(%rip), %rdx      # 0xa76a
leaq -0x4650(%rbp), %rdi
leaq -0x4670(%rbp), %rsi
callq 0x7530
jmp 0x6acd
movzbl -0x24f(%rbp), %esi
leaq -0x47d0(%rbp), %rdi
callq 0x9700
jmp 0x6ae2
leaq -0x4630(%rbp), %rdi
leaq -0x4650(%rbp), %rsi
leaq -0x47d0(%rbp), %rdx
callq 0x7770
jmp 0x6afe
leaq 0x3c65(%rip), %rdx      # 0xa76a
leaq -0x4610(%rbp), %rdi
leaq -0x4630(%rbp), %rsi
callq 0x7530
jmp 0x6b1a
movzbl -0x24e(%rbp), %esi
leaq -0x47f0(%rbp), %rdi
callq 0x9700
jmp 0x6b2f
leaq -0x45f0(%rbp), %rdi
leaq -0x4610(%rbp), %rsi
leaq -0x47f0(%rbp), %rdx
callq 0x7770
jmp 0x6b4b
leaq 0x3c32(%rip), %rdx      # 0xa784
leaq -0x45d0(%rbp), %rdi
leaq -0x45f0(%rbp), %rsi
callq 0x7530
jmp 0x6b67
movq 0x746a(%rip), %rdi      # 0xdfd8
leaq -0x45d0(%rbp), %rsi
callq 0x3270
jmp 0x6b7c
leaq -0x45d0(%rbp), %rdi
callq 0x3568
leaq -0x45f0(%rbp), %rdi
callq 0x3568
leaq -0x47f0(%rbp), %rdi
callq 0x3568
leaq -0x4610(%rbp), %rdi
callq 0x3568
leaq -0x4630(%rbp), %rdi
callq 0x3568
leaq -0x47d0(%rbp), %rdi
callq 0x3568
leaq -0x4650(%rbp), %rdi
callq 0x3568
leaq -0x4670(%rbp), %rdi
callq 0x3568
leaq -0x47b0(%rbp), %rdi
callq 0x3568
leaq -0x4690(%rbp), %rdi
callq 0x3568
leaq -0x46b0(%rbp), %rdi
callq 0x3568
leaq -0x4790(%rbp), %rdi
callq 0x3568
leaq -0x46d0(%rbp), %rdi
callq 0x3568
leaq -0x46f0(%rbp), %rdi
callq 0x3568
leaq -0x4770(%rbp), %rdi
callq 0x3568
leaq -0x4710(%rbp), %rdi
callq 0x3568
leaq -0x4730(%rbp), %rdi
callq 0x3568
leaq -0x4750(%rbp), %rdi
callq 0x3568
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6e54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6e48
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6e3c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6e30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6e24
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6e18
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6e0c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6e00
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6df4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6de8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6ddc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6dd0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6dc4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6db8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6dac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6da0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6d94
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x45d0(%rbp), %rdi
callq 0x3568
leaq -0x45f0(%rbp), %rdi
callq 0x3568
leaq -0x47f0(%rbp), %rdi
callq 0x3568
leaq -0x4610(%rbp), %rdi
callq 0x3568
leaq -0x4630(%rbp), %rdi
callq 0x3568
leaq -0x47d0(%rbp), %rdi
callq 0x3568
leaq -0x4650(%rbp), %rdi
callq 0x3568
leaq -0x4670(%rbp), %rdi
callq 0x3568
leaq -0x47b0(%rbp), %rdi
callq 0x3568
leaq -0x4690(%rbp), %rdi
callq 0x3568
leaq -0x46b0(%rbp), %rdi
callq 0x3568
leaq -0x4790(%rbp), %rdi
callq 0x3568
leaq -0x46d0(%rbp), %rdi
callq 0x3568
leaq -0x46f0(%rbp), %rdi
callq 0x3568
leaq -0x4770(%rbp), %rdi
callq 0x3568
leaq -0x4710(%rbp), %rdi
callq 0x3568
leaq -0x4730(%rbp), %rdi
callq 0x3568
leaq -0x4750(%rbp), %rdi
callq 0x3568
jmp 0x72dd
movl $0x3, -0x435c(%rbp)
jmp 0x6e7d
movl -0x4364(%rbp), %eax
movl %eax, -0x435c(%rbp)
jmp 0x6e7f
movl -0x435c(%rbp), %eax
cmpl -0x4368(%rbp), %eax
ja 0x723a
movl -0x435c(%rbp), %eax
movzbl -0x4290(%rbp,%rax), %eax
cmpl $0xff, %eax
je 0x7226
movl $0x0, -0x47f4(%rbp)
movl -0x435c(%rbp), %eax
movl %eax, -0x4360(%rbp)
movl -0x4360(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x47f8(%rbp)
movl -0x47f8(%rbp), %eax
cmpl -0x4368(%rbp), %eax
ja 0x6f42
movl -0x4360(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movzbl -0x4290(%rbp,%rax), %eax
cmpl $0xff, %eax
je 0x6f0f
movl -0x47f8(%rbp), %eax
movl %eax, -0x4360(%rbp)
movl $0x0, -0x47f4(%rbp)
jmp 0x6f2b
movl -0x47f4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x47f4(%rbp)
cmpl $0x8, -0x47f4(%rbp)
jb 0x6f29
jmp 0x6f42
jmp 0x6f2b
movl -0x4360(%rbp), %eax
addl -0x47f4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x47f8(%rbp)
jmp 0x6ecf
movl -0x436c(%rbp), %eax
cmpl -0x435c(%rbp), %eax
je 0x6f99
movzwl -0x435c(%rbp), %edi
callq 0x5570
movl %eax, -0x48e0(%rbp)
jmp 0x6f64
movl -0x48e0(%rbp), %eax
cmpl $0x0, %eax
je 0x6f97
movq 0x7062(%rip), %rdi      # 0xdfd8
leaq 0x3739(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x6f84
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
jmp 0x6f99
movl -0x435c(%rbp), %eax
movl %eax, -0x436c(%rbp)
movl -0x4360(%rbp), %eax
movl -0x435c(%rbp), %ecx
subl %ecx, %eax
incl %eax
movl %eax, -0x47fc(%rbp)
movzwl -0x435c(%rbp), %esi
movzwl -0x47fc(%rbp), %edx
leaq -0x250(%rbp), %rdi
callq 0x5770
movl %eax, -0x48e4(%rbp)
jmp 0x6fdd
movl -0x48e4(%rbp), %eax
cmpl $0x0, %eax
je 0x7010
movq 0x6fe9(%rip), %rdi      # 0xdfd8
leaq 0x36c0(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x6ffd
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movl $0x0, -0x4800(%rbp)
movl -0x4800(%rbp), %eax
cmpl -0x47fc(%rbp), %eax
jae 0x7215
movl -0x435c(%rbp), %eax
addl -0x4800(%rbp), %eax
movl %eax, %eax
movzbl -0x250(%rbp,%rax), %eax
movl -0x436c(%rbp), %ecx
movzbl -0x4290(%rbp,%rcx), %ecx
cmpl %ecx, %eax
je 0x71f2
movq 0x6f79(%rip), %rdi      # 0xdfd8
leaq 0x378c(%rip), %rsi      # 0xa7f2
callq 0x32a0
jmp 0x706d
movl -0x436c(%rbp), %esi
leaq -0x4820(%rbp), %rdi
callq 0x9700
jmp 0x7081
movq 0x6f50(%rip), %rdi      # 0xdfd8
leaq -0x4820(%rbp), %rsi
callq 0x3270
jmp 0x7096
leaq -0x4820(%rbp), %rdi
callq 0x3568
movq 0x6f2f(%rip), %rdi      # 0xdfd8
leaq 0x3762(%rip), %rsi      # 0xa812
callq 0x32a0
jmp 0x70b7
movl -0x436c(%rbp), %eax
movzbl -0x4290(%rbp,%rax), %esi
leaq -0x4840(%rbp), %rdi
callq 0x9700
jmp 0x70d3
movq 0x6efe(%rip), %rdi      # 0xdfd8
leaq -0x4840(%rbp), %rsi
callq 0x3270
jmp 0x70e8
leaq -0x4840(%rbp), %rdi
callq 0x3568
movq 0x6edd(%rip), %rdi      # 0xdfd8
leaq 0x371e(%rip), %rsi      # 0xa820
callq 0x32a0
jmp 0x7109
movl -0x4800(%rbp), %eax
movzbl -0x250(%rbp,%rax), %esi
leaq -0x4880(%rbp), %rdi
callq 0x9700
jmp 0x7125
leaq 0x3534(%rip), %rdx      # 0xa660
leaq -0x4860(%rbp), %rdi
leaq -0x4880(%rbp), %rsi
callq 0x7530
jmp 0x7141
movq 0x6e90(%rip), %rdi      # 0xdfd8
leaq -0x4860(%rbp), %rsi
callq 0x3270
jmp 0x7156
leaq -0x4860(%rbp), %rdi
callq 0x3568
leaq -0x4880(%rbp), %rdi
callq 0x3568
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x4820(%rbp), %rdi
callq 0x3568
jmp 0x72dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x4840(%rbp), %rdi
callq 0x3568
jmp 0x72dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x71e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x4860(%rbp), %rdi
callq 0x3568
leaq -0x4880(%rbp), %rdi
callq 0x3568
jmp 0x72dd
movl -0x436c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x436c(%rbp)
movl -0x4800(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4800(%rbp)
jmp 0x701a
movl -0x4360(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x435c(%rbp)
jmp 0x7235
movl -0x435c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x435c(%rbp)
jmp 0x6e7f
jmp 0x723c
jmp 0x723e
movb -0x4355(%rbp), %al
addb $0x1, %al
movb %al, -0x4355(%rbp)
jmp 0x6286
callq 0x5130
movl %eax, -0x48e8(%rbp)
jmp 0x725e
movl -0x48e8(%rbp), %eax
cmpl $0x0, %eax
je 0x728e
movq 0x6d68(%rip), %rdi      # 0xdfd8
leaq 0x343f(%rip), %rsi      # 0xa6b6
callq 0x32a0
jmp 0x727e
movb $0x0, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
jmp 0x72c6
movq 0x6d43(%rip), %rdi      # 0xdfd8
leaq 0x3595(%rip), %rsi      # 0xa831
callq 0x32a0
jmp 0x72a3
movq 0x6d2e(%rip), %rdi      # 0xdfd8
leaq 0x35a3(%rip), %rsi      # 0xa854
callq 0x32a0
jmp 0x72b8
movb $0x1, -0x1(%rbp)
movl $0x1, -0x4298(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x3568
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x48f0, %rsp           # imm = 0x48F0
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x3568
movq -0x38(%rbp), %rdi
callq 0x34c0
nop