// File: /workspace/github_c_makefile_star2_O1/wkoszek[P]mini_gzip/miniz.c
// Function: tdefl_compress_normal
static mz_bool tdefl_compress_normal(tdefl_compressor *d)
{
  const mz_uint8 *pSrc = d->m_pSrc; size_t src_buf_left = d->m_src_buf_left;
  tdefl_flush flush = d->m_flush;

  while ((src_buf_left) || ((flush) && (d->m_lookahead_size)))
  {
    mz_uint len_to_move, cur_match_dist, cur_match_len, cur_pos;
    // Update dictionary and hash chains. Keeps the lookahead size equal to TDEFL_MAX_MATCH_LEN.
    if ((d->m_lookahead_size + d->m_dict_size) >= (TDEFL_MIN_MATCH_LEN - 1))
    {
      mz_uint dst_pos = (d->m_lookahead_pos + d->m_lookahead_size) & TDEFL_LZ_DICT_SIZE_MASK, ins_pos = d->m_lookahead_pos + d->m_lookahead_size - 2;
      mz_uint hash = (d->m_dict[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] << TDEFL_LZ_HASH_SHIFT) ^ d->m_dict[(ins_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK];
      mz_uint num_bytes_to_process = (mz_uint)MZ_MIN(src_buf_left, TDEFL_MAX_MATCH_LEN - d->m_lookahead_size);
      const mz_uint8 *pSrc_end = pSrc + num_bytes_to_process;
      src_buf_left -= num_bytes_to_process;
      d->m_lookahead_size += num_bytes_to_process;
      while (pSrc != pSrc_end)
      {
        mz_uint8 c = *pSrc++; d->m_dict[dst_pos] = c; if (dst_pos < (TDEFL_MAX_MATCH_LEN - 1)) d->m_dict[TDEFL_LZ_DICT_SIZE + dst_pos] = c;
        hash = ((hash << TDEFL_LZ_HASH_SHIFT) ^ c) & (TDEFL_LZ_HASH_SIZE - 1);
        d->m_next[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] = d->m_hash[hash]; d->m_hash[hash] = (mz_uint16)(ins_pos);
        dst_pos = (dst_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK; ins_pos++;
      }
    }
    else
    {
      while ((src_buf_left) && (d->m_lookahead_size < TDEFL_MAX_MATCH_LEN))
      {
        mz_uint8 c = *pSrc++;
        mz_uint dst_pos = (d->m_lookahead_pos + d->m_lookahead_size) & TDEFL_LZ_DICT_SIZE_MASK;
        src_buf_left--;
        d->m_dict[dst_pos] = c;
        if (dst_pos < (TDEFL_MAX_MATCH_LEN - 1))
          d->m_dict[TDEFL_LZ_DICT_SIZE + dst_pos] = c;
        if ((++d->m_lookahead_size + d->m_dict_size) >= TDEFL_MIN_MATCH_LEN)
        {
          mz_uint ins_pos = d->m_lookahead_pos + (d->m_lookahead_size - 1) - 2;
          mz_uint hash = ((d->m_dict[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] << (TDEFL_LZ_HASH_SHIFT * 2)) ^ (d->m_dict[(ins_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK] << TDEFL_LZ_HASH_SHIFT) ^ c) & (TDEFL_LZ_HASH_SIZE - 1);
          d->m_next[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] = d->m_hash[hash]; d->m_hash[hash] = (mz_uint16)(ins_pos);
        }
      }
    }
    d->m_dict_size = MZ_MIN(TDEFL_LZ_DICT_SIZE - d->m_lookahead_size, d->m_dict_size);
    if ((!flush) && (d->m_lookahead_size < TDEFL_MAX_MATCH_LEN))
      break;

    // Simple lazy/greedy parsing state machine.
    len_to_move = 1; cur_match_dist = 0; cur_match_len = d->m_saved_match_len ? d->m_saved_match_len : (TDEFL_MIN_MATCH_LEN - 1); cur_pos = d->m_lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK;
    if (d->m_flags & (TDEFL_RLE_MATCHES | TDEFL_FORCE_ALL_RAW_BLOCKS))
    {
      if ((d->m_dict_size) && (!(d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS)))
      {
        mz_uint8 c = d->m_dict[(cur_pos - 1) & TDEFL_LZ_DICT_SIZE_MASK];
        cur_match_len = 0; while (cur_match_len < d->m_lookahead_size) { if (d->m_dict[cur_pos + cur_match_len] != c) break; cur_match_len++; }
        if (cur_match_len < TDEFL_MIN_MATCH_LEN) cur_match_len = 0; else cur_match_dist = 1;
      }
    }
    else
    {
      tdefl_find_match(d, d->m_lookahead_pos, d->m_dict_size, d->m_lookahead_size, &cur_match_dist, &cur_match_len);
    }
    if (((cur_match_len == TDEFL_MIN_MATCH_LEN) && (cur_match_dist >= 8U*1024U)) || (cur_pos == cur_match_dist) || ((d->m_flags & TDEFL_FILTER_MATCHES) && (cur_match_len <= 5)))
    {
      cur_match_dist = cur_match_len = 0;
    }
    if (d->m_saved_match_len)
    {
      if (cur_match_len > d->m_saved_match_len)
      {
        tdefl_record_literal(d, (mz_uint8)d->m_saved_lit);
        if (cur_match_len >= 128)
        {
          tdefl_record_match(d, cur_match_len, cur_match_dist);
          d->m_saved_match_len = 0; len_to_move = cur_match_len;
        }
        else
        {
          d->m_saved_lit = d->m_dict[cur_pos]; d->m_saved_match_dist = cur_match_dist; d->m_saved_match_len = cur_match_len;
        }
      }
      else
      {
        tdefl_record_match(d, d->m_saved_match_len, d->m_saved_match_dist);
        len_to_move = d->m_saved_match_len - 1; d->m_saved_match_len = 0;
      }
    }
    else if (!cur_match_dist)
      tdefl_record_literal(d, d->m_dict[cur_pos]);
    else if ((d->m_greedy_parsing) || (d->m_flags & TDEFL_RLE_MATCHES) || (cur_match_len >= 128))
    {
      tdefl_record_match(d, cur_match_len, cur_match_dist);
      len_to_move = cur_match_len;
    }
    else
    {
      d->m_saved_lit = d->m_dict[cur_pos]; d->m_saved_match_dist = cur_match_dist; d->m_saved_match_len = cur_match_len;
    }
    // Move the lookahead forward by len_to_move bytes.
    d->m_lookahead_pos += len_to_move;
    MZ_ASSERT(d->m_lookahead_size >= len_to_move);
    d->m_lookahead_size -= len_to_move;
    d->m_dict_size = MZ_MIN(d->m_dict_size + len_to_move, TDEFL_LZ_DICT_SIZE);
    // Check if it's time to flush the current LZ codes to the internal output buffer.
    if ( (d->m_pLZ_code_buf > &d->m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE - 8]) ||
         ( (d->m_total_lz_bytes > 31*1024) && (((((mz_uint)(d->m_pLZ_code_buf - d->m_lz_code_buf) * 115) >> 7) >= d->m_total_lz_bytes) || (d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS))) )
    {
      int n;
      d->m_pSrc = pSrc; d->m_src_buf_left = src_buf_left;
      if ((n = tdefl_flush_block(d, 0)) != 0)
        return (n < 0) ? MZ_FALSE : MZ_TRUE;
    }
  }

  d->m_pSrc = pSrc; d->m_src_buf_left = src_buf_left;
  return MZ_TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
movq 0xb8(%rdi), %r12
movq 0xc0(%rdi), %r13
movl 0xb0(%rdi), %eax
movl %eax, 0x40(%rsp)
leaq 0x1d0(%rdi), %rax
movq %rax, 0x50(%rsp)
leaq 0xd0(%rdi), %r8
leaq 0x92b2(%rdi), %rax
movq %rax, 0x78(%rsp)
leaq 0x192aa(%rdi), %rax
movq %rax, 0x80(%rsp)
movq %r8, 0x58(%rsp)
testq %r13, %r13
jne 0x4cbb
cmpl $0x0, 0x40(%rsp)
je 0x53ba
cmpl $0x0, 0x2c(%rbx)
je 0x53ba
movl 0x2c(%rbx), %r8d
movl 0x30(%rbx), %r11d
leal (%r11,%r8), %ecx
cmpl $0x1, %ecx
jbe 0x4d95
movl 0x28(%rbx), %ecx
leal (%rcx,%r8), %edx
addl $-0x2, %edx
movl %edx, %esi
movl $0x7fff, %eax           # imm = 0x7FFF
andl %eax, %esi
movzbl 0xd0(%rbx,%rsi), %esi
leal (%rcx,%r8), %edi
decl %edi
andl %eax, %edi
movzbl 0xd0(%rbx,%rdi), %r9d
movl $0x102, %r10d           # imm = 0x102
subl %r8d, %r10d
cmpq %r10, %r13
movl %r13d, %edi
cmovael %r10d, %edi
subq %rdi, %r13
leal (%rdi,%r8), %r10d
movl %r10d, 0x2c(%rbx)
testl %edi, %edi
je 0x4ead
addl %r8d, %ecx
shll $0x5, %esi
xorl %r9d, %esi
andl $0x7fff, %ecx           # imm = 0x7FFF
movb (%r12), %r8b
movb %r8b, 0xd0(%rbx,%rcx)
cmpl $0x100, %ecx            # imm = 0x100
ja 0x4d50
movl %ecx, %r9d
movb %r8b, 0x80d0(%rbx,%r9)
incq %r12
movzbl %r8b, %r8d
shll $0x5, %esi
andl $0x7fe0, %esi           # imm = 0x7FE0
xorl %r8d, %esi
movzwl 0x292b2(%rbx,%rsi,2), %r8d
movl %edx, %r9d
andl $0x7fff, %r9d           # imm = 0x7FFF
movw %r8w, 0x192b2(%rbx,%r9,2)
movw %dx, 0x292b2(%rbx,%rsi,2)
incl %ecx
incl %edx
decq %rdi
jne 0x4d2b
jmp 0x4ead
testq %r13, %r13
je 0x4e9d
movl 0x2c(%rbx), %ecx
movl $0x102, %edx            # imm = 0x102
subl %ecx, %edx
movl $0x0, %eax
cmovbl %eax, %edx
leal -0x2(%rcx), %eax
movq %rax, 0x30(%rsp)
movq %r11, 0x20(%rsp)
leal (%r11,%rcx), %edi
incl %edi
xorl %r8d, %r8d
movq %r13, %r9
cmpl %r8d, %edx
je 0x4ea2
movb (%r12,%r8), %r11b
movl 0x28(%rbx), %r10d
leal (%rcx,%r8), %r14d
addl %r10d, %r14d
andl $0x7fff, %r14d          # imm = 0x7FFF
movb %r11b, 0xd0(%rbx,%r14)
cmpl $0x100, %r14d           # imm = 0x100
ja 0x4e04
movl %r14d, %r14d
movb %r11b, 0x80d0(%rbx,%r14)
leal (%rcx,%r8), %ebp
incl %ebp
movl %ebp, 0x2c(%rbx)
leal (%rdi,%r8), %ebp
cmpl $0x3, %ebp
jb 0x4e86
movzbl %r11b, %r11d
movq 0x30(%rsp), %rax
leal (%rax,%r8), %r14d
addl %r10d, %r14d
movl $0x7fff, %esi           # imm = 0x7FFF
andl %esi, %r14d
movzbl 0xd0(%rbx,%r14), %ebp
leal (%rcx,%r8), %r15d
movq %r13, %rax
leal (%r10,%r15), %r13d
decl %r13d
andl %esi, %r13d
movzbl 0xd0(%rbx,%r13), %r13d
shll $0x5, %r13d
andl $0x1f, %ebp
shll $0xa, %ebp
xorl %r13d, %r11d
movq %rax, %r13
xorl %ebp, %r11d
movzwl 0x292b2(%rbx,%r11,2), %ebp
movw %bp, 0x192b2(%rbx,%r14,2)
addl %r15d, %r10d
addl $-0x2, %r10d
movw %r10w, 0x292b2(%rbx,%r11,2)
incq %r8
decq %r9
cmpq %r8, %r13
jne 0x4dc9
addq %r8, %r12
xorl %r13d, %r13d
jmp 0x4ea8
xorl %r13d, %r13d
jmp 0x4ead
addq %r8, %r12
movq %r9, %r13
movq 0x20(%rsp), %r11
cmpl $0x0, 0x40(%rsp)
sete %dil
movl 0x2c(%rbx), %esi
movl $0x8000, %edx           # imm = 0x8000
subl %esi, %edx
cmpl %r11d, %edx
cmovael %r11d, %edx
movl %edx, 0x30(%rbx)
cmpl $0x102, %esi            # imm = 0x102
setb %al
movl $0x3, %ecx
testb %al, %dil
movq 0x58(%rsp), %r8
jne 0x538b
movl %esi, %ecx
movl 0x70(%rbx), %esi
testl %esi, %esi
movl %esi, %r14d
movl $0x2, %eax
cmovel %eax, %r14d
movl 0x10(%rbx), %r9d
movl 0x28(%rbx), %edi
movl %edi, %ebp
andl $0x7fff, %ebp           # imm = 0x7FFF
testl $0x120000, %r9d         # imm = 0x120000
je 0x4f63
testl %edx, %edx
sete %al
movl %r9d, %edx
shrl $0x14, %edx
andl $0x1, %edx
orb %al, %dl
jne 0x520b
testq %rcx, %rcx
je 0x521f
decl %edi
andl $0x7fff, %edi           # imm = 0x7FFF
movb 0xd0(%rbx,%rdi), %al
xorl %r14d, %r14d
leal (%r14,%rbp), %edx
cmpb %al, 0xd0(%rbx,%rdx)
jne 0x5222
incq %r14
cmpq %r14, %rcx
jne 0x4f42
movl %ecx, %r14d
jmp 0x5222
cmpl $0x103, %ecx            # imm = 0x103
jae 0x5401
cmpl %ecx, %r14d
jae 0x520b
movl %r9d, 0x8(%rsp)
leaq (%r8,%rbp), %rax
movq %rax, 0x70(%rsp)
movzwl (%r8,%rbp), %eax
movw %ax, 0x1e(%rsp)
xorl %eax, %eax
cmpl $0x20, %r14d
setae %al
movl 0x14(%rbx,%rax,4), %r11d
leal -0x1(%rbp), %eax
movq %rax, 0x60(%rsp)
movq %r8, %r9
leal -0x1(%rbp,%r14), %r8d
movq 0x50(%rsp), %rax
addq %rbp, %rax
movq %rax, 0x68(%rsp)
leaq (%rbx,%rbp), %rax
movq %rax, 0x48(%rsp)
xorl %r10d, %r10d
movq %rbp, 0x10(%rsp)
movl %r8d, %eax
movzwl (%r9,%rax), %eax
movw %ax, 0x30(%rsp)
leal -0x1(%r14), %eax
movq %rax, 0x20(%rsp)
movq %r9, %r8
decl %r11d
movl %r11d, 0x38(%rsp)
subl $0x1, %r11d
jb 0x5210
movl %ebp, %eax
movzwl 0x192b2(%rbx,%rax,2), %ebp
testl %ebp, %ebp
je 0x5210
movl %edi, %eax
subl %ebp, %eax
movzwl %ax, %r15d
cmpl %r15d, %edx
jb 0x5210
andl $0x7fff, %ebp           # imm = 0x7FFF
movq 0x20(%rsp), %rax
addl %ebp, %eax
movzwl 0x30(%rsp), %r9d
cmpw %r9w, (%r8,%rax)
je 0x50ae
movzwl 0x192b2(%rbx,%rbp,2), %ebp
testl %ebp, %ebp
je 0x5210
movl %edi, %eax
subl %ebp, %eax
movzwl %ax, %r15d
cmpl %r15d, %edx
jb 0x5210
andl $0x7fff, %ebp           # imm = 0x7FFF
movq 0x20(%rsp), %rax
addl %ebp, %eax
movzwl 0x30(%rsp), %r9d
cmpw %r9w, (%r8,%rax)
je 0x50ae
movzwl 0x192b2(%rbx,%rbp,2), %ebp
testl %ebp, %ebp
je 0x5210
movl %edi, %eax
subl %ebp, %eax
movzwl %ax, %r15d
cmpl %r15d, %edx
jb 0x5210
andl $0x7fff, %ebp           # imm = 0x7FFF
movq 0x20(%rsp), %rax
addl %ebp, %eax
movzwl 0x30(%rsp), %r9d
cmpw %r9w, (%r8,%rax)
jne 0x4fe8
testl %r15d, %r15d
je 0x5210
movl %ebp, %r9d
movzwl 0x1e(%rsp), %eax
cmpw %ax, (%r8,%r9)
jne 0x4fe8
movl %r10d, 0x44(%rsp)
movq 0x50(%rsp), %rax
addq %r9, %rax
movq %rax, 0x28(%rsp)
leaq (%rbx,%r9), %r8
xorl %r11d, %r11d
movq 0x48(%rsp), %r10
movzwl 0xd2(%r10,%r11), %eax
cmpw 0xd2(%r8,%r11), %ax
jne 0x5151
movzwl 0xd4(%r10,%r11), %eax
cmpw 0xd4(%r8,%r11), %ax
jne 0x515c
movzwl 0xd6(%r10,%r11), %eax
cmpw 0xd6(%r8,%r11), %ax
jne 0x5167
movzwl 0xd8(%r10,%r11), %eax
cmpw 0xd8(%r8,%r11), %ax
sete %al
jne 0x5180
addq $0x8, %r11
cmpl $0x100, %r11d           # imm = 0x100
jne 0x50e3
movb $0x1, %al
movq 0x68(%rsp), %r8
jmp 0x51a3
leaq (%r10,%r11), %r8
movl $0xd2, %eax
jmp 0x5170
leaq (%r10,%r11), %r8
movl $0xd4, %eax
jmp 0x5170
leaq (%r10,%r11), %r8
movl $0xd6, %eax
addq %rax, %r8
addq %rbx, %r11
addq %r9, %r11
addq %rax, %r11
xorl %eax, %eax
jmp 0x519e
movq 0x48(%rsp), %r8
leaq (%r8,%r11), %r10
movl $0xd8, %r8d
addq %r8, %r10
addq %rbx, %r11
addq %r9, %r11
addq %r8, %r11
movq %r10, %r8
movq %r11, 0x28(%rsp)
testb %al, %al
movl 0x38(%rsp), %r11d
jne 0x5395
movq %r8, %rax
subl 0x70(%rsp), %r8d
andl $-0x2, %r8d
movb (%rax), %al
movb %al, 0xf(%rsp)
xorl %eax, %eax
movq 0x28(%rsp), %r9
movb 0xf(%rsp), %r10b
cmpb (%r9), %r10b
movl 0x44(%rsp), %r10d
sete %al
orl %r8d, %eax
cmpl %r14d, %eax
movq 0x58(%rsp), %r8
jbe 0x4fe5
cmpl %ecx, %eax
cmovael %ecx, %eax
jae 0x53a7
movq %r8, %r9
movq 0x60(%rsp), %r8
addl %eax, %r8d
movl %r15d, %r10d
movl %eax, %r14d
jmp 0x4fcc
xorl %r15d, %r15d
jmp 0x5236
movl %r10d, %r15d
movq 0x10(%rsp), %rbp
movl 0x8(%rsp), %r9d
jmp 0x5236
xorl %r14d, %r14d
xorl %r15d, %r15d
cmpl $0x3, %r14d
setae %r15b
movl $0x0, %eax
cmovbl %eax, %r14d
cmpl $0x3, %r14d
sete %al
cmpl $0x2000, %r15d          # imm = 0x2000
setae %cl
testb %cl, %al
jne 0x525d
cmpl %r15d, %ebp
je 0x525d
btl $0x12, %r9d
jae 0x5263
cmpl $0x5, %r14d
ja 0x5263
xorl %r15d, %r15d
xorl %r14d, %r14d
testl %esi, %esi
je 0x5291
cmpl %esi, %r14d
jbe 0x52ac
movzbl 0x74(%rbx), %esi
movq %rbx, %rdi
callq 0x5e44
cmpl $0x80, %r14d
jb 0x52e9
movq %rbx, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x5e85
jmp 0x52be
testl %r15d, %r15d
je 0x52c7
cmpl $0x0, 0x1c(%rbx)
je 0x52d9
movq %rbx, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x5e85
jmp 0x5302
movl 0x6c(%rbx), %edx
movq %rbx, %rdi
callq 0x5e85
movl 0x70(%rbx), %r14d
decl %r14d
movl $0x0, 0x70(%rbx)
jmp 0x5302
movzbl 0xd0(%rbx,%rbp), %esi
movq %rbx, %rdi
callq 0x5e44
jmp 0x52fc
btl $0x11, %r9d
jb 0x529c
cmpl $0x80, %r14d
jae 0x529c
movzbl 0xd0(%rbx,%rbp), %eax
movl %eax, 0x74(%rbx)
movl %r15d, 0x6c(%rbx)
movl %r14d, 0x70(%rbx)
movl $0x1, %r14d
addl %r14d, 0x28(%rbx)
movl 0x2c(%rbx), %eax
subl %r14d, %eax
jb 0x53e2
movl %eax, 0x2c(%rbx)
addl 0x30(%rbx), %r14d
movl $0x8000, %eax           # imm = 0x8000
cmpl %eax, %r14d
cmovael %eax, %r14d
movl %r14d, 0x30(%rbx)
movq 0x38(%rbx), %rax
cmpq 0x80(%rsp), %rax
jbe 0x536a
movq %r12, 0xb8(%rbx)
movq %r13, 0xc0(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5420
movl %eax, %edx
notl %edx
shrl $0x1f, %edx
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
movl 0x3c(%rsp), %eax
cmovnel %edx, %eax
movl %eax, 0x3c(%rsp)
jmp 0x538b
movl 0x5c(%rbx), %edx
xorl %ecx, %ecx
cmpl $0x7c01, %edx           # imm = 0x7C01
jb 0x538b
subl 0x78(%rsp), %eax
imull $0x73, %eax, %eax
shrl $0x7, %eax
cmpl %edx, %eax
jae 0x5337
testb $0x10, 0x12(%rbx)
jne 0x5337
testl %ecx, %ecx
je 0x4ca1
jmp 0x53af
movl $0x102, %eax            # imm = 0x102
cmpl %eax, %ecx
cmovael %eax, %ecx
movl %ecx, %r14d
jmp 0x5213
movl %eax, %r14d
jmp 0x5213
cmpl $0x3, %ecx
je 0x53bd
movl 0x3c(%rsp), %eax
jmp 0x53d0
xorl %r13d, %r13d
movq %r12, 0xb8(%rbx)
movq %r13, 0xc0(%rbx)
movl $0x1, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3bdd(%rip), %rdi      # 0x8fc6
leaq 0x3aba(%rip), %rsi      # 0x8eaa
leaq 0x3bf2(%rip), %rcx      # 0x8fe9
movl $0x8cc, %edx            # imm = 0x8CC
callq 0x1090
leaq 0x3c13(%rip), %rdi      # 0x901b
leaq 0x3a9b(%rip), %rsi      # 0x8eaa
leaq 0x3c2a(%rip), %rcx      # 0x9040
movl $0x786, %edx            # imm = 0x786
callq 0x1090