// File: /workspace/github_cpp_makefile_star2_O2/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 %r15d, %r15d
testq %rdi, %rdi
je 0xac65
movq %rdi, %rbx
cmpq $0x0, 0x68(%rdi)
je 0xac73
movl $0x18, 0x1c(%rbx)
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x50(%rbx)
je 0xac5e
cmpl $0x0, 0x14(%rbx)
jne 0xac5e
movl %edx, %r14d
testw %r14w, %r14w
jns 0xac90
cmpq $0x0, 0x48(%rbx)
je 0xac5e
movq 0x20(%rbx), %rax
leaq -0x1(%rax), %rcx
testq %rcx, %rax
jne 0xac5e
movq 0x28(%rbx), %rax
testq %rax, %rax
jne 0xacb1
leaq -0x7542(%rip), %rax     # 0x376b
movq %rax, 0x28(%rbx)
cmpq $0x0, 0x30(%rbx)
jne 0xacc3
leaq -0x7543(%rip), %rcx     # 0x377c
movq %rcx, 0x30(%rbx)
cmpq $0x0, 0x38(%rbx)
jne 0xacd5
leaq -0x7548(%rip), %rcx     # 0x3789
movq %rcx, 0x38(%rbx)
movq %rsi, (%rbx)
andq $0x0, 0x8(%rbx)
andl $0x0, 0x10(%rbx)
movq 0x40(%rbx), %rdi
pushq $0x1
popq %rsi
movl $0x98, %edx
callq *%rax
movq %rax, 0x68(%rbx)
testq %rax, %rax
je 0xad42
shrl $0xe, %r14d
andl $0x1, %r14d
movl $0x98, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0x3180
movq 0x68(%rbx), %rax
movl $0x1, 0x18(%rax)
pushq $0x4
popq %rcx
movl %ecx, 0x38(%rax)
movl %ecx, 0x58(%rax)
movl %r14d, 0x64(%rax)
movl %r14d, 0x68(%rax)
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0x14(%rbx)
pushq $0x1
popq %r15
jmp 0xac65
movl $0x10, 0x1c(%rbx)
jmp 0xac65