// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/src/../foreign/miniz-c.h
// Function: mz_deflate
int mz_deflate(mz_streamp pStream, int flush)
{
    size_t in_bytes, out_bytes;
    mz_ulong orig_total_in, orig_total_out;
    int mz_status = MZ_OK;

    if ((!pStream) || (!pStream->state) || (flush < 0) || (flush > MZ_FINISH) || (!pStream->next_out))
        return MZ_STREAM_ERROR;
    if (!pStream->avail_out)
        return MZ_BUF_ERROR;

    if (flush == MZ_PARTIAL_FLUSH)
        flush = MZ_SYNC_FLUSH;

    if (((tdefl_compressor *)pStream->state)->m_prev_return_status == TDEFL_STATUS_DONE)
        return (flush == MZ_FINISH) ? MZ_STREAM_END : MZ_BUF_ERROR;

    orig_total_in = pStream->total_in;
    orig_total_out = pStream->total_out;
    for (;;)
    {
        tdefl_status defl_status;
        in_bytes = pStream->avail_in;
        out_bytes = pStream->avail_out;

        defl_status = tdefl_compress((tdefl_compressor *)pStream->state, pStream->next_in, &in_bytes, pStream->next_out, &out_bytes, (tdefl_flush)flush);
        pStream->next_in += (mz_uint)in_bytes;
        pStream->avail_in -= (mz_uint)in_bytes;
        pStream->total_in += (mz_uint)in_bytes;
        pStream->adler = tdefl_get_adler32((tdefl_compressor *)pStream->state);

        pStream->next_out += (mz_uint)out_bytes;
        pStream->avail_out -= (mz_uint)out_bytes;
        pStream->total_out += (mz_uint)out_bytes;

        if (defl_status < 0)
        {
            mz_status = MZ_STREAM_ERROR;
            break;
        }
        else if (defl_status == TDEFL_STATUS_DONE)
        {
            mz_status = MZ_STREAM_END;
            break;
        }
        else if (!pStream->avail_out)
            break;
        else if ((!pStream->avail_in) && (flush != MZ_FINISH))
        {
            if ((flush) || (pStream->total_in != orig_total_in) || (pStream->total_out != orig_total_out))
                break;
            return MZ_BUF_ERROR; /* Can't make forward progress without some input.
 */
        }
    }
    return mz_status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl $0xfffffffe, %ebx       # imm = 0xFFFFFFFE
testq %rdi, %rdi
je 0x10a2bb
movq %rdi, %r14
movq 0x38(%rdi), %rax
testq %rax, %rax
sete %cl
cmpl $0x5, %esi
setae %dl
orb %cl, %dl
jne 0x10a2bb
cmpq $0x0, 0x18(%r14)
je 0x10a2bb
movl $0xfffffffb, %ebx       # imm = 0xFFFFFFFB
cmpl $0x0, 0x20(%r14)
je 0x10a2bb
cmpl $0x1, %esi
movl $0x2, %ebp
cmovnel %esi, %ebp
cmpl $0x1, 0x84(%rax)
jne 0x10a1cc
cmpl $0x4, %ebp
movl $0x1, %eax
cmovel %eax, %ebx
jmp 0x10a2bb
movq 0x10(%r14), %rax
movq %rax, 0x10(%rsp)
movq 0x28(%r14), %r13
leaq 0x8(%rsp), %r15
movq %rsp, %r12
xorl %ebx, %ebx
movl 0x8(%r14), %eax
movq %rax, 0x8(%rsp)
movl 0x20(%r14), %eax
movq %rax, (%rsp)
movq 0x38(%r14), %rdi
movq (%r14), %rsi
movq 0x18(%r14), %rcx
movq %r15, %rdx
movq %r12, %r8
movl %ebp, %r9d
callq 0x10a2cc
movq 0x8(%rsp), %rdi
movl %edi, %ecx
addq %rcx, (%r14)
movl 0x8(%r14), %r8d
movl 0x20(%r14), %r9d
movl %r8d, %edx
subl %edi, %edx
movl %edx, 0x8(%r14)
addq 0x10(%r14), %rcx
movq %rcx, 0x10(%r14)
movq 0x38(%r14), %rdx
movl 0x20(%rdx), %edx
movq %rdx, 0x60(%r14)
movq (%rsp), %r10
movl %r10d, %esi
addq %rsi, 0x18(%r14)
movl %r9d, %edx
subl %r10d, %edx
movl %edx, 0x20(%r14)
addq 0x28(%r14), %rsi
movq %rsi, 0x28(%r14)
movl $0x2, %edx
testl %eax, %eax
js 0x10a26d
cmpl $0x1, %eax
jne 0x10a274
movl $0x1, %ebx
jmp 0x10a2a9
movl $0xfffffffe, %ebx       # imm = 0xFFFFFFFE
jmp 0x10a2a9
cmpl %r10d, %r9d
je 0x10a2a9
movl %r8d, %eax
xorl %edi, %eax
xorl %edx, %edx
cmpl %edi, %r8d
sete %dl
addl %edx, %edx
cmpl $0x4, %ebp
movl $0x0, %edi
cmovel %edi, %edx
orl %ebp, %eax
jne 0x10a2a9
xorq 0x10(%rsp), %rcx
xorq %r13, %rsi
xorl %edx, %edx
orq %rcx, %rsi
setne %dl
incl %edx
testl %edx, %edx
je 0x10a1e3
cmpl $0x2, %edx
je 0x10a2bb
movl $0xfffffffb, %ebx       # imm = 0xFFFFFFFB
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq