// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/src/../foreign/miniz-c.h
// Function: tdefl_compress
tdefl_status tdefl_compress(tdefl_compressor *d, const void *pIn_buf, size_t *pIn_buf_size, void *pOut_buf, size_t *pOut_buf_size, tdefl_flush flush)
{
    if (!d)
    {
        if (pIn_buf_size)
            *pIn_buf_size = 0;
        if (pOut_buf_size)
            *pOut_buf_size = 0;
        return TDEFL_STATUS_BAD_PARAM;
    }

    d->m_pIn_buf = pIn_buf;
    d->m_pIn_buf_size = pIn_buf_size;
    d->m_pOut_buf = pOut_buf;
    d->m_pOut_buf_size = pOut_buf_size;
    d->m_pSrc = (const mz_uint8 *)(pIn_buf);
    d->m_src_buf_left = pIn_buf_size ? *pIn_buf_size : 0;
    d->m_out_buf_ofs = 0;
    d->m_flush = flush;

    if (((d->m_pPut_buf_func != NULL) == ((pOut_buf != NULL) || (pOut_buf_size != NULL))) || (d->m_prev_return_status != TDEFL_STATUS_OKAY) ||
        (d->m_wants_to_finish && (flush != TDEFL_FINISH)) || (pIn_buf_size && *pIn_buf_size && !pIn_buf) || (pOut_buf_size && *pOut_buf_size && !pOut_buf))
    {
        if (pIn_buf_size)
            *pIn_buf_size = 0;
        if (pOut_buf_size)
            *pOut_buf_size = 0;
        return (d->m_prev_return_status = TDEFL_STATUS_BAD_PARAM);
    }
    d->m_wants_to_finish |= (flush == TDEFL_FINISH);

    if ((d->m_output_flush_remaining) || (d->m_finished))
        return (d->m_prev_return_status = tdefl_flush_output_buffer(d));

#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
    if (((d->m_flags & TDEFL_MAX_PROBES_MASK) == 1) &&
        ((d->m_flags & TDEFL_GREEDY_PARSING_FLAG) != 0) &&
        ((d->m_flags & (TDEFL_FILTER_MATCHES | TDEFL_FORCE_ALL_RAW_BLOCKS | TDEFL_RLE_MATCHES)) == 0))
    {
        if (!tdefl_compress_fast(d))
            return d->m_prev_return_status;
    }
    else
#endif /* #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN */
    {
        if (!tdefl_compress_normal(d))
            return d->m_prev_return_status;
    }

    if ((d->m_flags & (TDEFL_WRITE_ZLIB_HEADER | TDEFL_COMPUTE_ADLER32)) && (pIn_buf))
        d->m_adler32 = (mz_uint32)mz_adler32(d->m_adler32, (const mz_uint8 *)pIn_buf, d->m_pSrc - (const mz_uint8 *)pIn_buf);

    if ((flush) && (!d->m_lookahead_size) && (!d->m_src_buf_left) && (!d->m_output_flush_remaining))
    {
        if (tdefl_flush_block(d, flush) < 0)
            return d->m_prev_return_status;
        d->m_finished = (flush == TDEFL_FINISH);
        if (flush == TDEFL_FULL_FLUSH)
        {
            MZ_CLEAR_ARR(d->m_hash);
            MZ_CLEAR_ARR(d->m_next);
            d->m_dict_size = 0;
        }
    }

    return (d->m_prev_return_status = tdefl_flush_output_buffer(d));
}

// Assembly:
testq %rdi, %rdi
je 0x109de8
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %r9d, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, 0x88(%rdi)
movq %rdx, 0x98(%rdi)
movq %rcx, 0x90(%rdi)
movq %r8, 0xa0(%rdi)
movq %rsi, 0xb0(%rdi)
testq %rdx, %rdx
je 0x109e06
movq (%rdx), %rax
jmp 0x109e08
testq %rdx, %rdx
je 0x109df4
movq $0x0, (%rdx)
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testq %r8, %r8
je 0x109e05
movq $0x0, (%r8)
retq
xorl %eax, %eax
movq %rax, 0xb8(%rbx)
movq $0x0, 0xc0(%rbx)
movl %ebp, 0xa8(%rbx)
movq %rcx, %rax
orq %r8, %rax
setne %al
cmpq $0x0, (%rbx)
sete %sil
xorb %al, %sil
jne 0x109e57
cmpl $0x0, 0x84(%rbx)
jne 0x109e57
movl 0x80(%rbx), %eax
testl %eax, %eax
setne %sil
cmpl $0x4, %ebp
setne %dil
testb %sil, %dil
je 0x109e89
testq %rdx, %rdx
je 0x109e63
movq $0x0, (%rdx)
testq %r8, %r8
je 0x109e6f
movq $0x0, (%r8)
movl $0xfffffffe, 0x84(%rbx) # imm = 0xFFFFFFFE
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
testq %rdx, %rdx
je 0x109e99
testq %r14, %r14
jne 0x109e99
cmpq $0x0, (%rdx)
jne 0x109e5c
testq %r8, %r8
je 0x109ea9
testq %rcx, %rcx
jne 0x109ea9
cmpq $0x0, (%r8)
jne 0x109e57
xorl %r15d, %r15d
cmpl $0x4, %ebp
sete %r15b
orl %r15d, %eax
movl %eax, 0x80(%rbx)
cmpl $0x0, 0x74(%rbx)
jne 0x109ec8
cmpl $0x0, 0x78(%rbx)
je 0x109ed8
movq %rbx, %rdi
callq 0x10c470
movl %eax, 0x84(%rbx)
jmp 0x109e7e
movq %rbx, %rdi
callq 0x10c50f
testl %eax, %eax
je 0x109f5b
testq %r14, %r14
je 0x109f0b
movl $0x3000, %eax           # imm = 0x3000
andl 0x10(%rbx), %eax
je 0x109f0b
movl 0x20(%rbx), %edi
movq 0xb0(%rbx), %rdx
subq %r14, %rdx
movq %r14, %rsi
callq 0x1097d8
movl %eax, 0x20(%rbx)
testl %ebp, %ebp
je 0x109ec8
cmpl $0x0, 0x28(%rbx)
jne 0x109ec8
cmpq $0x0, 0xb8(%rbx)
jne 0x109ec8
cmpl $0x0, 0x74(%rbx)
jne 0x109ec8
movq %rbx, %rdi
movl %ebp, %esi
callq 0x10ceb3
testl %eax, %eax
js 0x109f5b
movl %r15d, 0x78(%rbx)
cmpl $0x3, %ebp
jne 0x109ec8
leaq 0x192aa(%rbx), %rdi
movl $0x0, 0x2c(%rbx)
movl $0x20000, %edx          # imm = 0x20000
xorl %esi, %esi
callq 0x18140
jmp 0x109ec8
movl 0x84(%rbx), %eax
jmp 0x109e7e