// File: /workspace/github_cpp_makefile_star2_O1/jimmiebergmann[P]fbx-file/miniz.c
// Function: mz_zip_reader_read_central_dir(mz_zip_archive*, unsigned int)
static mz_bool mz_zip_reader_read_central_dir(mz_zip_archive *pZip, mz_uint flags)
{
    mz_uint cdir_size = 0, cdir_entries_on_this_disk = 0, num_this_disk = 0, cdir_disk_index = 0;
    mz_uint64 cdir_ofs = 0;
    mz_int64 cur_file_ofs = 0;
    const mz_uint8 *p;

    mz_uint32 buf_u32[4096 / sizeof(mz_uint32)];
    mz_uint8 *pBuf = (mz_uint8 *)buf_u32;
    mz_bool sort_central_dir = ((flags & MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY) == 0);
    mz_uint32 zip64_end_of_central_dir_locator_u32[(MZ_ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIZE + sizeof(mz_uint32) - 1) / sizeof(mz_uint32)];
    mz_uint8 *pZip64_locator = (mz_uint8 *)zip64_end_of_central_dir_locator_u32;

    mz_uint32 zip64_end_of_central_dir_header_u32[(MZ_ZIP64_END_OF_CENTRAL_DIR_HEADER_SIZE + sizeof(mz_uint32) - 1) / sizeof(mz_uint32)];
    mz_uint8 *pZip64_end_of_central_dir = (mz_uint8 *)zip64_end_of_central_dir_header_u32;

    mz_uint64 zip64_end_of_central_dir_ofs = 0;

    /* Basic sanity checks - reject files which are too small, and check the first 4 bytes of the file to make sure a local header is there. */
    if (pZip->m_archive_size < MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE)
        return mz_zip_set_error(pZip, MZ_ZIP_NOT_AN_ARCHIVE);

    if (!mz_zip_reader_locate_header_sig(pZip, MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG, MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE, &cur_file_ofs))
        return mz_zip_set_error(pZip, MZ_ZIP_FAILED_FINDING_CENTRAL_DIR);

    /* Read and verify the end of central directory record. */
    if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pBuf, MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) != MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE)
        return mz_zip_set_error(pZip, MZ_ZIP_FILE_READ_FAILED);

    if (MZ_READ_LE32(pBuf + MZ_ZIP_ECDH_SIG_OFS) != MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG)
        return mz_zip_set_error(pZip, MZ_ZIP_NOT_AN_ARCHIVE);

    if (cur_file_ofs >= (MZ_ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIZE + MZ_ZIP64_END_OF_CENTRAL_DIR_HEADER_SIZE))
    {
        if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs - MZ_ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIZE, pZip64_locator, MZ_ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIZE) == MZ_ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIZE)
        {
            if (MZ_READ_LE32(pZip64_locator + MZ_ZIP64_ECDL_SIG_OFS) == MZ_ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIG)
            {
                zip64_end_of_central_dir_ofs = MZ_READ_LE64(pZip64_locator + MZ_ZIP64_ECDL_REL_OFS_TO_ZIP64_ECDR_OFS);
                if (zip64_end_of_central_dir_ofs > (pZip->m_archive_size - MZ_ZIP64_END_OF_CENTRAL_DIR_HEADER_SIZE))
                    return mz_zip_set_error(pZip, MZ_ZIP_NOT_AN_ARCHIVE);

                if (pZip->m_pRead(pZip->m_pIO_opaque, zip64_end_of_central_dir_ofs, pZip64_end_of_central_dir, MZ_ZIP64_END_OF_CENTRAL_DIR_HEADER_SIZE) == MZ_ZIP64_END_OF_CENTRAL_DIR_HEADER_SIZE)
                {
                    if (MZ_READ_LE32(pZip64_end_of_central_dir + MZ_ZIP64_ECDH_SIG_OFS) == MZ_ZIP64_END_OF_CENTRAL_DIR_HEADER_SIG)
                    {
                        pZip->m_pState->m_zip64 = MZ_TRUE;
                    }
                }
            }
        }
    }

    pZip->m_total_files = MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS);
    cdir_entries_on_this_disk = MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS);
    num_this_disk = MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_NUM_THIS_DISK_OFS);
    cdir_disk_index = MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_NUM_DISK_CDIR_OFS);
    cdir_size = MZ_READ_LE32(pBuf + MZ_ZIP_ECDH_CDIR_SIZE_OFS);
    cdir_ofs = MZ_READ_LE32(pBuf + MZ_ZIP_ECDH_CDIR_OFS_OFS);

    if (pZip->m_pState->m_zip64)
    {
        mz_uint32 zip64_total_num_of_disks = MZ_READ_LE32(pZip64_locator + MZ_ZIP64_ECDL_TOTAL_NUMBER_OF_DISKS_OFS);
        mz_uint64 zip64_cdir_total_entries = MZ_READ_LE64(pZip64_end_of_central_dir + MZ_ZIP64_ECDH_CDIR_TOTAL_ENTRIES_OFS);
        mz_uint64 zip64_cdir_total_entries_on_this_disk = MZ_READ_LE64(pZip64_end_of_central_dir + MZ_ZIP64_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS);
        mz_uint64 zip64_size_of_end_of_central_dir_record = MZ_READ_LE64(pZip64_end_of_central_dir + MZ_ZIP64_ECDH_SIZE_OF_RECORD_OFS);
        mz_uint64 zip64_size_of_central_directory = MZ_READ_LE64(pZip64_end_of_central_dir + MZ_ZIP64_ECDH_CDIR_SIZE_OFS);

        if (zip64_size_of_end_of_central_dir_record < (MZ_ZIP64_END_OF_CENTRAL_DIR_HEADER_SIZE - 12))
            return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);

        if (zip64_total_num_of_disks != 1U)
            return mz_zip_set_error(pZip, MZ_ZIP_UNSUPPORTED_MULTIDISK);

        /* Check for miniz's practical limits */
        if (zip64_cdir_total_entries > MZ_UINT32_MAX)
            return mz_zip_set_error(pZip, MZ_ZIP_TOO_MANY_FILES);

        pZip->m_total_files = (mz_uint32)zip64_cdir_total_entries;

        if (zip64_cdir_total_entries_on_this_disk > MZ_UINT32_MAX)
            return mz_zip_set_error(pZip, MZ_ZIP_TOO_MANY_FILES);

        cdir_entries_on_this_disk = (mz_uint32)zip64_cdir_total_entries_on_this_disk;

        /* Check for miniz's current practical limits (sorry, this should be enough for millions of files) */
        if (zip64_size_of_central_directory > MZ_UINT32_MAX)
            return mz_zip_set_error(pZip, MZ_ZIP_UNSUPPORTED_CDIR_SIZE);

        cdir_size = (mz_uint32)zip64_size_of_central_directory;

        num_this_disk = MZ_READ_LE32(pZip64_end_of_central_dir + MZ_ZIP64_ECDH_NUM_THIS_DISK_OFS);

        cdir_disk_index = MZ_READ_LE32(pZip64_end_of_central_dir + MZ_ZIP64_ECDH_NUM_DISK_CDIR_OFS);

        cdir_ofs = MZ_READ_LE64(pZip64_end_of_central_dir + MZ_ZIP64_ECDH_CDIR_OFS_OFS);
    }

    if (pZip->m_total_files != cdir_entries_on_this_disk)
        return mz_zip_set_error(pZip, MZ_ZIP_UNSUPPORTED_MULTIDISK);

    if (((num_this_disk | cdir_disk_index) != 0) && ((num_this_disk != 1) || (cdir_disk_index != 1)))
        return mz_zip_set_error(pZip, MZ_ZIP_UNSUPPORTED_MULTIDISK);

    if (cdir_size < pZip->m_total_files * MZ_ZIP_CENTRAL_DIR_HEADER_SIZE)
        return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);

    if ((cdir_ofs + (mz_uint64)cdir_size) > pZip->m_archive_size)
        return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);

    pZip->m_central_directory_file_ofs = cdir_ofs;

    if (pZip->m_total_files)
    {
        mz_uint i, n;
        /* Read the entire central directory into a heap block, and allocate another heap block to hold the unsorted central dir file record offsets, and possibly another to hold the sorted indices. */
        if ((!mz_zip_array_resize(pZip, &pZip->m_pState->m_central_dir, cdir_size, MZ_FALSE)) ||
            (!mz_zip_array_resize(pZip, &pZip->m_pState->m_central_dir_offsets, pZip->m_total_files, MZ_FALSE)))
            return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);

        if (sort_central_dir)
        {
            if (!mz_zip_array_resize(pZip, &pZip->m_pState->m_sorted_central_dir_offsets, pZip->m_total_files, MZ_FALSE))
                return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);
        }

        if (pZip->m_pRead(pZip->m_pIO_opaque, cdir_ofs, pZip->m_pState->m_central_dir.m_p, cdir_size) != cdir_size)
            return mz_zip_set_error(pZip, MZ_ZIP_FILE_READ_FAILED);

        /* Now create an index into the central directory file records, do some basic sanity checking on each record */
        p = (const mz_uint8 *)pZip->m_pState->m_central_dir.m_p;
        for (n = cdir_size, i = 0; i < pZip->m_total_files; ++i)
        {
            mz_uint total_header_size, disk_index, bit_flags, filename_size, ext_data_size;
            mz_uint64 comp_size, decomp_size, local_header_ofs;

            if ((n < MZ_ZIP_CENTRAL_DIR_HEADER_SIZE) || (MZ_READ_LE32(p) != MZ_ZIP_CENTRAL_DIR_HEADER_SIG))
                return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);

            MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, i) = (mz_uint32)(p - (const mz_uint8 *)pZip->m_pState->m_central_dir.m_p);

            if (sort_central_dir)
                MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_sorted_central_dir_offsets, mz_uint32, i) = i;

            comp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS);
            decomp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS);
            local_header_ofs = MZ_READ_LE32(p + MZ_ZIP_CDH_LOCAL_HEADER_OFS);
            filename_size = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS);
            ext_data_size = MZ_READ_LE16(p + MZ_ZIP_CDH_EXTRA_LEN_OFS);

            if ((!pZip->m_pState->m_zip64_has_extended_info_fields) &&
                (ext_data_size) &&
                (MZ_MAX(MZ_MAX(comp_size, decomp_size), local_header_ofs) == MZ_UINT32_MAX))
            {
                /* Attempt to find zip64 extended information field in the entry's extra data */
                mz_uint32 extra_size_remaining = ext_data_size;

                if (extra_size_remaining)
                {
                    const mz_uint8 *pExtra_data = p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + filename_size;

                    do
                    {
                        mz_uint32 field_id;
                        mz_uint32 field_data_size;

                        if (extra_size_remaining < (sizeof(mz_uint16) * 2))
                            return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);

                        field_id = MZ_READ_LE16(pExtra_data);
                        field_data_size = MZ_READ_LE16(pExtra_data + sizeof(mz_uint16));

                        if ((field_data_size + sizeof(mz_uint16) * 2) > extra_size_remaining)
                            return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);

                        if (field_id == MZ_ZIP64_EXTENDED_INFORMATION_FIELD_HEADER_ID)
                        {
                            /* Ok, the archive didn't have any zip64 headers but it uses a zip64 extended information field so mark it as zip64 anyway (this can occur with infozip's zip util when it reads compresses files from stdin). */
                            pZip->m_pState->m_zip64 = MZ_TRUE;
                            pZip->m_pState->m_zip64_has_extended_info_fields = MZ_TRUE;
                            break;
                        }

                        pExtra_data += sizeof(mz_uint16) * 2 + field_data_size;
                        extra_size_remaining = extra_size_remaining - sizeof(mz_uint16) * 2 - field_data_size;
                    } while (extra_size_remaining);
                }
            }

            /* I've seen archives that aren't marked as zip64 that uses zip64 ext data, argh */
            if ((comp_size != MZ_UINT32_MAX) && (decomp_size != MZ_UINT32_MAX))
            {
                if (((!MZ_READ_LE32(p + MZ_ZIP_CDH_METHOD_OFS)) && (decomp_size != comp_size)) || (decomp_size && !comp_size))
                    return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);
            }

            disk_index = MZ_READ_LE16(p + MZ_ZIP_CDH_DISK_START_OFS);
            if ((disk_index == MZ_UINT16_MAX) || ((disk_index != num_this_disk) && (disk_index != 1)))
                return mz_zip_set_error(pZip, MZ_ZIP_UNSUPPORTED_MULTIDISK);

            if (comp_size != MZ_UINT32_MAX)
            {
                if (((mz_uint64)MZ_READ_LE32(p + MZ_ZIP_CDH_LOCAL_HEADER_OFS) + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + comp_size) > pZip->m_archive_size)
                    return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);
            }

            bit_flags = MZ_READ_LE16(p + MZ_ZIP_CDH_BIT_FLAG_OFS);
            if (bit_flags & MZ_ZIP_GENERAL_PURPOSE_BIT_FLAG_LOCAL_DIR_IS_MASKED)
                return mz_zip_set_error(pZip, MZ_ZIP_UNSUPPORTED_ENCRYPTION);

            if ((total_header_size = MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS) + MZ_READ_LE16(p + MZ_ZIP_CDH_EXTRA_LEN_OFS) + MZ_READ_LE16(p + MZ_ZIP_CDH_COMMENT_LEN_OFS)) > n)
                return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);

            n -= total_header_size;
            p += total_header_size;
        }
    }

    if (sort_central_dir)
        mz_zip_reader_sort_central_dir_offsets_by_filename(pZip);

    return MZ_TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1078, %rsp           # imm = 0x1078
