// File: /workspace/github_c_makefile_star2_O1/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 $0x20068, %rsp          # imm = 0x20068
movq %rdx, -0x68(%rbp)
movq %rsi, -0x40(%rbp)
movq %rdi, %r15
xorl %eax, %eax
movl %eax, -0x30(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x38(%rbp), %rbx
movq $0x0, (%rbx)
cmpl $0x6, %ecx
movl $0x5, %eax
cmovgel %ecx, %eax
movq %rax, -0x60(%rbp)
movq %rbx, %rdi
movl $0x1, %esi
callq 0x55f8
movq (%rbx), %rax
movslq -0x4(%rax), %rcx
leal 0x1(%rcx), %edx
movl %edx, -0x4(%rax)
movb $0x78, (%rax,%rcx)
testq %rax, %rax
je 0x4e68
movl -0x4(%rax), %ecx
incl %ecx
cmpl -0x8(%rax), %ecx
jl 0x4e76
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x55f8
movq -0x38(%rbp), %rdi
movslq -0x4(%rdi), %rax
leal 0x1(%rax), %ecx
movl %ecx, -0x4(%rdi)
movb $0x5e, (%rdi,%rax)
movl $0x1, %r14d
leaq -0x30(%rbp), %rbx
movl %r14d, (%rbx)
leaq -0x2c(%rbp), %r12
movl %r14d, (%r12)
movq %rbx, %rsi
movq %r12, %rdx
callq 0x567b
movl (%r12), %ecx
shll %cl, %r14d
orl %r14d, (%rbx)
movq %rax, -0x38(%rbp)
addl $0x2, %ecx
movl %ecx, (%r12)
movq %rax, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x567b
movq %rax, -0x50(%rbp)
movq %rax, -0x38(%rbp)
leaq -0x20090(%rbp), %rdi
xorl %r14d, %r14d
movl $0x20000, %edx          # imm = 0x20000
xorl %esi, %esi
callq 0x2150
movq -0x40(%rbp), %r12
cmpl $0x4, %r12d
jl 0x5376
leal -0x3(%r12), %eax
movl %eax, -0x58(%rbp)
movq -0x60(%rbp), %rax
leal (%rax,%rax), %ecx
movl %ecx, -0x54(%rbp)
movl %eax, %eax
movq %rax, -0x78(%rbp)
leaq (,%rax,8), %rax
movq %rax, -0x70(%rbp)
xorl %esi, %esi
movslq %esi, %rdx
movzwl (%r15,%rdx), %eax
movzbl 0x2(%r15,%rdx), %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 -0x20090(%rbp,%rax,8), %rbx
movl $0x0, %edi
testq %rbx, %rbx
je 0x4f6f
movl -0x4(%rbx), %edi
movq %rdx, -0x88(%rbp)
leaq (%r15,%rdx), %r12
testl %edi, %edi
movq %rsi, -0x48(%rbp)
jle 0x4ff1
leal -0x8000(%rsi), %ecx
movslq %ecx, %rcx
movq -0x40(%rbp), %rdx
subl %esi, %edx
leal -0x1(%rdx), %esi
movl $0x101, %r8d            # imm = 0x101
cmpl %r8d, %esi
cmovael %r8d, %esi
incl %esi
movl %edi, %edi
movl $0x3, %r14d
xorl %r8d, %r8d
xorl %r13d, %r13d
movq (%rbx,%r8,8), %r9
movq %r9, %r10
subq %r15, %r10
cmpq %rcx, %r10
jle 0x4fe7
xorl %r10d, %r10d
testl %edx, %edx
jle 0x4fdc
movb (%r9,%r10), %r11b
cmpb (%r12,%r10), %r11b
jne 0x4fdc
incq %r10
cmpq %r10, %rsi
jne 0x4fc7
movl %esi, %r10d
cmpl %r14d, %r10d
cmovgl %r10d, %r14d
cmovgeq %r9, %r13
incq %r8
cmpq %rdi, %r8
jne 0x4fb1
jmp 0x4ffa
movl $0x3, %r14d
xorl %r13d, %r13d
leaq -0x20090(,%rax,8), %rcx
addq %rbp, %rcx
testq %rbx, %rbx
je 0x5044
movl -0x54(%rbp), %eax
cmpl %eax, -0x4(%rbx)
jne 0x5035
movq -0x78(%rbp), %rax
leaq (%rbx,%rax,8), %rsi
movq %rcx, -0x80(%rbp)
movq %rbx, %rdi
movq -0x70(%rbp), %rdx
callq 0x2390
movq -0x80(%rbp), %rcx
movq -0x60(%rbp), %rax
movl %eax, -0x4(%rbx)
testq %rbx, %rbx
je 0x5044
movl -0x4(%rbx), %eax
incl %eax
cmpl -0x8(%rbx), %eax
jl 0x5057
movq %rcx, %rbx
movq %rcx, %rdi
movl $0x8, %esi
callq 0x55f8
movq %rbx, %rcx
movq (%rcx), %rax
movslq -0x4(%rax), %rcx
leal 0x1(%rcx), %edx
movl %edx, -0x4(%rax)
movq %r12, (%rax,%rcx,8)
testq %r13, %r13
je 0x50bb
movzwl 0x1(%r12), %eax
movzbl 0x3(%r12), %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 -0x20090(%rbp,%rax,8), %rax
testq %rax, %rax
je 0x50c3
movl -0x4(%rax), %r8d
jmp 0x50c6
xorl %r13d, %r13d
jmp 0x514f
xorl %r8d, %r8d
testl %r8d, %r8d
jle 0x514f
movq -0x88(%rbp), %rcx
addq %r15, %rcx
incq %rcx
movq -0x48(%rbp), %rsi
leal -0x7fff(%rsi), %edi
notl %esi
movq -0x40(%rbp), %r9
leal (%rsi,%r9), %edx
decl %edx
addl %r9d, %esi
movl $0x101, %r9d            # imm = 0x101
cmpl %r9d, %edx
cmovael %r9d, %edx
movslq %edi, %rdi
incl %edx
movl %r8d, %r8d
xorl %r9d, %r9d
movq (%rax,%r9,8), %r10
movq %r10, %r11
subq %r15, %r11
cmpq %rdi, %r11
jle 0x5147
xorl %r11d, %r11d
testl %esi, %esi
jle 0x5138
movb (%r10,%r11), %bl
cmpb (%rcx,%r11), %bl
jne 0x5138
incq %r11
cmpq %r11, %rdx
jne 0x5123
movl %edx, %r11d
cmpl %r14d, %r11d
movl $0x0, %r10d
cmovgq %r10, %r13
jg 0x514f
incq %r9
cmpq %r8, %r9
jne 0x510d
testq %r13, %r13
je 0x51be
subl %r13d, %r12d
cmpl $0x7fff, %r12d          # imm = 0x7FFF
movq -0x50(%rbp), %rdi
jg 0x55d5
cmpl $0x102, %r14d           # imm = 0x102
jg 0x55d5
xorl %eax, %eax
leaq -0x30(%rbp), %rsi
leaq 0xcf3e(%rip), %rdx      # 0x120c0
movzwl 0x2(%rdx,%rax,2), %ecx
incq %rax
cmpl %ecx, %r14d
jge 0x5182
leaq -0x1(%rax), %rbx
cmpq $0x16, %rbx
ja 0x5205
xorl %edx, %edx
movl $0xfffffff9, %ecx       # imm = 0xFFFFFFF9
movl %eax, %r8d
andl $0x1, %r8d
leal (%r8,%rdx,2), %edx
shrl %eax
incl %ecx
jne 0x51a0
movl -0x2c(%rbp), %ecx
shll %cl, %edx
orl %edx, -0x30(%rbp)
addl $0x7, %ecx
jmp 0x522d
movzbl (%r12), %eax
cmpl $0x8f, %eax
movq -0x50(%rbp), %rdi
ja 0x5319
addl $0x30, %eax
xorl %edx, %edx
movl $0xfffffff8, %ecx       # imm = 0xFFFFFFF8
movq -0x40(%rbp), %r12
leaq -0x30(%rbp), %rsi
movl %eax, %r8d
andl $0x1, %r8d
leal (%r8,%rdx,2), %edx
shrl %eax
incl %ecx
jne 0x51e4
movl -0x2c(%rbp), %ecx
shll %cl, %edx
orl %edx, -0x30(%rbp)
addl $0x8, %ecx
jmp 0x5349
addl $0xa8, %eax
xorl %edx, %edx
movl $0xfffffff8, %ecx       # imm = 0xFFFFFFF8
movl %eax, %r8d
andl $0x1, %r8d
leal (%r8,%rdx,2), %edx
shrl %eax
incl %ecx
jne 0x5211
movl -0x2c(%rbp), %ecx
shll %cl, %edx
orl %edx, -0x30(%rbp)
addl $0x8, %ecx
movl %ecx, -0x2c(%rbp)
leaq -0x2c(%rbp), %r13
movq %r13, %rdx
callq 0x567b
movl %ebx, %edx
leaq -0x1c(%rdx), %rcx
cmpq $-0x14, %rcx
jb 0x527f
leaq 0xce71(%rip), %rcx      # 0x120c0
movzwl (%rcx,%rdx,2), %ecx
movl %r14d, %esi
subl %ecx, %esi
movl -0x2c(%rbp), %ecx
shll %cl, %esi
orl %esi, -0x30(%rbp)
leaq 0xce99(%rip), %rsi      # 0x12100
movzbl (%rdx,%rsi), %edx
addl %ecx, %edx
movl %edx, -0x2c(%rbp)
movq %rax, %rdi
leaq -0x30(%rbp), %rsi
movq %r13, %rdx
callq 0x567b
leaq 0xce9a(%rip), %rdx      # 0x12120
movq -0x48(%rbp), %r13
movq $-0x1, %rbx
movzwl 0x4(%rdx,%rbx,2), %ecx
incq %rbx
cmpl %r12d, %ecx
jle 0x5291
xorl %edx, %edx
movl $0xfffffffb, %ecx       # imm = 0xFFFFFFFB
movl %ebx, %r8d
leaq -0x30(%rbp), %rsi
movl %r8d, %edi
andl $0x1, %edi
leal (%rdi,%rdx,2), %edx
shrl %r8d
incl %ecx
jne 0x52ac
movl -0x2c(%rbp), %ecx
shll %cl, %edx
orl %edx, -0x30(%rbp)
addl $0x5, %ecx
movl %ecx, -0x2c(%rbp)
movq %rax, %rdi
leaq -0x2c(%rbp), %rdx
callq 0x567b
movq %rax, %rdi
cmpq $0x4, %rbx
jae 0x52e5
movq -0x40(%rbp), %r12
jmp 0x5362
movl %ebx, %eax
leaq 0xce32(%rip), %rcx      # 0x12120
movzwl (%rcx,%rax,2), %ecx
subl %ecx, %r12d
movl -0x2c(%rbp), %ecx
shll %cl, %r12d
orl %r12d, -0x30(%rbp)
leaq 0xce5a(%rip), %rdx      # 0x12160
movzbl (%rax,%rdx), %eax
addl %ecx, %eax
movl %eax, -0x2c(%rbp)
movq -0x40(%rbp), %r12
leaq -0x30(%rbp), %rsi
jmp 0x5356
orl $0x100, %eax            # imm = 0x100
xorl %edx, %edx
movl $0xfffffff7, %ecx       # imm = 0xFFFFFFF7
movq -0x40(%rbp), %r12
leaq -0x30(%rbp), %rsi
movl %eax, %r8d
andl $0x1, %r8d
leal (%r8,%rdx,2), %edx
shrl %eax
incl %ecx
jne 0x532d
movl -0x2c(%rbp), %ecx
shll %cl, %edx
orl %edx, -0x30(%rbp)
addl $0x9, %ecx
movl %ecx, -0x2c(%rbp)
movl $0x1, %r14d
movq -0x48(%rbp), %r13
leaq -0x2c(%rbp), %rdx
callq 0x567b
movq %rax, %rdi
movq %rdi, -0x50(%rbp)
addl %r13d, %r14d
movl %r14d, %esi
cmpl -0x58(%rbp), %r14d
jl 0x4f1d
movq -0x50(%rbp), %rdi
movq %rdi, -0x38(%rbp)
cmpl %r12d, %r14d
jge 0x53fd
movslq %r14d, %r14
leaq -0x30(%rbp), %rbx
leaq -0x2c(%rbp), %r13
movzbl (%r15,%r14), %eax
cmpl $0x8f, %eax
ja 0x53bf
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 0x53a4
movl -0x2c(%rbp), %ecx
shll %cl, %edx
orl %edx, -0x30(%rbp)
addl $0x8, %ecx
jmp 0x53e4
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 0x53cb
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 0x567b
movq %rax, %rdi
incq %r14
cmpl %r12d, %r14d
jne 0x538e
movq %rdi, -0x38(%rbp)
leaq -0x2c(%rbp), %r13
addl $0x7, (%r13)
leaq -0x30(%rbp), %rsi
movq %r13, %rdx
callq 0x567b
movq %rax, %r14
movl (%r13), %eax
testl %eax, %eax
je 0x5442
leaq -0x30(%rbp), %r12
incl %eax
movl %eax, -0x2c(%rbp)
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x567b
movq %rax, %r14
movl -0x2c(%rbp), %eax
testl %eax, %eax
jne 0x5425
movq %r14, -0x38(%rbp)
xorl %ebx, %ebx
movq -0x40(%rbp), %r12
movq -0x20090(%rbp,%rbx,8), %rdi
testq %rdi, %rdi
je 0x5462
addq $-0x8, %rdi
callq 0x22b0
incq %rbx
cmpq $0x4000, %rbx           # imm = 0x4000
jne 0x544c
testl %r12d, %r12d
jle 0x54ec
movl %r12d, %eax
imulq $0x5e6ea9af, %rax, %rax # imm = 0x5E6EA9AF
shrq $0x2b, %rax
imull $0x15b0, %eax, %ecx     # imm = 0x15B0
movl %r12d, %eax
subl %ecx, %eax
movl $0x1, %r13d
xorl %ecx, %ecx
movl $0x80078071, %edx       # imm = 0x80078071
xorl %ebx, %ebx
testl %eax, %eax
je 0x54de
movl %eax, %esi
movl %ecx, %edi
movl %edi, %r8d
movzbl (%r15,%r8), %r8d
addl %r8d, %r13d
addl %r13d, %ebx
incl %edi
decq %rsi
jne 0x54a3
movl %r13d, %esi
imulq %rdx, %rsi
shrq $0x2f, %rsi
imull $0xfff1, %esi, %esi     # imm = 0xFFF1
subl %esi, %r13d
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 %r12d, %ecx
jl 0x549b
jmp 0x54f4
xorl %ebx, %ebx
movl $0x1, %r13d
testq %r14, %r14
je 0x5505
movl -0x4(%r14), %eax
incl %eax
cmpl -0x8(%r14), %eax
jl 0x5513
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x55f8
movq -0x38(%rbp), %rax
movslq -0x4(%rax), %rcx
leal 0x1(%rcx), %edx
movl %edx, -0x4(%rax)
movb %bh, (%rax,%rcx)
testq %rax, %rax
je 0x5533
movl -0x4(%rax), %ecx
incl %ecx
cmpl -0x8(%rax), %ecx
jl 0x5541
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x55f8
movq -0x38(%rbp), %rax
movslq -0x4(%rax), %rcx
leal 0x1(%rcx), %edx
movl %edx, -0x4(%rax)
movb %bl, (%rax,%rcx)
testq %rax, %rax
je 0x5561
movl -0x4(%rax), %ecx
incl %ecx
cmpl -0x8(%rax), %ecx
jl 0x556f
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x55f8
movq -0x38(%rbp), %rax
movslq -0x4(%rax), %rcx
leal 0x1(%rcx), %edx
movl %edx, -0x4(%rax)
movl %r13d, %ebx
movb %bh, (%rax,%rcx)
testq %rax, %rax
je 0x5592
movl -0x4(%rax), %ecx
incl %ecx
cmpl -0x8(%rax), %ecx
jl 0x55a0
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x55f8
movq -0x38(%rbp), %rsi
movslq -0x4(%rsi), %rax
leal 0x1(%rax), %ecx
movl %ecx, -0x4(%rsi)
movb %bl, (%rsi,%rax)
movslq -0x4(%rsi), %rdx
movq -0x68(%rbp), %rax
movl %edx, (%rax)
leaq -0x8(%rsi), %rdi
addq $0x20068, %rsp          # imm = 0x20068
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2390
movq %rdi, -0x38(%rbp)
leaq 0xcd5a(%rip), %rdi      # 0x1233a
leaq 0xcc4a(%rip), %rsi      # 0x12231
leaq 0xcd66(%rip), %rcx      # 0x12354
movl $0x20f, %edx            # imm = 0x20F
callq 0x2180