// File: /workspace/github_cpp_makefile_star2_O2/jimmiebergmann[P]fbx-file/miniz.c
// Function: mz_zip_writer_add_from_zip_reader
mz_bool mz_zip_writer_add_from_zip_reader(mz_zip_archive *pZip, mz_zip_archive *pSource_zip, mz_uint src_file_index)
{
    mz_uint n, bit_flags, num_alignment_padding_bytes, src_central_dir_following_data_size;
    mz_uint64 src_archive_bytes_remaining, local_dir_header_ofs;
    mz_uint64 cur_src_file_ofs, cur_dst_file_ofs;
    mz_uint32 local_header_u32[(MZ_ZIP_LOCAL_DIR_HEADER_SIZE + sizeof(mz_uint32) - 1) / sizeof(mz_uint32)];
    mz_uint8 *pLocal_header = (mz_uint8 *)local_header_u32;
    mz_uint8 new_central_header[MZ_ZIP_CENTRAL_DIR_HEADER_SIZE];
    size_t orig_central_dir_size;
    mz_zip_internal_state *pState;
    void *pBuf;
    const mz_uint8 *pSrc_central_header;
    mz_zip_archive_file_stat src_file_stat;
    mz_uint32 src_filename_len, src_comment_len, src_ext_len;
    mz_uint32 local_header_filename_size, local_header_extra_len;
    mz_uint64 local_header_comp_size, local_header_uncomp_size;
    mz_bool found_zip64_ext_data_in_ldir = MZ_FALSE;

    /* Sanity checks */
    if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) || (!pSource_zip->m_pRead))
        return mz_zip_set_error(pZip, MZ_ZIP_INVALID_PARAMETER);

    pState = pZip->m_pState;

    /* Don't support copying files from zip64 archives to non-zip64, even though in some cases this is possible */
    if ((pSource_zip->m_pState->m_zip64) && (!pZip->m_pState->m_zip64))
        return mz_zip_set_error(pZip, MZ_ZIP_INVALID_PARAMETER);

    /* Get pointer to the source central dir header and crack it */
    if (NULL == (pSrc_central_header = mz_zip_get_cdh(pSource_zip, src_file_index)))
        return mz_zip_set_error(pZip, MZ_ZIP_INVALID_PARAMETER);

    if (MZ_READ_LE32(pSrc_central_header + MZ_ZIP_CDH_SIG_OFS) != MZ_ZIP_CENTRAL_DIR_HEADER_SIG)
        return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);

    src_filename_len = MZ_READ_LE16(pSrc_central_header + MZ_ZIP_CDH_FILENAME_LEN_OFS);
    src_comment_len = MZ_READ_LE16(pSrc_central_header + MZ_ZIP_CDH_COMMENT_LEN_OFS);
    src_ext_len = MZ_READ_LE16(pSrc_central_header + MZ_ZIP_CDH_EXTRA_LEN_OFS);
    src_central_dir_following_data_size = src_filename_len + src_ext_len + src_comment_len;

    /* TODO: We don't support central dir's >= MZ_UINT32_MAX bytes right now (+32 fudge factor in case we need to add more extra data) */
    if ((pState->m_central_dir.m_size + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + src_central_dir_following_data_size + 32) >= MZ_UINT32_MAX)
        return mz_zip_set_error(pZip, MZ_ZIP_UNSUPPORTED_CDIR_SIZE);

    num_alignment_padding_bytes = mz_zip_writer_compute_padding_needed_for_file_alignment(pZip);

    if (!pState->m_zip64)
    {
        if (pZip->m_total_files == MZ_UINT16_MAX)
            return mz_zip_set_error(pZip, MZ_ZIP_TOO_MANY_FILES);
    }
    else
    {
        /* TODO: Our zip64 support still has some 32-bit limits that may not be worth fixing. */
        if (pZip->m_total_files == MZ_UINT32_MAX)
            return mz_zip_set_error(pZip, MZ_ZIP_TOO_MANY_FILES);
    }

    if (!mz_zip_file_stat_internal(pSource_zip, src_file_index, pSrc_central_header, &src_file_stat, NULL))
        return MZ_FALSE;

    cur_src_file_ofs = src_file_stat.m_local_header_ofs;
    cur_dst_file_ofs = pZip->m_archive_size;

    /* Read the source archive's local dir header */
    if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, cur_src_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != MZ_ZIP_LOCAL_DIR_HEADER_SIZE)
        return mz_zip_set_error(pZip, MZ_ZIP_FILE_READ_FAILED);

    if (MZ_READ_LE32(pLocal_header) != MZ_ZIP_LOCAL_DIR_HEADER_SIG)
        return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);

    cur_src_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE;

    /* Compute the total size we need to copy (filename+extra data+compressed data) */
    local_header_filename_size = MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_FILENAME_LEN_OFS);
    local_header_extra_len = MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_EXTRA_LEN_OFS);
    local_header_comp_size = MZ_READ_LE32(pLocal_header + MZ_ZIP_LDH_COMPRESSED_SIZE_OFS);
    local_header_uncomp_size = MZ_READ_LE32(pLocal_header + MZ_ZIP_LDH_DECOMPRESSED_SIZE_OFS);
    src_archive_bytes_remaining = local_header_filename_size + local_header_extra_len + src_file_stat.m_comp_size;

    /* Try to find a zip64 extended information field */
    if ((local_header_extra_len) && ((local_header_comp_size == MZ_UINT32_MAX) || (local_header_uncomp_size == MZ_UINT32_MAX)))
    {
        mz_zip_array file_data_array;
        const mz_uint8 *pExtra_data;
        mz_uint32 extra_size_remaining = local_header_extra_len;

        mz_zip_array_init(&file_data_array, 1);
        if (!mz_zip_array_resize(pZip, &file_data_array, local_header_extra_len, MZ_FALSE))
        {
            return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);
        }

        if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, src_file_stat.m_local_header_ofs + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + local_header_filename_size, file_data_array.m_p, local_header_extra_len) != local_header_extra_len)
        {
            mz_zip_array_clear(pZip, &file_data_array);
            return mz_zip_set_error(pZip, MZ_ZIP_FILE_READ_FAILED);
        }

        pExtra_data = (const mz_uint8 *)file_data_array.m_p;

        do
        {
            mz_uint32 field_id, field_data_size, field_total_size;

            if (extra_size_remaining < (sizeof(mz_uint16) * 2))
            {
                mz_zip_array_clear(pZip, &file_data_array);
                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));
            field_total_size = field_data_size + sizeof(mz_uint16) * 2;

            if (field_total_size > extra_size_remaining)
            {
                mz_zip_array_clear(pZip, &file_data_array);
                return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);
            }

            if (field_id == MZ_ZIP64_EXTENDED_INFORMATION_FIELD_HEADER_ID)
            {
                const mz_uint8 *pSrc_field_data = pExtra_data + sizeof(mz_uint32);

                if (field_data_size < sizeof(mz_uint64) * 2)
                {
                    mz_zip_array_clear(pZip, &file_data_array);
                    return mz_zip_set_error(pZip, MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);
                }

                local_header_uncomp_size = MZ_READ_LE64(pSrc_field_data);
                local_header_comp_size = MZ_READ_LE64(pSrc_field_data + sizeof(mz_uint64)); /* may be 0 if there's a descriptor */

                found_zip64_ext_data_in_ldir = MZ_TRUE;
                break;
            }

            pExtra_data += field_total_size;
            extra_size_remaining -= field_total_size;
        } while (extra_size_remaining);

        mz_zip_array_clear(pZip, &file_data_array);
    }

    if (!pState->m_zip64)
    {
        /* Try to detect if the new archive will most likely wind up too big and bail early (+(sizeof(mz_uint32) * 4) is for the optional descriptor which could be present, +64 is a fudge factor). */
        /* We also check when the archive is finalized so this doesn't need to be perfect. */
        mz_uint64 approx_new_archive_size = cur_dst_file_ofs + num_alignment_padding_bytes + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + src_archive_bytes_remaining + (sizeof(mz_uint32) * 4) +
                                            pState->m_central_dir.m_size + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + src_central_dir_following_data_size + MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE + 64;

        if (approx_new_archive_size >= MZ_UINT32_MAX)
            return mz_zip_set_error(pZip, MZ_ZIP_ARCHIVE_TOO_LARGE);
    }

    /* Write dest archive padding */
    if (!mz_zip_writer_write_zeros(pZip, cur_dst_file_ofs, num_alignment_padding_bytes))
        return MZ_FALSE;

    cur_dst_file_ofs += num_alignment_padding_bytes;

    local_dir_header_ofs = cur_dst_file_ofs;
    if (pZip->m_file_offset_alignment)
    {
        MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignment - 1)) == 0);
    }

    /* The original zip's local header+ext block doesn't change, even with zip64, so we can just copy it over to the dest zip */
    if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != MZ_ZIP_LOCAL_DIR_HEADER_SIZE)
        return mz_zip_set_error(pZip, MZ_ZIP_FILE_WRITE_FAILED);

    cur_dst_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE;

    /* Copy over the source archive bytes to the dest archive, also ensure we have enough buf space to handle optional data descriptor */
    if (NULL == (pBuf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)MZ_MAX(32U, MZ_MIN((mz_uint64)MZ_ZIP_MAX_IO_BUF_SIZE, src_archive_bytes_remaining)))))
        return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);

    while (src_archive_bytes_remaining)
    {
        n = (mz_uint)MZ_MIN((mz_uint64)MZ_ZIP_MAX_IO_BUF_SIZE, src_archive_bytes_remaining);
        if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, cur_src_file_ofs, pBuf, n) != n)
        {
            pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf);
            return mz_zip_set_error(pZip, MZ_ZIP_FILE_READ_FAILED);
        }
        cur_src_file_ofs += n;

        if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pBuf, n) != n)
        {
            pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf);
            return mz_zip_set_error(pZip, MZ_ZIP_FILE_WRITE_FAILED);
        }
        cur_dst_file_ofs += n;

        src_archive_bytes_remaining -= n;
    }

    /* Now deal with the optional data descriptor */
    bit_flags = MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_BIT_FLAG_OFS);
    if (bit_flags & 8)
    {
        /* Copy data descriptor */
        if ((pSource_zip->m_pState->m_zip64) || (found_zip64_ext_data_in_ldir))
        {
            /* src is zip64, dest must be zip64 */

            /* name			uint32_t's */
            /* id				1 (optional in zip64?) */
            /* crc			1 */
            /* comp_size	2 */
            /* uncomp_size 2 */
            if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, cur_src_file_ofs, pBuf, (sizeof(mz_uint32) * 6)) != (sizeof(mz_uint32) * 6))
            {
                pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf);
                return mz_zip_set_error(pZip, MZ_ZIP_FILE_READ_FAILED);
            }

            n = sizeof(mz_uint32) * ((MZ_READ_LE32(pBuf) == MZ_ZIP_DATA_DESCRIPTOR_ID) ? 6 : 5);
        }
        else
        {
            /* src is NOT zip64 */
            mz_bool has_id;

            if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, cur_src_file_ofs, pBuf, sizeof(mz_uint32) * 4) != sizeof(mz_uint32) * 4)
            {
                pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf);
                return mz_zip_set_error(pZip, MZ_ZIP_FILE_READ_FAILED);
            }

            has_id = (MZ_READ_LE32(pBuf) == MZ_ZIP_DATA_DESCRIPTOR_ID);

            if (pZip->m_pState->m_zip64)
            {
                /* dest is zip64, so upgrade the data descriptor */
                const mz_uint32 *pSrc_descriptor = (const mz_uint32 *)((const mz_uint8 *)pBuf + (has_id ? sizeof(mz_uint32) : 0));
                const mz_uint32 src_crc32 = pSrc_descriptor[0];
                const mz_uint64 src_comp_size = pSrc_descriptor[1];
                const mz_uint64 src_uncomp_size = pSrc_descriptor[2];

                mz_write_le32((mz_uint8 *)pBuf, MZ_ZIP_DATA_DESCRIPTOR_ID);
                mz_write_le32((mz_uint8 *)pBuf + sizeof(mz_uint32) * 1, src_crc32);
                mz_write_le64((mz_uint8 *)pBuf + sizeof(mz_uint32) * 2, src_comp_size);
                mz_write_le64((mz_uint8 *)pBuf + sizeof(mz_uint32) * 4, src_uncomp_size);

                n = sizeof(mz_uint32) * 6;
            }
            else
            {
                /* dest is NOT zip64, just copy it as-is */
                n = sizeof(mz_uint32) * (has_id ? 4 : 3);
            }
        }

        if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pBuf, n) != n)
        {
            pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf);
            return mz_zip_set_error(pZip, MZ_ZIP_FILE_WRITE_FAILED);
        }

        cur_src_file_ofs += n;
        cur_dst_file_ofs += n;
    }
    pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf);

    /* Finally, add the new central dir header */
    orig_central_dir_size = pState->m_central_dir.m_size;

    memcpy(new_central_header, pSrc_central_header, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE);

    if (pState->m_zip64)
    {
        /* This is the painful part: We need to write a new central dir header + ext block with updated zip64 fields, and ensure the old fields (if any) are not included. */
        const mz_uint8 *pSrc_ext = pSrc_central_header + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + src_filename_len;
        mz_zip_array new_ext_block;

        mz_zip_array_init(&new_ext_block, sizeof(mz_uint8));

        MZ_WRITE_LE32(new_central_header + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS, MZ_UINT32_MAX);
        MZ_WRITE_LE32(new_central_header + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS, MZ_UINT32_MAX);
        MZ_WRITE_LE32(new_central_header + MZ_ZIP_CDH_LOCAL_HEADER_OFS, MZ_UINT32_MAX);

        if (!mz_zip_writer_update_zip64_extension_block(&new_ext_block, pZip, pSrc_ext, src_ext_len, &src_file_stat.m_comp_size, &src_file_stat.m_uncomp_size, &local_dir_header_ofs, NULL))
        {
            mz_zip_array_clear(pZip, &new_ext_block);
            return MZ_FALSE;
        }

        MZ_WRITE_LE16(new_central_header + MZ_ZIP_CDH_EXTRA_LEN_OFS, new_ext_block.m_size);

        if (!mz_zip_array_push_back(pZip, &pState->m_central_dir, new_central_header, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE))
        {
            mz_zip_array_clear(pZip, &new_ext_block);
            return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);
        }

        if (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pSrc_central_header + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE, src_filename_len))
        {
            mz_zip_array_clear(pZip, &new_ext_block);
            mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE);
            return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);
        }

        if (!mz_zip_array_push_back(pZip, &pState->m_central_dir, new_ext_block.m_p, new_ext_block.m_size))
        {
            mz_zip_array_clear(pZip, &new_ext_block);
            mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE);
            return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);
        }

        if (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pSrc_central_header + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + src_filename_len + src_ext_len, src_comment_len))
        {
            mz_zip_array_clear(pZip, &new_ext_block);
            mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE);
            return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);
        }

        mz_zip_array_clear(pZip, &new_ext_block);
    }
    else
    {
        /* sanity checks */
        if (cur_dst_file_ofs > MZ_UINT32_MAX)
            return mz_zip_set_error(pZip, MZ_ZIP_ARCHIVE_TOO_LARGE);

        if (local_dir_header_ofs >= MZ_UINT32_MAX)
            return mz_zip_set_error(pZip, MZ_ZIP_ARCHIVE_TOO_LARGE);

        MZ_WRITE_LE32(new_central_header + MZ_ZIP_CDH_LOCAL_HEADER_OFS, local_dir_header_ofs);

        if (!mz_zip_array_push_back(pZip, &pState->m_central_dir, new_central_header, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE))
            return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);

        if (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pSrc_central_header + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE, src_central_dir_following_data_size))
        {
            mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE);
            return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);
        }
    }

    /* This shouldn't trigger unless we screwed up during the initial sanity checks */
    if (pState->m_central_dir.m_size >= MZ_UINT32_MAX)
    {
        /* TODO: Support central dirs >= 32-bits in size */
        mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE);
        return mz_zip_set_error(pZip, MZ_ZIP_UNSUPPORTED_CDIR_SIZE);
    }

    n = (mz_uint32)orig_central_dir_size;
    if (!mz_zip_array_push_back(pZip, &pState->m_central_dir_offsets, &n, 1))
    {
        mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE);
        return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);
    }

    pZip->m_total_files++;
    pZip->m_archive_size = cur_dst_file_ofs;

    return MZ_TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x588, %rsp            # imm = 0x588
