// File: /workspace/github_cpp_makefile_star2_O1/jimmiebergmann[P]fbx-file/miniz.c
// Function: mz_zip_writer_init_v2
mz_bool mz_zip_writer_init_v2(mz_zip_archive *pZip, mz_uint64 existing_size, mz_uint flags)
{
    mz_bool zip64 = (flags & MZ_ZIP_FLAG_WRITE_ZIP64) != 0;

    if ((!pZip) || (pZip->m_pState) || (!pZip->m_pWrite) || (pZip->m_zip_mode != MZ_ZIP_MODE_INVALID))
        return mz_zip_set_error(pZip, MZ_ZIP_INVALID_PARAMETER);

    if (flags & MZ_ZIP_FLAG_WRITE_ALLOW_READING)
    {
        if (!pZip->m_pRead)
            return mz_zip_set_error(pZip, MZ_ZIP_INVALID_PARAMETER);
    }

    if (pZip->m_file_offset_alignment)
    {
        /* Ensure user specified file offset alignment is a power of 2. */
        if (pZip->m_file_offset_alignment & (pZip->m_file_offset_alignment - 1))
            return mz_zip_set_error(pZip, MZ_ZIP_INVALID_PARAMETER);
    }

    if (!pZip->m_pAlloc)
        pZip->m_pAlloc = miniz_def_alloc_func;
    if (!pZip->m_pFree)
        pZip->m_pFree = miniz_def_free_func;
    if (!pZip->m_pRealloc)
        pZip->m_pRealloc = miniz_def_realloc_func;

    pZip->m_archive_size = existing_size;
    pZip->m_central_directory_file_ofs = 0;
    pZip->m_total_files = 0;

    if (NULL == (pZip->m_pState = (mz_zip_internal_state *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, sizeof(mz_zip_internal_state))))
        return mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED);

    memset(pZip->m_pState, 0, sizeof(mz_zip_internal_state));

    MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir, sizeof(mz_uint8));
    MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir_offsets, sizeof(mz_uint32));
    MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_sorted_central_dir_offsets, sizeof(mz_uint32));

    pZip->m_pState->m_zip64 = zip64;
    pZip->m_pState->m_zip64_has_extended_info_fields = zip64;

    pZip->m_zip_type = MZ_ZIP_TYPE_USER;
    pZip->m_zip_mode = MZ_ZIP_MODE_WRITING;

    return MZ_TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %r14d, %r14d
testq %rdi, %rdi
je 0xae80
movq %rdi, %rbx
cmpq $0x0, 0x68(%rdi)
je 0xae8e
testq %rbx, %rbx
je 0xae80
movl $0x18, 0x1c(%rbx)
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x50(%rbx)
je 0xae74
cmpl $0x0, 0x14(%rbx)
jne 0xae74
movl %edx, %r15d
testw %r15w, %r15w
jns 0xaeab
cmpq $0x0, 0x48(%rbx)
je 0xae79
movq 0x20(%rbx), %rax
leaq -0x1(%rax), %rcx
testq %rcx, %rax
jne 0xae79
cmpq $0x0, 0x28(%rbx)
jne 0xaeca
leaq -0x771a(%rip), %rax     # 0x37ac
movq %rax, 0x28(%rbx)
cmpq $0x0, 0x30(%rbx)
jne 0xaedc
leaq -0x771b(%rip), %rax     # 0x37bd
movq %rax, 0x30(%rbx)
cmpq $0x0, 0x38(%rbx)
jne 0xaeee
leaq -0x7720(%rip), %rax     # 0x37ca
movq %rax, 0x38(%rbx)
movq %rsi, (%rbx)
movq $0x0, 0x8(%rbx)
movl $0x0, 0x10(%rbx)
movq 0x40(%rbx), %rdi
movl $0x1, %esi
movl $0x98, %edx
callq *0x28(%rbx)
movq %rax, 0x68(%rbx)
testq %rax, %rax
je 0xaf68
shrl $0xe, %r15d
andl $0x1, %r15d
movl $0x98, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0x3160
movq 0x68(%rbx), %rax
movl $0x1, 0x18(%rax)
movl $0x4, %ecx
movl %ecx, 0x38(%rax)
movl %ecx, 0x58(%rax)
movl %r15d, 0x64(%rax)
movl %r15d, 0x68(%rax)
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0x14(%rbx)
movl $0x1, %r14d
jmp 0xae80
movl $0x10, 0x1c(%rbx)
jmp 0xae80