// File: /workspace/github_c_makefile_star2_O2/patriciogonzalezvivo[P]tprint/include/std/stb_image.h
// Function: stbi__create_png_image_raw(stbi__png*, unsigned char*, unsigned int, int, unsigned int, unsigned int, int, int)
static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__uint32 raw_len, int out_n, stbi__uint32 x, stbi__uint32 y, int depth, int color)
{
   stbi__context *s = a->s;
   stbi__uint32 i,j,stride = x*out_n;
   stbi__uint32 img_len, img_width_bytes;
   int k;
   int img_n = s->img_n; // copy it into a local for later

   STBI_ASSERT(out_n == s->img_n || out_n == s->img_n+1);
   a->out = (stbi_uc *) stbi__malloc(x * y * out_n); // extra bytes to write off the end into
   if (!a->out) return stbi__err("outofmem", "Out of memory");

   img_width_bytes = (((img_n * x * depth) + 7) >> 3);
   img_len = (img_width_bytes + 1) * y;
   if (s->img_x == x && s->img_y == y) {
      if (raw_len != img_len) return stbi__err("not enough pixels","Corrupt PNG");
   } else { // interlaced:
      if (raw_len < img_len) return stbi__err("not enough pixels","Corrupt PNG");
   }

   for (j=0; j < y; ++j) {
      stbi_uc *cur = a->out + stride*j;
      stbi_uc *prior = cur - stride;
      int filter = *raw++;
      int filter_bytes = img_n;
      int width = x;
      if (filter > 4)
         return stbi__err("invalid filter","Corrupt PNG");

      if (depth < 8) {
         STBI_ASSERT(img_width_bytes <= x);
         cur += x*out_n - img_width_bytes; // store output to the rightmost img_len bytes, so we can decode in place
         filter_bytes = 1;
         width = img_width_bytes;
      }

      // if first row, use special filter that doesn't sample previous row
      if (j == 0) filter = first_row_filter[filter];

      // handle first byte explicitly
      for (k=0; k < filter_bytes; ++k) {
         switch (filter) {
            case STBI__F_none       : cur[k] = raw[k]; break;
            case STBI__F_sub        : cur[k] = raw[k]; break;
            case STBI__F_up         : cur[k] = STBI__BYTECAST(raw[k] + prior[k]); break;
            case STBI__F_avg        : cur[k] = STBI__BYTECAST(raw[k] + (prior[k]>>1)); break;
            case STBI__F_paeth      : cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(0,prior[k],0)); break;
            case STBI__F_avg_first  : cur[k] = raw[k]; break;
            case STBI__F_paeth_first: cur[k] = raw[k]; break;
         }
      }

      if (depth == 8) {
         if (img_n != out_n)
            cur[img_n] = 255; // first pixel
         raw += img_n;
         cur += out_n;
         prior += out_n;
      } else {
         raw += 1;
         cur += 1;
         prior += 1;
      }

      // this is a little gross, so that we don't switch per-pixel or per-component
      if (depth < 8 || img_n == out_n) {
         int nk = (width - 1)*img_n;
         #define CASE(f) \
             case f:     \
                for (k=0; k < nk; ++k)
         switch (filter) {
            // "none" filter turns into a memcpy here; make that explicit.
            case STBI__F_none:         memcpy(cur, raw, nk); break;
            CASE(STBI__F_sub)          cur[k] = STBI__BYTECAST(raw[k] + cur[k-filter_bytes]); break;
            CASE(STBI__F_up)           cur[k] = STBI__BYTECAST(raw[k] + prior[k]); break;
            CASE(STBI__F_avg)          cur[k] = STBI__BYTECAST(raw[k] + ((prior[k] + cur[k-filter_bytes])>>1)); break;
            CASE(STBI__F_paeth)        cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-filter_bytes],prior[k],prior[k-filter_bytes])); break;
            CASE(STBI__F_avg_first)    cur[k] = STBI__BYTECAST(raw[k] + (cur[k-filter_bytes] >> 1)); break;
            CASE(STBI__F_paeth_first)  cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-filter_bytes],0,0)); break;
         }
         #undef CASE
         raw += nk;
      } else {
         STBI_ASSERT(img_n+1 == out_n);
         #define CASE(f) \
             case f:     \
                for (i=x-1; i >= 1; --i, cur[img_n]=255,raw+=img_n,cur+=out_n,prior+=out_n) \
                   for (k=0; k < img_n; ++k)
         switch (filter) {
            CASE(STBI__F_none)         cur[k] = raw[k]; break;
            CASE(STBI__F_sub)          cur[k] = STBI__BYTECAST(raw[k] + cur[k-out_n]); break;
            CASE(STBI__F_up)           cur[k] = STBI__BYTECAST(raw[k] + prior[k]); break;
            CASE(STBI__F_avg)          cur[k] = STBI__BYTECAST(raw[k] + ((prior[k] + cur[k-out_n])>>1)); break;
            CASE(STBI__F_paeth)        cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-out_n],prior[k],prior[k-out_n])); break;
            CASE(STBI__F_avg_first)    cur[k] = STBI__BYTECAST(raw[k] + (cur[k-out_n] >> 1)); break;
            CASE(STBI__F_paeth_first)  cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-out_n],0,0)); break;
         }
         #undef CASE
      }
   }

   // we make a separate pass to expand bits to pixels; for performance,
   // this could run two scanlines behind the above code, so it won't
   // intefere with filtering but will still be in the cache.
   if (depth < 8) {
      for (j=0; j < y; ++j) {
         stbi_uc *cur = a->out + stride*j;
         stbi_uc *in  = a->out + stride*j + x*out_n - img_width_bytes;
         // unpack 1/2/4-bit into a 8-bit buffer. allows us to keep the common 8-bit path optimal at minimal cost for 1/2/4-bit
         // png guarante byte alignment, if width is not multiple of 8/4/2 we'll decode dummy trailing data that will be skipped in the later loop
         stbi_uc scale = (color == 0) ? stbi__depth_scale_table[depth] : 1; // scale grayscale values to 0..255 range

         // note that the final byte might overshoot and write more data than desired.
         // we can allocate enough data that this never writes out of memory, but it
         // could also overwrite the next scanline. can it overwrite non-empty data
         // on the next scanline? yes, consider 1-pixel-wide scanlines with 1-bit-per-pixel.
         // so we need to explicitly clamp the final ones

         if (depth == 4) {
            for (k=x*img_n; k >= 2; k-=2, ++in) {
               *cur++ = scale * ((*in >> 4)       );
               *cur++ = scale * ((*in     ) & 0x0f);
            }
            if (k > 0) *cur++ = scale * ((*in >> 4)       );
         } else if (depth == 2) {
            for (k=x*img_n; k >= 4; k-=4, ++in) {
               *cur++ = scale * ((*in >> 6)       );
               *cur++ = scale * ((*in >> 4) & 0x03);
               *cur++ = scale * ((*in >> 2) & 0x03);
               *cur++ = scale * ((*in     ) & 0x03);
            }
            if (k > 0) *cur++ = scale * ((*in >> 6)       );
            if (k > 1) *cur++ = scale * ((*in >> 4) & 0x03);
            if (k > 2) *cur++ = scale * ((*in >> 2) & 0x03);
         } else if (depth == 1) {
            for (k=x*img_n; k >= 8; k-=8, ++in) {
               *cur++ = scale * ((*in >> 7)       );
               *cur++ = scale * ((*in >> 6) & 0x01);
               *cur++ = scale * ((*in >> 5) & 0x01);
               *cur++ = scale * ((*in >> 4) & 0x01);
               *cur++ = scale * ((*in >> 3) & 0x01);
               *cur++ = scale * ((*in >> 2) & 0x01);
               *cur++ = scale * ((*in >> 1) & 0x01);
               *cur++ = scale * ((*in     ) & 0x01);
            }
            if (k > 0) *cur++ = scale * ((*in >> 7)       );
            if (k > 1) *cur++ = scale * ((*in >> 6) & 0x01);
            if (k > 2) *cur++ = scale * ((*in >> 5) & 0x01);
            if (k > 3) *cur++ = scale * ((*in >> 4) & 0x01);
            if (k > 4) *cur++ = scale * ((*in >> 3) & 0x01);
            if (k > 5) *cur++ = scale * ((*in >> 2) & 0x01);
            if (k > 6) *cur++ = scale * ((*in >> 1) & 0x01);
         }
         if (img_n != out_n) {
            // insert alpha = 255
            stbi_uc *cur = a->out + stride*j;
            int i;
            if (img_n == 1) {
               for (i=x-1; i >= 0; --i) {
                  cur[i*2+1] = 255;
                  cur[i*2+0] = cur[i];
               }
            } else {
               STBI_ASSERT(img_n == 3);
               for (i=x-1; i >= 0; --i) {
                  cur[i*4+3] = 255;
                  cur[i*4+2] = cur[i*3+2];
                  cur[i*4+1] = cur[i*3+1];
                  cur[i*4+0] = cur[i*3+0];
               }
            }
         }
      }
   }

   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %edx, %r13d
