// File: /workspace/github_c_makefile_star2_O0/wkoszek[P]mini_gzip/miniz.c
// 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->crc32 = tdefl_get_crc32((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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x0, -0x3c(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x23bf
movq -0x10(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x23bf
cmpl $0x0, -0x14(%rbp)
jl 0x23bf
cmpl $0x4, -0x14(%rbp)
jg 0x23bf
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x23cb
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x2595
movq -0x10(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jne 0x23e1
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0x2595
cmpl $0x1, -0x14(%rbp)
jne 0x23ee
movl $0x2, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
cmpl $0x1, 0x8c(%rax)
jne 0x241a
movl -0x14(%rbp), %edx
movl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
movl $0x1, %ecx
cmpl $0x4, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x2595
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
movl -0x14(%rbp), %r9d
leaq -0x20(%rbp), %rdx
leaq -0x28(%rbp), %r8
callq 0x25a0
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl %edx, %edx
addq %rdx, %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x8(%rax)
movq -0x20(%rbp), %rax
movl %eax, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x2970
movl %eax, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x2990
movl %eax, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x28(%rbp), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
movl %edx, %edx
addq %rdx, %rcx
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x20(%rax)
movq -0x28(%rbp), %rax
movl %eax, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
addq 0x28(%rax), %rcx
movq %rcx, 0x28(%rax)
cmpl $0x0, -0x40(%rbp)
jge 0x252c
movl $0xfffffffe, -0x3c(%rbp) # imm = 0xFFFFFFFE
jmp 0x258f
cmpl $0x1, -0x40(%rbp)
jne 0x253b
movl $0x1, -0x3c(%rbp)
jmp 0x258f
movq -0x10(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jne 0x2547
jmp 0x258f
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x2584
cmpl $0x4, -0x14(%rbp)
je 0x2584
cmpl $0x0, -0x14(%rbp)
jne 0x2579
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x30(%rbp), %rax
jne 0x2579
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
cmpq -0x38(%rbp), %rax
je 0x257b
jmp 0x258f
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0x2595
jmp 0x2586
jmp 0x2588
jmp 0x258a
jmp 0x2432
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop