// File: /workspace/github_c_makefile_star2_O0/Joy-Division[P]tools-mgs/lodepng/lodepng.c
// Function: lodepng_get_color_profile
unsigned lodepng_get_color_profile(LodePNGColorProfile* profile,
                                   const unsigned char* in, unsigned w, unsigned h,
                                   const LodePNGColorMode* mode)
{
  unsigned error = 0;
  size_t i;
  ColorTree tree;
  size_t numpixels = w * h;

  unsigned colored_done = lodepng_is_greyscale_type(mode) ? 1 : 0;
  unsigned alpha_done = lodepng_can_have_alpha(mode) ? 0 : 1;
  unsigned numcolors_done = 0;
  unsigned bpp = lodepng_get_bpp(mode);
  unsigned bits_done = bpp == 1 ? 1 : 0;
  unsigned maxnumcolors = 257;
  unsigned sixteen = 0;
  if(bpp <= 8) maxnumcolors = bpp == 1 ? 2 : (bpp == 2 ? 4 : (bpp == 4 ? 16 : 256));

  color_tree_init(&tree);

  /*Check if the 16-bit input is truly 16-bit*/
  if(mode->bitdepth == 16)
  {
    unsigned short r, g, b, a;
    for(i = 0; i != numpixels; ++i)
    {
      getPixelColorRGBA16(&r, &g, &b, &a, in, i, mode);
      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*/
      {
        sixteen = 1;
        break;
      }
    }
  }

  if(sixteen)
  {
    unsigned short r = 0, g = 0, b = 0, a = 0;
    profile->bits = 16;
    bits_done = numcolors_done = 1; /*counting colors no longer useful, palette doesn't support 16-bit*/

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

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

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

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

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

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

      if(!alpha_done)
      {
        unsigned matchkey = (r == profile->key_r && g == profile->key_g && b == profile->key_b);
        if(a != 255 && (a != 0 || (profile->key && !matchkey)))
        {
          profile->alpha = 1;
          profile->key = 0;
          alpha_done = 1;
          if(profile->bits < 8) profile->bits = 8; /*PNG has no alphachannel modes with less than 8-bit per channel*/
        }
        else if(a == 0 && !profile->alpha && !profile->key)
        {
          profile->key = 1;
          profile->key_r = r;
          profile->key_g = g;
          profile->key_b = b;
        }
        else if(a == 255 && profile->key && matchkey)
        {
          /* Color key cannot be used if an opaque pixel also has that RGB color. */
          profile->alpha = 1;
          profile->key = 0;
          alpha_done = 1;
          if(profile->bits < 8) profile->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))
        {
          color_tree_add(&tree, r, g, b, a, profile->numcolors);
          if(profile->numcolors < 256)
          {
            unsigned char* p = profile->palette;
            unsigned n = profile->numcolors;
            p[n * 4 + 0] = r;
            p[n * 4 + 1] = g;
            p[n * 4 + 2] = b;
            p[n * 4 + 3] = a;
          }
          ++profile->numcolors;
          numcolors_done = profile->numcolors >= maxnumcolors;
        }
      }

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

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

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

  color_tree_cleanup(&tree);
  return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x14(%rbp), %eax
imull -0x18(%rbp), %eax
movl %eax, %eax
movq %rax, -0xc0(%rbp)
movq -0x20(%rbp), %rdi
callq 0x31c0
movl %eax, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0xc4(%rbp)
movq -0x20(%rbp), %rdi
callq 0x3290
movl %eax, %edx
movl $0x1, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0xc8(%rbp)
movl $0x0, -0xcc(%rbp)
movq -0x20(%rbp), %rdi
callq 0x30e0
movl %eax, -0xd0(%rbp)
movl -0xd0(%rbp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x1, %edx
cmovel %ecx, %eax
movl %eax, -0xd4(%rbp)
movl $0x101, -0xd8(%rbp)     # imm = 0x101
movl $0x0, -0xdc(%rbp)
cmpl $0x8, -0xd0(%rbp)
ja 0x5f9f
cmpl $0x1, -0xd0(%rbp)
jne 0x5f55
movl $0x2, %eax
movl %eax, -0x110(%rbp)
jmp 0x5f93
cmpl $0x2, -0xd0(%rbp)
jne 0x5f6b
movl $0x4, %eax
movl %eax, -0x114(%rbp)
jmp 0x5f87
movl -0xd0(%rbp), %edx
movl $0x100, %eax            # imm = 0x100
movl $0x10, %ecx
cmpl $0x4, %edx
cmovel %ecx, %eax
movl %eax, -0x114(%rbp)
movl -0x114(%rbp), %eax
movl %eax, -0x110(%rbp)
movl -0x110(%rbp), %eax
movl %eax, -0xd8(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x44e0
movq -0x20(%rbp), %rax
cmpl $0x10, 0x4(%rax)
jne 0x60a4
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0xc0(%rbp), %rax
je 0x60a2
movq -0x10(%rbp), %r8
movq -0x30(%rbp), %r9
movq -0x20(%rbp), %rax
leaq -0xde(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
leaq -0xe2(%rbp), %rdx
leaq -0xe4(%rbp), %rcx
movq %rax, (%rsp)
callq 0x4610
movzwl -0xde(%rbp), %eax
andl $0xff, %eax
movzwl -0xde(%rbp), %ecx
sarl $0x8, %ecx
andl $0xff, %ecx
cmpl %ecx, %eax
jne 0x6083
movzwl -0xe0(%rbp), %eax
andl $0xff, %eax
movzwl -0xe0(%rbp), %ecx
sarl $0x8, %ecx
andl $0xff, %ecx
cmpl %ecx, %eax
jne 0x6083
movzwl -0xe2(%rbp), %eax
andl $0xff, %eax
movzwl -0xe2(%rbp), %ecx
sarl $0x8, %ecx
andl $0xff, %ecx
cmpl %ecx, %eax
jne 0x6083
movzwl -0xe4(%rbp), %eax
andl $0xff, %eax
movzwl -0xe4(%rbp), %ecx
sarl $0x8, %ecx
andl $0xff, %ecx
cmpl %ecx, %eax
je 0x608f
movl $0x1, -0xdc(%rbp)
jmp 0x60a2
jmp 0x6091
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x5fc1
jmp 0x60a4
cmpl $0x0, -0xdc(%rbp)
je 0x6401
movw $0x0, -0xe6(%rbp)
movw $0x0, -0xe8(%rbp)
movw $0x0, -0xea(%rbp)
movw $0x0, -0xec(%rbp)
movq -0x8(%rbp), %rax
movl $0x10, 0x418(%rax)
movl $0x1, -0xcc(%rbp)
movl $0x1, -0xd4(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0xc0(%rbp), %rax
je 0x631c
movq -0x10(%rbp), %r8
movq -0x30(%rbp), %r9
movq -0x20(%rbp), %rax
leaq -0xe6(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
leaq -0xea(%rbp), %rdx
leaq -0xec(%rbp), %rcx
movq %rax, (%rsp)
callq 0x4610
cmpl $0x0, -0xc4(%rbp)
jne 0x6182
movzwl -0xe6(%rbp), %eax
movzwl -0xe8(%rbp), %ecx
cmpl %ecx, %eax
jne 0x616e
movzwl -0xe6(%rbp), %eax
movzwl -0xea(%rbp), %ecx
cmpl %ecx, %eax
je 0x6182
movq -0x8(%rbp), %rax
movl $0x1, (%rax)
movl $0x1, -0xc4(%rbp)
cmpl $0x0, -0xc8(%rbp)
jne 0x62e3
movzwl -0xe6(%rbp), %ecx
movq -0x8(%rbp), %rax
movzwl 0x8(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x115(%rbp)
jne 0x61df
movzwl -0xe8(%rbp), %ecx
movq -0x8(%rbp), %rax
movzwl 0xa(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x115(%rbp)
jne 0x61df
movzwl -0xea(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl 0xc(%rcx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x115(%rbp)
movb -0x115(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0xf0(%rbp)
movzwl -0xec(%rbp), %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x6242
movzwl -0xec(%rbp), %eax
cmpl $0x0, %eax
jne 0x621d
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x6242
cmpl $0x0, -0xf0(%rbp)
jne 0x6242
movq -0x8(%rbp), %rax
movl $0x1, 0x10(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x4(%rax)
movl $0x1, -0xc8(%rbp)
jmp 0x62e1
movzwl -0xec(%rbp), %eax
cmpl $0x0, %eax
jne 0x629c
movq -0x8(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x629c
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0x629c
movq -0x8(%rbp), %rax
movl $0x1, 0x4(%rax)
movw -0xe6(%rbp), %cx
movq -0x8(%rbp), %rax
movw %cx, 0x8(%rax)
movw -0xe8(%rbp), %cx
movq -0x8(%rbp), %rax
movw %cx, 0xa(%rax)
movw -0xea(%rbp), %cx
movq -0x8(%rbp), %rax
movw %cx, 0xc(%rax)
jmp 0x62df
movzwl -0xec(%rbp), %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x62dd
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x62dd
cmpl $0x0, -0xf0(%rbp)
je 0x62dd
movq -0x8(%rbp), %rax
movl $0x1, 0x10(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x4(%rax)
movl $0x1, -0xc8(%rbp)
jmp 0x62df
jmp 0x62e1
jmp 0x62e3
cmpl $0x0, -0xc8(%rbp)
je 0x6309
cmpl $0x0, -0xcc(%rbp)
je 0x6309
cmpl $0x0, -0xc4(%rbp)
je 0x6309
cmpl $0x0, -0xd4(%rbp)
je 0x6309
jmp 0x631c
jmp 0x630b
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x60ff
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x63fc
movq -0x8(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x63fc
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0xc0(%rbp), %rax
je 0x63fa
movq -0x10(%rbp), %r8
movq -0x30(%rbp), %r9
movq -0x20(%rbp), %rax
leaq -0xe6(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
leaq -0xea(%rbp), %rdx
leaq -0xec(%rbp), %rcx
movq %rax, (%rsp)
callq 0x4610
movzwl -0xec(%rbp), %eax
cmpl $0x0, %eax
je 0x63e7
movzwl -0xe6(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl 0x8(%rcx), %ecx
cmpl %ecx, %eax
jne 0x63e7
movzwl -0xe8(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl 0xa(%rcx), %ecx
cmpl %ecx, %eax
jne 0x63e7
movzwl -0xea(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl 0xc(%rcx), %ecx
cmpl %ecx, %eax
jne 0x63e7
movq -0x8(%rbp), %rax
movl $0x1, 0x10(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x4(%rax)
movl $0x1, -0xc8(%rbp)
jmp 0x63e9
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x6340
jmp 0x63fc
jmp 0x69a1
movb $0x0, -0xf1(%rbp)
movb $0x0, -0xf2(%rbp)
movb $0x0, -0xf3(%rbp)
movb $0x0, -0xf4(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0xc0(%rbp), %rax
je 0x6859
movq -0x10(%rbp), %r8
movq -0x30(%rbp), %r9
movq -0x20(%rbp), %rax
leaq -0xf1(%rbp), %rdi
leaq -0xf2(%rbp), %rsi
leaq -0xf3(%rbp), %rdx
leaq -0xf4(%rbp), %rcx
movq %rax, (%rsp)
callq 0x5490
cmpl $0x0, -0xd4(%rbp)
jne 0x64b3
movq -0x8(%rbp), %rax
cmpl $0x8, 0x418(%rax)
jae 0x64b3
movzbl -0xf1(%rbp), %edi
callq 0x69c0
movl %eax, -0xf8(%rbp)
movl -0xf8(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x418(%rcx), %eax
jbe 0x64b1
movl -0xf8(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x418(%rax)
jmp 0x64b3
movq -0x8(%rbp), %rax
movl 0x418(%rax), %eax
cmpl -0xd0(%rbp), %eax
setae %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0xd4(%rbp)
cmpl $0x0, -0xc4(%rbp)
jne 0x652f
movzbl -0xf1(%rbp), %eax
movzbl -0xf2(%rbp), %ecx
cmpl %ecx, %eax
jne 0x64fe
movzbl -0xf1(%rbp), %eax
movzbl -0xf3(%rbp), %ecx
cmpl %ecx, %eax
je 0x652f
movq -0x8(%rbp), %rax
movl $0x1, (%rax)
movl $0x1, -0xc4(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x8, 0x418(%rax)
jae 0x652d
movq -0x8(%rbp), %rax
movl $0x8, 0x418(%rax)
jmp 0x652f
cmpl $0x0, -0xc8(%rbp)
jne 0x66d1
movzbl -0xf1(%rbp), %ecx
movq -0x8(%rbp), %rax
movzwl 0x8(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x116(%rbp)
jne 0x658c
movzbl -0xf2(%rbp), %ecx
movq -0x8(%rbp), %rax
movzwl 0xa(%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x116(%rbp)
jne 0x658c
movzbl -0xf3(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl 0xc(%rcx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x116(%rbp)
movb -0x116(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0xfc(%rbp)
movzbl -0xf4(%rbp), %eax
cmpl $0xff, %eax
je 0x660a
movzbl -0xf4(%rbp), %eax
cmpl $0x0, %eax
jne 0x65ca
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x660a
cmpl $0x0, -0xfc(%rbp)
jne 0x660a
movq -0x8(%rbp), %rax
movl $0x1, 0x10(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x4(%rax)
movl $0x1, -0xc8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x8, 0x418(%rax)
jae 0x6605
movq -0x8(%rbp), %rax
movl $0x8, 0x418(%rax)
jmp 0x66cf
movzbl -0xf4(%rbp), %eax
cmpl $0x0, %eax
jne 0x666d
movq -0x8(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x666d
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0x666d
movq -0x8(%rbp), %rax
movl $0x1, 0x4(%rax)
movzbl -0xf1(%rbp), %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x8(%rax)
movzbl -0xf2(%rbp), %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0xa(%rax)
movzbl -0xf3(%rbp), %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0xc(%rax)
jmp 0x66cd
movzbl -0xf4(%rbp), %eax
cmpl $0xff, %eax
jne 0x66cb
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x66cb
cmpl $0x0, -0xfc(%rbp)
je 0x66cb
movq -0x8(%rbp), %rax
movl $0x1, 0x10(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x4(%rax)
movl $0x1, -0xc8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x8, 0x418(%rax)
jae 0x66c9
movq -0x8(%rbp), %rax
movl $0x8, 0x418(%rax)
jmp 0x66cb
jmp 0x66cd
jmp 0x66cf
jmp 0x66d1
cmpl $0x0, -0xcc(%rbp)
jne 0x6820
movb -0xf1(%rbp), %dl
movb -0xf2(%rbp), %cl
movb -0xf3(%rbp), %al
leaq -0xb8(%rbp), %rdi
movzbl %dl, %esi
movzbl %cl, %edx
movzbl %al, %ecx
movzbl -0xf4(%rbp), %r8d
callq 0x6a30
cmpl $0x0, %eax
jne 0x681e
movb -0xf1(%rbp), %sil
movb -0xf2(%rbp), %dl
movb -0xf3(%rbp), %cl
movb -0xf4(%rbp), %al
movq -0x8(%rbp), %rdi
movl 0x14(%rdi), %r9d
leaq -0xb8(%rbp), %rdi
movzbl %sil, %esi
movzbl %dl, %edx
movzbl %cl, %ecx
movzbl %al, %r8d
callq 0x4520
movq -0x8(%rbp), %rax
cmpl $0x100, 0x14(%rax)      # imm = 0x100
jae 0x67f6
movq -0x8(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x108(%rbp)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x10c(%rbp)
movb -0xf1(%rbp), %dl
movq -0x108(%rbp), %rax
movl -0x10c(%rbp), %ecx
shll $0x2, %ecx
addl $0x0, %ecx
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movb -0xf2(%rbp), %dl
movq -0x108(%rbp), %rax
movl -0x10c(%rbp), %ecx
shll $0x2, %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movb -0xf3(%rbp), %dl
movq -0x108(%rbp), %rax
movl -0x10c(%rbp), %ecx
shll $0x2, %ecx
addl $0x2, %ecx
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movb -0xf4(%rbp), %dl
movq -0x108(%rbp), %rax
movl -0x10c(%rbp), %ecx
shll $0x2, %ecx
addl $0x3, %ecx
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x14(%rax)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
cmpl -0xd8(%rbp), %eax
setae %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0xcc(%rbp)
jmp 0x6820
cmpl $0x0, -0xc8(%rbp)
je 0x6846
cmpl $0x0, -0xcc(%rbp)
je 0x6846
cmpl $0x0, -0xc4(%rbp)
je 0x6846
cmpl $0x0, -0xd4(%rbp)
je 0x6846
jmp 0x6859
jmp 0x6848
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x6425
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x6956
movq -0x8(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x6956
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0xc0(%rbp), %rax
je 0x6954
movq -0x10(%rbp), %r8
movq -0x30(%rbp), %r9
movq -0x20(%rbp), %rax
leaq -0xf1(%rbp), %rdi
leaq -0xf2(%rbp), %rsi
leaq -0xf3(%rbp), %rdx
leaq -0xf4(%rbp), %rcx
movq %rax, (%rsp)
callq 0x5490
movzbl -0xf4(%rbp), %eax
cmpl $0x0, %eax
je 0x6941
movzbl -0xf1(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl 0x8(%rcx), %ecx
cmpl %ecx, %eax
jne 0x6941
movzbl -0xf2(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl 0xa(%rcx), %ecx
cmpl %ecx, %eax
jne 0x6941
movzbl -0xf3(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl 0xc(%rcx), %ecx
cmpl %ecx, %eax
jne 0x6941
movq -0x8(%rbp), %rax
movl $0x1, 0x10(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x4(%rax)
movl $0x1, -0xc8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x8, 0x418(%rax)
jae 0x693f
movq -0x8(%rbp), %rax
movl $0x8, 0x418(%rax)
jmp 0x6941
jmp 0x6943
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x687d
jmp 0x6956
movq -0x8(%rbp), %rax
movzwl 0x8(%rax), %edx
shll $0x8, %edx
movq -0x8(%rbp), %rax
movzwl 0x8(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x8(%rax)
movq -0x8(%rbp), %rax
movzwl 0xa(%rax), %edx
shll $0x8, %edx
movq -0x8(%rbp), %rax
movzwl 0xa(%rax), %ecx
addl %edx, %ecx
movw %cx, 0xa(%rax)
movq -0x8(%rbp), %rax
movzwl 0xc(%rax), %edx
shll $0x8, %edx
movq -0x8(%rbp), %rax
movzwl 0xc(%rax), %ecx
addl %edx, %ecx
movw %cx, 0xc(%rax)
leaq -0xb8(%rbp), %rdi
callq 0x5db0
movl -0x24(%rbp), %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopl (%rax)