movq (%rdi), %rbx
movl 0x8(%rbx), %edx
cmpl %ecx, %edx
sete %al
movq %rdx, 0x28(%rsp)
incl %edx
movl %edx, 0x78(%rsp)
cmpl %ecx, %edx
sete %dl
orb %al, %dl
je 0x166b0
movl %r9d, %r12d
movl %r8d, %r14d
movq %rsi, %rbp
movq %rdi, %r15
movl %r8d, %edi
movl %ecx, 0x14(%rsp)
imull %ecx, %edi
movq %rdi, 0x48(%rsp)
imull %r9d, %edi
callq 0x8420
movq %rax, 0x18(%r15)
testq %rax, %rax
je 0x16247
movl 0x110(%rsp), %edx
movq 0x28(%rsp), %rax
imull %r14d, %eax
movl %eax, 0x34(%rsp)
movl %eax, %r8d
imull %edx, %r8d
addl $0x7, %r8d
shrl $0x3, %r8d
leal 0x1(%r8), %eax
imull %r12d, %eax
movq %r14, 0x18(%rsp)
cmpl %r14d, (%rbx)
jne 0x15c1a
cmpl %r12d, 0x4(%rbx)
jne 0x15c1a
cmpl %r13d, %eax
je 0x15c1f
leaq 0x35b9(%rip), %rax      # 0x191ce
jmp 0x16655
cmpl %r13d, %eax
ja 0x15c0e
movq %r15, 0x60(%rsp)
movq 0x28(%rsp), %rcx
movslq %ecx, %r13
movl %edx, %esi
movl 0x14(%rsp), %r9d
cmpl %r9d, %ecx
sete %al
movq 0x48(%rsp), %rdx
movl %edx, %edi
movq %rdi, %r10
negq %r10
movq %r10, 0xb8(%rsp)
cmpl $0x8, %esi
setl %sil
movq %r8, 0x88(%rsp)
subl %r8d, %edx
movq %rdx, 0xa8(%rsp)
movslq %r9d, %rdx
orb %al, %sil
movb %sil, 0x7(%rsp)
testl %ecx, %ecx
movl $0x0, %eax
cmovgl %ecx, %eax
movq %rax, 0x58(%rsp)
movl %r12d, %eax
movq %rax, 0x90(%rsp)
movq %rdx, %r10
negq %r10
movq %r10, %rcx
movq %rdi, 0x80(%rsp)
subq %rdi, %rcx
movq %rcx, 0xa0(%rsp)
xorl %eax, %eax
xorl %esi, %esi
movq 0x18(%rsp), %r8
movq %rbp, %r15
movq %r13, 0x50(%rsp)
movq %rdx, 0x68(%rsp)
movq %r10, 0x40(%rsp)
cmpq 0x90(%rsp), %rsi
je 0x16253
movzbl (%r15), %ebp
cmpq $0x4, %rbp
movq 0x28(%rsp), %rdx
ja 0x1664e
movq 0x60(%rsp), %rcx
movq 0x18(%rcx), %rdi
movq 0x48(%rsp), %r14
imull %esi, %r14d
addq %rdi, %r14
movq %r14, 0x8(%rsp)
movl %r8d, %ecx
movq %rcx, 0x98(%rsp)
cmpl $0x7, 0x110(%rsp)
leaq 0x2c4f(%rip), %rbx      # 0x18968
jg 0x15d47
movq 0x88(%rsp), %rcx
cmpl %r8d, %ecx
ja 0x16672
movq 0xa8(%rsp), %rdx
addq %r14, %rdx
movq %rdx, 0x8(%rsp)
pushq $0x1
popq %rdx
movq %rcx, 0x98(%rsp)
movq %rsi, 0xc8(%rsp)
testq %rsi, %rsi
jne 0x15d60
leaq 0x2df1(%rip), %rcx      # 0x18b4c
movb (%rbp,%rcx), %bpl
movl %eax, %ecx
movq 0xb8(%rsp), %rax
addq %rax, %r14
testl %edx, %edx
movl $0x0, %r13d
movl %edx, 0x7c(%rsp)
cmovgl %edx, %r13d
leaq 0x1(%r15), %rsi
movq %rdi, 0xb0(%rsp)
addq %rdi, %rax
movq %rcx, 0x38(%rsp)
movq %rax, 0xc0(%rsp)
leaq (%rax,%rcx), %rdx
xorl %r12d, %r12d
movq %rsi, 0x70(%rsp)
movq %rdx, 0xd0(%rsp)
movzbl %bpl, %ecx
cmpq %r12, %r13
je 0x15e17
cmpb $0x6, %bpl
ja 0x15e12
movslq (%rbx,%rcx,4), %rax
addq %rbx, %rax
jmpq *%rax
movb (%rsi,%r12), %al
jmp 0x15e09
movb (%rsi,%r12), %al
movb %al, 0x20(%rsp)
movzbl (%rdx,%r12), %esi
xorl %edi, %edi
xorl %edx, %edx
callq 0x166ee
movq 0xd0(%rsp), %rdx
movq 0x70(%rsp), %rsi
addb 0x20(%rsp), %al
movl 0x14(%rsp), %r9d
jmp 0x15e09
movb (%rdx,%r12), %al
jmp 0x15e05
movb (%rdx,%r12), %al
shrb %al
addb (%rsi,%r12), %al
movq 0x8(%rsp), %rcx
movb %al, (%rcx,%r12)
incq %r12
jmp 0x15dad
cmpl $0x8, 0x110(%rsp)
jne 0x15e45
cmpl %r9d, 0x28(%rsp)
je 0x15e36
movq 0x50(%rsp), %rax
movq 0x8(%rsp), %rdx
movb $-0x1, (%rdx,%rax)
addq 0x50(%rsp), %rsi
movq 0x68(%rsp), %rax
movq %rsi, %r15
jmp 0x15e4c
addq $0x2, %r15
pushq $0x1
popq %rax
movq 0x8(%rsp), %rdx
leaq (%rdx,%rax), %r12
cmpb $0x0, 0x7(%rsp)
je 0x15ed3
movq 0x98(%rsp), %r8
decl %r8d
imull 0x28(%rsp), %r8d
movslq %r8d, %rdx
movq %rdx, 0x8(%rsp)
cmpb $0x6, %bpl
movq 0xc0(%rsp), %rbx
ja 0x15ea8
leaq 0x2b16(%rip), %rdx      # 0x189a0
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
movslq 0x7c(%rsp), %rdx
jmpq *%rcx
movq %r12, %rdi
movq %r15, %rsi
movq 0x8(%rsp), %rdx
callq 0x8290
addq 0x8(%rsp), %r15
movl 0x14(%rsp), %r9d
movq 0xc8(%rsp), %rsi
incq %rsi
movq 0x48(%rsp), %rax
movq 0x38(%rsp), %rcx
addl %ecx, %eax
movq 0x18(%rsp), %r8
jmp 0x15cc4
cmpl %r9d, 0x78(%rsp)
jne 0x16691
cmpb $0x6, %bpl
movq 0x58(%rsp), %r8
ja 0x15eb2
addq %rax, %r14
leaq 0x2a91(%rip), %rdx      # 0x18984
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
movq 0x50(%rsp), %r13
movq 0x68(%rsp), %rbp
jmpq *%rcx
movq 0x18(%rsp), %rax
decl %eax
je 0x15eb2
xorl %ecx, %ecx
cmpq %rcx, %r8
je 0x15f23
movb (%r15,%rcx), %dl
movb %dl, (%r12,%rcx)
incq %rcx
jmp 0x15f11
movb $-0x1, (%r12,%r13)
addq %r13, %r15
addq %rbp, %r12
jmp 0x15f0b
testl %r8d, %r8d
movl $0x0, %ecx
cmovlel %ecx, %r8d
addq 0x38(%rsp), %rax
addq %rax, %rbx
negq %rdx
movq %rdx, 0x20(%rsp)
movq %r15, %r14
subq $0x1, %r8
jb 0x15ea8
movb (%r14), %bpl
movq 0x20(%rsp), %rax
movzbl (%r12,%rax), %edi
movzbl (%rbx), %esi
movzbl (%rbx,%rax), %edx
movq %r8, %r13
callq 0x166ee
movq %r13, %r8
addb %bpl, %al
movb %al, (%r12)
incq %r12
incq %rbx
incq %r14
jmp 0x15f4f
testl %r8d, %r8d
movl $0x0, %ecx
cmovlel %ecx, %r8d
addq 0x38(%rsp), %rax
addq %rax, %rbx
xorl %eax, %eax
cmpq %rax, %r8
je 0x15ea8
movb (%rbx,%rax), %cl
addb (%r15,%rax), %cl
movb %cl, (%r12,%rax)
incq %rax
jmp 0x15fa0
testl %r8d, %r8d
movl $0x0, %ecx
cmovlel %ecx, %r8d
addq 0x38(%rsp), %rax
addq %rax, %rbx
movq %r12, %rax
subq %rdx, %rax
xorl %ecx, %ecx
cmpq %rcx, %r8
je 0x15ea8
movzbl (%rbx,%rcx), %edx
movzbl (%rax,%rcx), %esi
addl %edx, %esi
shrl %esi
addb (%r15,%rcx), %sil
movb %sil, (%r12,%rcx)
incq %rcx
jmp 0x15fd5
testl %r8d, %r8d
movl $0x0, %eax
cmovlel %eax, %r8d
movq %r12, %rax
subq %rdx, %rax
xorl %ecx, %ecx
cmpq %rcx, %r8
je 0x15ea8
movb (%rax,%rcx), %dl
addb (%r15,%rcx), %dl
movb %dl, (%r12,%rcx)
incq %rcx
jmp 0x1600b
testl %r8d, %r8d
movl $0x0, %eax
cmovlel %eax, %r8d
movq %r12, %rax
subq %rdx, %rax
xorl %ecx, %ecx
cmpq %rcx, %r8
je 0x15ea8
movb (%rax,%rcx), %dl
shrb %dl
addb (%r15,%rcx), %dl
movb %dl, (%r12,%rcx)
incq %rcx
jmp 0x16038
testl %r8d, %r8d
movl $0x0, %eax
cmovlel %eax, %r8d
movq %r12, %rax
subq %rdx, %rax
xorl %ecx, %ecx
cmpq %rcx, %r8
je 0x15ea8
movb (%rax,%rcx), %dl
addb (%r15,%rcx), %dl
movb %dl, (%r12,%rcx)
incq %rcx
jmp 0x16067
movq %r14, 0x20(%rsp)
movq 0x8(%rsp), %r14
addq 0x40(%rsp), %r14
addq %rax, %r14
movq 0xb0(%rsp), %rcx
addq 0xa0(%rsp), %rcx
movq 0x38(%rsp), %rbp
addq %rax, %rbp
addq %rcx, %rbp
movq 0x18(%rsp), %rax
decl %eax
je 0x15ead
movl %eax, 0x8(%rsp)
xorl %ebx, %ebx
cmpq %rbx, %r8
je 0x160f2
movb (%r15,%rbx), %r13b
movzbl (%r14,%rbx), %edi
movq 0x20(%rsp), %rax
movzbl (%rax,%rbx), %esi
movzbl (%rbp,%rbx), %edx
callq 0x166ee
movq 0x58(%rsp), %r8
addb %r13b, %al
movb %al, (%r12,%rbx)
incq %rbx
jmp 0x160c0
movq 0x50(%rsp), %rax
movb $-0x1, (%r12,%rax)
addq %rax, %r15
movq 0x68(%rsp), %rax
addq %rax, %r12
addq %rax, 0x20(%rsp)
addq %rax, %r14
addq %rax, %rbp
movl 0x8(%rsp), %eax
jmp 0x160b2
movq 0x18(%rsp), %rax
decl %eax
je 0x15eb2
xorl %ecx, %ecx
cmpq %rcx, %r8
je 0x1613d
movb (%r14,%rcx), %dl
addb (%r15,%rcx), %dl
movb %dl, (%r12,%rcx)
incq %rcx
jmp 0x16127
movb $-0x1, (%r12,%r13)
addq %r13, %r15
addq %rbp, %r12
addq %rbp, %r14
jmp 0x1611d
movq 0x18(%rsp), %rax
decl %eax
je 0x15eb2
movq 0x40(%rsp), %rcx
addq %r12, %rcx
xorl %edx, %edx
cmpq %rdx, %r8
je 0x16183
movzbl (%r14,%rdx), %esi
movzbl (%rcx,%rdx), %edi
addl %esi, %edi
shrl %edi
addb (%r15,%rdx), %dil
movb %dil, (%r12,%rdx)
incq %rdx
jmp 0x16164
movb $-0x1, (%r12,%r13)
addq %r13, %r15
addq %rbp, %r12
addq %rbp, %r14
jmp 0x16152
movq 0x18(%rsp), %rax
movq 0x40(%rsp), %r10
decl %eax
je 0x15eb2
leaq (%r12,%r10), %rcx
xorl %edx, %edx
cmpq %rdx, %r8
je 0x161c1
movb (%rcx,%rdx), %sil
addb (%r15,%rdx), %sil
movb %sil, (%r12,%rdx)
incq %rdx
jmp 0x161ab
movb $-0x1, (%r12,%r13)
addq %r13, %r15
addq %rbp, %r12
jmp 0x1619d
movq 0x18(%rsp), %rax
movq 0x40(%rsp), %r10
decl %eax
je 0x15eb2
leaq (%r12,%r10), %rcx
xorl %edx, %edx
cmpq %rdx, %r8
je 0x161ff
movb (%rcx,%rdx), %sil
shrb %sil
addb (%r15,%rdx), %sil
movb %sil, (%r12,%rdx)
incq %rdx
jmp 0x161e6
movb $-0x1, (%r12,%r13)
addq %r13, %r15
addq %rbp, %r12
jmp 0x161d8
movq 0x18(%rsp), %rax
movq 0x40(%rsp), %r10
decl %eax
je 0x15eb2
leaq (%r12,%r10), %rcx
xorl %edx, %edx
cmpq %rdx, %r8
je 0x1623a
movb (%rcx,%rdx), %sil
addb (%r15,%rdx), %sil
movb %sil, (%r12,%rdx)
incq %rdx
jmp 0x16224
movb $-0x1, (%r12,%r13)
addq %r13, %r15
addq %rbp, %r12
jmp 0x16216
leaq 0x2c49(%rip), %rax      # 0x18e97
jmp 0x16655
pushq $0x1
popq %rcx
movl 0x110(%rsp), %r9d
cmpl $0x7, %r9d
jg 0x1665e
movl 0x88(%rsp), %edx
movl %r9d, %esi
movl %r8d, %edi
movq 0x80(%rsp), %rax
subq %rdx, %rax
movq %rax, 0x8(%rsp)
negq %rdx
leaq (%rdi,%rdi,2), %rax
addq $-0x3, %rax
movq %rax, 0x20(%rsp)
movl %r8d, %eax
decl %r8d
leal -0x4(,%rax,4), %r10d
movl %r10d, 0x58(%rsp)
decq %rdi
leal -0x1(,%rax,2), %eax
movl %eax, 0x70(%rsp)
xorl %ebx, %ebx
xorl %r15d, %r15d
xorl %r12d, %r12d
cmpq 0x90(%rsp), %r12
je 0x1665e
movb $0x1, %bpl
cmpl $0x0, 0x118(%rsp)
jne 0x162e4
leaq 0x27e0(%rip), %rax      # 0x18ac0
movb (%rsi,%rax), %bpl
movl %r15d, %r15d
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x48(%rsp), %r13
imull %r12d, %r13d
cmpl $0x4, %r9d
je 0x1647a
movq 0x80(%rsp), %r10
leaq (%r10,%r13), %r14
addq %rdx, %r14
addq %rax, %r14
cmpl $0x2, %r9d
je 0x163d7
cmpl $0x1, %r9d
jne 0x16585
addq %r15, %rax
addq $0x7, %rax
movl 0x34(%rsp), %r10d
cmpl $0x8, %r10d
jl 0x164db
movb (%r14), %r9b
sarb $0x7, %r9b
andb %bpl, %r9b
movb %r9b, -0x7(%rax)
movb (%r14), %r9b
addb %r9b, %r9b
sarb $0x7, %r9b
andb %bpl, %r9b
movb %r9b, -0x6(%rax)
movb (%r14), %r9b
shlb $0x2, %r9b
sarb $0x7, %r9b
andb %bpl, %r9b
movb %r9b, -0x5(%rax)
movb (%r14), %r9b
shlb $0x3, %r9b
sarb $0x7, %r9b
andb %bpl, %r9b
movb %r9b, -0x4(%rax)
movb (%r14), %r9b
shlb $0x4, %r9b
sarb $0x7, %r9b
andb %bpl, %r9b
movb %r9b, -0x3(%rax)
movb (%r14), %r9b
shlb $0x5, %r9b
sarb $0x7, %r9b
andb %bpl, %r9b
movb %r9b, -0x2(%rax)
movb (%r14), %r9b
shlb $0x6, %r9b
sarb $0x7, %r9b
andb %bpl, %r9b
movb %r9b, -0x1(%rax)
movzbl %bpl, %r9d
testb $0x1, (%r14)
cmovel %ebx, %r9d
movb %r9b, (%rax)
addl $-0x8, %r10d
incq %r14
addq $0x8, %rax
jmp 0x16335
leaq (%rax,%r15), %r10
addq $0x3, %r10
movl 0x34(%rsp), %r9d
cmpl $0x4, %r9d
jl 0x1642d
movb (%r14), %al
shrb $0x6, %al
mulb %bpl
movb %al, -0x3(%r10)
movb (%r14), %al
shrb $0x4, %al
andb $0x3, %al
mulb %bpl
movb %al, -0x2(%r10)
movb (%r14), %al
shrb $0x2, %al
andb $0x3, %al
mulb %bpl
movb %al, -0x1(%r10)
movb (%r14), %al
andb $0x3, %al
mulb %bpl
movb %al, (%r10)
addl $-0x4, %r9d
incq %r14
addq $0x4, %r10
jmp 0x163e4
testl %r9d, %r9d
jle 0x16585
movb (%r14), %al
shrb $0x6, %al
mulb %bpl
movb %al, -0x3(%r10)
cmpl $0x1, %r9d
je 0x16585
movb (%r14), %al
shrb $0x4, %al
andb $0x3, %al
mulb %bpl
movb %al, -0x2(%r10)
cmpl $0x3, %r9d
jne 0x16585
movb (%r14), %al
shrb $0x2, %al
andb $0x3, %al
mulb %bpl
movb %al, -0x1(%r10)
jmp 0x16585
leaq (%rax,%r15), %r14
addq 0x8(%rsp), %r14
leaq (%rax,%r15), %r9
incq %r9
xorl %r10d, %r10d
movl 0x34(%rsp), %r11d
cmpl $0x2, %r11d
jl 0x164bd
movb (%r14,%r10), %al
shrb $0x4, %al
mulb %bpl
movb %al, -0x1(%r9,%r10,2)
movb (%r14,%r10), %al
andb $0xf, %al
mulb %bpl
movb %al, (%r9,%r10,2)
addl $-0x2, %r11d
incq %r10
jmp 0x16492
cmpl $0x1, %r11d
jne 0x16585
movb (%r14,%r10), %al
shrb $0x4, %al
mulb %bpl
movb %al, -0x1(%r9,%r10,2)
jmp 0x16585
testl %r10d, %r10d
jle 0x16585
movb (%r14), %r9b
sarb $0x7, %r9b
andb %bpl, %r9b
movb %r9b, -0x7(%rax)
cmpl $0x1, %r10d
je 0x16585
movb (%r14), %r9b
addb %r9b, %r9b
sarb $0x7, %r9b
andb %bpl, %r9b
movb %r9b, -0x6(%rax)
cmpl $0x3, %r10d
jb 0x16585
movb (%r14), %r9b
shlb $0x2, %r9b
sarb $0x7, %r9b
andb %bpl, %r9b
movb %r9b, -0x5(%rax)
cmpl $0x3, %r10d
je 0x16585
movb (%r14), %r9b
shlb $0x3, %r9b
sarb $0x7, %r9b
andb %bpl, %r9b
movb %r9b, -0x4(%rax)
cmpl $0x5, %r10d
jb 0x16585
movb (%r14), %r9b
shlb $0x4, %r9b
sarb $0x7, %r9b
andb %bpl, %r9b
movb %r9b, -0x3(%rax)
cmpl $0x5, %r10d
je 0x16585
movb (%r14), %r9b
shlb $0x5, %r9b
sarb $0x7, %r9b
andb %bpl, %r9b
movb %r9b, -0x2(%rax)
cmpl $0x7, %r10d
jne 0x16585
movb (%r14), %r9b
shlb $0x6, %r9b
sarb $0x7, %r9b
andb %bpl, %r9b
movb %r9b, -0x1(%rax)
movq 0x28(%rsp), %rax
cmpl 0x14(%rsp), %eax
je 0x16600
movq 0x60(%rsp), %rax
addq 0x18(%rax), %r13
movq 0x28(%rsp), %r11
cmpl $0x1, %r11d
je 0x16615
movl 0x58(%rsp), %eax
movl %r8d, %r9d
movq 0x20(%rsp), %r10
cmpl $0x3, %r11d
je 0x165fb
jmp 0x166cf
leal 0x3(%rax), %r11d
movb $-0x1, (%r13,%r11)
movl %r10d, %r11d
movb 0x2(%r13,%r11), %bpl
leal 0x2(%rax), %r14d
movb %bpl, (%r13,%r14)
movb 0x1(%r13,%r11), %bpl
leal 0x1(%rax), %r14d
movb %bpl, (%r13,%r14)
movb (%r13,%r11), %r11b
movl %eax, %r14d
movb %r11b, (%r13,%r14)
addq $-0x3, %r10
decl %r9d
addl $-0x4, %eax
testl %r9d, %r9d
jns 0x165bb
incq %r12
addl 0x48(%rsp), %r15d
movl 0x110(%rsp), %r9d
jmp 0x162be
movl 0x70(%rsp), %eax
xorl %r9d, %r9d
movl %r8d, %r10d
addl %r9d, %r10d
js 0x16600
leaq (%rdi,%r9), %r10
leal -0x1(%rax), %r11d
movl %eax, %r14d
movb $-0x1, (%r13,%r14)
andl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
movb (%r13,%r10), %r10b
movb %r10b, (%r13,%r11)
decq %r9
addl $-0x2, %eax
jmp 0x1661c
leaq 0x2b8b(%rip), %rax      # 0x191e0
movq %rax, 0x9dac(%rip)      # 0x20408
xorl %ecx, %ecx
movl %ecx, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2b76(%rip), %rdi      # 0x191ef
leaq 0x28e7(%rip), %rsi      # 0x18f67
leaq 0x2ad7(%rip), %rcx      # 0x1915e
movl $0xf93, %edx            # imm = 0xF93
callq 0x8210
leaq 0x2b6c(%rip), %rdi      # 0x19204
leaq 0x28c8(%rip), %rsi      # 0x18f67
leaq 0x2ab8(%rip), %rcx      # 0x1915e
movl $0xfc8, %edx            # imm = 0xFC8
callq 0x8210
leaq 0x2a7e(%rip), %rdi      # 0x19135
leaq 0x28a9(%rip), %rsi      # 0x18f67
leaq 0x2a99(%rip), %rcx      # 0x1915e
movl $0xf7d, %edx            # imm = 0xF7D
callq 0x8210
leaq 0x2b3f(%rip), %rdi      # 0x19215
leaq 0x288a(%rip), %rsi      # 0x18f67
leaq 0x2a7a(%rip), %rcx      # 0x1915e
movl $0x1018, %edx           # imm = 0x1018
callq 0x8210