// File: /workspace/github_cpp_makefile_star2_O2/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_compress_chunk
static int stb_compress_chunk(stb_uchar *history,
                              stb_uchar *start,
                              stb_uchar *end,
                              int length,
                              int *pending_literals,
                              stb_uchar **chash,
                              stb_uint mask)
{
   int window = stb__window;
   stb_uint match_max;
   stb_uchar *lit_start = start - *pending_literals;
   stb_uchar *q = start;

   #define STB__SCRAMBLE(h)   (((h) + ((h) >> 16)) & mask)

   // stop short of the end so we don't scan off the end doing
   // the hashing; this means we won't compress the last few bytes
   // unless they were part of something longer
   while (q < start+length && q+12 < end) {
      int m;
      stb_uint h1,h2,h3,h4, h;
      stb_uchar *t;
      int best = 2, dist=0;

      if (q+65536 > end)
         match_max = end-q;
      else
         match_max = 65536;

      #define stb__nc(b,d)  ((d) <= window && ((b) > 9 || stb_not_crap(b,d)))

      #define STB__TRY(t,p)  /* avoid retrying a match we already tried */ \
                      if (p ? dist != q-t : 1)                             \
                      if ((m = stb_matchlen(t, q, match_max)) > best)     \
                      if (stb__nc(m,q-(t)))                                \
                          best = m, dist = q - (t)

      // rather than search for all matches, only try 4 candidate locations,
      // chosen based on 4 different hash functions of different lengths.
      // this strategy is inspired by LZO; hashing is unrolled here using the
      // 'hc' macro
      h = stb__hc3(q,0, 1, 2); h1 = STB__SCRAMBLE(h);
                                      t = chash[h1]; if (t) STB__TRY(t,0);
      h = stb__hc2(q,h, 3, 4); h2 = STB__SCRAMBLE(h);
      h = stb__hc2(q,h, 5, 6);        t = chash[h2]; if (t) STB__TRY(t,1);
      h = stb__hc2(q,h, 7, 8); h3 = STB__SCRAMBLE(h);
      h = stb__hc2(q,h, 9,10);        t = chash[h3]; if (t) STB__TRY(t,1);
      h = stb__hc2(q,h,11,12); h4 = STB__SCRAMBLE(h);
                                      t = chash[h4]; if (t) STB__TRY(t,1);

      // because we use a shared hash table, can only update it
      // _after_ we've probed all of them
      chash[h1] = chash[h2] = chash[h3] = chash[h4] = q;

      if (best > 2)
         assert(dist > 0);

      // see if our best match qualifies
      if (best < 3) { // fast path literals
         ++q;
      } else if (best > 2  &&  best <= 0x80    &&  dist <= 0x100) {
         outliterals(lit_start, q-lit_start); lit_start = (q += best);
         stb_out(0x80 + best-1);
         stb_out(dist-1);
      } else if (best > 5  &&  best <= 0x100   &&  dist <= 0x4000) {
         outliterals(lit_start, q-lit_start); lit_start = (q += best);
         stb_out2(0x4000 + dist-1);       
         stb_out(best-1);
      } else if (best > 7  &&  best <= 0x100   &&  dist <= 0x80000) {
         outliterals(lit_start, q-lit_start); lit_start = (q += best);
         stb_out3(0x180000 + dist-1);     
         stb_out(best-1);
      } else if (best > 8  &&  best <= 0x10000 &&  dist <= 0x80000) {
         outliterals(lit_start, q-lit_start); lit_start = (q += best);
         stb_out3(0x100000 + dist-1);     
         stb_out2(best-1);
      } else if (best > 9                      &&  dist <= 0x1000000) {
         if (best > 65536) best = 65536;
         outliterals(lit_start, q-lit_start); lit_start = (q += best);
         if (best <= 0x100) {
            stb_out(0x06);
            stb_out3(dist-1);
            stb_out(best-1);
         } else {
            stb_out(0x04);
            stb_out3(dist-1);
            stb_out2(best-1);
         }
      } else {  // fallback literals if no match was a balanced tradeoff
         ++q;
      }
   }

   // if we didn't get all the way, add the rest to literals
   if (q-start < length)
      q = start+length;

   // the literals are everything from lit_start to q
   *pending_literals = (q - lit_start);

   stb__running_adler = stb_adler32(stb__running_adler, start, q - start);
   return q - start;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %r9d, 0x18(%rsp)
movq %rsi, %r13
movslq 0xa6d6(%rip), %rax      # 0x18230
movq %rax, 0x30(%rsp)
movq %rcx, 0x50(%rsp)
movslq (%rcx), %rax
movq %rdi, %rcx
subq %rax, %rcx
movq %rcx, 0x10(%rsp)
movslq %edx, %rax
movq %rax, 0x48(%rsp)
addq %rdi, %rax
movq %rax, 0x40(%rsp)
movq %rdi, 0x58(%rsp)
movq %rdi, %r15
movq %r8, (%rsp)
movq %rsi, 0x60(%rsp)
movq %r15, %r14
cmpq 0x40(%rsp), %r15
jae 0xe151
leaq 0xc(%r14), %rax
cmpq %r13, %rax
jae 0xe151
leaq 0x10000(%r14), %rax
movl %r13d, %edx
subl %r14d, %edx
cmpq %r13, %rax
movl $0x10000, %eax          # imm = 0x10000
cmovbel %eax, %edx
movzbl (%r14), %eax
shll $0xe, %eax
movzbl 0x1(%r14), %ecx
shll $0x7, %ecx
addl %eax, %ecx
movzbl 0x2(%r14), %r13d
addl %ecx, %r13d
movl %r13d, %eax
shrl $0x10, %eax
addl %r13d, %eax
andl 0x18(%rsp), %eax
movq (%r8,%rax,8), %rbx
xorl %r9d, %r9d
testq %rbx, %rbx
movq %rax, 0x28(%rsp)
movl %edx, 0x1c(%rsp)
je 0xdc55
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf8e0
cmpl $0x3, %eax
jl 0xdc5c
movl %eax, %ebp
movq %r14, %r15
subq %rbx, %r15
pushq $0x2
popq %rax
movl %eax, %esi
cmpq 0x30(%rsp), %r15
movq (%rsp), %r8
movl $0x0, %r9d
jg 0xdc68
cmpl $0x9, %ebp
ja 0xdc4e
movl %ebp, %edi
movl %r15d, %esi
callq 0xf8f9
movq (%rsp), %r8
testl %eax, %eax
pushq $0x2
popq %rcx
cmovel %ecx, %ebp
cmovel %eax, %r15d
movl %ebp, %esi
movl %r15d, %r9d
jmp 0xdc68
pushq $0x2
popq %rax
movl %eax, %esi
jmp 0xdc68
pushq $0x2
popq %rax
movl %eax, %esi
movq (%rsp), %r8
xorl %r9d, %r9d
roll $0xe, %r13d
movzbl 0x3(%r14), %eax
shll $0x7, %eax
movzbl 0x4(%r14), %r12d
addl %eax, %r12d
addl %r13d, %r12d
movl %r12d, %ebx
shrl $0x10, %ebx
addl %r12d, %ebx
andl 0x18(%rsp), %ebx
movzbl 0x5(%r14), %r13d
movzbl 0x6(%r14), %ecx
movq (%r8,%rbx,8), %rdi
testq %rdi, %rdi
je 0xdd1d
movslq %r9d, %rax
movq %r14, %rbp
subq %rdi, %rbp
cmpq %rax, %rbp
je 0xdd1d
movl %ecx, 0xc(%rsp)
movl %r9d, 0x8(%rsp)
movq %rsi, %r15
movq %r14, %rsi
movl 0x1c(%rsp), %edx
callq 0xf8e0
movq %r15, %rsi
cmpl %esi, %eax
jle 0xdce7
cmpq 0x30(%rsp), %rbp
movq (%rsp), %r8
jg 0xdceb
movl %eax, %r15d
cmpl $0x9, %eax
jbe 0xdcf2
movl %r15d, %esi
movl %ebp, %r9d
jmp 0xdd19
movq (%rsp), %r8
movl 0x8(%rsp), %r9d
jmp 0xdd19
movl %r15d, %edi
movq %rsi, 0x20(%rsp)
movl %ebp, %esi
callq 0xf8f9
movq (%rsp), %r8
testl %eax, %eax
cmovel 0x20(%rsp), %r15d
movl 0x8(%rsp), %r9d
cmovnel %ebp, %r9d
movl %r15d, %esi
movl 0xc(%rsp), %ecx
roll $0xe, %r12d
shll $0x7, %r13d
addl %ecx, %r13d
addl %r12d, %r13d
roll $0xe, %r13d
movzbl 0x7(%r14), %eax
shll $0x7, %eax
movzbl 0x8(%r14), %r15d
addl %eax, %r15d
addl %r13d, %r15d
movl %r15d, %r12d
shrl $0x10, %r12d
addl %r15d, %r12d
andl 0x18(%rsp), %r12d
movzbl 0x9(%r14), %r13d
movzbl 0xa(%r14), %ecx
movq (%r8,%r12,8), %rdi
testq %rdi, %rdi
je 0xdd76
movslq %r9d, %rax
movq %r14, %rbp
subq %rdi, %rbp
cmpq %rax, %rbp
jne 0xde01
roll $0xe, %r15d
shll $0x7, %r13d
addl %ecx, %r13d
addl %r15d, %r13d
roll $0xe, %r13d
movzbl 0xb(%r14), %eax
shll $0x7, %eax
movzbl 0xc(%r14), %ecx
addl %eax, %ecx
addl %r13d, %ecx
movl %ecx, %r13d
shrl $0x10, %r13d
addl %ecx, %r13d
andl 0x18(%rsp), %r13d
movq (%r8,%r13,8), %rdi
testq %rdi, %rdi
je 0xde94
movslq %r9d, %rax
movq %r14, %rbp
subq %rdi, %rbp
cmpq %rax, %rbp
je 0xde94
movl %r9d, 0x8(%rsp)
movq %rsi, %r15
movq %r14, %rsi
movl 0x1c(%rsp), %edx
callq 0xf8e0
movq %r15, %rsi
cmpl %esi, %eax
jle 0xde50
cmpq 0x30(%rsp), %rbp
movq (%rsp), %r8
jg 0xde54
movl %eax, %r15d
cmpl $0x9, %eax
jbe 0xde6d
movl %r15d, %esi
movl %ebp, %r9d
jmp 0xde94
movl %ecx, 0xc(%rsp)
movl %r9d, 0x8(%rsp)
movq %rsi, 0x20(%rsp)
movq %r14, %rsi
movl 0x1c(%rsp), %edx
callq 0xf8e0
movq 0x20(%rsp), %rsi
cmpl %esi, %eax
jle 0xde5b
cmpq 0x30(%rsp), %rbp
movq (%rsp), %r8
movl 0xc(%rsp), %ecx
jg 0xde46
cmpl $0x9, %eax
jbe 0xdff1
movl %eax, %esi
movl %ebp, %r9d
jmp 0xdd76
movl 0x8(%rsp), %r9d
jmp 0xdd76
movq (%rsp), %r8
movl 0x8(%rsp), %r9d
jmp 0xde94
movq (%rsp), %r8
movl 0x8(%rsp), %r9d
movl 0xc(%rsp), %ecx
jmp 0xdd76
movl %r15d, %edi
movq %rsi, 0x20(%rsp)
movl %ebp, %esi
callq 0xf8f9
movq (%rsp), %r8
testl %eax, %eax
cmovel 0x20(%rsp), %r15d
movl 0x8(%rsp), %r9d
cmovnel %ebp, %r9d
movl %r15d, %esi
movq 0x28(%rsp), %rax
movq %r14, (%r8,%r13,8)
movq %r14, (%r8,%r12,8)
movq %r14, (%r8,%rbx,8)
movq %r14, (%r8,%rax,8)
cmpl $0x3, %esi
jb 0xdeb7
testl %r9d, %r9d
jle 0xe19e
leaq 0x1(%r14), %r15
cmpl $0x3, %esi
movq 0x60(%rsp), %r13
jb 0xdb93
movl %esi, %ebx
cmpl $0x80, %esi
ja 0xdf1b
cmpl $0x100, %r9d            # imm = 0x100
jg 0xdf1b
movl %r9d, %ebp
movq %rsi, %r15
movl %r14d, %esi
movq 0x10(%rsp), %rdi
subl %edi, %esi
callq 0xe1bd
movq %r15, %rcx
movq %rbx, %r15
addq %r14, %r15
movq 0xff57(%rip), %rax      # 0x1de58
addb $0x7f, %cl
testq %rax, %rax
je 0xdfba
movb %cl, (%rax)
incq %rax
movq (%rsp), %r8
jmp 0xdfd6
leal -0x6(%rsi), %eax
cmpl $0xfa, %eax
ja 0xdf58
cmpl $0x4000, %r9d           # imm = 0x4000
jg 0xdf58
movq %rsi, %r12
movl %r14d, %esi
movq 0x10(%rsp), %rdi
subl %edi, %esi
movl %r9d, %ebp
callq 0xe1bd
movq %rbx, %r15
addq %r14, %r15
addl $0x3fff, %ebp           # imm = 0x3FFF
movl %ebp, %edi
callq 0xf819
jmp 0xdf9b
leal -0x8(%rsi), %eax
cmpl $0xf8, %eax
ja 0xe038
cmpl $0x80000, %r9d          # imm = 0x80000
jg 0xe038
movq %rsi, %r12
movl %r14d, %esi
movq 0x10(%rsp), %rdi
subl %edi, %esi
movl %r9d, %ebp
callq 0xe1bd
movq %rbx, %r15
addq %r14, %r15
addl $0x17ffff, %ebp         # imm = 0x17FFFF
movl %ebp, %edi
callq 0xf92c
movq 0xfeb6(%rip), %rax      # 0x1de58
decb %r12b
testq %rax, %rax
je 0xe021
leaq 0x1(%rax), %rcx
movq %rcx, 0xfea3(%rip)      # 0x1de58
movb %r12b, (%rax)
jmp 0xe02a
movzbl %cl, %edi
callq 0xf804
movq 0xfe8f(%rip), %rax      # 0x1de58
testq %rax, %rax
movq (%rsp), %r8
je 0xe08c
decb %bpl
leaq 0x1(%rax), %rcx
movq %rcx, 0xfe74(%rip)      # 0x1de58
movb %bpl, (%rax)
movq %r15, 0x10(%rsp)
jmp 0xdb93
movl %eax, %edi
movl %ebp, %esi
movl %eax, 0x3c(%rsp)
callq 0xf8f9
movl 0xc(%rsp), %ecx
movq (%rsp), %r8
testl %eax, %eax
movl 0x3c(%rsp), %eax
cmovel 0x20(%rsp), %eax
movl 0x8(%rsp), %r9d
cmovnel %ebp, %r9d
movl %eax, %esi
jmp 0xdd76
movzbl %r12b, %edi
callq 0xf804
movq %r15, 0x10(%rsp)
movq (%rsp), %r8
jmp 0xdb93
leal -0x9(%rsi), %eax
cmpl $0xfff7, %eax           # imm = 0xFFF7
ja 0xe0a6
cmpl $0x80000, %r9d          # imm = 0x80000
jg 0xe0a6
movq %rsi, %r15
movl %r14d, %esi
movq 0x10(%rsp), %rdi
subl %edi, %esi
movl %r9d, %ebp
callq 0xe1bd
addq %r14, %rbx
addl $0xfffff, %ebp          # imm = 0xFFFFF
movl %ebp, %edi
callq 0xf92c
decl %r15d
movl %r15d, %edi
callq 0xf819
movq (%rsp), %r8
movq %rbx, %r15
movq %rbx, 0x10(%rsp)
jmp 0xdb93
decb %bpl
movzbl %bpl, %edi
callq 0xf804
movq (%rsp), %r8
movq %r15, 0x10(%rsp)
jmp 0xdb93
cmpl $0xa, %esi
jb 0xdb93
cmpl $0x1000000, %r9d        # imm = 0x1000000
jg 0xdb93
movl %r9d, %ebx
movl $0x10000, %eax          # imm = 0x10000
cmpl %eax, %esi
movl $0x10000, %r12d         # imm = 0x10000
cmovbl %esi, %r12d
movq %rsi, %rbp
movl %r14d, %esi
movq 0x10(%rsp), %rdi
subl %edi, %esi
callq 0xe1bd
leaq (%r12,%r14), %r15
movq 0xfd6b(%rip), %rax      # 0x1de58
cmpl $0x100, %ebp            # imm = 0x100
ja 0xe10a
testq %rax, %rax
je 0xe11f
leaq 0x1(%rax), %rcx
movq %rcx, 0xfd53(%rip)      # 0x1de58
movb $0x6, (%rax)
jmp 0xe127
testq %rax, %rax
je 0xe130
leaq 0x1(%rax), %rcx
movq %rcx, 0xfd3e(%rip)      # 0x1de58
movb $0x4, (%rax)
jmp 0xe138
pushq $0x6
popq %rdi
callq 0xf804
movl %ebx, %edi
decl %edi
jmp 0xdf96
pushq $0x4
popq %rdi
callq 0xf804
movl %ebx, %edi
decl %edi
callq 0xf92c
decl %r12d
movl %r12d, %edi
callq 0xf819
jmp 0xe02a
movq %r14, %rax
movq 0x58(%rsp), %rsi
subq %rsi, %rax
cmpq 0x48(%rsp), %rax
cmovll 0x40(%rsp), %r14d
movl %r14d, %eax
subl 0x10(%rsp), %eax
movq 0x50(%rsp), %rcx
movl %eax, (%rcx)
movl 0x10255(%rip), %edi     # 0x1e3d0
subl %esi, %r14d
movl %r14d, %edx
callq 0x923e
movl %eax, 0x10244(%rip)     # 0x1e3d0
movl %r14d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3194(%rip), %rdi      # 0x11339
leaq 0x2275(%rip), %rsi      # 0x10421
leaq 0x318f(%rip), %rcx      # 0x11342
movl $0x28ee, %edx           # imm = 0x28EE
callq 0x2140