// File: /workspace/github_c_makefile_star2_O2/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 $0x28, %rsp
pushq $-0x2
popq %r12
testq %rdi, %rdi
je 0xfd286
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
sete %al
cmpl $0x5, %esi
setae %cl
orb %al, %cl
jne 0xfd286
movq 0x18(%rbx), %rcx
testq %rcx, %rcx
je 0xfd286
movl 0x20(%rbx), %r9d
testl %r9d, %r9d
je 0xfd1a3
cmpl $0x1, %esi
pushq $0x2
popq %rbp
cmovnel %esi, %ebp
cmpl $0x1, 0x84(%rdi)
jne 0xfd1ab
cmpl $0x4, %ebp
pushq $0x1
popq %rcx
pushq $-0x5
popq %rax
cmovel %ecx, %eax
jmp 0xfd289
pushq $-0x5
popq %rax
jmp 0xfd289
movq 0x10(%rbx), %rax
movq %rax, 0x18(%rsp)
movq 0x28(%rbx), %rax
movq %rax, 0x20(%rsp)
movl 0x8(%rbx), %r8d
movq (%rbx), %rsi
movl %r8d, %eax
movq %rax, 0x10(%rsp)
movl %r9d, %eax
movq %rax, 0x8(%rsp)
leaq 0x10(%rsp), %rdx
leaq 0x8(%rsp), %r8
movl %ebp, %r9d
callq 0xfd29f
movq 0x10(%rsp), %r11
movl %r11d, %edx
movq (%rbx), %rsi
addq %rdx, %rsi
movq %rsi, (%rbx)
movl 0x8(%rbx), %r13d
movl 0x20(%rbx), %r14d
movl %r13d, %r8d
subl %r11d, %r8d
movl %r8d, 0x8(%rbx)
addq 0x10(%rbx), %rdx
movq %rdx, 0x10(%rbx)
movq 0x38(%rbx), %rdi
movl 0x20(%rdi), %ecx
movq %rcx, 0x60(%rbx)
movq 0x8(%rsp), %r15
movl %r15d, %r10d
movq 0x18(%rbx), %rcx
addq %r10, %rcx
movq %rcx, 0x18(%rbx)
movl %r14d, %r9d
subl %r15d, %r9d
movl %r9d, 0x20(%rbx)
addq 0x28(%rbx), %r10
movq %r10, 0x28(%rbx)
testl %eax, %eax
js 0xfd286
cmpl $0x1, %eax
je 0xfd298
xorl %eax, %eax
cmpl %r15d, %r14d
je 0xfd289
cmpl $0x4, %ebp
sete %r14b
cmpl %r11d, %r13d
setne %r11b
orb %r14b, %r11b
jne 0xfd1c4
testl %ebp, %ebp
jne 0xfd289
xorq 0x18(%rsp), %rdx
xorq 0x20(%rsp), %r10
xorl %eax, %eax
orq %rdx, %r10
setne %al
leal (%rax,%rax,4), %eax
addl $-0x5, %eax
jmp 0xfd289
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
jmp 0xfd1a5