// File: srajangarg[P]raytracer/src/core/stb_image_write.hpp
// 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 s1=1, s2=0;
      int blocklen = (int) (data_len % 5552);
      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, STBIW_UCHAR(s2 >> 8));
      stbiw__sbpush(out, STBIW_UCHAR(s2));
      stbiw__sbpush(out, STBIW_UCHAR(s1 >> 8));
      stbiw__sbpush(out, STBIW_UCHAR(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
subq $0x20090, %rsp          # imm = 0x20090
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movq $0x0, -0x38(%rbp)
cmpl $0x5, -0x1c(%rbp)
jge 0x387cc
movl $0x5, -0x1c(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x387e6
movq -0x38(%rbp), %rax
movl -0x4(%rax), %eax
addl $0x1, %eax
movq -0x38(%rbp), %rcx
cmpl -0x8(%rcx), %eax
jl 0x387f8
leaq -0x38(%rbp), %rdi
movl $0x1, %edx
movl %edx, %esi
callq 0x39420
jmp 0x387fa
jmp 0x387fa
movq -0x38(%rbp), %rax
movq -0x38(%rbp), %rdx
movl -0x4(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x4(%rdx)
movslq %ecx, %rcx
movb $0x78, (%rax,%rcx)
cmpq $0x0, -0x38(%rbp)
je 0x3882e
movq -0x38(%rbp), %rax
movl -0x4(%rax), %eax
addl $0x1, %eax
movq -0x38(%rbp), %rcx
cmpl -0x8(%rcx), %eax
jl 0x38840
leaq -0x38(%rbp), %rdi
movl $0x1, %edx
movl %edx, %esi
callq 0x39420
jmp 0x38842
jmp 0x38842
movq -0x38(%rbp), %rax
movq -0x38(%rbp), %rdx
movl -0x4(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x4(%rdx)
movslq %ecx, %rcx
movb $0x5e, (%rax,%rcx)
movl -0x2c(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x39510
movq %rax, -0x38(%rbp)
movl -0x2c(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x39510
movq %rax, -0x38(%rbp)
movl $0x0, -0x24(%rbp)
cmpl $0x4000, -0x24(%rbp)    # imm = 0x4000
jge 0x388e3
movslq -0x24(%rbp), %rax
movq $0x0, -0x20040(%rbp,%rax,8)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x388bf
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl -0xc(%rbp), %ecx
subl $0x3, %ecx
cmpl %ecx, %eax
jge 0x39061
movq -0x8(%rbp), %rdi
movslq -0x24(%rbp), %rax
addq %rax, %rdi
callq 0x395b0
andl $0x3fff, %eax           # imm = 0x3FFF
movl %eax, -0x20044(%rbp)
movl $0x3, -0x20048(%rbp)
movq $0x0, -0x20050(%rbp)
movslq -0x20044(%rbp), %rax
movq -0x20040(%rbp,%rax,8), %rax
movq %rax, -0x20058(%rbp)
cmpq $0x0, -0x20058(%rbp)
je 0x3895d
movq -0x20058(%rbp), %rax
movl -0x4(%rax), %eax
movl %eax, -0x20078(%rbp)
jmp 0x38967
xorl %eax, %eax
movl %eax, -0x20078(%rbp)
jmp 0x38967
movl -0x20078(%rbp), %eax
movl %eax, -0x2005c(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x2005c(%rbp), %eax
jge 0x38a1d
movq -0x20058(%rbp), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x8(%rbp), %rcx
subq %rcx, %rax
movl -0x24(%rbp), %ecx
subl $0x8000, %ecx           # imm = 0x8000
movslq %ecx, %rcx
cmpq %rcx, %rax
jle 0x38a0d
movq -0x20058(%rbp), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x8(%rbp), %rsi
movslq -0x24(%rbp), %rax
addq %rax, %rsi
movl -0xc(%rbp), %edx
subl -0x24(%rbp), %edx
callq 0x39630
movl %eax, -0x20060(%rbp)
movl -0x20060(%rbp), %eax
cmpl -0x20048(%rbp), %eax
jl 0x38a0b
movl -0x20060(%rbp), %eax
movl %eax, -0x20048(%rbp)
movq -0x20058(%rbp), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20050(%rbp)
jmp 0x38a0d
jmp 0x38a0f
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x3897a
movslq -0x20044(%rbp), %rax
cmpq $0x0, -0x20040(%rbp,%rax,8)
je 0x38a95
movslq -0x20044(%rbp), %rax
movq -0x20040(%rbp,%rax,8), %rax
movl -0x4(%rax), %eax
movl -0x1c(%rbp), %ecx
shll %ecx
cmpl %ecx, %eax
jne 0x38a95
movslq -0x20044(%rbp), %rax
movq -0x20040(%rbp,%rax,8), %rdi
movslq -0x20044(%rbp), %rax
movq -0x20040(%rbp,%rax,8), %rsi
movslq -0x1c(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movslq -0x1c(%rbp), %rdx
shlq $0x3, %rdx
callq 0x5650
movl -0x1c(%rbp), %ecx
movslq -0x20044(%rbp), %rax
movq -0x20040(%rbp,%rax,8), %rax
movl %ecx, -0x4(%rax)
movslq -0x20044(%rbp), %rax
cmpq $0x0, -0x20040(%rbp,%rax,8)
je 0x38ad0
movslq -0x20044(%rbp), %rax
movq -0x20040(%rbp,%rax,8), %rax
movl -0x4(%rax), %eax
addl $0x1, %eax
movslq -0x20044(%rbp), %rcx
movq -0x20040(%rbp,%rcx,8), %rcx
cmpl -0x8(%rcx), %eax
jl 0x38af6
movslq -0x20044(%rbp), %rax
leaq -0x20040(%rbp), %rdi
shlq $0x3, %rax
addq %rax, %rdi
movl $0x1, %esi
movl $0x8, %edx
callq 0x39420
jmp 0x38af8
jmp 0x38af8
movq -0x8(%rbp), %rdx
movslq -0x24(%rbp), %rax
addq %rax, %rdx
movslq -0x20044(%rbp), %rax
movq -0x20040(%rbp,%rax,8), %rax
movslq -0x20044(%rbp), %rcx
movq -0x20040(%rbp,%rcx,8), %rsi
movl -0x4(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, -0x4(%rsi)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
cmpq $0x0, -0x20050(%rbp)
je 0x38c46
movq -0x8(%rbp), %rdi
movslq -0x24(%rbp), %rax
addq %rax, %rdi
addq $0x1, %rdi
callq 0x395b0
andl $0x3fff, %eax           # imm = 0x3FFF
movl %eax, -0x20044(%rbp)
movslq -0x20044(%rbp), %rax
movq -0x20040(%rbp,%rax,8), %rax
movq %rax, -0x20058(%rbp)
cmpq $0x0, -0x20058(%rbp)
je 0x38b92
movq -0x20058(%rbp), %rax
movl -0x4(%rax), %eax
movl %eax, -0x2007c(%rbp)
jmp 0x38b9c
xorl %eax, %eax
movl %eax, -0x2007c(%rbp)
jmp 0x38b9c
movl -0x2007c(%rbp), %eax
movl %eax, -0x2005c(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x2005c(%rbp), %eax
jge 0x38c44
movq -0x20058(%rbp), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x8(%rbp), %rcx
subq %rcx, %rax
movl -0x24(%rbp), %ecx
subl $0x7fff, %ecx           # imm = 0x7FFF
movslq %ecx, %rcx
cmpq %rcx, %rax
jle 0x38c34
movq -0x20058(%rbp), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x8(%rbp), %rsi
movslq -0x24(%rbp), %rax
addq %rax, %rsi
addq $0x1, %rsi
movl -0xc(%rbp), %edx
subl -0x24(%rbp), %edx
subl $0x1, %edx
callq 0x39630
movl %eax, -0x20064(%rbp)
movl -0x20064(%rbp), %eax
cmpl -0x20048(%rbp), %eax
jle 0x38c32
movq $0x0, -0x20050(%rbp)
jmp 0x38c44
jmp 0x38c34
jmp 0x38c36
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x38baf
jmp 0x38c46
cmpq $0x0, -0x20050(%rbp)
je 0x38fb1
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
addq %rcx, %rax
movq -0x20050(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x20068(%rbp)
xorl %eax, %eax
cmpl $0x7fff, -0x20068(%rbp) # imm = 0x7FFF
movb %al, -0x2007d(%rbp)
jg 0x38c96
cmpl $0x102, -0x20048(%rbp)  # imm = 0x102
setle %al
movb %al, -0x2007d(%rbp)
movb -0x2007d(%rbp), %al
testb $0x1, %al
jne 0x38ca2
jmp 0x38ca4
jmp 0x38cc3
leaq 0xfd48(%rip), %rdi      # 0x489f3
leaq 0xfc87(%rip), %rsi      # 0x48939
movl $0x314, %edx            # imm = 0x314
leaq 0xfd4f(%rip), %rcx      # 0x48a0d
callq 0x52c0
movl $0x0, -0x28(%rbp)
movl -0x20048(%rbp), %eax
movl -0x28(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0x23a70(%rip), %rcx     # 0x5c750
movzwl (%rcx,%rdx,2), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x38cf8
jmp 0x38ced
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x38cca
movl -0x28(%rbp), %eax
addl $0x101, %eax            # imm = 0x101
cmpl $0x8f, %eax
jg 0x38d4b
movl -0x28(%rbp), %edi
addl $0x101, %edi            # imm = 0x101
addl $0x30, %edi
movl $0x8, %esi
callq 0x396a0
movl -0x2c(%rbp), %ecx
shll %cl, %eax
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x39510
movq %rax, -0x38(%rbp)
jmp 0x38e7b
movl -0x28(%rbp), %eax
addl $0x101, %eax            # imm = 0x101
cmpl $0xff, %eax
jg 0x38db2
movl -0x28(%rbp), %edi
addl $0x101, %edi            # imm = 0x101
addl $0x190, %edi            # imm = 0x190
subl $0x90, %edi
movl $0x9, %esi
callq 0x396a0
movl -0x2c(%rbp), %ecx
shll %cl, %eax
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x9, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x39510
movq %rax, -0x38(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x20088(%rbp)
jmp 0x38e74
movl -0x28(%rbp), %eax
addl $0x101, %eax            # imm = 0x101
cmpl $0x117, %eax            # imm = 0x117
jg 0x38e13
movl -0x28(%rbp), %edi
addl $0x101, %edi            # imm = 0x101
addl $0x0, %edi
subl $0x100, %edi            # imm = 0x100
movl $0x7, %esi
callq 0x396a0
movl -0x2c(%rbp), %ecx
shll %cl, %eax
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x7, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x39510
movq %rax, -0x38(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x20090(%rbp)
jmp 0x38e66
movl -0x28(%rbp), %edi
addl $0x101, %edi            # imm = 0x101
addl $0xc0, %edi
subl $0x118, %edi            # imm = 0x118
movl $0x8, %esi
callq 0x396a0
movl -0x2c(%rbp), %ecx
shll %cl, %eax
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x39510
movq %rax, -0x38(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x20090(%rbp)
movq -0x20090(%rbp), %rax
movq %rax, -0x20088(%rbp)
movq -0x20088(%rbp), %rax
movslq -0x28(%rbp), %rcx
leaq 0x2390a(%rip), %rax     # 0x5c790
cmpb $0x0, (%rax,%rcx)
je 0x38ed8
movl -0x20048(%rbp), %eax
movslq -0x28(%rbp), %rdx
leaq 0x238b3(%rip), %rcx     # 0x5c750
movzwl (%rcx,%rdx,2), %ecx
subl %ecx, %eax
movl -0x2c(%rbp), %ecx
shll %cl, %eax
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movslq -0x28(%rbp), %rcx
leaq 0x238d7(%rip), %rax     # 0x5c790
movzbl (%rax,%rcx), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x39510
movq %rax, -0x38(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x20068(%rbp), %eax
movl -0x28(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0x238bb(%rip), %rcx     # 0x5c7b0
movzwl (%rcx,%rdx,2), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x38f0d
jmp 0x38f02
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x38edf
movl -0x28(%rbp), %edi
movl $0x5, %esi
callq 0x396a0
movl -0x2c(%rbp), %ecx
shll %cl, %eax
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x5, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x39510
movq %rax, -0x38(%rbp)
movslq -0x28(%rbp), %rcx
leaq 0x238a2(%rip), %rax     # 0x5c7f0
cmpb $0x0, (%rax,%rcx)
je 0x38fa0
movl -0x20068(%rbp), %eax
movslq -0x28(%rbp), %rdx
leaq 0x2384b(%rip), %rcx     # 0x5c7b0
movzwl (%rcx,%rdx,2), %ecx
subl %ecx, %eax
movl -0x2c(%rbp), %ecx
shll %cl, %eax
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movslq -0x28(%rbp), %rcx
leaq 0x2386f(%rip), %rax     # 0x5c7f0
movzbl (%rax,%rcx), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x39510
movq %rax, -0x38(%rbp)
movl -0x20048(%rbp), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x3905c
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x8f, %eax
jg 0x39008
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %edi
addl $0x30, %edi
movl $0x8, %esi
callq 0x396a0
movl -0x2c(%rbp), %ecx
shll %cl, %eax
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x39510
movq %rax, -0x38(%rbp)
jmp 0x39053
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %edi
addl $0x190, %edi            # imm = 0x190
subl $0x90, %edi
movl $0x9, %esi
callq 0x396a0
movl -0x2c(%rbp), %ecx
shll %cl, %eax
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x9, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x39510
movq %rax, -0x38(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x388ea
jmp 0x39063
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x3911f
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x8f, %eax
jg 0x390c6
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %edi
addl $0x30, %edi
movl $0x8, %esi
callq 0x396a0
movl -0x2c(%rbp), %ecx
shll %cl, %eax
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x39510
movq %rax, -0x38(%rbp)
jmp 0x39111
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %edi
addl $0x190, %edi            # imm = 0x190
subl $0x90, %edi
movl $0x9, %esi
callq 0x396a0
movl -0x2c(%rbp), %ecx
shll %cl, %eax
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x9, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x39510
movq %rax, -0x38(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x39063
xorl %edi, %edi
movl $0x7, %esi
callq 0x396a0
movl -0x2c(%rbp), %ecx
shll %cl, %eax
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x7, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x39510
movq %rax, -0x38(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x39187
movl -0x2c(%rbp), %ecx
xorl %eax, %eax
shll %cl, %eax
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x39510
movq %rax, -0x38(%rbp)
jmp 0x39154
movl $0x0, -0x24(%rbp)
cmpl $0x4000, -0x24(%rbp)    # imm = 0x4000
jge 0x391ca
movslq -0x24(%rbp), %rax
cmpq $0x0, -0x20040(%rbp,%rax,8)
je 0x391bd
movslq -0x24(%rbp), %rax
movq -0x20040(%rbp,%rax,8), %rdi
addq $-0x8, %rdi
callq 0x54c0
jmp 0x391bf
jmp 0x391bf
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3918e
movl $0x1, -0x2006c(%rbp)
movl $0x0, -0x20070(%rbp)
movl -0xc(%rbp), %eax
movl $0x15b0, %ecx           # imm = 0x15B0
cltd
idivl %ecx
movl %edx, -0x20074(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x39293
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x20074(%rbp), %eax
jge 0x3924e
movq -0x8(%rbp), %rax
movl -0x28(%rbp), %ecx
addl -0x24(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
addl -0x2006c(%rbp), %eax
movl %eax, -0x2006c(%rbp)
movl -0x2006c(%rbp), %eax
addl -0x20070(%rbp), %eax
movl %eax, -0x20070(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x39209
movl -0x2006c(%rbp), %eax
movl $0xfff1, %ecx           # imm = 0xFFF1
xorl %edx, %edx
divl %ecx
movl %edx, -0x2006c(%rbp)
movl -0x20070(%rbp), %eax
movl $0xfff1, %ecx           # imm = 0xFFF1
xorl %edx, %edx
divl %ecx
movl %edx, -0x20070(%rbp)
movl -0x20074(%rbp), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl $0x15b0, -0x20074(%rbp) # imm = 0x15B0
jmp 0x391f6
cmpq $0x0, -0x38(%rbp)
je 0x392ad
movq -0x38(%rbp), %rax
movl -0x4(%rax), %eax
addl $0x1, %eax
movq -0x38(%rbp), %rcx
cmpl -0x8(%rcx), %eax
jl 0x392bf
leaq -0x38(%rbp), %rdi
movl $0x1, %edx
movl %edx, %esi
callq 0x39420
jmp 0x392c1
jmp 0x392c1
movl -0x20070(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x38(%rbp), %rax
movq -0x38(%rbp), %rsi
movl -0x4(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, -0x4(%rsi)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
cmpq $0x0, -0x38(%rbp)
je 0x39304
movq -0x38(%rbp), %rax
movl -0x4(%rax), %eax
addl $0x1, %eax
movq -0x38(%rbp), %rcx
cmpl -0x8(%rcx), %eax
jl 0x39316
leaq -0x38(%rbp), %rdi
movl $0x1, %edx
movl %edx, %esi
callq 0x39420
jmp 0x39318
jmp 0x39318
movl -0x20070(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x38(%rbp), %rax
movq -0x38(%rbp), %rsi
movl -0x4(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, -0x4(%rsi)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
cmpq $0x0, -0x38(%rbp)
je 0x39358
movq -0x38(%rbp), %rax
movl -0x4(%rax), %eax
addl $0x1, %eax
movq -0x38(%rbp), %rcx
cmpl -0x8(%rcx), %eax
jl 0x3936a
leaq -0x38(%rbp), %rdi
movl $0x1, %edx
movl %edx, %esi
callq 0x39420
jmp 0x3936c
jmp 0x3936c
movl -0x2006c(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x38(%rbp), %rax
movq -0x38(%rbp), %rsi
movl -0x4(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, -0x4(%rsi)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
cmpq $0x0, -0x38(%rbp)
je 0x393af
movq -0x38(%rbp), %rax
movl -0x4(%rax), %eax
addl $0x1, %eax
movq -0x38(%rbp), %rcx
cmpl -0x8(%rcx), %eax
jl 0x393c1
leaq -0x38(%rbp), %rdi
movl $0x1, %edx
movl %edx, %esi
callq 0x39420
jmp 0x393c3
jmp 0x393c3
movl -0x2006c(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x38(%rbp), %rax
movq -0x38(%rbp), %rsi
movl -0x4(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, -0x4(%rsi)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x38(%rbp), %rax
movl -0x4(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x38(%rbp), %rdi
addq $-0x8, %rdi
movq -0x38(%rbp), %rsi
movq -0x18(%rbp), %rax
movslq (%rax), %rdx
callq 0x5650
movq -0x38(%rbp), %rax
addq $-0x8, %rax
addq $0x20090, %rsp          # imm = 0x20090
popq %rbp
retq
nop