// File: /workspace/github_cpp_makefile_star2_O3/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 $0x108, %rsp            # imm = 0x108
movq %r8, %r15
movq %rsi, 0x48(%rsp)
movq %rdi, %rbx
movl %edx, %eax
movl %ecx, %ecx
imulq %rax, %rcx
movq %rcx, 0x20(%rsp)
movl (%r8), %r14d
movq %r8, %rdi
callq 0x5abd
movl %eax, %ebp
xorl $0x1, %ebp
movq %r15, 0x40(%rsp)
movl 0x4(%r15), %r13d
movl %r14d, %edi
callq 0x5a40
imull %r13d, %eax
movl 0x418(%rbx), %esi
movl %esi, %ecx
xorl $0x1, %ecx
movl %eax, %edx
xorl $0x1, %edx
orl %ecx, %edx
sete %r12b
movl 0x14(%rbx), %r8d
movl $0x101, %edi            # imm = 0x101
cmpl $0x8, %eax
ja 0x7885
movl $0x1, %edi
movl %eax, %ecx
shll %cl, %edi
addl %r8d, %edi
movl $0x101, %ecx            # imm = 0x101
cmpl %ecx, %edi
cmovael %ecx, %edi
testl $0xfffffffb, %r14d      # imm = 0xFFFFFFFB
sete %r10b
movq 0x20(%rsp), %rcx
addq %rcx, 0x420(%rbx)
cmpl $0x0, 0x428(%rbx)
sete %cl
pxor %xmm0, %xmm0
movdqa %xmm0, 0xf0(%rsp)
movdqa %xmm0, 0xe0(%rsp)
movdqa %xmm0, 0xd0(%rsp)
movdqa %xmm0, 0xc0(%rsp)
movdqa %xmm0, 0xb0(%rsp)
movdqa %xmm0, 0xa0(%rsp)
movdqa %xmm0, 0x90(%rsp)
movdqa %xmm0, 0x80(%rsp)
movl $0xffffffff, 0x100(%rsp) # imm = 0xFFFFFFFF
cmpl $0x0, 0x10(%rbx)
movl $0x1, %r15d
cmovel %ebp, %r15d
movq %rbx, 0x30(%rsp)
cmpl $0x0, (%rbx)
setne %bl
cmpl $0x10, %esi
sete %r9b
cmpl %eax, %esi
setae %sil
cmpl %edi, %r8d
setae %dl
orb %cl, %r9b
orb %dl, %r9b
movl %eax, 0x2c(%rsp)
movl %edi, 0x6c(%rsp)
je 0x7943
movq %r8, 0x58(%rsp)
jmp 0x79d5
testl %r8d, %r8d
je 0x79cc
movb %r10b, 0x1c(%rsp)
movb %sil, 0x9(%rsp)
movb %r9b, 0x14(%rsp)
movb %r12b, 0x18(%rsp)
xorl %r14d, %r14d
leaq 0x80(%rsp), %r13
movq 0x30(%rsp), %r12
movzbl 0x18(%r12,%r14,4), %esi
movzbl 0x19(%r12,%r14,4), %edx
movzbl 0x1a(%r12,%r14,4), %ecx
movzbl 0x1b(%r12,%r14,4), %r8d
movq %r13, %rdi
movl %r14d, %r9d
callq 0x6a1a
testl %eax, %eax
jne 0x820e
incq %r14
movl 0x14(%r12), %eax
cmpq %rax, %r14
jb 0x7970
movq %rax, 0x58(%rsp)
movq 0x40(%rsp), %rax
movl 0x4(%rax), %r13d
movb 0x18(%rsp), %r12b
movb 0x14(%rsp), %r9b
movb 0x9(%rsp), %sil
movb 0x1c(%rsp), %r10b
jmp 0x79d5
movq $0x0, 0x58(%rsp)
orb %r10b, %bl
movzbl %bl, %eax
movl %eax, 0x1c(%rsp)
cmpl $0x10, %r13d
jne 0x7aad
movb %sil, 0x9(%rsp)
movb %r9b, 0x14(%rsp)
xorl %eax, %eax
movw %ax, 0xe(%rsp)
movw %ax, 0xa(%rsp)
movw %ax, 0xc(%rsp)
movw %ax, 0x10(%rsp)
cmpq $0x0, 0x20(%rsp)
movq 0x30(%rsp), %rbx
je 0x7aa3
xorl %r14d, %r14d
leaq 0xc(%rsp), %rbp
leaq 0x10(%rsp), %r13
movq 0x40(%rsp), %rax
movq %rax, (%rsp)
leaq 0xe(%rsp), %rdi
leaq 0xa(%rsp), %rsi
movq %rbp, %rdx
movq %r13, %rcx
movq 0x48(%rsp), %r8
movq %r14, %r9
callq 0x6aec
movzwl 0xe(%rsp), %eax
movzbl %al, %ecx
shrl $0x8, %eax
cmpl %eax, %ecx
jne 0x802b
movzwl 0xa(%rsp), %eax
movzbl %al, %ecx
shrl $0x8, %eax
cmpl %eax, %ecx
jne 0x802b
movzwl 0xc(%rsp), %eax
movzbl %al, %ecx
shrl $0x8, %eax
cmpl %eax, %ecx
jne 0x802b
movzwl 0x10(%rsp), %eax
movzbl %al, %ecx
shrl $0x8, %eax
cmpl %eax, %ecx
jne 0x802b
incq %r14
cmpq %r14, 0x20(%rsp)
jne 0x7a27
movb 0x14(%rsp), %r9b
movb 0x9(%rsp), %sil
xorl %eax, %eax
movb %al, 0xe(%rsp)
movb %al, 0xa(%rsp)
movb %al, 0xc(%rsp)
movb %al, 0x10(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x7f30
orb %r12b, %sil
movzbl %sil, %eax
movl %eax, 0x54(%rsp)
movzbl %r9b, %ecx
xorl %r13d, %r13d
xorl %r14d, %r14d
xorl %ebx, %ebx
xorl %r12d, %r12d
xorl %ebp, %ebp
movl %ecx, 0x14(%rsp)
movq 0x40(%rsp), %rax
movq %rax, (%rsp)
leaq 0xe(%rsp), %rdi
leaq 0xa(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq 0x48(%rsp), %r8
movq %r13, %r9
callq 0x7348
testq %r13, %r13
setne %al
movb 0xe(%rsp), %r11b
movl %r11d, %ecx
xorb %bpl, %cl
movb 0xa(%rsp), %dil
movl %edi, %edx
xorb %r12b, %dl
orb %cl, %dl
movb 0xc(%rsp), %sil
movl %esi, %ecx
xorb %bl, %cl
orb %dl, %cl
movb 0x10(%rsp), %dl
movb %dl, 0x9(%rsp)
xorb %r14b, %dl
orb %cl, %dl
sete %cl
testb %al, %cl
je 0x7b65
movl 0x14(%rsp), %ecx
movl %ebp, %r11d
movl %r12d, %edi
movl %ebx, %esi
movl %r14d, %ebp
jmp 0x7d53
movzbl %r11b, %r10d
cmpl $0x0, 0x54(%rsp)
sete %al
movq 0x30(%rsp), %r8
movl 0x418(%r8), %r14d
cmpl $0x8, %r14d
setb %cl
andb %al, %cl
cmpb $0x1, %cl
movl 0x1c(%rsp), %edx
movq %r10, 0x60(%rsp)
jne 0x7bee
leal 0x1(%r11), %ecx
movl $0x1, %eax
cmpb $0x2, %cl
movl 0x2c(%rsp), %r9d
leaq 0x80(%rsp), %rbx
movb 0x9(%rsp), %bpl
jb 0x7bdd
movl %r10d, %eax
shll $0x4, %eax
movl %r10d, %ecx
subl %eax, %ecx
movl $0x8, %eax
cmpb $0xf, %cl
ja 0x7bdd
leal (%r10,%r10,2), %eax
negl %eax
xorl %ecx, %ecx
cmpb $0x4, %al
setae %cl
leal 0x2(,%rcx,2), %eax
cmpl %r14d, %eax
jbe 0x7c00
movl %eax, 0x418(%r8)
movl %eax, %r14d
jmp 0x7c00
movl 0x2c(%rsp), %r9d
leaq 0x80(%rsp), %rbx
movb 0x9(%rsp), %bpl
cmpl %r9d, %r14d
setae %al
movl %r14d, %ecx
movb $0x1, %r10b
movl %r10d, 0x18(%rsp)
testl %edx, %edx
movl $0x1, %r10d
jne 0x7c6e
movl %r11d, %ecx
xorb %dil, %cl
movl %r11d, %edx
xorb %sil, %dl
movl $0x0, 0x18(%rsp)
orb %cl, %dl
movl %r14d, %ecx
movl $0x0, %r10d
je 0x7c6e
movl $0x1, (%r8)
movl %r14d, %ecx
movb $0x1, %dl
movl %edx, 0x18(%rsp)
movl $0x1, %r10d
cmpl $0x7, %r14d
ja 0x7c6e
movl $0x8, 0x418(%r8)
movl $0x8, %ecx
movb $0x1, %dl
movl %edx, 0x18(%rsp)
movzbl %dil, %edx
movl %edx, 0x3c(%rsp)
movzbl %sil, %r12d
movzbl %bpl, %r9d
testl %r15d, %r15d
je 0x7cc9
movb $0x1, %dl
movl $0x1, %r15d
xorl %ecx, %ecx
movb %al, %cl
movl %ecx, %eax
movl $0x1, %ecx
cmpl $0x0, 0x14(%rsp)
movl %r10d, 0x1c(%rsp)
movl %eax, 0x54(%rsp)
je 0x7cf8
movl 0x2c(%rsp), %r8d
andb %cl, %dl
movl 0x18(%rsp), %eax
andb %dl, %al
cmpb $0x1, %al
jne 0x7d53
cmpl %r8d, %r14d
jb 0x7d53
jmp 0x7f30
movq 0x60(%rsp), %rdx
cmpw %dx, 0x8(%r8)
jne 0x7d71
movl 0x3c(%rsp), %edx
cmpw %dx, 0xa(%r8)
jne 0x7d71
movl %r12d, %edx
movl %r14d, %ebx
cmpw %dx, 0xc(%r8)
sete %dl
jmp 0x7d76
movl %edx, 0x70(%rsp)
movl %r15d, 0x14(%rsp)
movl %r14d, 0x74(%rsp)
movb %sil, 0x13(%rsp)
movb %dil, 0x12(%rsp)
movq %r11, 0x78(%rsp)
movq %rbx, %rdi
movq 0x60(%rsp), %rbx
movl %ebx, %esi
movl 0x3c(%rsp), %r15d
movl %r15d, %edx
movl %r12d, %ecx
movl %r9d, %r14d
movl %r9d, %r8d
callq 0xeca2
xorl %ecx, %ecx
testl %eax, %eax
js 0x7e30
movq 0x78(%rsp), %r11
movb 0x12(%rsp), %dil
movb 0x13(%rsp), %sil
movl 0x14(%rsp), %r15d
incq %r13
movl %ebp, %r14d
movl %esi, %ebx
movl %edi, %r12d
movl %r11d, %ebp
cmpq %r13, 0x20(%rsp)
jne 0x7ae7
jmp 0x7f30
movl %r14d, %ebx
xorl %edx, %edx
movl %esi, %r14d
cmpl $0xff, %r9d
je 0x7ec0
testl %r9d, %r9d
jne 0x7df1
movl 0x4(%r8), %esi
testl %esi, %esi
movl %edi, %ebp
sete %dil
orb %dl, %dil
testb $0x1, %dil
movl %ebp, %edi
movb 0x9(%rsp), %bpl
je 0x7df1
xorl %edx, %edx
orl 0x10(%r8), %esi
movl $0x0, %r15d
movl %r14d, %esi
movl %ebx, %r14d
leaq 0x80(%rsp), %rbx
jne 0x7c8b
movl $0x1, 0x4(%r8)
movq 0x60(%rsp), %rcx
movw %cx, 0x8(%r8)
movl 0x3c(%rsp), %ecx
movw %cx, 0xa(%r8)
movw %r12w, 0xc(%r8)
xorl %edx, %edx
xorl %r15d, %r15d
jmp 0x7c8b
movl $0x1, 0x10(%r8)
movl $0x0, 0x4(%r8)
cmpl $0x7, %ecx
ja 0x7f15
movl $0x8, 0x418(%r8)
movb $0x1, %dl
movl $0x1, %r15d
movl %r14d, %esi
movl %ebx, %r14d
leaq 0x80(%rsp), %rbx
jmp 0x7c8b
leaq 0x80(%rsp), %rdi
movl %ebx, %esi
movl %r15d, %edx
movl %r12d, %ecx
movl %r14d, %r8d
movq 0x58(%rsp), %r9
callq 0x6a1a
testl %eax, %eax
jne 0x820e
movq 0x30(%rsp), %rcx
movl 0x14(%rcx), %edx
cmpq $0xff, %rdx
movq 0x78(%rsp), %r11
movb 0x12(%rsp), %dil
movb 0x13(%rsp), %sil
movb 0x9(%rsp), %bpl
ja 0x7e95
leal (,%rdx,4), %eax
movb %r11b, 0x18(%rcx,%rdx,4)
movb %dil, 0x19(%rcx,%rax)
movb %sil, 0x1a(%rcx,%rax)
movb %bpl, 0x1b(%rcx,%rax)
incl %edx
movl %edx, 0x14(%rcx)
xorl %ecx, %ecx
movq %rdx, 0x58(%rsp)
cmpl 0x6c(%rsp), %edx
setae %cl
movl 0x2c(%rsp), %r8d
movl 0x74(%rsp), %r14d
movl 0x14(%rsp), %r15d
movl 0x70(%rsp), %edx
jmp 0x7cab
cmpl $0x0, 0x4(%r8)
setne %sil
andb %dl, %sil
xorl %edx, %edx
movl $0x0, %r15d
cmpb $0x1, %sil
movl %r14d, %esi
movl %ebx, %r14d
leaq 0x80(%rsp), %rbx
jne 0x7c8b
movl $0x1, 0x10(%r8)
movl $0x0, 0x4(%r8)
cmpl $0x7, %ecx
ja 0x7c83
movl $0x8, 0x418(%r8)
jmp 0x7c83
movl %r14d, %esi
movl %ebx, %r14d
movl $0x1, %r15d
leaq 0x80(%rsp), %rbx
movb $0x1, %dl
jmp 0x7c8b
movq 0x30(%rsp), %rbx
cmpl $0x0, 0x4(%rbx)
je 0x7fe3
cmpq $0x0, 0x20(%rsp)
sete %al
cmpl $0x0, 0x10(%rbx)
setne %cl
orb %al, %cl
jne 0x7fe3
xorl %r14d, %r14d
leaq 0xe(%rsp), %r15
leaq 0xa(%rsp), %r12
leaq 0xc(%rsp), %r13
leaq 0x10(%rsp), %rbp
movq 0x40(%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 0x7348
cmpb $0x0, 0x10(%rsp)
je 0x7fd9
movzbl 0xe(%rsp), %eax
cmpw %ax, 0x8(%rbx)
jne 0x7fd9
movzbl 0xa(%rsp), %eax
cmpw %ax, 0xa(%rbx)
jne 0x7fd9
movzbl 0xc(%rsp), %eax
cmpw %ax, 0xc(%rbx)
jne 0x7fd9
movl $0x1, 0x10(%rbx)
movl $0x0, 0x4(%rbx)
cmpl $0x7, 0x418(%rbx)
ja 0x7fd9
movl $0x8, 0x418(%rbx)
incq %r14
cmpq %r14, 0x20(%rsp)
jne 0x7f6e
movq 0x8(%rbx), %xmm0
movdqa %xmm0, %xmm1
psllw $0x8, %xmm1
paddw %xmm0, %xmm1
movd %xmm1, 0x8(%rbx)
movl 0xc(%rbx), %eax
movl %eax, %ecx
shll $0x8, %ecx
addl %eax, %ecx
movw %cx, 0xc(%rbx)
xorl %ebp, %ebp
leaq 0x80(%rsp), %rdi
callq 0x761a
movl %ebp, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, 0x418(%rbx)
xorl %r12d, %r12d
leaq 0xe(%rsp), %r14
movw %r12w, (%r14)
leaq 0xa(%rsp), %rax
movw %r12w, (%rax)
leaq 0xc(%rsp), %r13
movw %r12w, (%r13)
leaq 0x10(%rsp), %rbp
movw %r12w, (%rbp)
movl 0x1c(%rsp), %r8d
movl %r8d, %ebx
movq 0x40(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %rdi
leaq 0xa(%rsp), %rsi
movq %r13, %rdx
movq %rbp, %rcx
movq 0x48(%rsp), %r8
movq %r12, %r9
callq 0x6aec
movl $0x1, %r8d
movb $0x1, %al
testl %ebx, %ebx
je 0x809d
movq 0x30(%rsp), %rbx
jmp 0x80cb
movzwl 0xe(%rsp), %ecx
cmpw 0xa(%rsp), %cx
movq 0x30(%rsp), %rbx
jne 0x80bd
xorl %eax, %eax
movl $0x0, %r8d
cmpw 0xc(%rsp), %cx
je 0x80cb
movl $0x1, (%rbx)
movb $0x1, %al
movl $0x1, %r8d
testl %r15d, %r15d
jne 0x8163
movzwl 0xe(%rsp), %ecx
cmpw 0x8(%rbx), %cx
jne 0x80f8
movzwl 0xa(%rsp), %edx
cmpw 0xa(%rbx), %dx
jne 0x80f8
movzwl 0xc(%rsp), %edx
cmpw 0xc(%rbx), %dx
sete %dl
jmp 0x80fa
xorl %edx, %edx
movzwl 0x10(%rsp), %esi
cmpl $0xffff, %esi           # imm = 0xFFFF
je 0x8144
testl %esi, %esi
jne 0x8155
movl 0x4(%rbx), %esi
testl %esi, %esi
sete %dil
orb %dl, %dil
testb $0x1, %dil
je 0x8155
xorl %r15d, %r15d
orl 0x10(%rbx), %esi
jne 0x816d
movl $0x1, 0x4(%rbx)
movw %cx, 0x8(%rbx)
movzwl 0xa(%rsp), %eax
movw %ax, 0xa(%rbx)
movzwl 0xc(%rsp), %eax
movw %ax, 0xc(%rbx)
jmp 0x816d
cmpl $0x0, 0x4(%rbx)
setne %cl
andb %dl, %cl
xorl %r15d, %r15d
cmpb $0x1, %cl
jne 0x816d
movl $0x1, 0x10(%rbx)
movl $0x0, 0x4(%rbx)
movl $0x1, %r15d
testb %al, %al
jne 0x817b
incq %r12
cmpq %r12, 0x20(%rsp)
jne 0x8063
cmpl $0x0, 0x4(%rbx)
je 0x8008
cmpl $0x0, 0x10(%rbx)
jne 0x8008
xorl %r14d, %r14d
leaq 0xe(%rsp), %r15
leaq 0xa(%rsp), %r12
leaq 0xc(%rsp), %r13
leaq 0x10(%rsp), %rbp
movq 0x40(%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 0x6aec
cmpw $0x0, 0x10(%rsp)
je 0x81ff
movzwl 0xe(%rsp), %eax
cmpw 0x8(%rbx), %ax
jne 0x81ff
movzwl 0xa(%rsp), %eax
cmpw 0xa(%rbx), %ax
jne 0x81ff
movzwl 0xc(%rsp), %eax
cmpw 0xc(%rbx), %ax
jne 0x81ff
movl $0x1, 0x10(%rbx)
movl $0x0, 0x4(%rbx)
incq %r14
cmpq %r14, 0x20(%rsp)
jne 0x81a6
jmp 0x8008
movl %eax, %ebp
jmp 0x800a