// File: /workspace/github_c_makefile_star2_O3/vlenhart[P]q3bsp/./stb_image_write.h
// Function: stbi_zlib_compress(unsigned char*, int, int*, int)
unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_len, int quality)
{
   static unsigned short lengthc[] = { 3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258, 259 };
   static unsigned char  lengtheb[]= { 0,0,0,0,0,0,0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4,  4,  5,  5,  5,  5,  0 };
   static unsigned short distc[]   = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577, 32768 };
   static unsigned char  disteb[]  = { 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13 };
   unsigned int bitbuf=0;
   int i,j, bitcount=0;
   unsigned char *out = NULL;
   unsigned char **hash_table[stbiw__ZHASH]; // 64KB on the stack!
   if (quality < 5) quality = 5;

   stbiw__sbpush(out, 0x78);   // DEFLATE 32K window
   stbiw__sbpush(out, 0x5e);   // FLEVEL = 1
   stbiw__zlib_add(1,1);  // BFINAL = 1
   stbiw__zlib_add(1,2);  // BTYPE = 1 -- fixed huffman

   for (i=0; i < stbiw__ZHASH; ++i)
      hash_table[i] = NULL;

   i=0;
   while (i < data_len-3) {
      // hash next 3 bytes of data to be compressed
      int h = stbiw__zhash(data+i)&(stbiw__ZHASH-1), best=3;
      unsigned char *bestloc = 0;
      unsigned char **hlist = hash_table[h];
      int n = stbiw__sbcount(hlist);
      for (j=0; j < n; ++j) {
         if (hlist[j]-data > i-32768) { // if entry lies within window
            int d = stbiw__zlib_countm(hlist[j], data+i, data_len-i);
            if (d >= best) best=d,bestloc=hlist[j];
         }
      }
      // when hash table entry is too long, delete half the entries
      if (hash_table[h] && stbiw__sbn(hash_table[h]) == 2*quality) {
         STBIW_MEMMOVE(hash_table[h], hash_table[h]+quality, sizeof(hash_table[h][0])*quality);
         stbiw__sbn(hash_table[h]) = quality;
      }
      stbiw__sbpush(hash_table[h],data+i);

      if (bestloc) {
         // "lazy matching" - check match at *next* byte, and if it's better, do cur byte as literal
         h = stbiw__zhash(data+i+1)&(stbiw__ZHASH-1);
         hlist = hash_table[h];
         n = stbiw__sbcount(hlist);
         for (j=0; j < n; ++j) {
            if (hlist[j]-data > i-32767) {
               int e = stbiw__zlib_countm(hlist[j], data+i+1, data_len-i-1);
               if (e > best) { // if next match is better, bail on current match
                  bestloc = NULL;
                  break;
               }
            }
         }
      }

      if (bestloc) {
         int d = (int) (data+i - bestloc); // distance back
         STBIW_ASSERT(d <= 32767 && best <= 258);
         for (j=0; best > lengthc[j+1]-1; ++j);
         stbiw__zlib_huff(j+257);
         if (lengtheb[j]) stbiw__zlib_add(best - lengthc[j], lengtheb[j]);
         for (j=0; d > distc[j+1]-1; ++j);
         stbiw__zlib_add(stbiw__zlib_bitrev(j,5),5);
         if (disteb[j]) stbiw__zlib_add(d - distc[j], disteb[j]);
         i += best;
      } else {
         stbiw__zlib_huffb(data[i]);
         ++i;
      }
   }
   // write out final bytes
   for (;i < data_len; ++i)
      stbiw__zlib_huffb(data[i]);
   stbiw__zlib_huff(256); // end of block
   // pad with 0 bits to byte boundary
   while (bitcount)
      stbiw__zlib_add(0,1);

   for (i=0; i < stbiw__ZHASH; ++i)
      (void) stbiw__sbfree(hash_table[i]);

   {
      // compute adler32 on input
      unsigned int i=0, s1=1, s2=0, blocklen = data_len % 5552;
      int j=0;
      while (j < data_len) {
         for (i=0; i < blocklen; ++i) s1 += data[j+i], s2 += s1;
         s1 %= 65521, s2 %= 65521;
         j += blocklen;
         blocklen = 5552;
      }
      stbiw__sbpush(out, (unsigned char) (s2 >> 8));
      stbiw__sbpush(out, (unsigned char) s2);
      stbiw__sbpush(out, (unsigned char) (s1 >> 8));
      stbiw__sbpush(out, (unsigned char) s1);
   }
   *out_len = stbiw__sbn(out);
   // make returned pointer freeable
   STBIW_MEMMOVE(stbiw__sbraw(out), out, *out_len);
   return (unsigned char *) stbiw__sbraw(out);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20058, %rsp          # imm = 0x20058