movq %rdi, %rbx
movq (%rdi), %rax
cmpq $0x15, %rax
ja 0x8053
xorl %r12d, %r12d
testq %rbx, %rbx
je 0x8578
movl $0x8, 0x1c(%rbx)
jmp 0x8578
movl %esi, -0x2c(%rbp)
leaq -0x1000(%rax), %rcx
xorl %r15d, %r15d
cmpq $0x1001, %rax           # imm = 0x1001
cmovgeq %rcx, %r15
leaq -0x10a0(%rbp), %r12
movq (%rbx), %r14
movq 0x60(%rbx), %rdi
subq %r15, %r14
movl $0x1000, %eax           # imm = 0x1000
cmpq %rax, %r14
movl $0x1000, %r13d          # imm = 0x1000
cmovbq %r14, %r13
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq *0x48(%rbx)
movl $0x1, %ecx
cmpq %r13, %rax
jne 0x8113
cmpq $0x4, %r14
jb 0x80e5
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
addl %r13d, %eax
addl $-0x3, %r13d
leaq (%rax,%rbp), %rdx
addq $-0x10a0, %rdx          # imm = 0xEF60
addq %r15, %rax
negq %rax
cmpl $0x6054b50, (%rdx)      # imm = 0x6054B50
jne 0x80da
movq (%rbx), %rsi
addq %rax, %rsi
cmpq $0x15, %rsi
ja 0x8108
decq %rdx
incq %rax
decl %r13d
jg 0x80c6
testq %r15, %r15
je 0x8113
movq (%rbx), %rax
subq %r15, %rax
leaq -0xffd(%r15), %rdx
xorl %ecx, %ecx
cmpq $0x10015, %rax          # imm = 0x10015
setae %cl
cmovbq %rdx, %r15
jmp 0x8113
negq %rax
movl $0x2, %ecx
movq %rax, %r15
testl %ecx, %ecx
je 0x8071
cmpl $0x2, %ecx
jne 0x8124
xorl %eax, %eax
jmp 0x8129
movb $0x1, %al
xorl %r15d, %r15d
testb %al, %al
je 0x8139
movl $0x7, 0x1c(%rbx)
jmp 0x8575
movq 0x60(%rbx), %rdi
leaq -0x10a0(%rbp), %rdx
movl $0x16, %ecx
movq %r15, %rsi
callq *0x48(%rbx)
cmpq $0x16, %rax
jne 0x856e
cmpl $0x6054b50, -0x10a0(%rbp) # imm = 0x6054B50
jne 0x81aa
cmpq $0x4c, %r15
jl 0x81e0
movq 0x60(%rbx), %rdi
addq $-0x14, %r15
leaq -0xa0(%rbp), %rdx
movl $0x14, %ecx
movq %r15, %rsi
callq *0x48(%rbx)
cmpq $0x14, %rax
jne 0x81e0
cmpl $0x7064b50, -0xa0(%rbp) # imm = 0x7064B50
jne 0x81e0
movq -0x98(%rbp), %rsi
movq (%rbx), %rax
addq $-0x38, %rax
cmpq %rax, %rsi
jbe 0x81b6
movl $0x8, 0x1c(%rbx)
jmp 0x8575
movq 0x60(%rbx), %rdi
leaq -0x80(%rbp), %rdx
movl $0x38, %ecx
callq *0x48(%rbx)
cmpq $0x38, %rax
jne 0x81e0
cmpl $0x6064b50, -0x80(%rbp) # imm = 0x6064B50
jne 0x81e0
movq 0x68(%rbx), %rax
movl $0x1, 0x64(%rax)
movzwl -0x1096(%rbp), %eax
movl %eax, 0x10(%rbx)
movzwl -0x1098(%rbp), %ecx
movzwl -0x109c(%rbp), %r10d
movzwl -0x109a(%rbp), %eax
movl -0x1094(%rbp), %r11d
movl -0x1090(%rbp), %r15d
movq 0x68(%rbx), %r12
cmpl $0x0, 0x64(%r12)
je 0x8271
cmpq $0x2b, -0x7c(%rbp)
ja 0x822a
movl $0x9, 0x1c(%rbx)
jmp 0x8267
cmpl $0x1, -0x90(%rbp)
jne 0x8260
cmpl $0x0, -0x5c(%rbp)
jne 0x8257
movl -0x60(%rbp), %r8d
movl -0x68(%rbp), %esi
movl -0x64(%rbp), %r9d
movl -0x58(%rbp), %edi
movl -0x54(%rbp), %edx
movl %r8d, 0x10(%rbx)
testl %r9d, %r9d
je 0x85a4
movl $0x2, 0x1c(%rbx)
jmp 0x8267
movl $0xa, 0x1c(%rbx)
xorl %edx, %edx
testb %dl, %dl
je 0x8575
movl 0x10(%rbx), %edx
cmpl %ecx, %edx
jne 0x82aa
movl %r10d, %ecx
orl %eax, %ecx
je 0x828a
cmpl $0x1, %r10d
jne 0x82aa
cmpl $0x1, %eax
jne 0x82aa
imull $0x2e, %edx, %eax
cmpl %eax, %r11d
jb 0x829e
movl %r11d, %r13d
leaq (%r15,%r13), %rax
cmpq (%rbx), %rax
jbe 0x82b6
movl $0x9, 0x1c(%rbx)
jmp 0x8575
movl $0xa, 0x1c(%rbx)
jmp 0x8575
movq %r15, 0x8(%rbx)
testl %edx, %edx
je 0x858d
movl %r11d, -0x3c(%rbp)
movl %r10d, -0x40(%rbp)
cmpq %r13, 0x10(%r12)
jae 0x82e9
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0xffe4
testl %eax, %eax
je 0x85b8
movq %r13, 0x8(%r12)
movq 0x68(%rbx), %r14
movl 0x10(%rbx), %r12d
cmpq %r12, 0x30(%r14)
jae 0x8315
leaq 0x20(%r14), %rsi
movq %rbx, %rdi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0xffe4
testl %eax, %eax
je 0x85b8
btl $0xb, -0x2c(%rbp)
movq %r12, 0x28(%r14)
jb 0x8356
movq 0x68(%rbx), %r14
movl 0x10(%rbx), %ecx
cmpq %rcx, 0x50(%r14)
jae 0x8352
leaq 0x40(%r14), %rsi
xorl %r12d, %r12d
movq %rbx, %rdi
movq %rcx, -0x38(%rbp)
movq -0x38(%rbp), %rdx
xorl %ecx, %ecx
callq 0xffe4
movq -0x38(%rbp), %rcx
testl %eax, %eax
je 0x85d8
movq %rcx, 0x48(%r14)
movq 0x60(%rbx), %rdi
movq 0x68(%rbx), %rax
movq (%rax), %rdx
movq %r15, %rsi
movq %r13, %rcx
callq *0x48(%rbx)
cmpq %r13, %rax
jne 0x856e
cmpl $0x0, 0x10(%rbx)
movl -0x3c(%rbp), %ecx
je 0x858d
movq 0x68(%rbx), %rax
movq (%rax), %rdi
xorl %edx, %edx
movq %rdi, -0x38(%rbp)
cmpl $0x2e, %ecx
jb 0x849a
cmpl $0x2014b50, (%rdi)      # imm = 0x2014B50
jne 0x849a
movl %edi, %esi
subl -0x38(%rbp), %esi
btl $0xb, -0x2c(%rbp)
movq 0x20(%rax), %r8
movl %esi, (%r8,%rdx,4)
jb 0x83bd
movq 0x40(%rax), %rsi
movl %edx, (%rsi,%rdx,4)
movl 0x14(%rdi), %r10d
movl 0x18(%rdi), %r11d
movzwl 0x1c(%rdi), %r8d
movzwl 0x1e(%rdi), %esi
movzwl %si, %r9d
cmpl $0x0, 0x68(%rax)
jne 0x83fb
testw %si, %si
je 0x83fb
movl 0x2a(%rdi), %esi
cmpl %r11d, %r10d
movl %r11d, %r14d
cmoval %r10d, %r14d
cmpl %esi, %r14d
cmovbel %esi, %r14d
cmpl $-0x1, %r14d
je 0x84c1
cmpl $-0x1, %r10d
setne %sil
cmpl $-0x1, %r11d
setne %r14b
andb %sil, %r14b
cmpb $0x1, %r14b
jne 0x843f
cmpl $0x0, 0xa(%rdi)
setne %sil
cmpl %r10d, %r11d
sete %r14b
orb %sil, %r14b
cmpb $0x1, %r14b
jne 0x849a
testl %r11d, %r11d
sete %sil
testl %r10d, %r10d
setne %r11b
orb %sil, %r11b
je 0x849a
movzwl 0x22(%rdi), %esi
cmpl $0xffff, %esi           # imm = 0xFFFF
movl -0x40(%rbp), %r11d
je 0x8459
cmpl $0x1, %esi
je 0x8462
cmpl %esi, %r11d
je 0x8462
movl $0xa, 0x1c(%rbx)
jmp 0x84a1
cmpl $-0x1, %r10d
je 0x8477
movl 0x2a(%rdi), %esi
addq %r10, %rsi
addq $0x1e, %rsi
cmpq (%rbx), %rsi
ja 0x849a
testb $0x20, 0x9(%rdi)
jne 0x8552
addl %r9d, %r8d
movzwl 0x20(%rdi), %esi
addl %esi, %r8d
addl $0x2e, %r8d
movl %ecx, %esi
subl %r8d, %esi
jae 0x855e
movl $0x9, 0x1c(%rbx)
xorl %r8d, %r8d
testb %r8b, %r8b
je 0x8575
incq %rdx
movl 0x10(%rbx), %esi
cmpq %rsi, %rdx
jb 0x838d
jmp 0x858d
leaq (%rdi,%r8), %r14
addq $0x2e, %r14
movl %r9d, %r15d
cmpl $0x3, %r15d
jbe 0x84e4
movl %r15d, %esi
movzwl 0x2(%r14), %r12d
leaq 0x4(%r12), %r13
cmpq %rsi, %r13
jbe 0x8503
movl $0x9, 0x1c(%rbx)
movl $0x1, %r13d
xorl %r12d, %r12d
testl %r13d, %r13d
jne 0x853a
testl %r15d, %r15d
jne 0x84cc
jmp 0x83fb
cmpw $0x1, (%r14)
jne 0x8520
movabsq $0x100000001, %rsi      # imm = 0x100000001
movq %rsi, 0x64(%rax)
movl $0x5, %r13d
jmp 0x84f1
addq %r13, %r14
movl $0xfffffffc, %r15d      # imm = 0xFFFFFFFC
addl %r15d, %esi
subl %r12d, %esi
xorl %r13d, %r13d
movb $0x1, %r12b
movl %esi, %r15d
jmp 0x84f4
cmpl $0x5, %r13d
je 0x83fb
testb %r12b, %r12b
jne 0x83fb
jmp 0x84a1
movl $0x5, 0x1c(%rbx)
jmp 0x84a1
movl %r8d, %r8d
addq %r8, %rdi
movb $0x1, %r8b
movl %esi, %ecx
jmp 0x84a4
movl $0x14, 0x1c(%rbx)
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x1078, %rsp           # imm = 0x1078
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %r12d
btl $0xb, -0x2c(%rbp)
jb 0x8578
movq %rbx, %rdi
callq 0xfbe9
jmp 0x8578
testl %edx, %edx
je 0x85c1
movl $0xf, 0x1c(%rbx)
xorl %edx, %edx
movl %esi, %ecx
jmp 0x8269
movl $0x10, 0x1c(%rbx)
jmp 0x8575
movl -0x70(%rbp), %r10d
movl -0x6c(%rbp), %eax
movb $0x1, %dl
movq -0x50(%rbp), %r15
movl %esi, %ecx
movl %edi, %r11d
jmp 0x8269
movl $0x10, 0x1c(%rbx)
jmp 0x8578