// File: /workspace/github_c_makefile_star2_O0/wkoszek[P]mini_gzip/miniz.c
// Function: mz_inflate
int mz_inflate(mz_streamp pStream, int flush)
{
  inflate_state* pState;
  mz_uint n, first_call, decomp_flags = TINFL_FLAG_COMPUTE_ADLER32;
  size_t in_bytes, out_bytes, orig_avail_in;
  tinfl_status status;

  if ((!pStream) || (!pStream->state)) return MZ_STREAM_ERROR;
  if (flush == MZ_PARTIAL_FLUSH) flush = MZ_SYNC_FLUSH;
  if ((flush) && (flush != MZ_SYNC_FLUSH) && (flush != MZ_FINISH)) return MZ_STREAM_ERROR;

  pState = (inflate_state*)pStream->state;
  if (pState->m_window_bits > 0) decomp_flags |= TINFL_FLAG_PARSE_ZLIB_HEADER;
  orig_avail_in = pStream->avail_in;

  first_call = pState->m_first_call; pState->m_first_call = 0;
  if (pState->m_last_status < 0) return MZ_DATA_ERROR;

  if (pState->m_has_flushed && (flush != MZ_FINISH)) return MZ_STREAM_ERROR;
  pState->m_has_flushed |= (flush == MZ_FINISH);

  if ((flush == MZ_FINISH) && (first_call))
  {
    // MZ_FINISH on the first call implies that the input and output buffers are large enough to hold the entire compressed/decompressed file.
    decomp_flags |= TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF;
    in_bytes = pStream->avail_in; out_bytes = pStream->avail_out;
    status = tinfl_decompress(&pState->m_decomp, pStream->next_in, &in_bytes, pStream->next_out, pStream->next_out, &out_bytes, decomp_flags);
    pState->m_last_status = status;
    pStream->next_in += (mz_uint)in_bytes; pStream->avail_in -= (mz_uint)in_bytes; pStream->total_in += (mz_uint)in_bytes;
    pStream->adler = tinfl_get_adler32(&pState->m_decomp);
    pStream->crc32 = tinfl_get_crc32(&pState->m_decomp);
    pStream->next_out += (mz_uint)out_bytes; pStream->avail_out -= (mz_uint)out_bytes; pStream->total_out += (mz_uint)out_bytes;

    if (status < 0)
      return MZ_DATA_ERROR;
    else if (status != TINFL_STATUS_DONE)
    {
      pState->m_last_status = TINFL_STATUS_FAILED;
      return MZ_BUF_ERROR;
    }
    return MZ_STREAM_END;
  }
  // flush != MZ_FINISH then we must assume there's more input.
  if (flush != MZ_FINISH) decomp_flags |= TINFL_FLAG_HAS_MORE_INPUT;

  if (pState->m_dict_avail)
  {
    n = MZ_MIN(pState->m_dict_avail, pStream->avail_out);
    memcpy(pStream->next_out, pState->m_dict + pState->m_dict_ofs, n);
    pStream->next_out += n; pStream->avail_out -= n; pStream->total_out += n;
    pState->m_dict_avail -= n; pState->m_dict_ofs = (pState->m_dict_ofs + n) & (TINFL_LZ_DICT_SIZE - 1);
    return ((pState->m_last_status == TINFL_STATUS_DONE) && (!pState->m_dict_avail)) ? MZ_STREAM_END : MZ_OK;
  }

  for ( ; ; )
  {
    in_bytes = pStream->avail_in;
    out_bytes = TINFL_LZ_DICT_SIZE - pState->m_dict_ofs;

    status = tinfl_decompress(&pState->m_decomp, pStream->next_in, &in_bytes, pState->m_dict, pState->m_dict + pState->m_dict_ofs, &out_bytes, decomp_flags);
    pState->m_last_status = status;

    pStream->next_in += (mz_uint)in_bytes; pStream->avail_in -= (mz_uint)in_bytes;
    pStream->total_in += (mz_uint)in_bytes; pStream->adler = tinfl_get_adler32(&pState->m_decomp); pStream->crc32 = tinfl_get_crc32(&pState->m_decomp);

    pState->m_dict_avail = (mz_uint)out_bytes;

    n = MZ_MIN(pState->m_dict_avail, pStream->avail_out);
    memcpy(pStream->next_out, pState->m_dict + pState->m_dict_ofs, n);
    pStream->next_out += n; pStream->avail_out -= n; pStream->total_out += n;
    pState->m_dict_avail -= n; pState->m_dict_ofs = (pState->m_dict_ofs + n) & (TINFL_LZ_DICT_SIZE - 1);

    if (status < 0)
       return MZ_DATA_ERROR; // Stream is corrupted (there could be some uncompressed data left in the output dictionary - oh well).
    else if ((status == TINFL_STATUS_NEEDS_MORE_INPUT) && (!orig_avail_in))
      return MZ_BUF_ERROR; // Signal caller that we can't make forward progress without supplying more input or by setting flush to MZ_FINISH.
    else if (flush == MZ_FINISH)
    {
       // The output buffer MUST be large to hold the remaining uncompressed data when flush==MZ_FINISH.
       if (status == TINFL_STATUS_DONE)
          return pState->m_dict_avail ? MZ_BUF_ERROR : MZ_STREAM_END;
       // status here must be TINFL_STATUS_HAS_MORE_OUTPUT, which means there's at least 1 more byte on the way. If there's no more room left in the output buffer then something is wrong.
       else if (!pStream->avail_out)
          return MZ_BUF_ERROR;
    }
    else if ((status == TINFL_STATUS_DONE) || (!pStream->avail_in) || (!pStream->avail_out) || (pState->m_dict_avail))
      break;
  }

  return ((status == TINFL_STATUS_DONE) && (!pState->m_dict_avail)) ? MZ_STREAM_END : MZ_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x8, -0x2c(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x2d98
movq -0x10(%rbp), %rax
cmpq $0x0, 0x38(%rax)
jne 0x2da4
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x3349
cmpl $0x1, -0x14(%rbp)
jne 0x2db1
movl $0x2, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x2dcf
cmpl $0x2, -0x14(%rbp)
je 0x2dcf
cmpl $0x4, -0x14(%rbp)
je 0x2dcf
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x3349
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x2b10(%rax)
jle 0x2df1
movl -0x2c(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movl 0x2b08(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl $0x0, 0x2b08(%rax)
movq -0x20(%rbp), %rax
cmpl $0x0, 0xab14(%rax)
jge 0x2e30
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0x3349
movq -0x20(%rbp), %rax
cmpl $0x0, 0x2b0c(%rax)
je 0x2e4f
cmpl $0x4, -0x14(%rbp)
je 0x2e4f
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x3349
cmpl $0x4, -0x14(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x20(%rbp), %rax
orl 0x2b0c(%rax), %ecx
movl %ecx, 0x2b0c(%rax)
cmpl $0x4, -0x14(%rbp)
jne 0x2fb6
cmpl $0x0, -0x28(%rbp)
je 0x2fb6
movl -0x2c(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %r8
movl -0x2c(%rbp), %eax
leaq -0x38(%rbp), %rdx
leaq -0x40(%rbp), %r9
movl %eax, (%rsp)
callq 0x3360
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0xab14(%rax)
movq -0x38(%rbp), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl %edx, %edx
addq %rdx, %rcx
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x8(%rax)
movq -0x38(%rbp), %rax
movl %eax, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x20(%rbp), %rax
movl 0x24(%rax), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x40(%rbp), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
movl %edx, %edx
addq %rdx, %rcx
movq %rcx, 0x18(%rax)
movq -0x40(%rbp), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x20(%rax)
movq -0x40(%rbp), %rax
movl %eax, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
addq 0x28(%rax), %rcx
movq %rcx, 0x28(%rax)
cmpl $0x0, -0x4c(%rbp)
jge 0x2f88
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0x3349
cmpl $0x0, -0x4c(%rbp)
je 0x2fa8
movq -0x20(%rbp), %rax
movl $0xffffffff, 0xab14(%rax) # imm = 0xFFFFFFFF
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0x3349
jmp 0x2faa
movl $0x1, -0x4(%rbp)
jmp 0x3349
cmpl $0x4, -0x14(%rbp)
je 0x2fc5
movl -0x2c(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x2b04(%rax)
je 0x30d5
movq -0x20(%rbp), %rax
movl 0x2b04(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jae 0x2ff8
movq -0x20(%rbp), %rax
movl 0x2b04(%rax), %eax
movl %eax, -0x50(%rbp)
jmp 0x3002
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0x2b14, %rsi           # imm = 0x2B14
movq -0x20(%rbp), %rax
movl 0x2b00(%rax), %eax
addq %rax, %rsi
movl -0x24(%rbp), %eax
movl %eax, %edx
callq 0x10d0
movl -0x24(%rbp), %edx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
movl %edx, %edx
addq %rdx, %rcx
movq %rcx, 0x18(%rax)
movl -0x24(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x20(%rax)
movl -0x24(%rbp), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
addq 0x28(%rax), %rcx
movq %rcx, 0x28(%rax)
movl -0x24(%rbp), %edx
movq -0x20(%rbp), %rax
movl 0x2b04(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x2b04(%rax)
movq -0x20(%rbp), %rax
movl 0x2b00(%rax), %ecx
addl -0x24(%rbp), %ecx
andl $0x7fff, %ecx           # imm = 0x7FFF
movq -0x20(%rbp), %rax
movl %ecx, 0x2b00(%rax)
movq -0x20(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, 0xab14(%rcx)
movb %al, -0x51(%rbp)
jne 0x30bd
movq -0x20(%rbp), %rax
cmpl $0x0, 0x2b04(%rax)
setne %al
xorb $-0x1, %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x3349
jmp 0x30d7
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rcx
movl $0x8000, %eax           # imm = 0x8000
subl 0x2b00(%rcx), %eax
movl %eax, %eax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x20(%rbp), %rcx
addq $0x2b14, %rcx           # imm = 0x2B14
movq -0x20(%rbp), %r8
addq $0x2b14, %r8            # imm = 0x2B14
movq -0x20(%rbp), %rax
movl 0x2b00(%rax), %eax
addq %rax, %r8
movl -0x2c(%rbp), %eax
leaq -0x38(%rbp), %rdx
leaq -0x40(%rbp), %r9
movl %eax, (%rsp)
callq 0x3360
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0xab14(%rax)
movq -0x38(%rbp), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl %edx, %edx
addq %rdx, %rcx
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x8(%rax)
movq -0x38(%rbp), %rax
movl %eax, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x20(%rbp), %rax
movl 0x24(%rax), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x40(%rbp), %rax
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x2b04(%rax)
movq -0x20(%rbp), %rax
movl 0x2b04(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jae 0x31d7
movq -0x20(%rbp), %rax
movl 0x2b04(%rax), %eax
movl %eax, -0x58(%rbp)
jmp 0x31e1
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0x2b14, %rsi           # imm = 0x2B14
movq -0x20(%rbp), %rax
movl 0x2b00(%rax), %eax
addq %rax, %rsi
movl -0x24(%rbp), %eax
movl %eax, %edx
callq 0x10d0
movl -0x24(%rbp), %edx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
movl %edx, %edx
addq %rdx, %rcx
movq %rcx, 0x18(%rax)
movl -0x24(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x20(%rax)
movl -0x24(%rbp), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
addq 0x28(%rax), %rcx
movq %rcx, 0x28(%rax)
movl -0x24(%rbp), %edx
movq -0x20(%rbp), %rax
movl 0x2b04(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x2b04(%rax)
movq -0x20(%rbp), %rax
movl 0x2b00(%rax), %ecx
addl -0x24(%rbp), %ecx
andl $0x7fff, %ecx           # imm = 0x7FFF
movq -0x20(%rbp), %rax
movl %ecx, 0x2b00(%rax)
cmpl $0x0, -0x4c(%rbp)
jge 0x3289
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0x3349
cmpl $0x1, -0x4c(%rbp)
jne 0x32a2
cmpq $0x0, -0x48(%rbp)
jne 0x32a2
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0x3349
cmpl $0x4, -0x14(%rbp)
jne 0x32e4
cmpl $0x0, -0x4c(%rbp)
jne 0x32cd
movq -0x20(%rbp), %rax
movl 0x2b04(%rax), %edx
movl $0x1, %eax
movl $0xfffffffb, %ecx       # imm = 0xFFFFFFFB
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x3349
movq -0x10(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jne 0x32e0
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0x3349
jmp 0x32e2
jmp 0x330f
cmpl $0x0, -0x4c(%rbp)
je 0x330b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x330b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x20(%rax)
je 0x330b
movq -0x20(%rbp), %rax
cmpl $0x0, 0x2b04(%rax)
je 0x330d
jmp 0x3318
jmp 0x330f
jmp 0x3311
jmp 0x3313
jmp 0x30d7
xorl %eax, %eax
cmpl $0x0, -0x4c(%rbp)
movb %al, -0x59(%rbp)
jne 0x3336
movq -0x20(%rbp), %rax
cmpl $0x0, 0x2b04(%rax)
setne %al
xorb $-0x1, %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)