// File: /workspace/github_cpp_makefile_star2_O1/srajangarg[P]raytracer/src/core/stb_image.hpp
// 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) {
            int q;
            // insert alpha = 255
            cur = a->out + stride*j;
            if (img_n == 1) {
               for (q=x-1; q >= 0; --q) {
                  cur[q*2+1] = 255;
                  cur[q*2+0] = cur[q];
               }
            } else {
               STBI_ASSERT(img_n == 3);
               for (q=x-1; q >= 0; --q) {
                  cur[q*4+3] = 255;
                  cur[q*4+2] = cur[q*3+2];
                  cur[q*4+1] = cur[q*3+1];
                  cur[q*4+0] = cur[q*3+0];
               }
            }
         }
      }
   }

   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %ecx, %r14d
movl %edx, 0x30(%rsp)
movq (%rdi), %rbx
movl 0x8(%rbx), %ecx
cmpl %r14d, %ecx
sete %al
movq %rcx, 0x50(%rsp)
incl %ecx
movl %ecx, 0x84(%rsp)
cmpl %r14d, %ecx
sete %cl
orb %al, %cl
je 0x211db
movl %r9d, %ebp
movl %r8d, %r13d
movq %rsi, %r12
movq %rdi, %r15
movl %r8d, %eax
imull %r14d, %eax
movl %eax, 0xc(%rsp)
movl %eax, %edi
imull %r9d, %edi
callq 0x4400
movq %r15, 0x70(%rsp)
movq %rax, 0x18(%r15)
testq %rax, %rax
je 0x20dc4
movq 0x50(%rsp), %rax
imull %r13d, %eax
movl %eax, 0x8(%rsp)
movl %eax, %ecx
imull 0xe0(%rsp), %ecx
addl $0x7, %ecx
shrl $0x3, %ecx
leal 0x1(%rcx), %eax
imull %ebp, %eax
movq %r13, %rdx
cmpl %r13d, (%rbx)
jne 0x206f0
cmpl %ebp, 0x4(%rbx)
jne 0x206f0
cmpl 0x30(%rsp), %eax
je 0x206f6
leaq 0xce54(%rip), %rax      # 0x2d53f
jmp 0x20dcb
cmpl 0x30(%rsp), %eax
ja 0x206e4
movq %rcx, 0x68(%rsp)
movl %r14d, 0x24(%rsp)
movl %ebp, 0x5c(%rsp)
testl %ebp, %ebp
movq 0x50(%rsp), %r15
movq %rdx, %r11
je 0x20de8
movl %r15d, %r14d
movslq %r15d, %r13
movl 0x24(%rsp), %edx
cmpl %edx, %r15d
sete %al
movl 0xc(%rsp), %esi
movl %esi, %ecx
movq %rcx, %rdi
negq %rdi
movq %rdi, 0x40(%rsp)
cmpl $0x8, 0xe0(%rsp)
setl %dil
subl 0x68(%rsp), %esi
movq %rsi, 0x98(%rsp)
movslq %edx, %r10
orb %al, %dil
movb %dil, 0x7(%rsp)
leal -0x1(%r11), %eax
movl %eax, (%rsp)
movl 0x5c(%rsp), %eax
movq %rax, 0xa0(%rsp)
movq %r10, %rax
negq %rax
movq %rax, 0x38(%rsp)
subq %rcx, %rax
movq %rax, 0x90(%rsp)
xorl %esi, %esi
xorl %edx, %edx
movq %r13, 0x88(%rsp)
movq %r11, 0x60(%rsp)
movq %r10, 0x28(%rsp)
movl %esi, %esi
leaq 0x1(%r12), %rdi
movzbl (%r12), %eax
movq %rax, 0x30(%rsp)
cmpq $0x5, %rax
movq %rsi, 0x18(%rsp)
movq %rdx, 0x78(%rsp)
jae 0x208b2
movq 0x70(%rsp), %rax
movq 0x18(%rax), %r8
movl 0xc(%rsp), %eax
movl %eax, %ecx
imull %edx, %ecx
movq %r8, 0x48(%rsp)
addq %r8, %rcx
movq %rcx, %rax
movl %r15d, 0x10(%rsp)
movl %r11d, %r8d
cmpl $0x7, 0xe0(%rsp)
jg 0x20815
movq %rdx, %r9
movq 0x68(%rsp), %rdx
cmpl %r11d, %edx
ja 0x21238
movq 0x98(%rsp), %rax
addq %rcx, %rax
movl $0x1, 0x10(%rsp)
movl %edx, %r8d
movq %r9, %rdx
movq 0x30(%rsp), %rsi
movl %esi, %r11d
testq %rdx, %rdx
jne 0x20832
leaq 0xc6b3(%rip), %rdx      # 0x2cedc
movq 0x30(%rsp), %rsi
movb (%rsi,%rdx), %r11b
movzbl %r11b, %r10d
cmpl $0x0, 0x10(%rsp)
jle 0x2088f
movl 0x10(%rsp), %edx
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %r9
addq %r9, %rsi
addq 0x18(%rsp), %rsi
xorl %r9d, %r9d
cmpb $0x6, %r11b
ja 0x20887
leaq 0xc4a1(%rip), %rbp      # 0x2cd04
movslq (%rbp,%r10,4), %rbx
addq %rbp, %rbx
jmpq *%rbx
movb (%rdi,%r9), %bl
jmp 0x20883
movb (%rsi,%r9), %bl
jmp 0x2087f
movb (%rsi,%r9), %bl
shrb %bl
addb (%rdi,%r9), %bl
movb %bl, (%rax,%r9)
incq %r9
cmpq %r9, %rdx
jne 0x20856
cmpl $0x8, 0xe0(%rsp)
jne 0x208c8
cmpl 0x24(%rsp), %r15d
je 0x208a5
movb $-0x1, (%rax,%r13)
addq %r13, %rdi
movq 0x28(%rsp), %rdx
movq %rdi, %r12
jmp 0x208d1
leaq 0xcc98(%rip), %rax      # 0x2d551
movq %rax, 0x17af0(%rip)     # 0x383b0
movq %rdi, %r12
jmp 0x20b4d
addq $0x2, %r12
movl $0x1, %edx
leaq (%rax,%rdx), %rdi
cmpb $0x0, 0x7(%rsp)
je 0x20910
decl %r8d
imull %r15d, %r8d
movslq %r8d, %rbp
cmpb $0x6, %r11b
ja 0x20b45
leaq 0xc445(%rip), %rsi      # 0x2cd3c
movslq (%rsi,%r10,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movq %r12, %rsi
movq %rbp, %rdx
callq 0x42a0
jmp 0x20b45
movl 0x84(%rsp), %esi
cmpl 0x24(%rsp), %esi
jne 0x21219
cmpb $0x6, %r11b
ja 0x20b48
addq 0x40(%rsp), %rcx
addq %rdx, %rcx
leaq 0xc3e6(%rip), %r8       # 0x2cd20
movslq (%r8,%r10,4), %rsi
addq %r8, %rsi
movq 0x60(%rsp), %r11
jmpq *%rsi
movl (%rsp), %eax
testl %eax, %eax
movq 0x28(%rsp), %r10
je 0x20b4d
testl %r15d, %r15d
jle 0x2096e
xorl %ecx, %ecx
movb (%r12,%rcx), %dl
movb %dl, (%rdi,%rcx)
incq %rcx
cmpq %rcx, %r14
jne 0x2095f
movb $-0x1, (%rdi,%r13)
addq %r13, %r12
addq %r10, %rdi
decl %eax
jne 0x20958
jmp 0x20b4d
testl %r8d, %r8d
jle 0x20b45
movslq 0x10(%rsp), %r9
movl %r8d, %ecx
movq %rcx, 0x10(%rsp)
movq %rdx, %rsi
subq %r9, %rsi
addq %rsi, %rax
movq 0x48(%rsp), %rcx
addq 0x40(%rsp), %rcx
addq 0x18(%rsp), %rdx
movq %rdx, %rsi
subq %r9, %rsi
addq %rcx, %rsi
addq %rcx, %rdx
xorl %r8d, %r8d
movzbl (%rax,%r8), %r9d
movzbl (%rdx,%r8), %r11d
movzbl (%rsi,%r8), %r10d
leal (%r11,%r9), %r13d
subl %r10d, %r13d
movl %r13d, %ecx
subl %r9d, %ecx
movl %ecx, %ebx
negl %ebx
cmovsl %ecx, %ebx
movl %r13d, %ecx
subl %r11d, %ecx
movl %ecx, %r15d
negl %r15d
cmovsl %ecx, %r15d
subl %r10d, %r13d
movl %r13d, %ecx
negl %ecx
cmovsl %r13d, %ecx
cmpl %ecx, %r15d
ja 0x20a06
movl %r11d, %r10d
cmpl %ecx, %ebx
cmoval %r10d, %r9d
cmpl %r15d, %ebx
cmoval %r10d, %r9d
addb (%r12,%r8), %r9b
movb %r9b, (%rdi,%r8)
incq %r8
cmpq %r8, 0x10(%rsp)
movq 0x50(%rsp), %r15
movq 0x88(%rsp), %r13
jne 0x209bf
jmp 0x20b45
testl %r8d, %r8d
jle 0x20b45
movl %r8d, %eax
movq 0x48(%rsp), %rcx
addq 0x40(%rsp), %rcx
addq 0x18(%rsp), %rdx
addq %rcx, %rdx
xorl %ecx, %ecx
movb (%rdx,%rcx), %sil
addb (%r12,%rcx), %sil
movb %sil, (%rdi,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x20a57
jmp 0x20b45
testl %r8d, %r8d
jle 0x20b45
movslq 0x10(%rsp), %rsi
movl %r8d, %ecx
movq %rdx, %r8
subq %rsi, %r8
addq %r8, %rax
movq 0x48(%rsp), %rsi
addq 0x40(%rsp), %rsi
addq 0x18(%rsp), %rdx
addq %rsi, %rdx
xorl %esi, %esi
movzbl (%rdx,%rsi), %r8d
movzbl (%rax,%rsi), %r9d
addl %r8d, %r9d
shrl %r9d
addb (%r12,%rsi), %r9b
movb %r9b, (%rdi,%rsi)
incq %rsi
cmpq %rsi, %rcx
jne 0x20a9e
jmp 0x20b45
testl %r8d, %r8d
jle 0x20b45
movslq 0x10(%rsp), %rsi
movl %r8d, %ecx
subq %rsi, %rdx
addq %rdx, %rax
xorl %edx, %edx
movb (%rax,%rdx), %sil
addb (%r12,%rdx), %sil
movb %sil, (%rdi,%rdx)
incq %rdx
cmpq %rdx, %rcx
jne 0x20ad8
jmp 0x20b45
testl %r8d, %r8d
jle 0x20b45
movslq 0x10(%rsp), %rsi
movl %r8d, %ecx
subq %rsi, %rdx
addq %rdx, %rax
xorl %edx, %edx
movb (%rax,%rdx), %sil
shrb %sil
addb (%r12,%rdx), %sil
movb %sil, (%rdi,%rdx)
incq %rdx
cmpq %rdx, %rcx
jne 0x20b03
jmp 0x20b45
testl %r8d, %r8d
jle 0x20b45
movslq 0x10(%rsp), %rsi
movl %r8d, %ecx
subq %rsi, %rdx
addq %rdx, %rax
xorl %edx, %edx
movb (%rax,%rdx), %sil
addb (%r12,%rdx), %sil
movb %sil, (%rdi,%rdx)
incq %rdx
cmpq %rdx, %rcx
jne 0x20b31
addq %rbp, %r12
movq 0x60(%rsp), %r11
cmpb $0x5, 0x30(%rsp)
jae 0x20dd2
movq 0x78(%rsp), %rdx
incq %rdx
movq 0x18(%rsp), %rsi
addl 0xc(%rsp), %esi
cmpq 0xa0(%rsp), %rdx
jne 0x20797
jmp 0x20de8
movl (%rsp), %esi
testl %esi, %esi
je 0x20b4d
addq 0x38(%rsp), %rax
addq %rdx, %rax
movq 0x48(%rsp), %r8
addq 0x90(%rsp), %r8
addq 0x18(%rsp), %rdx
addq %r8, %rdx
testl %r15d, %r15d
jle 0x20c0c
xorl %r8d, %r8d
movzbl (%rax,%r8), %r9d
movzbl (%rcx,%r8), %r11d
movzbl (%rdx,%r8), %r10d
leal (%r11,%r9), %r13d
subl %r10d, %r13d
movl %r13d, %ebp
subl %r9d, %ebp
movl %ebp, %ebx
negl %ebx
cmovsl %ebp, %ebx
movl %r13d, %ebp
subl %r11d, %ebp
movl %ebp, %r15d
negl %r15d
cmovsl %ebp, %r15d
subl %r10d, %r13d
movl %r13d, %ebp
negl %ebp
cmovsl %r13d, %ebp
cmpl %ebp, %r15d
ja 0x20bef
movl %r11d, %r10d
cmpl %ebp, %ebx
cmoval %r10d, %r9d
cmpl %r15d, %ebx
cmoval %r10d, %r9d
addb (%r12,%r8), %r9b
movb %r9b, (%rdi,%r8)
incq %r8
cmpq %r8, %r14
jne 0x20ba8
movq 0x88(%rsp), %r13
movb $-0x1, (%rdi,%r13)
addq %r13, %r12
movq 0x28(%rsp), %r10
addq %r10, %rdi
addq %r10, %rcx
addq %r10, %rax
addq %r10, %rdx
decl %esi
movq 0x60(%rsp), %r11
movq 0x50(%rsp), %r15
jne 0x20ba0
jmp 0x20b4d
movl (%rsp), %edx
movl %edx, %eax
testl %edx, %edx
movq 0x28(%rsp), %r10
je 0x20b4d
testl %r15d, %r15d
jle 0x20c71
xorl %edx, %edx
movb (%rcx,%rdx), %sil
addb (%r12,%rdx), %sil
movb %sil, (%rdi,%rdx)
incq %rdx
cmpq %rdx, %r14
jne 0x20c5d
movb $-0x1, (%rdi,%r13)
addq %r13, %r12
addq %r10, %rdi
addq %r10, %rcx
decl %eax
jne 0x20c56
jmp 0x20b4d
movl (%rsp), %esi
testl %esi, %esi
movq 0x28(%rsp), %r10
je 0x20b4d
addq 0x38(%rsp), %rax
addq %rdx, %rax
movl %esi, %edx
testl %r15d, %r15d
jle 0x20cc9
xorl %esi, %esi
movzbl (%rcx,%rsi), %r8d
movzbl (%rax,%rsi), %r9d
addl %r8d, %r9d
shrl %r9d
addb (%r12,%rsi), %r9b
movb %r9b, (%rdi,%rsi)
incq %rsi
cmpq %rsi, %r14
jne 0x20ca9
movb $-0x1, (%rdi,%r13)
addq %r13, %r12
addq %r10, %rdi
addq %r10, %rcx
addq %r10, %rax
decl %edx
jne 0x20ca2
jmp 0x20b4d
movl (%rsp), %ecx
testl %ecx, %ecx
movq 0x28(%rsp), %r10
je 0x20b4d
addq 0x38(%rsp), %rax
addq %rdx, %rax
testl %r15d, %r15d
jle 0x20d16
xorl %edx, %edx
movb (%rax,%rdx), %sil
addb (%r12,%rdx), %sil
movb %sil, (%rdi,%rdx)
incq %rdx
cmpq %rdx, %r14
jne 0x20d02
movb $-0x1, (%rdi,%r13)
addq %r13, %r12
addq %r10, %rdi
addq %r10, %rax
decl %ecx
jne 0x20cfb
jmp 0x20b4d
movl (%rsp), %ecx
testl %ecx, %ecx
movq 0x28(%rsp), %r10
je 0x20b4d
addq 0x38(%rsp), %rax
addq %rdx, %rax
testl %r15d, %r15d
jle 0x20d63
xorl %edx, %edx
movb (%rax,%rdx), %sil
shrb %sil
addb (%r12,%rdx), %sil
movb %sil, (%rdi,%rdx)
incq %rdx
cmpq %rdx, %r14
jne 0x20d4c
movb $-0x1, (%rdi,%r13)
addq %r13, %r12
addq %r10, %rdi
addq %r10, %rax
decl %ecx
jne 0x20d45
jmp 0x20b4d
movl (%rsp), %ecx
testl %ecx, %ecx
movq 0x28(%rsp), %r10
je 0x20b4d
addq 0x38(%rsp), %rax
addq %rdx, %rax
testl %r15d, %r15d
jle 0x20dad
xorl %edx, %edx
movb (%rax,%rdx), %sil
addb (%r12,%rdx), %sil
movb %sil, (%rdi,%rdx)
incq %rdx
cmpq %rdx, %r14
jne 0x20d99
movb $-0x1, (%rdi,%r13)
addq %r13, %r12
addq %r10, %rdi
addq %r10, %rax
decl %ecx
jne 0x20d92
jmp 0x20b4d
leaq 0xc43e(%rip), %rax      # 0x2d209
movq %rax, 0x175de(%rip)     # 0x383b0
xorl %ecx, %ecx
movl %ecx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0xe0(%rsp), %edi
cmpl $0x8, %edi
setge %al
movl 0x5c(%rsp), %r8d
testl %r8d, %r8d
sete %dl
movl $0x1, %ecx
orb %al, %dl
jne 0x20dd4
movl 0xe8(%rsp), %edx
movl 0xc(%rsp), %eax
movl 0x68(%rsp), %esi
movl %edi, %edi
movq %rdi, 0x30(%rsp)
decl %r11d
movl %r8d, %r8d
movq %rax, %r9
subq %rsi, %r9
negq %rsi
leaq (%r11,%r11,2), %rdi
addq $0x2, %rdi
movq %rdi, 0x78(%rsp)
movq %r11, %rdi
leaq 0x1(%r11), %r10
movq %r10, 0x18(%rsp)
xorl %ebx, %ebx
addq %rax, %rsi
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x70(%rsp), %r14
movb $0x1, %bpl
testl %edx, %edx
jne 0x20e6e
movq 0x30(%rsp), %rax
leaq 0xbfe6(%rip), %r10      # 0x2ce50
movb (%rax,%r10), %bpl
movq 0x18(%r14), %r10
movl 0xc(%rsp), %eax
movl %eax, %r14d
imull %r12d, %r14d
addq %r10, %r14
leaq (%r14,%rsi), %r13
movl %r15d, %r15d
movl 0xe0(%rsp), %eax
cmpl $0x4, %eax
je 0x210d9
cmpl $0x2, %eax
je 0x21027
cmpl $0x1, %eax
jne 0x2113c
movl 0x8(%rsp), %r11d
movl %r11d, %eax
cmpl $0x8, %r11d
jl 0x20f76
leaq (%r10,%r9), %r13
movl 0x8(%rsp), %eax
movl %eax, %r11d
movb (%r13,%r15), %al
sarb $0x7, %al
andb %bpl, %al
movb %al, (%r10,%r15)
movb (%r13,%r15), %al
addb %al, %al
sarb $0x7, %al
andb %bpl, %al
movb %al, 0x1(%r10,%r15)
movb (%r13,%r15), %al
shlb $0x2, %al
sarb $0x7, %al
andb %bpl, %al
movb %al, 0x2(%r10,%r15)
movb (%r13,%r15), %al
shlb $0x3, %al
sarb $0x7, %al
andb %bpl, %al
movb %al, 0x3(%r10,%r15)
movb (%r13,%r15), %al
shlb $0x4, %al
sarb $0x7, %al
andb %bpl, %al
movb %al, 0x4(%r10,%r15)
movb (%r13,%r15), %al
shlb $0x5, %al
sarb $0x7, %al
andb %bpl, %al
movb %al, 0x5(%r10,%r15)
movb (%r13,%r15), %al
shlb $0x6, %al
sarb $0x7, %al
andb %bpl, %al
movb %al, 0x6(%r10,%r15)
testb $0x1, (%r13,%r15)
movzbl %bpl, %eax
cmovel %ebx, %eax
movb %al, 0x7(%r10,%r15)
leal -0x8(%r11), %eax
incq %r13
addq $0x8, %r10
cmpl $0xf, %r11d
jg 0x20ec3
addq %r15, %r13
addq %r15, %r10
movq %r10, %r14
testl %eax, %eax
jle 0x20f8b
movb (%r13), %r10b
sarb $0x7, %r10b
andb %bpl, %r10b
movb %r10b, (%r14)
incq %r14
cmpl $0x2, %eax
jl 0x20fa4
movb (%r13), %r10b
addb %r10b, %r10b
sarb $0x7, %r10b
andb %bpl, %r10b
movb %r10b, (%r14)
incq %r14
cmpl $0x3, %eax
jl 0x20fbe
movb (%r13), %r10b
shlb $0x2, %r10b
sarb $0x7, %r10b
andb %bpl, %r10b
movb %r10b, (%r14)
incq %r14
cmpl $0x4, %eax
jl 0x20fd8
movb (%r13), %r10b
shlb $0x3, %r10b
sarb $0x7, %r10b
andb %bpl, %r10b
movb %r10b, (%r14)
incq %r14
cmpl $0x5, %eax
jl 0x20ff2
movb (%r13), %r10b
shlb $0x4, %r10b
sarb $0x7, %r10b
andb %bpl, %r10b
movb %r10b, (%r14)
incq %r14
cmpl $0x6, %eax
jl 0x2100c
movb (%r13), %r10b
shlb $0x5, %r10b
sarb $0x7, %r10b
andb %bpl, %r10b
movb %r10b, (%r14)
incq %r14
cmpl $0x7, %eax
jne 0x2113c
movb (%r13), %al
shlb $0x6, %al
sarb $0x7, %al
andb %bpl, %al
jmp 0x21139
movl 0x8(%rsp), %eax
movl %eax, %r11d
cmpl $0x4, %eax
jl 0x2109b
leaq (%r10,%r9), %r13
movl 0x8(%rsp), %r11d
movl %r11d, %r14d
movb (%r13,%r15), %al
shrb $0x6, %al
mulb %bpl
movb %al, (%r10,%r15)
movb (%r13,%r15), %al
shrb $0x4, %al
andb $0x3, %al
mulb %bpl
movb %al, 0x1(%r10,%r15)
movb (%r13,%r15), %al
shrb $0x2, %al
andb $0x3, %al
mulb %bpl
movb %al, 0x2(%r10,%r15)
movb (%r13,%r15), %al
andb $0x3, %al
mulb %bpl
movb %al, 0x3(%r10,%r15)
leal -0x4(%r14), %r11d
incq %r13
addq $0x4, %r10
cmpl $0x7, %r14d
jg 0x2103c
addq %r15, %r13
addq %r15, %r10
movq %r10, %r14
testl %r11d, %r11d
jle 0x210b0
movb (%r13), %al
shrb $0x6, %al
mulb %bpl
movb %al, (%r14)
incq %r14
cmpl $0x2, %r11d
jl 0x210c8
movb (%r13), %al
shrb $0x4, %al
andb $0x3, %al
mulb %bpl
movb %al, (%r14)
incq %r14
cmpl $0x3, %r11d
jne 0x2113c
movb (%r13), %al
shrb $0x2, %al
andb $0x3, %al
jmp 0x21136
movl 0x8(%rsp), %r11d
movl %r11d, %eax
cmpl $0x2, %r11d
jl 0x2112a
leaq (%r10,%r9), %r13
movl 0x8(%rsp), %eax
movl %eax, %r11d
movb (%r13,%r15), %al
shrb $0x4, %al
mulb %bpl
movb %al, (%r10,%r15)
movb (%r13,%r15), %al
andb $0xf, %al
mulb %bpl
movb %al, 0x1(%r10,%r15)
leal -0x2(%r11), %eax
incq %r13
addq $0x2, %r10
cmpl $0x3, %r11d
jg 0x210ef
addq %r15, %r13
addq %r15, %r10
movq %r10, %r14
cmpl $0x1, %eax
jne 0x2113c
movb (%r13), %al
shrb $0x4, %al
mulb %bpl
movb %al, (%r14)
movq 0x50(%rsp), %r10
cmpl 0x24(%rsp), %r10d
movq 0x70(%rsp), %r14
je 0x211c5
movq 0x18(%r14), %rax
cmpl $0x1, %r10d
je 0x211a4
cmpl $0x3, %r10d
jne 0x211fa
movq %rdi, %r10
testl %r10d, %r10d
js 0x211c5
addq %r15, %rax
movq 0x78(%rsp), %r10
addq %rax, %r10
movq 0x18(%rsp), %r11
movb $-0x1, -0x1(%rax,%r11,4)
movb (%r10), %bpl
movb %bpl, -0x2(%rax,%r11,4)
movb -0x1(%r10), %bpl
movb %bpl, -0x3(%rax,%r11,4)
movb -0x2(%r10), %bpl
movb %bpl, -0x4(%rax,%r11,4)
addq $-0x3, %r10
decq %r11
jg 0x21179
jmp 0x211c5
testl %edi, %edi
js 0x211c5
addq %r15, %rax
movq 0x18(%rsp), %r10
movb $-0x1, -0x1(%rax,%r10,2)
movb -0x1(%rax,%r10), %r11b
movb %r11b, -0x2(%rax,%r10,2)
decq %r10
jg 0x211b0
incq %r12
addl 0xc(%rsp), %r15d
cmpq %r8, %r12
jne 0x20e57
jmp 0x20dd4
leaq 0xc2c4(%rip), %rdi      # 0x2d4a6
leaq 0xc0f0(%rip), %rsi      # 0x2d2d9
leaq 0xc2df(%rip), %rcx      # 0x2d4cf
movl $0xf94, %edx            # imm = 0xF94
callq 0x4200
leaq 0xc385(%rip), %rdi      # 0x2d586
leaq 0xc0d1(%rip), %rsi      # 0x2d2d9
leaq 0xc2c0(%rip), %rcx      # 0x2d4cf
movl $0x102f, %edx           # imm = 0x102F
callq 0x4200
leaq 0xc355(%rip), %rdi      # 0x2d575
leaq 0xc0b2(%rip), %rsi      # 0x2d2d9
leaq 0xc2a1(%rip), %rcx      # 0x2d4cf
movl $0xfdf, %edx            # imm = 0xFDF
callq 0x4200
leaq 0xc321(%rip), %rdi      # 0x2d560
leaq 0xc093(%rip), %rsi      # 0x2d2d9
leaq 0xc282(%rip), %rcx      # 0x2d4cf
movl $0xfaa, %edx            # imm = 0xFAA
callq 0x4200