xorl %r14d, %r14d
testq %rdi, %rdi
je 0xcf3c
movq %rdi, %rbx
movq 0x68(%rdi), %r15
testq %r15, %r15
je 0xcf35
cmpl $0x2, 0x14(%rbx)
jne 0xcf35
movq %rsi, %r13
cmpq $0x0, 0x48(%rsi)
je 0xcf35
movl %edx, %r12d
movq 0x68(%r13), %rax
cmpl $0x0, 0x64(%rax)
je 0xced4
cmpl $0x0, 0x64(%r15)
je 0xcf35
cmpl %r12d, 0x10(%r13)
jbe 0xcf35
movq (%rax), %rdx
testq %rdx, %rdx
je 0xcf35
movq 0x20(%rax), %rax
movl %r12d, %ecx
movl (%rax,%rcx,4), %eax
addq %rax, %rdx
cmpl $0x2014b50, (%rdx)      # imm = 0x2014B50
jne 0xd174
movzwl 0x1c(%rdx), %r8d
movzwl 0x20(%rdx), %esi
movzwl 0x1e(%rdx), %edi
leal (%rsi,%r8), %r9d
addl %edi, %r9d
movq 0x8(%r15), %rax
addq %r9, %rax
movabsq $-0xffffffff, %rcx      # imm = 0xFFFFFFFF00000001
addq %rcx, %rax
addq $0x4e, %rax
cmpq %rcx, %rax
jae 0xcf51
movl $0xf, 0x1c(%rbx)
jmp 0xcf3c
movl $0x18, 0x1c(%rbx)
movl %r14d, %eax
addq $0x588, %rsp            # imm = 0x588
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r9, -0x40(%rbp)
movq %r8, -0xa8(%rbp)
movq %rdi, -0x78(%rbp)
movq %rsi, -0xb8(%rbp)
movq %rdx, -0x70(%rbp)
movq %rbx, %rdi
callq 0xbf4c
cmpl $0x0, 0x64(%r15)
movl 0x10(%rbx), %ecx
je 0xd180
cmpl $-0x1, %ecx
je 0xd18c
movl %eax, -0x48(%rbp)
xorl %r14d, %r14d
leaq -0x5a8(%rbp), %rcx
movq %r13, %rdi
movl %r12d, %esi
movq -0x70(%rbp), %rdx
xorl %r8d, %r8d
callq 0xa693
testl %eax, %eax
je 0xcf3c
movq -0x568(%rbp), %r12
movq (%rbx), %rax
movq %rax, -0x38(%rbp)
movq 0x60(%r13), %rdi
leaq -0x120(%rbp), %rdx
pushq $0x1e
popq %rcx
movq %r12, %rsi
callq *0x48(%r13)
cmpq $0x1e, %rax
jne 0xd628
cmpl $0x4034b50, -0x120(%rbp) # imm = 0x4034B50
jne 0xd174
movq %r12, -0x60(%rbp)
movzwl -0x106(%rbp), %eax
movzwl -0x104(%rbp), %r12d
leal (%r12,%rax), %edi
addq -0x580(%rbp), %rdi
testl %r12d, %r12d
je 0xd027
cmpl $-0x1, -0x10e(%rbp)
je 0xd198
cmpl $-0x1, -0x10a(%rbp)
je 0xd198
movl $0x0, -0x58(%rbp)
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %r12
movl -0x48(%rbp), %edx
cmpl $0x0, 0x64(%r15)
movl %edx, %r8d
jne 0xd067
movq 0x8(%r15), %rax
addq %r8, %rcx
addq %r12, %rcx
addq %rdi, %rcx
addq %rcx, %rax
addq $0xb2, %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
jae 0xd23f
movq %r8, -0x48(%rbp)
movq %rdi, -0x50(%rbp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0xbf6a
xorl %r14d, %r14d
testl %eax, %eax
je 0xcf3c
addq -0x48(%rbp), %r12
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0xd09e
decq %rax
testq %r12, %rax
jne 0xda10
movq 0x60(%rbx), %rdi
leaq -0x120(%rbp), %rdx
pushq $0x1e
popq %rcx
movq %r12, -0x38(%rbp)
movq %r12, %rsi
callq *0x50(%rbx)
cmpq $0x1e, %rax
jne 0xd807
movq 0x40(%rbx), %rdi
movl $0x10000, %eax          # imm = 0x10000
movq -0x50(%rbp), %rcx
cmpq %rax, %rcx
cmovbq %rcx, %rax
cmpq $0x21, %rax
pushq $0x20
popq %rdx
cmovaeq %rax, %rdx
pushq $0x1
popq %rsi
callq *0x28(%rbx)
testq %rax, %rax
je 0xda04
movq %rax, %rdx
addq $0x1e, -0x60(%rbp)
movq -0x38(%rbp), %rax
addq $0x1e, %rax
movq -0x50(%rbp), %rcx
movq %rdx, -0x30(%rbp)
movq %rax, -0x48(%rbp)
testq %rcx, %rcx
je 0xd273
movl $0x10000, %eax          # imm = 0x10000
cmpq %rax, %rcx
movl $0x10000, %r12d         # imm = 0x10000
movq %rcx, -0x50(%rbp)
cmovbq %rcx, %r12
movq 0x60(%r13), %rdi
movq -0x60(%rbp), %rsi
movq %r12, %rcx
callq *0x48(%r13)
cmpq %r12, %rax
jne 0xd61d
movq 0x60(%rbx), %rdi
movq -0x48(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq %r12, %rcx
callq *0x50(%rbx)
cmpq %r12, %rax
jne 0xd7fc
addq %r12, -0x60(%rbp)
movq -0x48(%rbp), %rax
addq %r12, %rax
movq -0x50(%rbp), %rcx
subq %r12, %rcx
movq -0x30(%rbp), %rdx
jmp 0xd106
movl $0x9, 0x1c(%rbx)
jmp 0xcf3c
cmpl $0xffff, %ecx           # imm = 0xFFFF
jne 0xcf8a
movl $0x2, 0x1c(%rbx)
jmp 0xcf3c
movq %rax, -0x58(%rbp)
movq %rdi, -0x50(%rbp)
xorps %xmm0, %xmm0
leaq -0x100(%rbp), %rsi
movaps %xmm0, 0x10(%rsi)
movaps %xmm0, (%rsi)
movl $0x1, 0x18(%rsi)
movl %r12d, %edx
xorl %r14d, %r14d
movq %rbx, %rdi
movq %rdx, -0x30(%rbp)
xorl %ecx, %ecx
callq 0xf595
testl %eax, %eax
je 0xd24e
movq -0x100(%rbp), %rdx
movq 0x60(%r13), %rdi
movq -0x568(%rbp), %rax
movq -0x58(%rbp), %rcx
leaq (%rcx,%rax), %rsi
addq $0x1e, %rsi
movq %rdx, -0xb0(%rbp)
movq -0x30(%rbp), %rcx
callq *0x48(%r13)
cmpq -0x30(%rbp), %rax
jne 0xd253
pushq $0x9
popq %r8
movq -0xb0(%rbp), %rsi
movq %rsi, %rax
cmpl $0x4, %r12d
jb 0xd25e
movzwl 0x2(%rax), %edx
leaq 0x4(%rdx), %rcx
cmpl %ecx, %r12d
jb 0xd25e
cmpw $0x1, (%rax)
sete %dil
je 0xd512
addq %rcx, %rax
subl %ecx, %r12d
jne 0xd211
jmp 0xd51c
movl $0x1d, 0x1c(%rbx)
xorl %r14d, %r14d
jmp 0xcf3c
pushq $0x10
popq %rax
jmp 0xd26b
pushq $0x14
popq %r8
movq -0xb0(%rbp), %rsi
movq 0x40(%rbx), %rdi
movl %r8d, %r15d
callq *0x30(%rbx)
movl %r15d, %eax
movl %eax, 0x1c(%rbx)
jmp 0xcf3c
movl %r12d, -0x64(%rbp)
testb $0x8, -0x11a(%rbp)
jne 0xd537
movq 0x40(%rbx), %rdi
movq -0x30(%rbp), %rsi
callq *0x30(%rbx)
movq 0x8(%r15), %rax
movq %rax, -0x30(%rbp)
movq -0x70(%rbp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x1e(%rax), %xmm2
movups %xmm2, -0x132(%rbp)
movaps %xmm1, -0x140(%rbp)
movaps %xmm0, -0x150(%rbp)
cmpl $0x0, 0x64(%r15)
je 0xd634
xorps %xmm0, %xmm0
leaq -0xa0(%rbp), %rsi
movaps %xmm0, 0x10(%rsi)
movaps %xmm0, (%rsi)
movl $0x1, 0x18(%rsi)
orq $-0x1, -0x13c(%rbp)
movq -0x78(%rbp), %rax
leaq 0x40(%rax), %rdx
orl $-0x1, -0x126(%rbp)
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xf595
testl %eax, %eax
je 0xd659
andq $0x0, -0x98(%rbp)
movw $0x1, -0x100(%rbp)
movq -0x580(%rbp), %rax
movq -0x578(%rbp), %rcx
movq %rcx, -0xfc(%rbp)
movb %al, -0xf4(%rbp)
movb %ah, -0xf3(%rbp)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, -0xf2(%rbp)
movl %eax, %ecx
shrl $0x18, %ecx
movb %cl, -0xf1(%rbp)
movq %rax, %rcx
shrq $0x20, %rcx
movb %cl, -0xf0(%rbp)
movq %rax, %rcx
shrq $0x28, %rcx
movb %cl, -0xef(%rbp)
movq %rax, %rcx
shrq $0x30, %rcx
movb %cl, -0xee(%rbp)
shrq $0x38, %rax
movb %al, -0xed(%rbp)
movq -0x38(%rbp), %rcx
movb %cl, -0xec(%rbp)
movb %ch, -0xeb(%rbp)
movl %ecx, %eax
shrl $0x10, %eax
movb %al, -0xea(%rbp)
movl %ecx, %eax
shrl $0x18, %eax
movb %al, -0xe9(%rbp)
movq %rcx, %rax
shrq $0x20, %rax
movb %al, -0xe8(%rbp)
movq %rcx, %rax
shrq $0x28, %rax
movb %al, -0xe7(%rbp)
movq %rcx, %rax
shrq $0x30, %rax
movb %al, -0xe6(%rbp)
shrq $0x38, %rcx
movb %cl, -0xe5(%rbp)
movw $0x18, -0xfe(%rbp)
cmpq $0x1b, -0x90(%rbp)
ja 0xd407
leaq -0xa0(%rbp), %rsi
pushq $0x1c
popq %rdx
pushq $0x1
popq %rcx
movq %rbx, %rdi
callq 0xf595
testl %eax, %eax
je 0xd659
movq -0x70(%rbp), %rax
movq -0xa8(%rbp), %rcx
addq %rcx, %rax
addq $0x2e, %rax
movq %rax, -0x58(%rbp)
movq $0x1c, -0x98(%rbp)
movq -0xa0(%rbp), %rdi
movl -0x88(%rbp), %eax
imulq $0x1c, %rax, %rdx
leaq -0x100(%rbp), %rsi
movq %rdi, -0x60(%rbp)
callq 0x31f0
cmpl $0x0, -0x78(%rbp)
je 0xd67c
pushq $0x1c
popq %rax
movq %rax, -0x50(%rbp)
movq -0x78(%rbp), %rax
movl %eax, -0x40(%rbp)
movq -0x58(%rbp), %r12
cmpl $0x3, -0x40(%rbp)
jbe 0xd662
movzwl 0x2(%r12), %r13d
addq $0x4, %r13
cmpl %r13d, -0x40(%rbp)
jb 0xd662
cmpw $0x1, (%r12)
je 0xd4f9
movq -0x50(%rbp), %rax
addq %r13, %rax
movq %rax, -0x38(%rbp)
cmpq %rax, -0x90(%rbp)
jae 0xd4c8
movq %rbx, %rdi
leaq -0xa0(%rbp), %rsi
movq -0x38(%rbp), %rdx
pushq $0x1
popq %rcx
callq 0xf595
testl %eax, %eax
je 0xd659
movq -0xa0(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x98(%rbp)
movl -0x88(%rbp), %edx
movq -0x50(%rbp), %rdi
imulq %rdx, %rdi
addq -0x60(%rbp), %rdi
imulq %r13, %rdx
movq %r12, %rsi
callq 0x31f0
movq -0x38(%rbp), %rax
movq %rax, -0x50(%rbp)
addq %r13, %r12
subl %r13d, -0x40(%rbp)
jne 0xd465
movq -0x98(%rbp), %rax
jmp 0xd67f
cmpw $0x10, %dx
jb 0xd25e
movl %edi, -0x58(%rbp)
movq 0x40(%rbx), %rdi
callq *0x30(%rbx)
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %r12
movq -0x50(%rbp), %rdi
jmp 0xd036
movq 0x68(%r13), %rax
cmpl $0x0, 0x64(%rax)
sete %cl
movl -0x58(%rbp), %edx
notb %dl
movq 0x48(%r13), %rax
movq 0x60(%r13), %rdi
testb %cl, %dl
jne 0xd585
pushq $0x18
popq %rcx
movq -0x60(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq *%rax
cmpq $0x18, %rax
jne 0xd61d
xorl %eax, %eax
movq -0x30(%rbp), %rcx
cmpl $0x8074b50, (%rcx)      # imm = 0x8074B50
sete %al
leal 0x14(,%rax,4), %eax
jmp 0xd7d6
pushq $0x10
popq %rcx
movq -0x60(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq *%rax
cmpq $0x10, %rax
jne 0xd61d
movq -0x30(%rbp), %rax
movl (%rax), %eax
movq 0x68(%rbx), %rcx
cmpl $0x0, 0x64(%rcx)
je 0xd7c5
movl $0x8074b50, %esi        # imm = 0x8074B50
xorl %edi, %edi
cmpl %esi, %eax
sete %dil
movq -0x30(%rbp), %rax
movl (%rax,%rdi,4), %edx
movl 0x4(%rax,%rdi,4), %ecx
movl 0x8(%rax,%rdi,4), %edi
movl %esi, (%rax)
movb %dl, 0x4(%rax)
movb %dh, 0x5(%rax)
movl %edx, %esi
shrl $0x10, %esi
movb %sil, 0x6(%rax)
shrl $0x18, %edx
movb %dl, 0x7(%rax)
movb %cl, 0x8(%rax)
movb %ch, 0x9(%rax)
movl %ecx, %edx
shrl $0x10, %edx
movb %dl, 0xa(%rax)
shrl $0x18, %ecx
movb %cl, 0xb(%rax)
andl $0x0, 0xc(%rax)
movl %edi, %edx
movb %dl, 0x10(%rax)
movb %dh, 0x11(%rax)
movl %edi, %ecx
shrl $0x10, %ecx
movb %cl, 0x12(%rax)
shrl $0x18, %edx
movb %dl, 0x13(%rax)
andl $0x0, 0x14(%rax)
pushq $0x18
popq %rax
jmp 0xd7d6
movq 0x40(%rbx), %rdi
movq -0x30(%rbp), %rsi
callq *0x30(%rbx)
movl $0x14, 0x1c(%rbx)
jmp 0xcf3c
movq -0x48(%rbp), %rax
shrq $0x20, %rax
jne 0xd64d
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq %rax, -0x38(%rbp)
jbe 0xd71a
movl $0x1d, 0x1c(%rbx)
jmp 0xcf3c
movl $0x10, 0x1c(%rbx)
jmp 0xd669
movl $0x9, 0x1c(%rbx)
movq 0x40(%rbx), %rdi
movq -0xa0(%rbp), %rsi
callq *0x30(%rbx)
jmp 0xd246
pushq $0x1c
popq %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movw %ax, -0x132(%rbp)
movq 0x8(%r15), %r12
leaq 0x2e(%r12), %r13
cmpq %r13, 0x10(%r15)
jae 0xd6b6
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xf595
testl %eax, %eax
je 0xd9c3
movq %r13, 0x8(%r15)
movl 0x18(%r15), %eax
imulq %rax, %r12
addq (%r15), %r12
imulq $0x2e, %rax, %rdx
leaq -0x150(%rbp), %rsi
movq %r12, %rdi
callq 0x31f0
movq 0x8(%r15), %r12
movq -0xa8(%rbp), %rax
leaq (%r12,%rax), %r13
cmpq %r13, 0x10(%r15)
jae 0xd813
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xf595
movq -0xa0(%rbp), %rcx
movq %rcx, -0x38(%rbp)
testl %eax, %eax
jne 0xd81e
jmp 0xd98f
movq -0x38(%rbp), %rax
movl %eax, -0x126(%rbp)
movq -0x30(%rbp), %rax
leaq 0x2e(%rax), %r12
cmpq %r12, 0x10(%r15)
jae 0xd74b
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xf595
testl %eax, %eax
je 0xda04
movq %r12, 0x8(%r15)
movl 0x18(%r15), %eax
movq -0x30(%rbp), %rdi
imulq %rax, %rdi
addq (%r15), %rdi
imulq $0x2e, %rax, %rdx
leaq -0x150(%rbp), %rsi
callq 0x31f0
movq 0x8(%r15), %r12
movq -0x40(%rbp), %rax
leaq (%r12,%rax), %r13
cmpq %r13, 0x10(%r15)
jae 0xd799
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xf595
testl %eax, %eax
je 0xd9dd
movq -0x70(%rbp), %rsi
addq $0x2e, %rsi
movq %r13, 0x8(%r15)
movl 0x18(%r15), %eax
imulq %rax, %r12
addq (%r15), %r12
movq -0x40(%rbp), %rdx
imulq %rax, %rdx
movq %r12, %rdi
callq 0x31f0
jmp 0xd8f9
xorl %ecx, %ecx
cmpl $0x8074b50, %eax        # imm = 0x8074B50
sete %cl
leal 0xc(,%rcx,4), %eax
movl %eax, -0x64(%rbp)
movq 0x60(%rbx), %rdi
movl %eax, %r12d
movq -0x48(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq %r12, %rcx
callq *0x50(%rbx)
cmpq %r12, %rax
jne 0xd7fc
addq %r12, -0x48(%rbp)
jmp 0xd284
movq 0x40(%rbx), %rdi
movq -0x30(%rbp), %rsi
callq *0x30(%rbx)
movl $0x13, 0x1c(%rbx)
jmp 0xcf3c
movq -0xa0(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x70(%rbp), %rsi
addq $0x2e, %rsi
movq %r13, 0x8(%r15)
movl 0x18(%r15), %eax
imulq %rax, %r12
addq (%r15), %r12
movq -0xa8(%rbp), %rdx
imulq %rax, %rdx
movq %r12, %rdi
callq 0x31f0
movq 0x8(%r15), %r12
movq -0x40(%rbp), %rax
leaq (%r12,%rax), %r13
cmpq %r13, 0x10(%r15)
jae 0xd873
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xf595
testl %eax, %eax
je 0xd98f
movq %r13, 0x8(%r15)
movl 0x18(%r15), %eax
imulq %rax, %r12
addq (%r15), %r12
movq -0x40(%rbp), %rdx
imulq %rax, %rdx
movq %r12, %rdi
movq -0x38(%rbp), %rsi
callq 0x31f0
movq 0x8(%r15), %r12
movq -0xb8(%rbp), %rax
leaq (%r12,%rax), %r13
cmpq %r13, 0x10(%r15)
jae 0xd8c4
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xf595
testl %eax, %eax
je 0xd98f
movq -0x58(%rbp), %rsi
addq -0x78(%rbp), %rsi
movq %r13, 0x8(%r15)
movl 0x18(%r15), %eax
imulq %rax, %r12
addq (%r15), %r12
movq -0xb8(%rbp), %rdx
imulq %rax, %rdx
movq %r12, %rdi
callq 0x31f0
movq 0x40(%rbx), %rdi
movq -0x38(%rbp), %rsi
callq *0x30(%rbx)
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq %rax, 0x8(%r15)
jbe 0xd934
movq -0x30(%rbp), %rax
cmpq %rax, 0x10(%r15)
jae 0xd927
movq %rbx, %rdi
movq %r15, %rsi
movq -0x30(%rbp), %rdx
xorl %ecx, %ecx
callq 0xf595
testl %eax, %eax
je 0xcf2c
movq -0x30(%rbp), %rax
movq %rax, 0x8(%r15)
jmp 0xcf2c
movq -0x30(%rbp), %rax
movl %eax, -0x64(%rbp)
movq 0x28(%r15), %r12
leaq 0x1(%r12), %r13
cmpq %r13, 0x30(%r15)
jae 0xd960
leaq 0x20(%r15), %rsi
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r13, %rdx
callq 0xf595
testl %eax, %eax
je 0xd9dd
pushq $0x1
popq %r14
movq %r13, 0x28(%r15)
movl 0x38(%r15), %edx
imulq %rdx, %r12
addq 0x20(%r15), %r12
leaq -0x64(%rbp), %rsi
movq %r12, %rdi
callq 0x31f0
incl 0x10(%rbx)
movq -0x48(%rbp), %rax
movq %rax, (%rbx)
jmp 0xcf3c
movq 0x40(%rbx), %rdi
movq -0x38(%rbp), %rsi
callq *0x30(%rbx)
movq -0x30(%rbp), %rax
cmpq %rax, 0x10(%r15)
jae 0xd9b9
movq %rbx, %rdi
movq %r15, %rsi
movq -0x30(%rbp), %rdx
xorl %ecx, %ecx
callq 0xf595
testl %eax, %eax
je 0xd9d1
movq -0x30(%rbp), %rax
movq %rax, 0x8(%r15)
jmp 0xd9d1
movq 0x40(%rbx), %rdi
movq -0xa0(%rbp), %rsi
callq *0x30(%rbx)
movl $0x10, 0x1c(%rbx)
jmp 0xd246
movq -0x30(%rbp), %rax
cmpq %rax, 0x10(%r15)
jae 0xd9fc
movq %rbx, %rdi
movq %r15, %rsi
movq -0x30(%rbp), %rdx
xorl %ecx, %ecx
callq 0xf595
testl %eax, %eax
je 0xda04
movq -0x30(%rbp), %rax
movq %rax, 0x8(%r15)
movl $0x10, 0x1c(%rbx)
jmp 0xcf3c
leaq 0x8810(%rip), %rdi      # 0x16227
leaq 0x8700(%rip), %rsi      # 0x1611e
leaq 0x8a2f(%rip), %rcx      # 0x16454
movl $0x1adf, %edx           # imm = 0x1ADF
callq 0x3190