// File: /workspace/github_c_makefile_star2_O1/wkoszek[P]mini_gzip/miniz.c
// 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 (d->m_flags & TDEFL_COMPUTE_CRC32)
    d->m_crc32 = (mz_uint32)mz_crc32(d->m_crc32, (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_OBJ(d->m_hash); MZ_CLEAR_OBJ(d->m_next); d->m_dict_size = 0; }
  }

  return (d->m_prev_return_status = tdefl_flush_output_buffer(d));
}

// Assembly:
testq %rdi, %rdi
je 0x1d9c
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r9d, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, 0x90(%rdi)
movq %rdx, 0xa0(%rdi)
movq %rcx, 0x98(%rdi)
movq %r8, 0xa8(%rdi)
movq %rsi, 0xb8(%rdi)
testq %rdx, %rdx
je 0x1dba
movq (%rdx), %rax
jmp 0x1dbc
testq %rdx, %rdx
je 0x1da8
movq $0x0, (%rdx)
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testq %r8, %r8
je 0x1db9
movq $0x0, (%r8)
retq
xorl %eax, %eax
movq %rax, 0xc0(%rbx)
movq $0x0, 0xc8(%rbx)
movl %ebp, 0xb0(%rbx)
movq %rcx, %rax
orq %r8, %rax
setne %al
cmpq $0x0, (%rbx)
sete %sil
xorb %al, %sil
jne 0x1e2b
cmpl $0x0, 0x8c(%rbx)
jne 0x1e2b
movl 0x88(%rbx), %eax
testl %eax, %eax
setne %sil
cmpl $0x4, %ebp
setne %dil
testb %sil, %dil
jne 0x1e2b
testq %rdx, %rdx
je 0x1e1b
testq %r14, %r14
jne 0x1e1b
cmpq $0x0, (%rdx)
jne 0x1e2b
testq %r8, %r8
je 0x1e5b
testq %rcx, %rcx
jne 0x1e5b
cmpq $0x0, (%r8)
je 0x1e5b
testq %rdx, %rdx
je 0x1e37
movq $0x0, (%rdx)
testq %r8, %r8
je 0x1e43
movq $0x0, (%r8)
movl $0xfffffffe, 0x8c(%rbx) # imm = 0xFFFFFFFE
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
cmpl $0x4, %ebp
sete %r15b
orl %r15d, %eax
movl %eax, 0x88(%rbx)
cmpl $0x0, 0x7c(%rbx)
jne 0x1e7d
cmpl $0x0, 0x80(%rbx)
je 0x1e8d
movq %rbx, %rdi
callq 0x44fd
movl %eax, 0x8c(%rbx)
jmp 0x1e52
movl $0x168fff, %eax         # imm = 0x168FFF
andl 0x10(%rbx), %eax
movq %rbx, %rdi
cmpl $0x8001, %eax           # imm = 0x8001
jne 0x1ea6
callq 0x459f
jmp 0x1eab
callq 0x4c42
testl %eax, %eax
je 0x1f69
movl 0x10(%rbx), %r12d
testl $0x3000, %r12d          # imm = 0x3000
sete %al
testq %r14, %r14
sete %cl
orb %al, %cl
jne 0x1ee3
movl 0x20(%rbx), %edi
movq 0xb8(%rbx), %rdx
subq %r14, %rdx
movq %r14, %rsi
callq 0x175c
movl %eax, 0x20(%rbx)
btl $0xe, %r12d
jae 0x1f02
movl 0x24(%rbx), %edi
movq 0xb8(%rbx), %rdx
subq %r14, %rdx
movq %r14, %rsi
callq 0x1880
movl %eax, 0x24(%rbx)
testl %ebp, %ebp
je 0x1e7d
cmpl $0x0, 0x2c(%rbx)
jne 0x1e7d
cmpq $0x0, 0xc0(%rbx)
jne 0x1e7d
cmpl $0x0, 0x7c(%rbx)
jne 0x1e7d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5420
testl %eax, %eax
js 0x1f69
movl %r15d, 0x80(%rbx)
cmpl $0x3, %ebp
jne 0x1e7d
leaq 0x192b2(%rbx), %rdi
movl $0x0, 0x30(%rbx)
movl $0x20000, %edx          # imm = 0x20000
xorl %esi, %esi
callq 0x10a0
jmp 0x1e7d
movl 0x8c(%rbx), %eax
jmp 0x1e52