// File: /workspace/github_c_makefile_star2_O3/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 $0x68, %rsp
movq %rdi, %rbx
movq 0xb8(%rdi), %r15
movq 0xc0(%rdi), %r12
movl 0xb0(%rdi), %eax
movl %eax, 0x34(%rsp)
leaq 0xd0(%rdi), %r13
leaq 0x92b2(%rdi), %rax
movq %rax, 0x58(%rsp)
leaq 0x192aa(%rdi), %rax
movq %rax, 0x60(%rsp)
leaq 0xd8(%rdi), %rax
movq %rax, 0x40(%rsp)
testq %r12, %r12
je 0x4e31
movl 0x2c(%rbx), %edi
movl 0x30(%rbx), %ecx
leal (%rcx,%rdi), %eax
cmpl $0x1, %eax
ja 0x4e56
jmp 0x4f2e
cmpl $0x0, 0x34(%rsp)
je 0x54ec
movl 0x2c(%rbx), %edi
testl %edi, %edi
je 0x54ec
movl 0x30(%rbx), %ecx
leal (%rcx,%rdi), %eax
cmpl $0x1, %eax
jbe 0x4f25
movq %rcx, 0x28(%rsp)
movl 0x28(%rbx), %edx
movq %rdi, %rsi
addl %edx, %edi
addl $-0x2, %edi
movl %edi, %eax
movl $0x7fff, %ecx           # imm = 0x7FFF
andl %ecx, %eax
movzbl 0xd0(%rbx,%rax), %r8d
leal (%rdx,%rsi), %eax
decl %eax
andl %ecx, %eax
movzbl 0xd0(%rbx,%rax), %r10d
movl $0x102, %eax            # imm = 0x102
subl %esi, %eax
cmpq %rax, %r12
movl %r12d, %r9d
cmovael %eax, %r9d
subq %r9, %r12
leal (%r9,%rsi), %eax
movl %eax, 0x2c(%rbx)
testl %r9d, %r9d
je 0x502c
addl %esi, %edx
leaq (%r15,%r9), %rsi
shll $0x5, %r8d
xorl %r10d, %r8d
andl $0x7fff, %edx           # imm = 0x7FFF
movb (%r15), %r10b
movb %r10b, (%r13,%rdx)
cmpl $0x100, %edx            # imm = 0x100
ja 0x4eda
movl %edx, %r11d
movb %r10b, 0x8000(%r13,%r11)
incq %r15
movzbl %r10b, %r10d
shll $0x5, %r8d
andl $0x7fe0, %r8d           # imm = 0x7FE0
xorl %r10d, %r8d
movzwl 0x292b2(%rbx,%r8,2), %r10d
movl %edi, %r11d
andl $0x7fff, %r11d          # imm = 0x7FFF
movw %r10w, 0x192b2(%rbx,%r11,2)
movw %di, 0x292b2(%rbx,%r8,2)
incl %edx
incl %edi
decq %r9
jne 0x4eb9
movq %rsi, %r15
jmp 0x502c
testq %r12, %r12
je 0x5065
cmpl $0x103, %edi            # imm = 0x103
movl $0x102, %edx            # imm = 0x102
cmovael %edi, %edx
movq %rdx, 0x38(%rsp)
subl %edi, %edx
movl %edi, %eax
leal -0x2(%rdi), %esi
movq %rsi, 0x20(%rsp)
movq %rcx, 0x28(%rsp)
leal (%rdi,%rcx), %r9d
incl %r9d
xorl %edi, %edi
cmpl %edi, %edx
je 0x5053
movb (%r15,%rdi), %r11b
movl 0x28(%rbx), %r10d
leal (%rax,%rdi), %r14d
addl %r10d, %r14d
andl $0x7fff, %r14d          # imm = 0x7FFF
movb %r11b, 0xd0(%rbx,%r14)
cmpl $0x100, %r14d           # imm = 0x100
ja 0x4f95
movl %r14d, %r14d
movb %r11b, 0x8000(%r13,%r14)
leal (%rax,%rdi), %ebp
incl %ebp
movl %ebp, 0x2c(%rbx)
leal (%r9,%rdi), %ebp
cmpl $0x3, %ebp
jb 0x5018
movzbl %r11b, %r11d
movq 0x20(%rsp), %rcx
leal (%rcx,%rdi), %r14d
addl %r10d, %r14d
movl $0x7fff, %esi           # imm = 0x7FFF
andl %esi, %r14d
movzbl 0xd0(%rbx,%r14), %ebp
movq %r13, %r8
movq %r12, %r13
leal (%rax,%rdi), %r12d
leal (%r10,%r12), %ecx
decl %ecx
andl %esi, %ecx
movzbl 0xd0(%rbx,%rcx), %ecx
shll $0x5, %ecx
andl $0x1f, %ebp
shll $0xa, %ebp
xorl %ecx, %r11d
xorl %ebp, %r11d
movzwl 0x292b2(%rbx,%r11,2), %ecx
movw %cx, 0x192b2(%rbx,%r14,2)
leal (%r10,%r12), %ecx
addl $-0x2, %ecx
movq %r13, %r12
movq %r8, %r13
movw %cx, 0x292b2(%rbx,%r11,2)
incq %rdi
cmpq %rdi, %r12
jne 0x4f5b
addl %edi, %eax
addq %rdi, %r15
xorl %r12d, %r12d
movl $0x8000, %edx           # imm = 0x8000
subl %eax, %edx
movq 0x28(%rsp), %rcx
cmpl %ecx, %edx
cmovael %ecx, %edx
movl %edx, 0x30(%rbx)
cmpl $0x0, 0x34(%rsp)
jne 0x5079
cmpl $0x102, %eax            # imm = 0x102
jae 0x5079
jmp 0x54ef
addq %rdi, %r15
subq %rdi, %r12
movq 0x28(%rsp), %rcx
movq 0x38(%rsp), %rdi
jmp 0x5068
xorl %r12d, %r12d
movl $0x8000, %edx           # imm = 0x8000
subl %edi, %edx
cmpl %ecx, %edx
cmovael %ecx, %edx
movl %edx, 0x30(%rbx)
movl %edi, %eax
movq %r12, 0x20(%rsp)
movl 0x70(%rbx), %esi
testl %esi, %esi
movl %esi, %r14d
movl $0x2, %ecx
cmovel %ecx, %r14d
movl 0x10(%rbx), %r8d
movl 0x28(%rbx), %edi
movl %edi, %r9d
andl $0x7fff, %r9d           # imm = 0x7FFF
testl $0x120000, %r8d         # imm = 0x120000
je 0x50f5
testl %edx, %edx
sete %cl
movl %r8d, %edx
shrl $0x14, %edx
andl $0x1, %edx
orb %cl, %dl
jne 0x5334
testl %eax, %eax
je 0x534c
movl %eax, %r14d
decl %edi
andl $0x7fff, %edi           # imm = 0x7FFF
movb (%r13,%rdi), %al
xorl %ecx, %ecx
leal (%r9,%rcx), %edx
cmpb %al, (%r13,%rdx)
jne 0x5351
incq %rcx
cmpq %rcx, %r14
jne 0x50d9
jmp 0x5354
cmpl $0x103, %eax            # imm = 0x103
jae 0x5537
cmpl %eax, %r14d
jae 0x5334
movl %esi, 0xc(%rsp)
movl %r8d, 0x10(%rsp)
leaq (%r9,%r13), %rcx
movq %rcx, 0x50(%rsp)
movzwl (%r13,%r9), %ecx
movw %cx, 0x32(%rsp)
xorl %ecx, %ecx
cmpl $0x20, %r14d
setae %cl
movl 0x14(%rbx,%rcx,4), %r8d
leal -0x1(%r9), %ecx
movq %rcx, 0x48(%rsp)
leal -0x1(%r9,%r14), %ecx
leaq (%rbx,%r9), %r12
movl $0x0, 0x14(%rsp)
movq %r9, 0x18(%rsp)
movl %r9d, %ebp
movl %ecx, %ecx
movzwl (%r13,%rcx), %esi
leal -0x1(%r14), %ecx
movq %rcx, 0x28(%rsp)
decl %r8d
movl %r8d, %r11d
movzwl 0x32(%rsp), %r10d
subl $0x1, %r11d
jb 0x5338
movl %ebp, %ecx
movzwl 0x192b2(%rbx,%rcx,2), %ebp
testl %ebp, %ebp
je 0x5338
movl %edi, %ecx
subl %ebp, %ecx
movzwl %cx, %r9d
cmpl %r9d, %edx
jb 0x5338
andl $0x7fff, %ebp           # imm = 0x7FFF
movq 0x28(%rsp), %rcx
addl %ebp, %ecx
cmpw %si, (%r13,%rcx)
je 0x5221
movzwl 0x192b2(%rbx,%rbp,2), %ebp
testl %ebp, %ebp
je 0x5338
movl %edi, %ecx
subl %ebp, %ecx
movzwl %cx, %r9d
cmpl %r9d, %edx
jb 0x5338
andl $0x7fff, %ebp           # imm = 0x7FFF
movq 0x28(%rsp), %rcx
addl %ebp, %ecx
cmpw %si, (%r13,%rcx)
je 0x5221
movzwl 0x192b2(%rbx,%rbp,2), %ebp
testl %ebp, %ebp
je 0x5338
movl %edi, %ecx
subl %ebp, %ecx
movzwl %cx, %r9d
cmpl %r9d, %edx
jb 0x5338
andl $0x7fff, %ebp           # imm = 0x7FFF
movq 0x28(%rsp), %rcx
addl %ebp, %ecx
cmpw %si, (%r13,%rcx)
jne 0x523a
testl %r9d, %r9d
je 0x5338
movl %r8d, 0x38(%rsp)
movl %ebp, %r8d
cmpw %r10w, (%r13,%r8)
je 0x5242
movl %r11d, %r8d
jmp 0x5173
movw %si, 0x30(%rsp)
addq 0x40(%rsp), %r8
xorl %r10d, %r10d
movq %r12, %rsi
movzwl 0xd2(%r12,%r10), %r11d
movzwl -0x6(%r8,%r10), %ecx
cmpw %cx, %r11w
jne 0x52b7
movzwl 0xd4(%rsi,%r10), %r11d
movzwl -0x4(%r8,%r10), %ecx
cmpw %cx, %r11w
jne 0x52c4
movzwl 0xd6(%rsi,%r10), %r11d
movzwl -0x2(%r8,%r10), %ecx
cmpw %cx, %r11w
jne 0x52d1
movzwl 0xd8(%rsi,%r10), %r11d
movzwl (%r8,%r10), %ecx
cmpw %cx, %r11w
jne 0x52de
addq $0x8, %r10
cmpl $0x100, %r10d           # imm = 0x100
jne 0x524f
jmp 0x54d4
leaq (%rsi,%r10), %r8
addq $0xd2, %r8
jmp 0x52e9
leaq (%rsi,%r10), %r8
addq $0xd4, %r8
jmp 0x52e9
leaq (%rsi,%r10), %r8
addq $0xd6, %r8
jmp 0x52e9
leaq (%r12,%r10), %r8
addq $0xd8, %r8
subl 0x50(%rsp), %r8d
andl $-0x2, %r8d
xorl %r10d, %r10d
cmpb %cl, %r11b
sete %r10b
orl %r8d, %r10d
cmpl %r14d, %r10d
movl 0x38(%rsp), %r8d
movzwl 0x30(%rsp), %esi
jbe 0x5167
cmpl %eax, %r10d
cmovael %eax, %r10d
jae 0x54e4
movq 0x48(%rsp), %rcx
addl %r10d, %ecx
movl %r9d, 0x14(%rsp)
movl %r10d, %r14d
jmp 0x5156
xorl %ebp, %ebp
jmp 0x5367
movl 0x10(%rsp), %r8d
movl 0x14(%rsp), %ebp
movl 0xc(%rsp), %esi
movq 0x18(%rsp), %r9
jmp 0x5367
xorl %r14d, %r14d
jmp 0x5354
movl %ecx, %r14d
xorl %ebp, %ebp
cmpl $0x3, %r14d
setae %bpl
movl $0x0, %eax
cmovbl %eax, %r14d
cmpl $0x3, %r14d
sete %al
cmpl $0x2000, %ebp           # imm = 0x2000
setae %cl
testb %cl, %al
jne 0x538d
cmpl %ebp, %r9d
je 0x538d
btl $0x12, %r8d
jae 0x53ac
cmpl $0x6, %r14d
jae 0x53ac
testl %esi, %esi
je 0x53fd
movl 0x6c(%rbx), %edx
movq %rbx, %rdi
callq 0x6015
movl 0x70(%rbx), %r14d
decl %r14d
movl $0x0, 0x70(%rbx)
jmp 0x5414
testl %esi, %esi
je 0x53e0
cmpl %esi, %r14d
jbe 0x5391
movq %r9, %r12
movzbl 0x74(%rbx), %esi
movq %rbx, %rdi
callq 0x5fd4
cmpl $0x80, %r14d
jb 0x5499
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x6015
jmp 0x53a3
testl %ebp, %ebp
je 0x53fd
cmpl $0x0, 0x1c(%rbx)
je 0x54a4
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x6015
jmp 0x5414
movzbl 0xd0(%rbx,%r9), %esi
movq %rbx, %rdi
callq 0x5fd4
movl $0x1, %r14d
movq 0x20(%rsp), %r12
addl %r14d, 0x28(%rbx)
movl 0x2c(%rbx), %eax
subl %r14d, %eax
jb 0x5518
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 0x60(%rsp), %rax
jbe 0x5470
movq %r15, 0xb8(%rbx)
movq %r12, 0xc0(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5556
testl %eax, %eax
je 0x4e19
jmp 0x5504
movl 0x5c(%rbx), %ecx
cmpl $0x7c01, %ecx           # imm = 0x7C01
jb 0x4e19
subl 0x58(%rsp), %eax
imull $0x73, %eax, %eax
shrl $0x7, %eax
cmpl %ecx, %eax
jae 0x544b
testb $0x10, 0x12(%rbx)
je 0x4e19
jmp 0x544b
movzbl 0xd0(%rbx,%r12), %eax
jmp 0x54c5
btl $0x11, %r8d
jb 0x53ee
cmpl $0x80, %r14d
jae 0x53ee
movzbl 0xd0(%rbx,%r9), %eax
movl %eax, 0x74(%rbx)
movl %ebp, 0x6c(%rbx)
movl %r14d, 0x70(%rbx)
jmp 0x540e
movl %r9d, %ebp
movl %eax, %r14d
movl 0x10(%rsp), %r8d
jmp 0x5341
movl %r9d, %ebp
movl %r10d, %r14d
jmp 0x54da
xorl %r12d, %r12d
movq %r15, 0xb8(%rbx)
movq %r12, 0xc0(%rbx)
movl $0x1, %eax
jmp 0x5509
notl %eax
shrl $0x1f, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3b17(%rip), %rdi      # 0x9036
leaq 0x39f4(%rip), %rsi      # 0x8f1a
leaq 0x3b2c(%rip), %rcx      # 0x9059
movl $0x8cc, %edx            # imm = 0x8CC
callq 0x1090
leaq 0x3b4d(%rip), %rdi      # 0x908b
leaq 0x39d5(%rip), %rsi      # 0x8f1a
leaq 0x3b64(%rip), %rcx      # 0x90b0
movl $0x786, %edx            # imm = 0x786
callq 0x1090