// File: /workspace/github_cpp_makefile_star2_O1/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 $0x48, %rsp
movq %rsi, %r14
movq %rcx, 0x38(%rsp)
movslq (%rcx), %rax
movq %rdi, %rcx
subq %rax, %rcx
movq %rcx, 0x8(%rsp)
movslq %edx, %rsi
leaq (%rdi,%rsi), %r15
testl %esi, %esi
setg %al
leaq 0xc(%rdi), %rdx
cmpq %r14, %rdx
setb %cl
andb %al, %cl
cmpb $0x1, %cl
movq %rdi, 0x40(%rsp)
movq %rsi, 0x30(%rsp)
jne 0xfd3d
movl %r9d, %ebp
movq %r8, %rbx
movslq 0xab4d(%rip), %rax      # 0x1a240
movq %rax, 0x28(%rsp)
movq %rdi, %r13
movl %r9d, 0x14(%rsp)
movq %r15, 0x20(%rsp)
movq %r14, (%rsp)
leaq 0x10000(%r13), %rax
movl %r14d, %ecx
subl %r13d, %ecx
cmpq %r14, %rax
movl $0x10000, %eax          # imm = 0x10000
cmovbel %eax, %ecx
movzbl (%r13), %eax
shll $0xe, %eax
movzbl 0x1(%r13), %edi
shll $0x7, %edi
addl %eax, %edi
movzbl 0x2(%r13), %esi
addl %edi, %esi
movl %esi, %eax
shrl $0x10, %eax
addl %esi, %eax
andl %ebp, %eax
movq (%rbx,%rax,8), %r8
movl $0x2, %r10d
xorl %r14d, %r14d
testq %r8, %r8
je 0xf7b8
movl $0x0, %edi
testq %rcx, %rcx
je 0xf776
xorl %edi, %edi
movb (%r8,%rdi), %r9b
cmpb (%r13,%rdi), %r9b
jne 0xf776
incq %rdi
cmpq %rdi, %rcx
jne 0xf761
movl %ecx, %edi
cmpl $0x3, %edi
jl 0xf7b8
movq %r13, %r9
subq %r8, %r9
cmpq 0x28(%rsp), %r9
jg 0xf7b8
cmpl $0x9, %edi
jg 0xf7b2
cmpl $0x101, %r9d            # imm = 0x101
jl 0xf7b2
cmpl $0x4000, %r9d           # imm = 0x4000
jg 0xf7a4
cmpl $0x5, %edi
jg 0xf7b2
cmpl $0x80000, %r9d          # imm = 0x80000
jg 0xf7b8
cmpl $0x8, %edi
jl 0xf7b8
movl %edi, %r10d
movl %r9d, %r14d
movq %r10, 0x18(%rsp)
roll $0xe, %esi
movzbl 0x3(%r13), %r8d
shll $0x7, %r8d
movzbl 0x4(%r13), %edi
addl %r8d, %edi
addl %esi, %edi
movl %edi, %esi
shrl $0x10, %esi
addl %edi, %esi
andl %ebp, %esi
movzbl 0x5(%r13), %r9d
movzbl 0x6(%r13), %r8d
movq %rbx, %r12
movq (%rbx,%rsi,8), %rbx
testq %rbx, %rbx
je 0xf804
movslq %r14d, %r11
movq %r13, %r10
subq %rbx, %r10
cmpq %r11, %r10
jne 0xf993
movq %r12, %rbx
roll $0xe, %edi
shll $0x7, %r9d
addl %r8d, %r9d
addl %edi, %r9d
roll $0xe, %r9d
movzbl 0x7(%r13), %edi
shll $0x7, %edi
movzbl 0x8(%r13), %r8d
addl %r9d, %r8d
addl %edi, %r8d
movl %r8d, %edi
shrl $0x10, %edi
addl %r8d, %edi
andl %ebp, %edi
movzbl 0x9(%r13), %r9d
movzbl 0xa(%r13), %r10d
movq (%rbx,%rdi,8), %rbp
testq %rbp, %rbp
je 0xf85b
movslq %r14d, %rbx
movq %r13, %r11
subq %rbp, %r11
cmpq %rbx, %r11
jne 0xfa10
movl 0x14(%rsp), %ebp
roll $0xe, %r8d
shll $0x7, %r9d
addl %r10d, %r9d
addl %r8d, %r9d
roll $0xe, %r9d
movzbl 0xb(%r13), %r8d
shll $0x7, %r8d
movzbl (%rdx), %r10d
addl %r9d, %r10d
addl %r8d, %r10d
movl %r10d, %edx
shrl $0x10, %edx
addl %r10d, %edx
andl %ebp, %edx
movq %r12, %rbx
movq (%r12,%rdx,8), %r10
testq %r10, %r10
je 0xf90d
movslq %r14d, %r9
movq %r13, %r8
subq %r10, %r8
cmpq %r9, %r8
movq 0x18(%rsp), %r12
je 0xf912
xorl %r9d, %r9d
testq %rcx, %rcx
je 0xf8cc
movb (%r10,%r9), %r11b
cmpb (%r13,%r9), %r11b
jne 0xf8cc
incq %r9
cmpq %r9, %rcx
jne 0xf8b6
movl %ecx, %r9d
cmpl %r12d, %r9d
jle 0xf912
cmpq 0x28(%rsp), %r8
jg 0xf912
cmpl $0x9, %r9d
jg 0xf905
cmpl $0x101, %r8d            # imm = 0x101
jl 0xf905
cmpl $0x4000, %r8d           # imm = 0x4000
jg 0xf8f6
cmpl $0x5, %r9d
jg 0xf905
cmpl $0x80000, %r8d          # imm = 0x80000
jg 0xf912
cmpl $0x8, %r9d
jl 0xf912
movl %r9d, %r12d
movl %r8d, %r14d
jmp 0xf912
movq 0x18(%rsp), %r12
movq %r13, (%rbx,%rdx,8)
movq %r13, (%rbx,%rdi,8)
movq %r13, (%rbx,%rsi,8)
movq %r13, (%rbx,%rax,8)
cmpl $0x3, %r12d
jl 0xf931
testl %r14d, %r14d
jle 0xfd8b
leaq 0x1(%r13), %rax
cmpl $0x3, %r12d
jge 0xf943
movq %rax, %r13
jmp 0xfbf4
cmpl $0x80, %r12d
jg 0xfa8a
cmpl $0x100, %r14d           # imm = 0x100
jg 0xfa8a
movl %r13d, %esi
movq 0x8(%rsp), %rdi
subl %edi, %esi
callq 0xfdaa
movq 0x104f5(%rip), %rax     # 0x1fe68
testq %rax, %rax
je 0xfb35
leal 0x7f(%r12), %ecx
leaq 0x1(%rax), %rdx
movq %rdx, 0x104dc(%rip)     # 0x1fe68
movb %cl, (%rax)
jmp 0xfb4f
xorl %r11d, %r11d
testq %rcx, %rcx
je 0xf9b5
movb (%rbx,%r11), %bpl
cmpb (%r13,%r11), %bpl
jne 0xf9b1
incq %r11
cmpq %r11, %rcx
jne 0xf99b
movl %ecx, %r11d
movl 0x14(%rsp), %ebp
cmpl 0x18(%rsp), %r11d
movq %r12, %rbx
jle 0xf807
cmpq 0x28(%rsp), %r10
jg 0xf807
cmpl $0x9, %r11d
jg 0xfa03
cmpl $0x101, %r10d           # imm = 0x101
jl 0xfa03
cmpl $0x4000, %r10d          # imm = 0x4000
jg 0xf9ec
cmpl $0x5, %r11d
jg 0xfa03
cmpl $0x80000, %r10d         # imm = 0x80000
jg 0xf807
cmpl $0x8, %r11d
jl 0xf807
movq %r11, 0x18(%rsp)
movl %r10d, %r14d
jmp 0xf807
xorl %ebx, %ebx
testq %rcx, %rcx
je 0xfa32
movb (%rbp,%rbx), %r15b
cmpb (%r13,%rbx), %r15b
jne 0xfa2d
incq %rbx
cmpq %rbx, %rcx
jne 0xfa17
movl %ecx, %ebx
movq 0x20(%rsp), %r15
cmpl 0x18(%rsp), %ebx
movl 0x14(%rsp), %ebp
jle 0xf85f
cmpq 0x28(%rsp), %r11
jg 0xf85f
cmpl $0x9, %ebx
jg 0xfa7d
cmpl $0x101, %r11d           # imm = 0x101
jl 0xfa7d
cmpl $0x4000, %r11d          # imm = 0x4000
jg 0xfa67
cmpl $0x5, %ebx
jg 0xfa7d
cmpl $0x80000, %r11d         # imm = 0x80000
jg 0xf85f
cmpl $0x8, %ebx
jl 0xf85f
movq %rbx, 0x18(%rsp)
movl %r11d, %r14d
jmp 0xf85f
leal -0x6(%r12), %ecx
cmpl $0xfa, %ecx
ja 0xfac9
cmpl $0x4000, %r14d          # imm = 0x4000
jg 0xfac9
movl %r13d, %esi
movq 0x8(%rsp), %rdi
subl %edi, %esi
callq 0xfdaa
movl %r12d, %eax
addq %r13, %rax
movq %rax, %r13
addl $0x3fff, %r14d          # imm = 0x3FFF
movl %r14d, %edi
callq 0x11707
jmp 0xfb0e
leal -0x8(%r12), %ecx
cmpl $0xf8, %ecx
ja 0xfbaa
cmpl $0x80000, %r14d         # imm = 0x80000
jg 0xfbaa
movl %r13d, %esi
movq 0x8(%rsp), %rdi
subl %edi, %esi
callq 0xfdaa
movl %r12d, %eax
addq %r13, %rax
movq %rax, %r13
addl $0x17ffff, %r14d        # imm = 0x17FFFF
movl %r14d, %edi
callq 0x11841
movq 0x10353(%rip), %rax     # 0x1fe68
testq %rax, %rax
movq %r13, 0x8(%rsp)
je 0xfb8f
decb %r12b
leaq 0x1(%rax), %rcx
movq %rcx, 0x1033b(%rip)     # 0x1fe68
movb %r12b, (%rax)
jmp 0xfbf4
leal 0x7f(%r12), %eax
movzbl %al, %edi
movq 0x1032c(%rip), %rsi     # 0x1fe70
callq 0x21b0
incl 0x10329(%rip)           # 0x1fe78
movl %r12d, %eax
addq %rax, %r13
movq 0x1030c(%rip), %rax     # 0x1fe68
testq %rax, %rax
je 0xfb74
decb %r14b
leaq 0x1(%rax), %rcx
movq %rcx, 0x102f9(%rip)     # 0x1fe68
movb %r14b, (%rax)
jmp 0xfbef
decl %r14d
movzbl %r14b, %edi
movq 0x102ee(%rip), %rsi     # 0x1fe70
callq 0x21b0
incl 0x102eb(%rip)           # 0x1fe78
jmp 0xfbef
decl %r12d
movzbl %r12b, %edi
movq 0x102d3(%rip), %rsi     # 0x1fe70
callq 0x21b0
incl 0x102d0(%rip)           # 0x1fe78
jmp 0xfbf4
leal -0x9(%r12), %ecx
cmpl $0xfff7, %ecx           # imm = 0xFFF7
ja 0xfc13
cmpl $0x80000, %r14d         # imm = 0x80000
jg 0xfc13
movl %r13d, %esi
movq 0x8(%rsp), %rdi
subl %edi, %esi
callq 0xfdaa
movl %r12d, %eax
addq %rax, %r13
addl $0xfffff, %r14d         # imm = 0xFFFFF
movl %r14d, %edi
callq 0x11841
decl %r12d
movl %r12d, %edi
callq 0x11707
movq %r13, 0x8(%rsp)
movq (%rsp), %r14
cmpq %r15, %r13
jae 0xfd40
leaq 0xc(%r13), %rdx
cmpq %r14, %rdx
jb 0xf709
jmp 0xfd40
cmpl $0xa, %r12d
jl 0xf93b
cmpl $0x1000000, %r14d       # imm = 0x1000000
jg 0xf93b
movl $0x10000, %eax          # imm = 0x10000
cmpl %eax, %r12d
movl $0x10000, %r15d         # imm = 0x10000
cmovll %r12d, %r15d
movl %r13d, %esi
movq 0x8(%rsp), %rdi
subl %edi, %esi
callq 0xfdaa
movq %r15, 0x18(%rsp)
addq %r15, %r13
movq 0x1020e(%rip), %rax     # 0x1fe68
cmpl $0x100, %r12d           # imm = 0x100
jg 0xfc7b
movl %r14d, %r12d
testq %rax, %rax
je 0xfc93
leaq 0x1(%rax), %rcx
movq %rcx, 0x101f2(%rip)     # 0x1fe68
movb $0x6, (%rax)
jmp 0xfcaa
movl %r14d, %r12d
testq %rax, %rax
je 0xfcdf
leaq 0x1(%rax), %rcx
movq %rcx, 0x101da(%rip)     # 0x1fe68
movb $0x4, (%rax)
jmp 0xfcf6
movq 0x101d6(%rip), %rsi     # 0x1fe70
movl $0x6, %edi
callq 0x21b0
incl 0x101ce(%rip)           # 0x1fe78
movq (%rsp), %r14
movq 0x20(%rsp), %r15
movl %r12d, %edi
decl %edi
callq 0x11841
movq 0x101a4(%rip), %rax     # 0x1fe68
testq %rax, %rax
je 0xfd17
movq 0x18(%rsp), %rdx
decb %dl
leaq 0x1(%rax), %rcx
movq %rcx, 0x1018d(%rip)     # 0x1fe68
movb %dl, (%rax)
jmp 0xfd33
movq 0x1018a(%rip), %rsi     # 0x1fe70
movl $0x4, %edi
callq 0x21b0
incl 0x10182(%rip)           # 0x1fe78
movq (%rsp), %r14
movq 0x20(%rsp), %r15
movl %r12d, %edi
decl %edi
callq 0x11841
movq 0x18(%rsp), %rdi
decl %edi
callq 0x11707
jmp 0xfd33
movq 0x18(%rsp), %rax
decl %eax
movzbl %al, %edi
movq 0x10148(%rip), %rsi     # 0x1fe70
callq 0x21b0
incl 0x10145(%rip)           # 0x1fe78
movq %r13, 0x8(%rsp)
jmp 0xfbf8
movq %rdi, %r13
movq %r13, %rax
movq 0x40(%rsp), %rsi
subq %rsi, %rax
cmpq 0x30(%rsp), %rax
cmovll %r15d, %r13d
movl %r13d, %eax
subl 0x8(%rsp), %eax
movq 0x38(%rsp), %rcx
movl %eax, (%rcx)
movl 0x10678(%rip), %edi     # 0x203e0
subl %esi, %r13d
movl %r13d, %edx
callq 0xa30b
movl %eax, 0x10667(%rip)     # 0x203e0
movl %r13d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3691(%rip), %rdi      # 0x13423
leaq 0x2768(%rip), %rsi      # 0x12501
leaq 0x368c(%rip), %rcx      # 0x1342c
movl $0x28ee, %edx           # imm = 0x28EE
callq 0x2140