movq %rdx, -0x70(%rbp)
movq %rsi, -0x40(%rbp)
movq %rdi, -0x50(%rbp)
leaq -0x38(%rbp), %rbx
movq $0x0, (%rbx)
cmpl $0x6, %ecx
movl $0x5, %eax
cmovgel %ecx, %eax
movq %rax, -0x60(%rbp)
movl $0x1, %r14d
movq %rbx, %rdi
movl $0x1, %esi
callq 0x565a
movq (%rbx), %rdi
movslq -0x4(%rdi), %rax
leal 0x1(%rax), %ecx
movl %ecx, -0x4(%rdi)
movb $0x78, (%rdi,%rax)
movl -0x4(%rdi), %eax
leal 0x1(%rax), %ecx
cmpl -0x8(%rdi), %ecx
jl 0x4f2f
movq %rbx, %rdi
movl $0x1, %esi
callq 0x565a
movq (%rbx), %rdi
movl -0x4(%rdi), %eax
leal 0x1(%rax), %ecx
movl %ecx, -0x4(%rdi)
cltq
movb $0x5e, (%rdi,%rax)
leaq -0x30(%rbp), %rbx
movl %r14d, (%rbx)
leaq -0x2c(%rbp), %r12
movl %r14d, (%r12)
movq %rbx, %rsi
movq %r12, %rdx
callq 0x56dd
movl (%r12), %ecx
shll %cl, %r14d
orl %r14d, (%rbx)
addl $0x2, %ecx
movl %ecx, (%r12)
movq %rax, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x56dd
movq %rax, -0x48(%rbp)
movq %rax, -0x38(%rbp)
leaq -0x20080(%rbp), %rdi
xorl %r12d, %r12d
movl $0x20000, %edx          # imm = 0x20000
xorl %esi, %esi
callq 0x2150
movq -0x40(%rbp), %rax
cmpl $0x4, %eax
jl 0x53c5
addl $-0x3, %eax
movl %eax, -0x58(%rbp)
movq -0x60(%rbp), %rax
leal (%rax,%rax), %ecx
movl %ecx, -0x54(%rbp)
movl %eax, %eax
movq %rax, -0x80(%rbp)
leaq (,%rax,8), %rax
movq %rax, -0x78(%rbp)
xorl %esi, %esi
movq -0x50(%rbp), %r11
movslq %esi, %rax
leaq (%r11,%rax), %r13
movzwl (%r11,%rax), %ecx
movzbl 0x2(%r11,%rax), %eax
shll $0x10, %eax
orl %ecx, %eax
leal (,%rax,8), %ecx
xorl %eax, %ecx
movl %ecx, %eax
shrl $0x5, %eax
addl %ecx, %eax
movl %eax, %ecx
shll $0x4, %ecx
xorl %eax, %ecx
movl %ecx, %eax
shrl $0x11, %eax
addl %ecx, %eax
movl %eax, %r15d
shrl $0x6, %r15d
addl %eax, %r15d
andl $0x3fff, %r15d          # imm = 0x3FFF
movq -0x20080(%rbp,%r15,8), %rbx
testq %rbx, %rbx
movq %rsi, -0x68(%rbp)
je 0x5093
movslq -0x4(%rbx), %rax
testq %rax, %rax
jle 0x509e
leal -0x8000(%rsi), %ecx
movslq %ecx, %rcx
movq -0x40(%rbp), %rdx
subl %esi, %edx
leal -0x1(%rdx), %esi
movl $0x101, %edi            # imm = 0x101
cmpl %edi, %esi
cmovael %edi, %esi
incl %esi
movl $0x3, %r12d
xorl %edi, %edi
xorl %r14d, %r14d
movq (%rbx,%rdi,8), %r8
movq %r8, %r9
subq %r11, %r9
cmpq %rcx, %r9
jle 0x5084
xorl %r9d, %r9d
testl %edx, %edx
jle 0x5079
movb (%r8,%r9), %r10b
cmpb (%r13,%r9), %r10b
jne 0x5079
incq %r9
cmpq %r9, %rsi
jne 0x5063
movl %esi, %r9d
cmpl %r12d, %r9d
cmovgl %r9d, %r12d
cmovgeq %r8, %r14
incq %rdi
cmpq %rax, %rdi
jne 0x504d
testq %rbx, %rbx
jne 0x50a7
jmp 0x50d2
movl $0x3, %r12d
xorl %r14d, %r14d
jmp 0x50d2
movl $0x3, %r12d
xorl %r14d, %r14d
movl -0x4(%rbx), %eax
cmpl -0x54(%rbp), %eax
jne 0x50ca
movq -0x80(%rbp), %rax
leaq (%rbx,%rax,8), %rsi
movq %rbx, %rdi
movq -0x78(%rbp), %rdx
callq 0x2390
movq -0x60(%rbp), %rax
movl %eax, -0x4(%rbx)
leal 0x1(%rax), %ecx
cmpl -0x8(%rbx), %ecx
jl 0x50f3
leaq -0x20080(,%r15,8), %rbx
addq %rbp, %rbx
movq %rbx, %rdi
movl $0x8, %esi
callq 0x565a
movq (%rbx), %rbx
movl -0x4(%rbx), %eax
leal 0x1(%rax), %ecx
movl %ecx, -0x4(%rbx)
cltq
movq %r13, (%rbx,%rax,8)
testq %r14, %r14
leaq -0x2c(%rbp), %r15
je 0x522d
movzwl 0x1(%r13), %eax
movzbl 0x3(%r13), %ecx
shll $0x10, %ecx
orl %eax, %ecx
leal (,%rcx,8), %eax
xorl %ecx, %eax
movl %eax, %ecx
shrl $0x5, %ecx
addl %eax, %ecx
movl %ecx, %eax
shll $0x4, %eax
xorl %ecx, %eax
movl %eax, %ecx
shrl $0x11, %ecx
addl %eax, %ecx
movl %ecx, %eax
shrl $0x6, %eax
addl %ecx, %eax
andl $0x3fff, %eax           # imm = 0x3FFF
movq -0x20080(%rbp,%rax,8), %rax
testq %rax, %rax
je 0x51c6
movslq -0x4(%rax), %rcx
testq %rcx, %rcx
jle 0x51c6
leaq 0x1(%r13), %rdx
movq -0x68(%rbp), %r8
leal -0x7fff(%r8), %esi
movslq %esi, %rsi
notl %r8d
movq -0x40(%rbp), %r9
leal (%r8,%r9), %edi
decl %edi
addl %r9d, %r8d
movl $0x101, %r9d            # imm = 0x101
cmpl %r9d, %edi
cmovael %r9d, %edi
incl %edi
xorl %r9d, %r9d
movq (%rax,%r9,8), %r10
movq %r10, %r11
subq -0x50(%rbp), %r11
cmpq %rsi, %r11
jle 0x51be
xorl %r11d, %r11d
testl %r8d, %r8d
jle 0x51b9
movb (%r10,%r11), %bl
cmpb (%rdx,%r11), %bl
jne 0x51b9
incq %r11
cmpq %r11, %rdi
jne 0x51a4
movl %edi, %r11d
cmpl %r12d, %r11d
jg 0x522d
incq %r9
cmpq %rcx, %r9
jne 0x518c
subl %r14d, %r13d
cmpl $0x7fff, %r13d          # imm = 0x7FFF
jg 0x563b
cmpl $0x102, %r12d           # imm = 0x102
jg 0x563b
xorl %eax, %eax
movq -0x48(%rbp), %rdi
leaq -0x30(%rbp), %r14
leaq 0xcecc(%rip), %rdx      # 0x120c0
movzwl 0x2(%rdx,%rax,2), %ecx
incq %rax
cmpl %ecx, %r12d
jge 0x51f4
leaq -0x1(%rax), %rbx
cmpq $0x16, %rbx
ja 0x526d
xorl %edx, %edx
movl $0xfffffff9, %ecx       # imm = 0xFFFFFFF9
movl %eax, %esi
andl $0x1, %esi
leal (%rsi,%rdx,2), %edx
shrl %eax
incl %ecx
jne 0x5212
movl -0x2c(%rbp), %ecx
shll %cl, %edx
orl %edx, -0x30(%rbp)
addl $0x7, %ecx
jmp 0x5292
movzbl (%r13), %eax
cmpl $0x8f, %eax
ja 0x536b
addl $0x30, %eax
xorl %edx, %edx
movl $0xfffffff8, %ecx       # imm = 0xFFFFFFF8
movq -0x48(%rbp), %rdi
leaq -0x30(%rbp), %r14
movl %eax, %esi
andl $0x1, %esi
leal (%rsi,%rdx,2), %edx
shrl %eax
incl %ecx
jne 0x524f
movl -0x2c(%rbp), %ecx
shll %cl, %edx
orl %edx, -0x30(%rbp)
addl $0x8, %ecx
jmp 0x5398
addl $0xa8, %eax
xorl %edx, %edx
movl $0xfffffff8, %ecx       # imm = 0xFFFFFFF8
movl %eax, %esi
andl $0x1, %esi
leal (%rsi,%rdx,2), %edx
shrl %eax
incl %ecx
jne 0x5279
movl -0x2c(%rbp), %ecx
shll %cl, %edx
orl %edx, -0x30(%rbp)
addl $0x8, %ecx
movl %ecx, -0x2c(%rbp)
movq %r14, %rsi
movq %r15, %rdx
callq 0x56dd
movl %ebx, %edx
leaq -0x1c(%rdx), %rcx
cmpq $-0x14, %rcx
jb 0x52e2
leaq 0xce0d(%rip), %rcx      # 0x120c0
movzwl (%rcx,%rdx,2), %ecx
movl %r12d, %esi
subl %ecx, %esi
movl -0x2c(%rbp), %ecx
shll %cl, %esi
orl %esi, -0x30(%rbp)
leaq 0xce35(%rip), %rsi      # 0x12100
movzbl (%rdx,%rsi), %edx
addl %ecx, %edx
movl %edx, -0x2c(%rbp)
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x56dd
leaq 0xce37(%rip), %rdx      # 0x12120
movq $-0x1, %rbx
movzwl 0x4(%rdx,%rbx,2), %ecx
incq %rbx
cmpl %r13d, %ecx
jle 0x52f0
xorl %edx, %edx
movl $0xfffffffb, %ecx       # imm = 0xFFFFFFFB
movl %ebx, %esi
movl %esi, %edi
andl $0x1, %edi
leal (%rdi,%rdx,2), %edx
shrl %esi
incl %ecx
jne 0x5306
movl -0x2c(%rbp), %ecx
shll %cl, %edx
orl %edx, -0x30(%rbp)
addl $0x5, %ecx
movl %ecx, -0x2c(%rbp)
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x56dd
movq %rax, %rdi
cmpq $0x4, %rbx
jae 0x533f
movq %rdi, -0x48(%rbp)
jmp 0x53b0
movl %ebx, %eax
leaq 0xcdd8(%rip), %rcx      # 0x12120
movzwl (%rcx,%rax,2), %ecx
subl %ecx, %r13d
movl -0x2c(%rbp), %ecx
shll %cl, %r13d
orl %r13d, -0x30(%rbp)
leaq 0xce00(%rip), %rdx      # 0x12160
movzbl (%rax,%rdx), %eax
addl %ecx, %eax
movl %eax, -0x2c(%rbp)
jmp 0x53a1
orl $0x100, %eax            # imm = 0x100
xorl %edx, %edx
movl $0xfffffff7, %ecx       # imm = 0xFFFFFFF7
movq -0x48(%rbp), %rdi
leaq -0x30(%rbp), %r14
movl %eax, %esi
andl $0x1, %esi
leal (%rsi,%rdx,2), %edx
shrl %eax
incl %ecx
jne 0x537f
movl -0x2c(%rbp), %ecx
shll %cl, %edx
orl %edx, -0x30(%rbp)
addl $0x9, %ecx
movl %ecx, -0x2c(%rbp)
movl $0x1, %r12d
movq %r14, %rsi
movq %r15, %rdx
callq 0x56dd
movq %rax, -0x48(%rbp)
addl -0x68(%rbp), %r12d
movl %r12d, %esi
cmpl -0x58(%rbp), %r12d
movq -0x50(%rbp), %r11
jl 0x4fc4
movq -0x48(%rbp), %rdi
movq %rdi, -0x38(%rbp)
cmpl -0x40(%rbp), %r12d
jge 0x5459
movslq %r12d, %r14
leaq -0x30(%rbp), %rbx
leaq -0x2c(%rbp), %r13
movq -0x40(%rbp), %r15
movq -0x50(%rbp), %rax
movzbl (%rax,%r14), %eax
cmpl $0x8f, %eax
ja 0x541b
addl $0x30, %eax
xorl %edx, %edx
movl $0xfffffff8, %ecx       # imm = 0xFFFFFFF8
movl %eax, %esi
andl $0x1, %esi
leal (%rsi,%rdx,2), %edx
shrl %eax
incl %ecx
jne 0x5400
movl -0x2c(%rbp), %ecx
shll %cl, %edx
orl %edx, -0x30(%rbp)
addl $0x8, %ecx
jmp 0x5440
orl $0x100, %eax            # imm = 0x100
xorl %edx, %edx
movl $0xfffffff7, %ecx       # imm = 0xFFFFFFF7
movl %eax, %esi
andl $0x1, %esi
leal (%rsi,%rdx,2), %edx
shrl %eax
incl %ecx
jne 0x5427
movl -0x2c(%rbp), %ecx
shll %cl, %edx
orl %edx, -0x30(%rbp)
addl $0x9, %ecx
movl %ecx, -0x2c(%rbp)
movq %rbx, %rsi
movq %r13, %rdx
callq 0x56dd
movq %rax, %rdi
incq %r14
cmpl %r15d, %r14d
jne 0x53e6
movq %rdi, -0x38(%rbp)
leaq -0x2c(%rbp), %r13
addl $0x7, (%r13)
leaq -0x30(%rbp), %rsi
movq %r13, %rdx
callq 0x56dd
movq %rax, %rdi
movl (%r13), %eax
testl %eax, %eax
je 0x549b
leaq -0x30(%rbp), %r12
incl %eax
movl %eax, -0x2c(%rbp)
movq %r12, %rsi
movq %r13, %rdx
callq 0x56dd
movq %rax, %rdi
movl -0x2c(%rbp), %eax
testl %eax, %eax
jne 0x5481
movq %rdi, %r12
movq %rdi, -0x38(%rbp)
xorl %ebx, %ebx
movq -0x40(%rbp), %r14
movq -0x50(%rbp), %r9
movq -0x20080(%rbp,%rbx,8), %rdi
testq %rdi, %rdi
je 0x54c6
addq $-0x8, %rdi
callq 0x22b0
movq -0x50(%rbp), %r9
incq %rbx
cmpq $0x4000, %rbx           # imm = 0x4000
jne 0x54ac
testl %r14d, %r14d
jle 0x5550
movl %r14d, %eax
imulq $0x5e6ea9af, %rax, %rax # imm = 0x5E6EA9AF
shrq $0x2b, %rax
imull $0x15b0, %eax, %ecx     # imm = 0x15B0
movl %r14d, %eax
subl %ecx, %eax
movl $0x1, %r15d
xorl %ecx, %ecx
movl $0x80078071, %edx       # imm = 0x80078071
xorl %ebx, %ebx
testl %eax, %eax
je 0x5542
movl %eax, %esi
movl %ecx, %edi
movl %edi, %r8d
movzbl (%r9,%r8), %r8d
addl %r8d, %r15d
addl %r15d, %ebx
incl %edi
decq %rsi
jne 0x5507
movl %r15d, %esi
imulq %rdx, %rsi
shrq $0x2f, %rsi
imull $0xfff1, %esi, %esi     # imm = 0xFFF1
subl %esi, %r15d
movl %ebx, %esi
imulq %rdx, %rsi
shrq $0x2f, %rsi
imull $0xfff1, %esi, %esi     # imm = 0xFFF1
subl %esi, %ebx
addl %eax, %ecx
movl $0x15b0, %eax           # imm = 0x15B0
cmpl %r14d, %ecx
jl 0x54ff
jmp 0x5558
xorl %ebx, %ebx
movl $0x1, %r15d
testq %r12, %r12
je 0x556f
movq %r12, %rdx
movl -0x4(%r12), %eax
leal 0x1(%rax), %ecx
cmpl -0x8(%r12), %ecx
jl 0x5589
leaq -0x38(%rbp), %r14
movq %r14, %rdi
movl $0x1, %esi
callq 0x565a
movq (%r14), %rdx
movl -0x4(%rdx), %eax
leal 0x1(%rax), %ecx
movl %ecx, -0x4(%rdx)
cltq
movb %bh, (%rdx,%rax)
movl -0x4(%rdx), %eax
incl %eax
cmpl -0x8(%rdx), %eax
jl 0x55a9
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x565a
movq -0x38(%rbp), %rsi
movslq -0x4(%rsi), %rax
leal 0x1(%rax), %ecx
movl %ecx, -0x4(%rsi)
movb %bl, (%rsi,%rax)
movl -0x4(%rsi), %eax
leal 0x1(%rax), %ecx
cmpl -0x8(%rsi), %ecx
jl 0x55df
leaq -0x38(%rbp), %r14
movq %r14, %rdi
movl $0x1, %esi
callq 0x565a
movq (%r14), %rsi
movl -0x4(%rsi), %eax
leal 0x1(%rax), %ecx
movl %ecx, -0x4(%rsi)
cltq
movl %r15d, %ebx
movb %bh, (%rsi,%rax)
movl -0x4(%rsi), %eax
leal 0x1(%rax), %ecx
cmpl -0x8(%rsi), %ecx
jl 0x560f
leaq -0x38(%rbp), %r14
movq %r14, %rdi
movl $0x1, %esi
callq 0x565a
movq (%r14), %rsi
movl -0x4(%rsi), %eax
leal 0x1(%rax), %ecx
movl %ecx, -0x4(%rsi)
cltq
movb %bl, (%rsi,%rax)
movslq -0x4(%rsi), %rdx
movq -0x70(%rbp), %rax
movl %edx, (%rax)
leaq -0x8(%rsi), %rdi
addq $0x20058, %rsp          # imm = 0x20058
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2390
leaq 0xccf8(%rip), %rdi      # 0x1233a
leaq 0xcbe8(%rip), %rsi      # 0x12231
leaq 0xcd04(%rip), %rcx      # 0x12354
movl $0x20f, %edx            # imm = 0x20F
callq 0x2180