// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: lodepng_compute_color_stats(LodePNGColorStats*, unsigned char const*, unsigned int, unsigned int, LodePNGColorMode const*)
unsigned lodepng_compute_color_stats(LodePNGColorStats* stats,
                                     const unsigned char* in, unsigned w, unsigned h,
                                     const LodePNGColorMode* mode_in) {
  size_t i;
  ColorTree tree;
  size_t numpixels = (size_t)w * (size_t)h;
  unsigned error = 0;

  /* mark things as done already if it would be impossible to have a more expensive case */
  unsigned colored_done = lodepng_is_greyscale_type(mode_in) ? 1 : 0;
  unsigned alpha_done = lodepng_can_have_alpha(mode_in) ? 0 : 1;
  unsigned numcolors_done = 0;
  unsigned bpp = lodepng_get_bpp(mode_in);
  unsigned bits_done = (stats->bits == 1 && bpp == 1) ? 1 : 0;
  unsigned sixteen = 0; /* whether the input image is 16 bit */
  unsigned maxnumcolors = 257;
  if(bpp <= 8) maxnumcolors = LODEPNG_MIN(257, stats->numcolors + (1u << bpp));

  stats->numpixels += numpixels;

  /*if palette not allowed, no need to compute numcolors*/
  if(!stats->allow_palette) numcolors_done = 1;

  color_tree_init(&tree);

  /*If the stats was already filled in from previous data, fill its palette in tree
  and mark things as done already if we know they are the most expensive case already*/
  if(stats->alpha) alpha_done = 1;
  if(stats->colored) colored_done = 1;
  if(stats->bits == 16) numcolors_done = 1;
  if(stats->bits >= bpp) bits_done = 1;
  if(stats->numcolors >= maxnumcolors) numcolors_done = 1;

  if(!numcolors_done) {
    for(i = 0; i < stats->numcolors; i++) {
      const unsigned char* color = &stats->palette[i * 4];
      error = color_tree_add(&tree, color[0], color[1], color[2], color[3], (unsigned)i);
      if(error) goto cleanup;
    }
  }

  /*Check if the 16-bit input is truly 16-bit*/
  if(mode_in->bitdepth == 16 && !sixteen) {
    unsigned short r = 0, g = 0, b = 0, a = 0;
    for(i = 0; i != numpixels; ++i) {
      getPixelColorRGBA16(&r, &g, &b, &a, in, i, mode_in);
      if((r & 255) != ((r >> 8) & 255) || (g & 255) != ((g >> 8) & 255) ||
         (b & 255) != ((b >> 8) & 255) || (a & 255) != ((a >> 8) & 255)) /*first and second byte differ*/ {
        stats->bits = 16;
        sixteen = 1;
        bits_done = 1;
        numcolors_done = 1; /*counting colors no longer useful, palette doesn't support 16-bit*/
        break;
      }
    }
  }

  if(sixteen) {
    unsigned short r = 0, g = 0, b = 0, a = 0;

    for(i = 0; i != numpixels; ++i) {
      getPixelColorRGBA16(&r, &g, &b, &a, in, i, mode_in);

      if(!colored_done && (r != g || r != b)) {
        stats->colored = 1;
        colored_done = 1;
      }

      if(!alpha_done) {
        unsigned matchkey = (r == stats->key_r && g == stats->key_g && b == stats->key_b);
        if(a != 65535 && (a != 0 || (stats->key && !matchkey))) {
          stats->alpha = 1;
          stats->key = 0;
          alpha_done = 1;
        } else if(a == 0 && !stats->alpha && !stats->key) {
          stats->key = 1;
          stats->key_r = r;
          stats->key_g = g;
          stats->key_b = b;
        } else if(a == 65535 && stats->key && matchkey) {
          /* Color key cannot be used if an opaque pixel also has that RGB color. */
          stats->alpha = 1;
          stats->key = 0;
          alpha_done = 1;
        }
      }
      if(alpha_done && numcolors_done && colored_done && bits_done) break;
    }

    if(stats->key && !stats->alpha) {
      for(i = 0; i != numpixels; ++i) {
        getPixelColorRGBA16(&r, &g, &b, &a, in, i, mode_in);
        if(a != 0 && r == stats->key_r && g == stats->key_g && b == stats->key_b) {
          /* Color key cannot be used if an opaque pixel also has that RGB color. */
          stats->alpha = 1;
          stats->key = 0;
          alpha_done = 1;
        }
      }
    }
  } else /* < 16-bit */ {
    unsigned char r = 0, g = 0, b = 0, a = 0;
    unsigned char pr = 0, pg = 0, pb = 0, pa = 0;
    for(i = 0; i != numpixels; ++i) {
      getPixelColorRGBA8(&r, &g, &b, &a, in, i, mode_in);

      /*skip if color same as before, this speeds up large non-photographic
      images with many same colors by avoiding 'color_tree_has' below */
      if(i != 0 && r == pr && g == pg && b == pb && a == pa) continue;
      pr = r;
      pg = g;
      pb = b;
      pa = a;

      if(!bits_done && stats->bits < 8) {
        /*only r is checked, < 8 bits is only relevant for grayscale*/
        unsigned bits = getValueRequiredBits(r);
        if(bits > stats->bits) stats->bits = bits;
      }
      bits_done = (stats->bits >= bpp);

      if(!colored_done && (r != g || r != b)) {
        stats->colored = 1;
        colored_done = 1;
        if(stats->bits < 8) stats->bits = 8; /*PNG has no colored modes with less than 8-bit per channel*/
      }

      if(!alpha_done) {
        unsigned matchkey = (r == stats->key_r && g == stats->key_g && b == stats->key_b);
        if(a != 255 && (a != 0 || (stats->key && !matchkey))) {
          stats->alpha = 1;
          stats->key = 0;
          alpha_done = 1;
          if(stats->bits < 8) stats->bits = 8; /*PNG has no alphachannel modes with less than 8-bit per channel*/
        } else if(a == 0 && !stats->alpha && !stats->key) {
          stats->key = 1;
          stats->key_r = r;
          stats->key_g = g;
          stats->key_b = b;
        } else if(a == 255 && stats->key && matchkey) {
          /* Color key cannot be used if an opaque pixel also has that RGB color. */
          stats->alpha = 1;
          stats->key = 0;
          alpha_done = 1;
          if(stats->bits < 8) stats->bits = 8; /*PNG has no alphachannel modes with less than 8-bit per channel*/
        }
      }

      if(!numcolors_done) {
        if(!color_tree_has(&tree, r, g, b, a)) {
          error = color_tree_add(&tree, r, g, b, a, stats->numcolors);
          if(error) goto cleanup;
          if(stats->numcolors < 256) {
            unsigned char* p = stats->palette;
            unsigned n = stats->numcolors;
            p[n * 4 + 0] = r;
            p[n * 4 + 1] = g;
            p[n * 4 + 2] = b;
            p[n * 4 + 3] = a;
          }
          ++stats->numcolors;
          numcolors_done = stats->numcolors >= maxnumcolors;
        }
      }

      if(alpha_done && numcolors_done && colored_done && bits_done) break;
    }

    if(stats->key && !stats->alpha) {
      for(i = 0; i != numpixels; ++i) {
        getPixelColorRGBA8(&r, &g, &b, &a, in, i, mode_in);
        if(a != 0 && r == stats->key_r && g == stats->key_g && b == stats->key_b) {
          /* Color key cannot be used if an opaque pixel also has that RGB color. */
          stats->alpha = 1;
          stats->key = 0;
          alpha_done = 1;
          if(stats->bits < 8) stats->bits = 8; /*PNG has no alphachannel modes with less than 8-bit per channel*/
        }
      }
    }

    /*make the stats's key always 16-bit for consistency - repeat each byte twice*/
    stats->key_r += (stats->key_r << 8);
    stats->key_g += (stats->key_g << 8);
    stats->key_b += (stats->key_b << 8);
  }

cleanup:
  color_tree_cleanup(&tree);
  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %r8, %r14
movq %rsi, 0x48(%rsp)
movq %rdi, %r15
movl %edx, %eax
movl %ecx, %ecx
imulq %rax, %rcx
movq %rcx, 0x40(%rsp)
movl (%r8), %ebx
movq %r8, %rdi
callq 0x4b87
xorl $0x1, %eax
movl %eax, 0x10(%rsp)
movq %r14, 0x38(%rsp)
movq %r14, %rdi
callq 0x4b00
movl %eax, %r13d
movl 0x418(%r15), %ebp
movl %ebp, %eax
xorl $0x1, %eax
movl %r13d, %ecx
xorl $0x1, %ecx
orl %eax, %ecx
sete 0x28(%rsp)
movl $0x101, %r12d           # imm = 0x101
cmpl $0x8, %r13d
ja 0x6664
pushq $0x1
popq %r12
movl %r13d, %ecx
shll %cl, %r12d
addl 0x14(%r15), %r12d
movl $0x101, %eax            # imm = 0x101
cmpl %eax, %r12d
cmovael %eax, %r12d
testl $0xfffffffb, %ebx       # imm = 0xFFFFFFFB
sete %bl
movq 0x40(%rsp), %rax
addq %rax, 0x420(%r15)
cmpl $0x0, 0x428(%r15)
sete %r14b
leaq 0x70(%rsp), %rdi
callq 0x5f0d
cmpl $0x0, 0x10(%r15)
movl 0x10(%rsp), %eax
pushq $0x1
popq %rcx
cmovnel %ecx, %eax
movl %eax, 0x10(%rsp)
cmpl $0x0, (%r15)
movl %r13d, %eax
setne %r13b
cmpl $0x10, %ebp
sete %dl
movl %eax, 0x30(%rsp)
cmpl %eax, %ebp
setae %cl
movl 0x14(%r15), %eax
movl %r12d, 0x64(%rsp)
movq %rax, 0x58(%rsp)
cmpl %r12d, %eax
setae %al
orb %r14b, %dl
orb %al, %dl
movb %dl, 0x20(%rsp)
movq %r15, %rbp
jne 0x673b
movb %bl, 0x24(%rsp)
movl %ecx, %r12d
xorl %r14d, %r14d
leaq 0x70(%rsp), %r15
movq %rbp, %rcx
movl 0x14(%rcx), %eax
cmpq %rax, %r14
movq %rcx, %rbp
jae 0x672f
movzbl 0x18(%rbp,%r14,4), %esi
movzbl 0x19(%rbp,%r14,4), %edx
movzbl 0x1a(%rbp,%r14,4), %ecx
movzbl 0x1b(%rbp,%r14,4), %r8d
movq %r15, %rdi
movl %r14d, %r9d
callq 0x5f28
movq %rbp, %rcx
incq %r14
testl %eax, %eax
je 0x66f0
movl %eax, %ebp
jmp 0x6e80
movq %rax, 0x58(%rsp)
movl %r12d, %ecx
movb 0x24(%rsp), %bl
orb %bl, %r13b
movzbl %r13b, %eax
movl %eax, 0x24(%rsp)
movq 0x38(%rsp), %rax
cmpl $0x10, 0x4(%rax)
movq %rbp, 0x18(%rsp)
jne 0x6a00
movb %cl, 0x34(%rsp)
leaq 0xc(%rsp), %rbx
andw $0x0, (%rbx)
leaq 0xa(%rsp), %r15
andw $0x0, (%r15)
leaq 0x8(%rsp), %r12
andw $0x0, (%r12)
leaq 0xe(%rsp), %r13
andw $0x0, (%r13)
xorl %r14d, %r14d
cmpq %r14, 0x40(%rsp)
je 0x69fc
movq 0x38(%rsp), %rax
movq %rax, (%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movq 0x48(%rsp), %r8
movq %r14, %r9
callq 0x5fdf
movzwl 0xc(%rsp), %eax
movzbl %al, %ecx
shrl $0x8, %eax
cmpl %eax, %ecx
jne 0x67f6
movzwl 0xa(%rsp), %eax
movzbl %al, %ecx
shrl $0x8, %eax
cmpl %eax, %ecx
jne 0x67f6
movzwl 0x8(%rsp), %eax
movzbl %al, %ecx
shrl $0x8, %eax
cmpl %eax, %ecx
jne 0x67f6
movzwl 0xe(%rsp), %eax
movzbl %al, %ecx
shrl $0x8, %eax
incq %r14
cmpl %eax, %ecx
je 0x678a
movl $0x10, 0x418(%rbp)
leaq 0xc(%rsp), %rax
andw $0x0, (%rax)
leaq 0xa(%rsp), %rax
andw $0x0, (%rax)
leaq 0x8(%rsp), %rax
andw $0x0, (%rax)
leaq 0xe(%rsp), %r13
andw $0x0, (%r13)
xorl %r12d, %r12d
pushq $0x1
popq %rbx
movl 0x24(%rsp), %r14d
movl 0x10(%rsp), %r15d
cmpq %r12, 0x40(%rsp)
je 0x6952
movq 0x38(%rsp), %rax
movq %rax, (%rsp)
leaq 0xc(%rsp), %rdi
leaq 0xa(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r13, %rcx
movq 0x48(%rsp), %r8
movq %r12, %r9
callq 0x5fdf
movb $0x1, %cl
movb $0x1, %al
testl %r14d, %r14d
movl %ebx, %r14d
jne 0x689c
movzwl 0xc(%rsp), %edx
cmpw 0xa(%rsp), %dx
jne 0x6890
xorl %eax, %eax
movl $0x0, %r14d
cmpw 0x8(%rsp), %dx
je 0x689c
movl $0x1, (%rbp)
movb $0x1, %al
movl %ebx, %r14d
testl %r15d, %r15d
jne 0x6942
movzwl 0xc(%rsp), %edx
cmpw 0x8(%rbp), %dx
jne 0x68c9
movzwl 0xa(%rsp), %ecx
cmpw 0xa(%rbp), %cx
jne 0x68c9
movzwl 0x8(%rsp), %ecx
cmpw 0xc(%rbp), %cx
sete %cl
jmp 0x68cb
xorl %ecx, %ecx
movzwl 0xe(%rsp), %esi
cmpl $0xffff, %esi           # imm = 0xFFFF
je 0x691f
testl %esi, %esi
jne 0x6935
movl 0x4(%rbp), %esi
testl %esi, %esi
sete %dil
orb %cl, %dil
testb $0x1, %dil
je 0x6935
xorl %ecx, %ecx
orl 0x10(%rbp), %esi
movl $0x0, %r15d
jne 0x6945
movl $0x1, 0x4(%rbp)
movw %dx, 0x8(%rbp)
movzwl 0xa(%rsp), %ecx
movw %cx, 0xa(%rbp)
movzwl 0x8(%rsp), %ecx
movw %cx, 0xc(%rbp)
xorl %ecx, %ecx
xorl %r15d, %r15d
jmp 0x6945
cmpl $0x0, 0x4(%rbp)
setne %dl
andb %cl, %dl
xorl %ecx, %ecx
movl $0x0, %r15d
cmpb $0x1, %dl
jne 0x6945
movl $0x1, 0x10(%rbp)
andl $0x0, 0x4(%rbp)
movb $0x1, %cl
movl %ebx, %r15d
andb %cl, %al
incq %r12
cmpb $0x1, %al
jne 0x6836
cmpl $0x0, 0x4(%rbp)
je 0x6e7e
movq 0x18(%rsp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x6e7e
xorl %r14d, %r14d
leaq 0xc(%rsp), %r15
leaq 0xa(%rsp), %r12
leaq 0x8(%rsp), %r13
leaq 0xe(%rsp), %rbp
cmpq %r14, 0x40(%rsp)
je 0x6e7e
movq 0x38(%rsp), %rax
movq %rax, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
movq 0x48(%rsp), %r8
movq %r14, %r9
callq 0x5fdf
cmpw $0x0, 0xe(%rsp)
je 0x69f7
movzwl 0xc(%rsp), %eax
movq 0x18(%rsp), %rcx
cmpw 0x8(%rcx), %ax
jne 0x69f7
movzwl 0xa(%rsp), %eax
movq 0x18(%rsp), %rcx
cmpw 0xa(%rcx), %ax
jne 0x69f7
movzwl 0x8(%rsp), %eax
movq 0x18(%rsp), %rcx
cmpw 0xc(%rcx), %ax
jne 0x69f7
movq 0x18(%rsp), %rax
movl $0x1, 0x10(%rax)
andl $0x0, 0x4(%rax)
incq %r14
jmp 0x6982
movb 0x34(%rsp), %cl
orb 0x28(%rsp), %cl
movzbl %cl, %eax
movl %eax, 0x28(%rsp)
movzbl 0x20(%rsp), %eax
movl %eax, 0x20(%rsp)
xorl %ebx, %ebx
leaq 0xc(%rsp), %rax
movb %bl, (%rax)
leaq 0xa(%rsp), %rax
movb %bl, (%rax)
leaq 0x8(%rsp), %rax
movb %bl, (%rax)
leaq 0xe(%rsp), %rax
movb %bl, (%rax)
xorl %ebp, %ebp
xorl %r15d, %r15d
xorl %r13d, %r13d
xorl %r12d, %r12d
cmpq %r12, 0x40(%rsp)
je 0x6e46
movq 0x38(%rsp), %rax
movq %rax, (%rsp)
leaq 0xc(%rsp), %rdi
leaq 0xa(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0xe(%rsp), %rcx
movq 0x48(%rsp), %r8
movq %r12, %r9
callq 0x6157
testq %r12, %r12
setne %al
movb 0xc(%rsp), %r14b
movl %r14d, %ecx
xorb %bl, %cl
movb 0xa(%rsp), %r9b
movl %r9d, %edx
xorb %bpl, %dl
orb %cl, %dl
movb 0x8(%rsp), %r10b
movl %r10d, %ecx
xorb %r15b, %cl
orb %dl, %cl
movb 0xe(%rsp), %r11b
movl %r11d, %edx
xorb %r13b, %dl
orb %cl, %dl
sete %cl
testb %al, %cl
je 0x6ac1
movl %ebx, %r14d
movl %ebp, %r9d
movl %r15d, %r10d
movl %r13d, %r11d
jmp 0x6e32
cmpl $0x0, 0x28(%rsp)
sete %al
movq 0x18(%rsp), %rdx
movl 0x418(%rdx), %r15d
cmpl $0x8, %r15d
setb %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x6b3c
leal 0x1(%r14), %ecx
pushq $0x1
popq %r8
movl %r8d, %eax
cmpb $0x2, %cl
movl 0x24(%rsp), %esi
movl 0x30(%rsp), %ebx
jb 0x6b2c
movzbl %r14b, %ecx
movl %ecx, %eax
movq %rdx, %rdi
movb $0x11, %dl
divb %dl
movzbl %ah, %edx
pushq $0x8
popq %rax
testb %dl, %dl
movq %rdi, %rdx
jne 0x6b2c
movl %ecx, %eax
movb $0x55, %cl
divb %cl
movzbl %ah, %eax
xorl %ecx, %ecx
testb %al, %al
setne %cl
leal 0x2(,%rcx,2), %eax
cmpl %r15d, %eax
jbe 0x6b48
movl %eax, 0x418(%rdx)
movl %eax, %r15d
jmp 0x6b48
movl 0x24(%rsp), %esi
movl 0x30(%rsp), %ebx
pushq $0x1
popq %r8
movl $0x0, 0x28(%rsp)
cmpl %ebx, %r15d
setae %dil
movl %r15d, %eax
movb $0x1, %bl
testl %esi, %esi
movl %r8d, %esi
jne 0x6ba3
movl %r14d, %eax
xorb %r9b, %al
movl %r14d, %ecx
xorb %r10b, %cl
xorl %ebx, %ebx
orb %al, %cl
movl %r15d, %eax
movl $0x0, %esi
je 0x6ba3
movl $0x1, (%rdx)
movl %r15d, %eax
movb $0x1, %bl
movl %r8d, %esi
cmpl $0x7, %r15d
ja 0x6ba3
movl $0x8, 0x418(%rdx)
pushq $0x8
popq %rax
movb $0x1, %bl
movl %r8d, %esi
movl %eax, 0x2c(%rsp)
movzbl %r14b, %r13d
movzbl %r9b, %eax
movzbl %r10b, %r8d
movzbl %r11b, %ecx
movl %ecx, 0x34(%rsp)
cmpl $0x0, 0x10(%rsp)
movl %esi, 0x24(%rsp)
movl %r13d, 0x54(%rsp)
je 0x6be4
movb $0x1, %r13b
pushq $0x1
popq %rcx
movl %ecx, 0x10(%rsp)
movl %eax, %edx
movl %r8d, %ecx
leaq 0x70(%rsp), %rbp
jmp 0x6d16
cmpw %r13w, 0x8(%rdx)
jne 0x6bfb
cmpw %ax, 0xa(%rdx)
jne 0x6bfb
cmpw %r8w, 0xc(%rdx)
sete %cl
jmp 0x6bfd
xorl %ecx, %ecx
movl 0x34(%rsp), %edx
cmpl $0xff, %edx
je 0x6cad
testl %edx, %edx
jne 0x6c7b
movq 0x18(%rsp), %rdx
movl 0x4(%rdx), %edx
testl %edx, %edx
sete %sil
orb %cl, %sil
testb $0x1, %sil
je 0x6c7b
xorl %r13d, %r13d
movq 0x18(%rsp), %rcx
orl 0x10(%rcx), %edx
movl $0x0, 0x10(%rsp)
leaq 0x70(%rsp), %rbp
movl %eax, %edx
movl %r8d, %ecx
jne 0x6d16
movq 0x18(%rsp), %r8
movl $0x1, 0x4(%r8)
movl 0x54(%rsp), %eax
movw %ax, 0x8(%r8)
movw %dx, 0xa(%r8)
movw %cx, 0xc(%r8)
xorl %r13d, %r13d
movl $0x0, 0x10(%rsp)
jmp 0x6d16
movq 0x18(%rsp), %rcx
movl $0x1, 0x10(%rcx)
andl $0x0, 0x4(%rcx)
cmpl $0x7, 0x2c(%rsp)
ja 0x6d02
movl $0x8, 0x418(%rcx)
movb $0x1, %r13b
pushq $0x1
popq %rcx
movl %ecx, 0x10(%rsp)
leaq 0x70(%rsp), %rbp
jmp 0x6d11
movq 0x18(%rsp), %rdx
cmpl $0x0, 0x4(%rdx)
setne %dl
andb %cl, %dl
xorl %r13d, %r13d
movl $0x0, 0x10(%rsp)
cmpb $0x1, %dl
leaq 0x70(%rsp), %rbp
movl %eax, %edx
movl %r8d, %ecx
jne 0x6d16
movq 0x18(%rsp), %rax
movl $0x1, 0x10(%rax)
andl $0x0, 0x4(%rax)
cmpl $0x7, 0x2c(%rsp)
ja 0x6cf6
movl $0x8, 0x418(%rax)
movb $0x1, %r13b
pushq $0x1
popq %rax
movl %eax, 0x10(%rsp)
jmp 0x6d16
pushq $0x1
popq %rcx
movl %ecx, 0x10(%rsp)
leaq 0x70(%rsp), %rbp
movb $0x1, %r13b
movl %eax, %edx
movl %r8d, %ecx
cmpl $0x0, 0x20(%rsp)
je 0x6d2a
pushq $0x1
popq %r8
movl 0x30(%rsp), %ecx
jmp 0x6e0d
movl %r13d, 0x50(%rsp)
movb %dil, 0x17(%rsp)
movl %r15d, 0x2c(%rsp)
movb %r11b, 0x20(%rsp)
movb %r10b, 0x16(%rsp)
movb %r9b, 0x15(%rsp)
movq %rbp, %rdi
movl 0x54(%rsp), %r13d
movl %r13d, %esi
movq %rbp, %r15
movl %edx, 0x6c(%rsp)
movl %ecx, 0x68(%rsp)
movl 0x34(%rsp), %ebp
movl %ebp, %r8d
callq 0xcf1b
testl %eax, %eax
js 0x6d82
xorl %r8d, %r8d
movb 0x15(%rsp), %r9b
movb 0x16(%rsp), %r10b
movb 0x20(%rsp), %r11b
jmp 0x6dfa
movq %r15, %rdi
movl %r13d, %esi
movl 0x6c(%rsp), %edx
movl 0x68(%rsp), %ecx
movl %ebp, %r8d
movq 0x58(%rsp), %r9
callq 0x5f28
testl %eax, %eax
jne 0x6728
movq 0x18(%rsp), %rcx
movl 0x14(%rcx), %eax
cmpq $0xff, %rax
movb 0x15(%rsp), %r9b
movb 0x16(%rsp), %r10b
movb 0x20(%rsp), %r11b
ja 0x6de5
movq %rax, %rdx
leal (,%rax,4), %eax
movb %r14b, 0x18(%rcx,%rdx,4)
movb %r9b, 0x19(%rcx,%rax)
movb %r10b, 0x1a(%rcx,%rax)
movb %r11b, 0x1b(%rcx,%rax)
movq %rdx, %rax
incl %eax
movl %eax, 0x14(%rcx)
xorl %r8d, %r8d
movq %rax, 0x58(%rsp)
cmpl 0x64(%rsp), %eax
setae %r8b
movl 0x2c(%rsp), %r15d
movl 0x30(%rsp), %ecx
movb 0x17(%rsp), %dil
movl 0x50(%rsp), %r13d
movl 0x28(%rsp), %eax
movb %dil, %al
movl %eax, 0x28(%rsp)
movl %r8d, 0x20(%rsp)
testl %r8d, %r8d
setne %al
andb %r13b, %bl
andb %al, %bl
cmpb $0x1, %bl
jne 0x6e32
cmpl %ecx, %r15d
jae 0x6e46
incq %r12
movl %r14d, %ebx
movl %r9d, %ebp
movl %r10d, %r15d
movl %r11d, %r13d
jmp 0x6a3d
movq 0x18(%rsp), %rax
cmpl $0x0, 0x4(%rax)
je 0x6e5c
movq 0x18(%rsp), %rax
cmpl $0x0, 0x10(%rax)
je 0x6e9e
movq 0x18(%rsp), %rcx
movq 0x8(%rcx), %xmm0
pmullw 0x551c2(%rip), %xmm0    # 0x5c030
movd %xmm0, 0x8(%rcx)
imull $0x101, 0xc(%rcx), %eax # imm = 0x101
movw %ax, 0xc(%rcx)
xorl %ebp, %ebp
leaq 0x70(%rsp), %rdi
callq 0x63ff
movl %ebp, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
leaq 0xc(%rsp), %r15
leaq 0xa(%rsp), %r12
leaq 0x8(%rsp), %r13
leaq 0xe(%rsp), %rbp
cmpq %r14, 0x40(%rsp)
je 0x6e5c
movq 0x38(%rsp), %rax
movq %rax, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
movq 0x48(%rsp), %r8
movq %r14, %r9
callq 0x6157
cmpb $0x0, 0xe(%rsp)
je 0x6f3d
movzbl 0xc(%rsp), %eax
movq 0x18(%rsp), %rcx
cmpw %ax, 0x8(%rcx)
jne 0x6f3d
movzbl 0xa(%rsp), %eax
movq 0x18(%rsp), %rcx
cmpw %ax, 0xa(%rcx)
jne 0x6f3d
movzbl 0x8(%rsp), %eax
movq 0x18(%rsp), %rcx
cmpw %ax, 0xc(%rcx)
jne 0x6f3d
movq 0x18(%rsp), %rax
movl $0x1, 0x10(%rax)
andl $0x0, 0x4(%rax)
cmpl $0x7, 0x418(%rax)
ja 0x6f3d
movq 0x18(%rsp), %rax
movl $0x8, 0x418(%rax)
incq %r14
jmp 0x6eb5