// File: /workspace/github_cpp_makefile_star2_O3/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 $0x548, %rsp            # imm = 0x548
xorl %r14d, %r14d
testq %rdi, %rdi
je 0xd179
movq %rdi, %rbx
movq 0x68(%rdi), %r15
testq %r15, %r15
je 0xd172
cmpl $0x2, 0x14(%rbx)
jne 0xd172
movq %rsi, %r12
cmpq $0x0, 0x48(%rsi)
je 0xd172
movq 0x68(%r12), %rax
cmpl $0x0, 0x64(%rax)
je 0xd10d
cmpl $0x0, 0x64(%r15)
je 0xd172
cmpl %edx, 0x10(%r12)
jbe 0xd172
movq (%rax), %r13
testq %r13, %r13
je 0xd172
movq 0x20(%rax), %rax
movl %edx, %ecx
movl (%rax,%rcx,4), %eax
addq %rax, %r13
cmpl $0x2014b50, (%r13)      # imm = 0x2014B50
jne 0xd3ce
movzwl 0x1c(%r13), %r8d
movzwl 0x20(%r13), %esi
movzwl 0x1e(%r13), %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 0xd18e
movl $0xf, 0x1c(%rbx)
jmp 0xd179
movl $0x18, 0x1c(%rbx)
movl %r14d, %eax
addq $0x548, %rsp            # imm = 0x548
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rbx), %r10
testq %r10, %r10
je 0xd1a7
leal -0x1(%r10), %eax
movl (%rbx), %ecx
andl %eax, %ecx
subl %ecx, %r10d
andl %eax, %r10d
jmp 0xd1aa
xorl %r10d, %r10d
cmpl $0x0, 0x64(%r15)
movl 0x10(%rbx), %eax
je 0xd3da
cmpl $-0x1, %eax
je 0xd3e5
movq %r10, -0x30(%rbp)
movq %r9, -0x40(%rbp)
movq %r8, -0x70(%rbp)
movl %edi, -0x7c(%rbp)
movq %rsi, -0x88(%rbp)
xorl %r14d, %r14d
leaq -0x568(%rbp), %rcx
movq %r12, %rdi
movl %edx, %esi
movq %r13, %rdx
xorl %r8d, %r8d
callq 0xa7a9
testl %eax, %eax
je 0xd179
movq -0x528(%rbp), %rsi
movq (%rbx), %rax
movq %rax, -0x48(%rbp)
movq 0x60(%r12), %rdi
leaq -0xb0(%rbp), %rdx
movl $0x1e, %ecx
movq %rsi, -0x68(%rbp)
callq *0x48(%r12)
cmpq $0x1e, %rax
jne 0xd840
cmpl $0x4034b50, -0xb0(%rbp) # imm = 0x4034B50
jne 0xd3ce
movzwl -0x96(%rbp), %ecx
movzwl -0x94(%rbp), %eax
leal (%rax,%rcx), %edi
addq -0x540(%rbp), %rdi
testl %eax, %eax
je 0xd26d
cmpl $-0x1, -0x9e(%rbp)
je 0xd3f4
cmpl $-0x1, -0x9a(%rbp)
je 0xd3f4
movl $0x0, -0x78(%rbp)
movq -0x48(%rbp), %r8
movq -0x40(%rbp), %rsi
movq -0x30(%rbp), %rdx
cmpl $0x0, 0x64(%r15)
jne 0xd2ad
movl %edx, %eax
movq 0x8(%r15), %rcx
addq %rsi, %rax
addq %r8, %rax
addq %rdi, %rax
addq %rcx, %rax
addq $0xb2, %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
jae 0xd4a8
movq %rdi, -0x50(%rbp)
movq %rbx, %rdi
movq %r8, %rsi
callq 0xc13f
xorl %r14d, %r14d
testl %eax, %eax
je 0xd179
movl -0x30(%rbp), %eax
movq -0x48(%rbp), %rsi
addq %rax, %rsi
movq %rsi, -0x90(%rbp)
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0xd2ed
decq %rax
testq %rsi, %rax
jne 0xda7a
movq 0x60(%rbx), %rdi
leaq -0xb0(%rbp), %rdx
movl $0x1e, %ecx
movq %rsi, -0x48(%rbp)
callq *0x50(%rbx)
cmpq $0x1e, %rax
jne 0xda1d
movq 0x40(%rbx), %rdi
movl $0x10000, %eax          # imm = 0x10000
movq -0x50(%rbp), %rcx
cmpq %rax, %rcx
cmovbq %rcx, %rax
cmpq $0x21, %rax
movl $0x20, %edx
cmovaeq %rax, %rdx
movl $0x1, %esi
callq *0x28(%rbx)
movq %rax, -0x38(%rbp)
testq %rax, %rax
je 0xda6e
movq -0x68(%rbp), %rsi
addq $0x1e, %rsi
addq $0x1e, -0x48(%rbp)
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0xd4d4
movq -0x38(%rbp), %rdx
movl $0x10000, %ecx          # imm = 0x10000
cmpq %rcx, %rax
movq %rax, -0x50(%rbp)
cmovbq %rax, %rcx
movq %rcx, -0x30(%rbp)
movq 0x60(%r12), %rdi
movq %rsi, -0x68(%rbp)
callq *0x48(%r12)
movq -0x30(%rbp), %rcx
cmpq %rcx, %rax
jne 0xd835
movq 0x60(%rbx), %rdi
movq -0x48(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq *0x50(%rbx)
movq -0x30(%rbp), %rcx
cmpq %rcx, %rax
jne 0xda12
movq -0x68(%rbp), %rsi
addq %rcx, %rsi
addq %rcx, -0x48(%rbp)
movq -0x50(%rbp), %rax
subq %rcx, %rax
movq -0x38(%rbp), %rdx
jne 0xd362
jmp 0xd4d8
movl $0x9, 0x1c(%rbx)
jmp 0xd179
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0xd1c1
movl $0x2, 0x1c(%rbx)
xorl %r14d, %r14d
jmp 0xd179
movq %rcx, -0x60(%rbp)
movq %rdi, -0x50(%rbp)
xorps %xmm0, %xmm0
leaq -0xf0(%rbp), %rsi
movaps %xmm0, 0x10(%rsi)
movaps %xmm0, (%rsi)
movl $0x1, 0x18(%rsi)
movq %rax, -0x78(%rbp)
movl %eax, %edx
xorl %r14d, %r14d
movq %rbx, %rdi
movq %rdx, -0x38(%rbp)
xorl %ecx, %ecx
callq 0xfd63
testl %eax, %eax
je 0xd4b4
movq -0xf0(%rbp), %rdx
movq %rdx, -0xb8(%rbp)
movq 0x60(%r12), %rdi
movq -0x528(%rbp), %rax
movq -0x60(%rbp), %rcx
leaq (%rcx,%rax), %rsi
addq $0x1e, %rsi
movq -0x38(%rbp), %rcx
callq *0x48(%r12)
movq -0xb8(%rbp), %rsi
movl $0x14, -0x60(%rbp)
cmpq -0x38(%rbp), %rax
movq -0x78(%rbp), %rdi
jne 0xd4c2
movq %rsi, %rax
cmpl $0x4, %edi
jb 0xd4bb
movzwl 0x2(%rax), %edx
leaq 0x4(%rdx), %rcx
cmpl %ecx, %edi
jb 0xd4bb
cmpw $0x1, (%rax)
sete %r8b
je 0xd76f
addq %rcx, %rax
subl %ecx, %edi
jne 0xd47d
jmp 0xd780
movl $0x1d, 0x1c(%rbx)
jmp 0xd3ec
movl $0x10, %eax
jmp 0xd4cc
movl $0x9, -0x60(%rbp)
movq 0x40(%rbx), %rdi
callq *0x30(%rbx)
movl -0x60(%rbp), %eax
movl %eax, 0x1c(%rbx)
jmp 0xd179
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl %eax, -0x54(%rbp)
testb $0x8, -0xaa(%rbp)
jne 0xd720
movq 0x40(%rbx), %rdi
movq -0x38(%rbp), %rsi
callq *0x30(%rbx)
movq 0x8(%r15), %rax
movq %rax, -0x30(%rbp)
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups 0x1e(%r13), %xmm2
movups %xmm2, -0xd2(%rbp)
movaps %xmm1, -0xe0(%rbp)
movaps %xmm0, -0xf0(%rbp)
cmpl $0x0, 0x64(%r15)
je 0xd84c
leaq -0x540(%rbp), %r8
movq -0x70(%rbp), %rax
leaq (%rax,%r13), %rdx
addq $0x2e, %rdx
xorps %xmm0, %xmm0
leaq -0x110(%rbp), %rdi
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
movl $0x1, 0x18(%rdi)
leaq -0x538(%rbp), %r9
movq $-0x1, -0xdc(%rbp)
movl $0xffffffff, -0xc6(%rbp) # imm = 0xFFFFFFFF
leaq -0x90(%rbp), %rax
movq %rax, (%rsp)
movq %rbx, %rsi
movq %rdx, -0x50(%rbp)
movl -0x7c(%rbp), %ecx
callq 0xda99
testl %eax, %eax
je 0xd873
movq -0x108(%rbp), %rcx
movq %rcx, -0x68(%rbp)
movw %cx, -0xd2(%rbp)
movq 0x8(%r15), %r12
leaq 0x2e(%r12), %rax
movq %rax, -0x40(%rbp)
cmpq %rax, 0x10(%r15)
jae 0xd5d8
movq %rbx, %rdi
movq %r15, %rsi
movq -0x40(%rbp), %rdx
movl $0x1, %ecx
callq 0xfd63
testl %eax, %eax
je 0xda29
movq -0x40(%rbp), %rax
movq %rax, 0x8(%r15)
movl 0x18(%r15), %eax
imulq %rax, %r12
addq (%r15), %r12
imulq $0x2e, %rax, %rdx
leaq -0xf0(%rbp), %rsi
movq %r12, %rdi
callq 0x31e0
movq 0x8(%r15), %r12
movq -0x70(%rbp), %rax
addq %r12, %rax
movq %rax, -0x40(%rbp)
cmpq %rax, 0x10(%r15)
jae 0xd62f
movq %rbx, %rdi
movq %r15, %rsi
movq -0x40(%rbp), %rdx
movl $0x1, %ecx
callq 0xfd63
testl %eax, %eax
je 0xda39
addq $0x2e, %r13
movq -0x40(%rbp), %rax
movq %rax, 0x8(%r15)
movl 0x18(%r15), %eax
imulq %rax, %r12
addq (%r15), %r12
movq -0x70(%rbp), %rdx
imulq %rax, %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x31e0
movq -0x110(%rbp), %rax
movq %rax, -0x40(%rbp)
movq 0x8(%r15), %r12
movq -0x68(%rbp), %rax
leaq (%r12,%rax), %r13
cmpq %r13, 0x10(%r15)
jae 0xd691
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl $0x1, %ecx
callq 0xfd63
testl %eax, %eax
je 0xd9d1
movq %r13, 0x8(%r15)
movl 0x18(%r15), %eax
imulq %rax, %r12
addq (%r15), %r12
movq -0x68(%rbp), %rdx
imulq %rax, %rdx
movq %r12, %rdi
movq -0x40(%rbp), %rsi
callq 0x31e0
movq 0x8(%r15), %r12
movq -0x88(%rbp), %rax
leaq (%r12,%rax), %r13
cmpq %r13, 0x10(%r15)
jae 0xd6e4
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl $0x1, %ecx
callq 0xfd63
testl %eax, %eax
je 0xd9d1
movl -0x7c(%rbp), %eax
movq -0x50(%rbp), %rsi
addq %rax, %rsi
movq %r13, 0x8(%r15)
movl 0x18(%r15), %eax
imulq %rax, %r12
addq (%r15), %r12
movq -0x88(%rbp), %rdx
imulq %rax, %rdx
movq %r12, %rdi
callq 0x31e0
movq 0x40(%rbx), %rdi
movq -0x40(%rbp), %rsi
callq *0x30(%rbx)
jmp 0xd933
movq 0x68(%r12), %rax
cmpl $0x0, 0x64(%rax)
sete %cl
movl -0x78(%rbp), %edx
notb %dl
movq 0x48(%r12), %rax
movq 0x60(%r12), %rdi
testb %cl, %dl
jne 0xd79c
movl $0x18, %ecx
movq -0x38(%rbp), %rdx
callq *%rax
cmpq $0x18, %rax
jne 0xd835
xorl %eax, %eax
movq -0x38(%rbp), %rcx
cmpl $0x8074b50, (%rcx)      # imm = 0x8074B50
sete %al
leal 0x14(,%rax,4), %eax
jmp 0xd9ec
movl $0x9, -0x60(%rbp)
cmpw $0x10, %dx
jb 0xd4c2
movl %r8d, -0x78(%rbp)
movq 0x40(%rbx), %rdi
callq *0x30(%rbx)
movq -0x48(%rbp), %r8
movq -0x40(%rbp), %rsi
movq -0x50(%rbp), %rdi
jmp 0xd27c
movl $0x10, %ecx
movq -0x38(%rbp), %rdx
callq *%rax
cmpq $0x10, %rax
jne 0xd835
movq -0x38(%rbp), %rax
movl (%rax), %eax
movq 0x68(%rbx), %rcx
cmpl $0x0, 0x64(%rcx)
je 0xd9db
movl $0x8074b50, %esi        # imm = 0x8074B50
xorl %edi, %edi
cmpl %esi, %eax
sete %dil
movq -0x38(%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)
xorl %ecx, %ecx
movl %ecx, 0xc(%rax)
movl %edi, %edx
movb %dl, 0x10(%rax)
movb %dh, 0x11(%rax)
movl %edi, %esi
shrl $0x10, %edx
movb %dl, 0x12(%rax)
shrl $0x18, %esi
movb %sil, 0x13(%rax)
movl %ecx, 0x14(%rax)
movl $0x18, %eax
jmp 0xd9ec
movq 0x40(%rbx), %rdi
movq -0x38(%rbp), %rsi
callq *0x30(%rbx)
movl $0x14, 0x1c(%rbx)
jmp 0xd179
movq -0x48(%rbp), %rax
shrq $0x20, %rax
jne 0xd867
movq -0x90(%rbp), %rax
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
cmpq %rcx, %rax
jbe 0xd886
movl $0x1d, 0x1c(%rbx)
jmp 0xd179
movq 0x40(%rbx), %rdi
movq -0x110(%rbp), %rsi
callq *0x30(%rbx)
jmp 0xd179
movl %eax, -0xc6(%rbp)
movq -0x30(%rbp), %rax
leaq 0x2e(%rax), %r12
cmpq %r12, 0x10(%r15)
jae 0xd8b5
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movl $0x1, %ecx
callq 0xfd63
testl %eax, %eax
je 0xda6e
movq %r12, 0x8(%r15)
movl 0x18(%r15), %eax
movq -0x30(%rbp), %rdi
imulq %rax, %rdi
addq (%r15), %rdi
imulq $0x2e, %rax, %rdx
leaq -0xf0(%rbp), %rsi
callq 0x31e0
movq 0x8(%r15), %r12
movq -0x40(%rbp), %rax
addq %r12, %rax
movq %rax, -0x70(%rbp)
cmpq %rax, 0x10(%r15)
jae 0xd909
movq %rbx, %rdi
movq %r15, %rsi
movq -0x70(%rbp), %rdx
movl $0x1, %ecx
callq 0xfd63
testl %eax, %eax
je 0xda47
addq $0x2e, %r13
movq -0x70(%rbp), %rax
movq %rax, 0x8(%r15)
movl 0x18(%r15), %eax
imulq %rax, %r12
addq (%r15), %r12
movq -0x40(%rbp), %rdx
imulq %rax, %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x31e0
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq %rax, 0x8(%r15)
jbe 0xd96e
movq -0x30(%rbp), %rax
cmpq %rax, 0x10(%r15)
jae 0xd961
movq %rbx, %rdi
movq %r15, %rsi
movq -0x30(%rbp), %rdx
xorl %ecx, %ecx
callq 0xfd63
testl %eax, %eax
je 0xd169
movq -0x30(%rbp), %rax
movq %rax, 0x8(%r15)
jmp 0xd169
movq -0x30(%rbp), %rax
movl %eax, -0x54(%rbp)
movq 0x28(%r15), %r12
leaq 0x1(%r12), %r13
cmpq %r13, 0x30(%r15)
jae 0xd9a0
leaq 0x20(%r15), %rsi
movq %rbx, %rdi
movq %r13, %rdx
movl $0x1, %ecx
callq 0xfd63
testl %eax, %eax
je 0xda47
movq %r13, 0x28(%r15)
movl 0x38(%r15), %edx
imulq %rdx, %r12
addq 0x20(%r15), %r12
leaq -0x54(%rbp), %rsi
movq %r12, %rdi
callq 0x31e0
incl 0x10(%rbx)
movq -0x48(%rbp), %rax
movq %rax, (%rbx)
movl $0x1, %r14d
jmp 0xd179
movq 0x40(%rbx), %rdi
movq -0x40(%rbp), %rsi
jmp 0xda44
xorl %ecx, %ecx
cmpl $0x8074b50, %eax        # imm = 0x8074B50
sete %cl
leal 0xc(,%rcx,4), %eax
movl %eax, -0x54(%rbp)
movq 0x60(%rbx), %rdi
movl %eax, %r12d
movq -0x48(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq %r12, %rcx
callq *0x50(%rbx)
cmpq %r12, %rax
jne 0xda12
addq %r12, -0x48(%rbp)
jmp 0xd4ec
movq 0x40(%rbx), %rdi
movq -0x38(%rbp), %rsi
callq *0x30(%rbx)
movl $0x13, 0x1c(%rbx)
jmp 0xd179
movq 0x40(%rbx), %rdi
movq -0x110(%rbp), %rsi
callq *0x30(%rbx)
jmp 0xda6e
movq 0x40(%rbx), %rdi
movq -0x110(%rbp), %rsi
callq *0x30(%rbx)
movq -0x30(%rbp), %rax
cmpq %rax, 0x10(%r15)
jae 0xda66
movq %rbx, %rdi
movq %r15, %rsi
movq -0x30(%rbp), %rdx
xorl %ecx, %ecx
callq 0xfd63
testl %eax, %eax
je 0xda6e
movq -0x30(%rbp), %rax
movq %rax, 0x8(%r15)
movl $0x10, 0x1c(%rbx)
jmp 0xd179
leaq 0x97c6(%rip), %rdi      # 0x17247
leaq 0x96b6(%rip), %rsi      # 0x1713e
leaq 0x99e5(%rip), %rcx      # 0x17474
movl $0x1adf, %edx           # imm = 0x1ADF
callq 0x3170