// File: /workspace/github_cpp_makefile_star2_O3/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 0xad9d
movq %rdi, %rbx
cmpq $0x0, 0x68(%rdi)
je 0xadab
movl $0x18, 0x1c(%rbx)
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x50(%rbx)
je 0xad96
cmpl $0x0, 0x14(%rbx)
jne 0xad96
movl %edx, %r14d
testw %r14w, %r14w
jns 0xadc8
cmpq $0x0, 0x48(%rbx)
je 0xad96
movq 0x20(%rbx), %rax
leaq -0x1(%rax), %rcx
testq %rcx, %rax
jne 0xad96
movq 0x28(%rbx), %rax
testq %rax, %rax
jne 0xade9
leaq -0x7639(%rip), %rax     # 0x37ac
movq %rax, 0x28(%rbx)
cmpq $0x0, 0x30(%rbx)
jne 0xadfb
leaq -0x763a(%rip), %rcx     # 0x37bd
movq %rcx, 0x30(%rbx)
cmpq $0x0, 0x38(%rbx)
jne 0xae0d
leaq -0x763f(%rip), %rcx     # 0x37ca
movq %rcx, 0x38(%rbx)
movq %rsi, (%rbx)
movq $0x0, 0x8(%rbx)
movl $0x0, 0x10(%rbx)
movq 0x40(%rbx), %rdi
movl $0x1, %esi
movl $0x98, %edx
callq *%rax
movq %rax, 0x68(%rbx)
testq %rax, %rax
je 0xae86
shrl $0xe, %r14d
andl $0x1, %r14d
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 %r14d, 0x64(%rax)
movl %r14d, 0x68(%rax)
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0x14(%rbx)
movl $0x1, %r15d
jmp 0xad9d
movl $0x10, 0x1c(%rbx)
jmp 0xad9d