// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/png/pngrtran.c
// Function: png_init_read_transformations
void /* PRIVATE */
png_init_read_transformations(png_structp png_ptr)
{
   png_debug(1, "in png_init_read_transformations");

  {
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
    defined(PNG_READ_SHIFT_SUPPORTED) || \
    defined(PNG_READ_GAMMA_SUPPORTED)
   int color_type = png_ptr->color_type;
#endif

#if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED)

#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
   /* Detect gray background and attempt to enable optimization
    * for gray --> RGB case
    *
    * Note:  if PNG_BACKGROUND_EXPAND is set and color_type is either RGB or
    * RGB_ALPHA (in which case need_expand is superfluous anyway), the
    * background color might actually be gray yet not be flagged as such.
    * This is not a problem for the current code, which uses
    * PNG_BACKGROUND_IS_GRAY only to decide when to do the
    * png_do_gray_to_rgb() transformation.
    */
   if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) &&
       !(color_type & PNG_COLOR_MASK_COLOR))
   {
          png_ptr->mode |= PNG_BACKGROUND_IS_GRAY;
   } else if ((png_ptr->transformations & PNG_BACKGROUND) &&
              !(png_ptr->transformations & PNG_BACKGROUND_EXPAND) &&
              (png_ptr->transformations & PNG_GRAY_TO_RGB) &&
              png_ptr->background.red == png_ptr->background.green &&
              png_ptr->background.red == png_ptr->background.blue)
   {
          png_ptr->mode |= PNG_BACKGROUND_IS_GRAY;
          png_ptr->background.gray = png_ptr->background.red;
   }
#endif

   if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) &&
       (png_ptr->transformations & PNG_EXPAND))
   {
      if (!(color_type & PNG_COLOR_MASK_COLOR))  /* i.e., GRAY or GRAY_ALPHA */
      {
         /* Expand background and tRNS chunks */
         switch (png_ptr->bit_depth)
         {
            case 1:
               png_ptr->background.gray *= (png_uint_16)0xff;
               png_ptr->background.red = png_ptr->background.green
                 =  png_ptr->background.blue = png_ptr->background.gray;
               if (!(png_ptr->transformations & PNG_EXPAND_tRNS))
               {
                 png_ptr->trans_color.gray *= (png_uint_16)0xff;
                 png_ptr->trans_color.red = png_ptr->trans_color.green
                   = png_ptr->trans_color.blue = png_ptr->trans_color.gray;
               }
               break;

            case 2:
               png_ptr->background.gray *= (png_uint_16)0x55;
               png_ptr->background.red = png_ptr->background.green
                 = png_ptr->background.blue = png_ptr->background.gray;
               if (!(png_ptr->transformations & PNG_EXPAND_tRNS))
               {
                 png_ptr->trans_color.gray *= (png_uint_16)0x55;
                 png_ptr->trans_color.red = png_ptr->trans_color.green
                   = png_ptr->trans_color.blue = png_ptr->trans_color.gray;
               }
               break;

            case 4:
               png_ptr->background.gray *= (png_uint_16)0x11;
               png_ptr->background.red = png_ptr->background.green
                 = png_ptr->background.blue = png_ptr->background.gray;
               if (!(png_ptr->transformations & PNG_EXPAND_tRNS))
               {
                 png_ptr->trans_color.gray *= (png_uint_16)0x11;
                 png_ptr->trans_color.red = png_ptr->trans_color.green
                   = png_ptr->trans_color.blue = png_ptr->trans_color.gray;
               }
               break;

            case 8:

            case 16:
               png_ptr->background.red = png_ptr->background.green
                 = png_ptr->background.blue = png_ptr->background.gray;
               break;
         }
      }
      else if (color_type == PNG_COLOR_TYPE_PALETTE)
      {
         png_ptr->background.red   =
            png_ptr->palette[png_ptr->background.index].red;
         png_ptr->background.green =
            png_ptr->palette[png_ptr->background.index].green;
         png_ptr->background.blue  =
            png_ptr->palette[png_ptr->background.index].blue;

#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
        if (png_ptr->transformations & PNG_INVERT_ALPHA)
        {
#ifdef PNG_READ_EXPAND_SUPPORTED
           if (!(png_ptr->transformations & PNG_EXPAND_tRNS))
#endif
           {
           /* Invert the alpha channel (in tRNS) unless the pixels are
            * going to be expanded, in which case leave it for later
            */
              int i, istop;
              istop=(int)png_ptr->num_trans;
              for (i=0; i<istop; i++)
                 png_ptr->trans_alpha[i] = (png_byte)(255 - png_ptr->trans_alpha[i]);
           }
        }
#endif

      }
   }
#endif

#if defined(PNG_READ_BACKGROUND_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED)
   png_ptr->background_1 = png_ptr->background;
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)

   if ((color_type == PNG_COLOR_TYPE_PALETTE && png_ptr->num_trans != 0)
       && (fabs(png_ptr->screen_gamma * png_ptr->gamma - 1.0)
         < PNG_GAMMA_THRESHOLD))
   {
    int i, k;
    k=0;
    for (i=0; i<png_ptr->num_trans; i++)
    {
      if (png_ptr->trans_alpha[i] != 0 && png_ptr->trans_alpha[i] != 0xff)
        k=1; /* Partial transparency is present */
    }
    if (k == 0)
      png_ptr->transformations &= ~PNG_GAMMA;
   }

   if ((png_ptr->transformations & (PNG_GAMMA | PNG_RGB_TO_GRAY)) &&
        png_ptr->gamma != 0.0)
   {
      png_build_gamma_table(png_ptr, png_ptr->bit_depth);

#ifdef PNG_READ_BACKGROUND_SUPPORTED
      if (png_ptr->transformations & PNG_BACKGROUND)
      {
         if (color_type == PNG_COLOR_TYPE_PALETTE)
         {
           /* Could skip if no transparency */
            png_color back, back_1;
            png_colorp palette = png_ptr->palette;
            int num_palette = png_ptr->num_palette;
            int i;
            if (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_FILE)
            {
               back.red = png_ptr->gamma_table[png_ptr->background.red];
               back.green = png_ptr->gamma_table[png_ptr->background.green];
               back.blue = png_ptr->gamma_table[png_ptr->background.blue];

               back_1.red = png_ptr->gamma_to_1[png_ptr->background.red];
               back_1.green = png_ptr->gamma_to_1[png_ptr->background.green];
               back_1.blue = png_ptr->gamma_to_1[png_ptr->background.blue];
            }
            else
            {
               double g, gs;

               switch (png_ptr->background_gamma_type)
               {
                  case PNG_BACKGROUND_GAMMA_SCREEN:
                     g = (png_ptr->screen_gamma);
                     gs = 1.0;
                     break;

                  case PNG_BACKGROUND_GAMMA_FILE:
                     g = 1.0 / (png_ptr->gamma);
                     gs = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma);
                     break;

                  case PNG_BACKGROUND_GAMMA_UNIQUE:
                     g = 1.0 / (png_ptr->background_gamma);
                     gs = 1.0 / (png_ptr->background_gamma *
                                 png_ptr->screen_gamma);
                     break;
                  default:
                     g = 1.0;    /* back_1 */
                     gs = 1.0;   /* back */
               }

               if ( fabs(gs - 1.0) < PNG_GAMMA_THRESHOLD)
               {
                  back.red   = (png_byte)png_ptr->background.red;
                  back.green = (png_byte)png_ptr->background.green;
                  back.blue  = (png_byte)png_ptr->background.blue;
               }
               else
               {
                  back.red = (png_byte)(pow(
                     (double)png_ptr->background.red/255.0, gs) * 255.0 + .5);
                  back.green = (png_byte)(pow(
                     (double)png_ptr->background.green/255.0, gs) * 255.0
                         + .5);
                  back.blue = (png_byte)(pow(
                     (double)png_ptr->background.blue/255.0, gs) * 255.0 + .5);
               }

               back_1.red = (png_byte)(pow(
                  (double)png_ptr->background.red/255.0, g) * 255.0 + .5);
               back_1.green = (png_byte)(pow(
                  (double)png_ptr->background.green/255.0, g) * 255.0 + .5);
               back_1.blue = (png_byte)(pow(
                  (double)png_ptr->background.blue/255.0, g) * 255.0 + .5);
            }
            for (i = 0; i < num_palette; i++)
            {
               if (i < (int)png_ptr->num_trans && png_ptr->trans_alpha[i] != 0xff)
               {
                  if (png_ptr->trans_alpha[i] == 0)
                  {
                     palette[i] = back;
                  }
                  else /* if (png_ptr->trans_alpha[i] != 0xff) */
                  {
                     png_byte v, w;

                     v = png_ptr->gamma_to_1[palette[i].red];
                     png_composite(w, v, png_ptr->trans_alpha[i], back_1.red);
                     palette[i].red = png_ptr->gamma_from_1[w];

                     v = png_ptr->gamma_to_1[palette[i].green];
                     png_composite(w, v, png_ptr->trans_alpha[i], back_1.green);
                     palette[i].green = png_ptr->gamma_from_1[w];

                     v = png_ptr->gamma_to_1[palette[i].blue];
                     png_composite(w, v, png_ptr->trans_alpha[i], back_1.blue);
                     palette[i].blue = png_ptr->gamma_from_1[w];
                  }
               }
               else
               {
                  palette[i].red = png_ptr->gamma_table[palette[i].red];
                  palette[i].green = png_ptr->gamma_table[palette[i].green];
                  palette[i].blue = png_ptr->gamma_table[palette[i].blue];
               }
            }
            /* Prevent the transformations being done again, and make sure
             * that the now spurious alpha channel is stripped - the code
             * has just reduced background composition and gamma correction
             * to a simple alpha channel strip.
             */
            png_ptr->transformations &= ~PNG_BACKGROUND;
            png_ptr->transformations &= ~PNG_GAMMA;
            png_ptr->transformations |= PNG_STRIP_ALPHA;
         }
         /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */
         else
         /* color_type != PNG_COLOR_TYPE_PALETTE */
         {
            double m = (double)(((png_uint_32)1 << png_ptr->bit_depth) - 1);
            double g = 1.0;
            double gs = 1.0;

            switch (png_ptr->background_gamma_type)
            {
               case PNG_BACKGROUND_GAMMA_SCREEN:
                  g = (png_ptr->screen_gamma);
                  gs = 1.0;
                  break;

               case PNG_BACKGROUND_GAMMA_FILE:
                  g = 1.0 / (png_ptr->gamma);
                  gs = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma);
                  break;

               case PNG_BACKGROUND_GAMMA_UNIQUE:
                  g = 1.0 / (png_ptr->background_gamma);
                  gs = 1.0 / (png_ptr->background_gamma *
                     png_ptr->screen_gamma);
                  break;
            }

            png_ptr->background_1.gray = (png_uint_16)(pow(
               (double)png_ptr->background.gray / m, g) * m + .5);
            png_ptr->background.gray = (png_uint_16)(pow(
               (double)png_ptr->background.gray / m, gs) * m + .5);

            if ((png_ptr->background.red != png_ptr->background.green) ||
                (png_ptr->background.red != png_ptr->background.blue) ||
                (png_ptr->background.red != png_ptr->background.gray))
            {
               /* RGB or RGBA with color background */
               png_ptr->background_1.red = (png_uint_16)(pow(
                  (double)png_ptr->background.red / m, g) * m + .5);
               png_ptr->background_1.green = (png_uint_16)(pow(
                  (double)png_ptr->background.green / m, g) * m + .5);
               png_ptr->background_1.blue = (png_uint_16)(pow(
                  (double)png_ptr->background.blue / m, g) * m + .5);
               png_ptr->background.red = (png_uint_16)(pow(
                  (double)png_ptr->background.red / m, gs) * m + .5);
               png_ptr->background.green = (png_uint_16)(pow(
                  (double)png_ptr->background.green / m, gs) * m + .5);
               png_ptr->background.blue = (png_uint_16)(pow(
                  (double)png_ptr->background.blue / m, gs) * m + .5);
            }
            else
            {
               /* GRAY, GRAY ALPHA, RGB, or RGBA with gray background */
               png_ptr->background_1.red = png_ptr->background_1.green
                 = png_ptr->background_1.blue = png_ptr->background_1.gray;
               png_ptr->background.red = png_ptr->background.green
                 = png_ptr->background.blue = png_ptr->background.gray;
            }
         }
      }
      else
      /* Transformation does not include PNG_BACKGROUND */
#endif /* PNG_READ_BACKGROUND_SUPPORTED */
      if (color_type == PNG_COLOR_TYPE_PALETTE)
      {
         png_colorp palette = png_ptr->palette;
         int num_palette = png_ptr->num_palette;
         int i;

         for (i = 0; i < num_palette; i++)
         {
            palette[i].red = png_ptr->gamma_table[palette[i].red];
            palette[i].green = png_ptr->gamma_table[palette[i].green];
            palette[i].blue = png_ptr->gamma_table[palette[i].blue];
         }

         /* Done the gamma correction. */
         png_ptr->transformations &= ~PNG_GAMMA;
      }
   }
#ifdef PNG_READ_BACKGROUND_SUPPORTED
   else
#endif
#endif /* PNG_READ_GAMMA_SUPPORTED && PNG_FLOATING_POINT_SUPPORTED */
#ifdef PNG_READ_BACKGROUND_SUPPORTED
   /* No GAMMA transformation */
   if ((png_ptr->transformations & PNG_BACKGROUND) &&
       (color_type == PNG_COLOR_TYPE_PALETTE))
   {
      int i;
      int istop = (int)png_ptr->num_trans;
      png_color back;
      png_colorp palette = png_ptr->palette;

      back.red   = (png_byte)png_ptr->background.red;
      back.green = (png_byte)png_ptr->background.green;
      back.blue  = (png_byte)png_ptr->background.blue;

      for (i = 0; i < istop; i++)
      {
         if (png_ptr->trans_alpha[i] == 0)
         {
            palette[i] = back;
         }
         else if (png_ptr->trans_alpha[i] != 0xff)
         {
            /* The png_composite() macro is defined in png.h */
            png_composite(palette[i].red, palette[i].red,
               png_ptr->trans_alpha[i], back.red);
            png_composite(palette[i].green, palette[i].green,
               png_ptr->trans_alpha[i], back.green);
            png_composite(palette[i].blue, palette[i].blue,
               png_ptr->trans_alpha[i], back.blue);
         }
      }

      /* Handled alpha, still need to strip the channel. */
      png_ptr->transformations &= ~PNG_BACKGROUND;
      png_ptr->transformations |= PNG_STRIP_ALPHA;
   }
#endif /* PNG_READ_BACKGROUND_SUPPORTED */

#ifdef PNG_READ_SHIFT_SUPPORTED
   if ((png_ptr->transformations & PNG_SHIFT) &&
      (color_type == PNG_COLOR_TYPE_PALETTE))
   {
      png_uint_16 i;
      png_uint_16 istop = png_ptr->num_palette;
      int sr = 8 - png_ptr->sig_bit.red;
      int sg = 8 - png_ptr->sig_bit.green;
      int sb = 8 - png_ptr->sig_bit.blue;

      if (sr < 0 || sr > 8)
         sr = 0;
      if (sg < 0 || sg > 8)
         sg = 0;
      if (sb < 0 || sb > 8)
         sb = 0;
      for (i = 0; i < istop; i++)
      {
         png_ptr->palette[i].red >>= sr;
         png_ptr->palette[i].green >>= sg;
         png_ptr->palette[i].blue >>= sb;
      }
   }
#endif  /* PNG_READ_SHIFT_SUPPORTED */
 }
#if !defined(PNG_READ_GAMMA_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED) \
 && !defined(PNG_READ_BACKGROUND_SUPPORTED)
   if (png_ptr)
      return;
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
movb 0x24e(%rdi), %al
movl 0x124(%rdi), %ecx
movl %ecx, %edx
shrl $0x8, %edx
testb $0x2, %al
sete %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x8d54e
orb $0x8, 0x11d(%rbx)
jmp 0x8d592
movl %ecx, %edx
andl $0x4180, %edx           # imm = 0x4180
cmpl $0x4080, %edx           # imm = 0x4080
jne 0x8d592
movzwl 0x262(%rbx), %ecx
cmpw 0x264(%rbx), %cx
jne 0x8d745
cmpw 0x266(%rbx), %cx
jne 0x8d745
orb $0x8, 0x11d(%rbx)
movw %cx, 0x268(%rbx)
jmp 0x8d745
movl %ecx, %edx
notl %edx
testl $0x1100, %edx           # imm = 0x1100
jne 0x8d745
testb $0x2, %al
jne 0x8d603
movzbl 0x24f(%rbx), %esi
leal -0x1(%rsi), %edx
cmpl $0x7, %edx
ja 0x8d694
leaq 0x1f7d4(%rip), %rsi     # 0xacd94
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movl 0x268(%rbx), %edx
movl %edx, %esi
shll $0x8, %esi
subl %edx, %esi
movd %esi, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
movq %xmm0, 0x262(%rbx)
btl $0x19, %ecx
jb 0x8d745
movl 0x2e8(%rbx), %ecx
movl %ecx, %edx
shll $0x8, %edx
subl %ecx, %edx
jmp 0x8d734
cmpb $0x3, %al
jne 0x8d673
movq 0x238(%rbx), %rdx
movzbl 0x260(%rbx), %esi
leaq (%rsi,%rsi,2), %rsi
movzbl (%rdx,%rsi), %edi
movw %di, 0x262(%rbx)
movzbl 0x1(%rdx,%rsi), %edi
movw %di, 0x264(%rbx)
movzbl 0x2(%rdx,%rsi), %edx
movw %dx, 0x266(%rbx)
andl $0x2080000, %ecx        # imm = 0x2080000
cmpl $0x80000, %ecx          # imm = 0x80000
jne 0x8d6be
movzwl 0x242(%rbx), %ecx
testq %rcx, %rcx
je 0x8e173
xorl %edx, %edx
movq 0x2d8(%rbx), %rsi
notb (%rsi,%rdx)
incq %rdx
cmpq %rdx, %rcx
jne 0x8d65c
jmp 0x8d745
movzwl 0x268(%rbx), %eax
movw %ax, 0x272(%rbx)
movq 0x260(%rbx), %rax
movq %rax, 0x26a(%rbx)
jmp 0x8d7f0
cmpl $0x10, %esi
jne 0x8d745
movzwl 0x268(%rbx), %ecx
movw %cx, 0x266(%rbx)
movw %cx, 0x264(%rbx)
movw %cx, 0x262(%rbx)
jmp 0x8d745
leaq 0x260(%rbx), %rax
movzwl 0x8(%rax), %ecx
movw %cx, 0x272(%rbx)
movq (%rax), %rax
jmp 0x8e188
imull $0x55, 0x268(%rbx), %edx
movd %edx, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
movq %xmm0, 0x262(%rbx)
btl $0x19, %ecx
jb 0x8d745
imull $0x55, 0x2e8(%rbx), %ecx
movd %ecx, %xmm0
jmp 0x8d738
movl 0x268(%rbx), %edx
movl %edx, %esi
shll $0x4, %esi
addl %edx, %esi
movd %esi, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
movq %xmm0, 0x262(%rbx)
btl $0x19, %ecx
jb 0x8d745
movl 0x2e8(%rbx), %ecx
movl %ecx, %edx
shll $0x4, %edx
addl %ecx, %edx
movd %edx, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
movq %xmm0, 0x2e2(%rbx)
movzwl 0x268(%rbx), %ecx
movw %cx, 0x272(%rbx)
movq 0x260(%rbx), %rcx
movq %rcx, 0x26a(%rbx)
cmpb $0x3, %al
jne 0x8d7f0
movzwl 0x242(%rbx), %eax
movb $0x1, %bpl
testq %rax, %rax
je 0x8d7f2
movss 0x290(%rbx), %xmm0
mulss 0x28c(%rbx), %xmm0
cvtss2sd %xmm0, %xmm0
addsd 0x148b4(%rip), %xmm0    # 0xa2048
andpd 0x14ad4(%rip), %xmm0    # 0xa2270
movsd 0x1f6cc(%rip), %xmm1    # 0xace70
ucomisd %xmm0, %xmm1
jbe 0x8d7f2
movq 0x2d8(%rbx), %rcx
negq %rax
movb $0x1, %dl
xorl %esi, %esi
incq %rsi
movzbl -0x1(%rcx,%rsi), %edi
cmpl $0xff, %edi
je 0x8d7cc
testl %edi, %edi
jne 0x8d7e1
leaq (%rax,%rsi), %rdi
incq %rdi
incq %rsi
cmpq $0x1, %rdi
jne 0x8d7bb
jmp 0x8da75
movb $0x1, %bpl
xorl %edx, %edx
movq %rax, %rdi
addq %rsi, %rdi
jne 0x8d7b8
jmp 0x8d7f2
xorl %ebp, %ebp
movl 0x124(%rbx), %ecx
testl $0x602000, %ecx         # imm = 0x602000
je 0x8d8a0
movss 0x28c(%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x8d81b
jnp 0x8d8a0
movzbl 0x24f(%rbx), %esi
movq %rbx, %rdi
callq 0x8e194
movl 0x124(%rbx), %ecx
testb %cl, %cl
js 0x8d9ed
testb %bpl, %bpl
je 0x8e164
movzwl 0x240(%rbx), %esi
testq %rsi, %rsi
je 0x8d895
movq 0x238(%rbx), %rax
movq 0x298(%rbx), %rdx
leaq (%rsi,%rsi,2), %rsi
xorl %edi, %edi
movzbl (%rax,%rdi), %r8d
movb (%rdx,%r8), %r8b
movb %r8b, (%rax,%rdi)
movzbl 0x1(%rax,%rdi), %r8d
movb (%rdx,%r8), %r8b
movb %r8b, 0x1(%rax,%rdi)
movzbl 0x2(%rax,%rdi), %r8d
movb (%rdx,%r8), %r8b
movb %r8b, 0x2(%rax,%rdi)
addq $0x3, %rdi
cmpq %rdi, %rsi
jne 0x8d861
andl $0xffffdf7f, %ecx       # imm = 0xFFFFDF7F
jmp 0x8de83
testb %cl, %cl
setns %al
movl %ebp, %edx
xorb $0x1, %dl
orb %al, %dl
jne 0x8de89
movzwl 0x242(%rbx), %eax
testq %rax, %rax
je 0x8d9dc
movl %ebp, 0x10(%rsp)
movzwl 0x262(%rbx), %r9d
movl $0xff, %ecx
movl %r9d, 0x8(%rsp)
andl %ecx, %r9d
movzwl 0x264(%rbx), %esi
movl %esi, %r14d
andl %ecx, %r14d
movzwl 0x266(%rbx), %edi
movl %edi, %r15d
andl %ecx, %r15d
movq 0x238(%rbx), %rbp
addq $0x2, %rbp
xorl %r8d, %r8d
movzwl %r9w, %r9d
movl $0x80, %r10d
movl $0xffff, %r11d          # imm = 0xFFFF
movzwl %r14w, %r14d
movzwl %r15w, %r15d
movq 0x2d8(%rbx), %r12
movzbl (%r12,%r8), %r13d
cmpl $0xff, %r13d
je 0x8d9c2
testl %r13d, %r13d
jne 0x8d94a
movl 0x8(%rsp), %ecx
movb %cl, -0x2(%rbp)
movb %sil, -0x1(%rbp)
movb %dil, (%rbp)
jmp 0x8d9c2
movzwl %r13w, %edx
movzbl -0x2(%rbp), %ecx
imull %edx, %ecx
notb %r13b
movzbl %r13b, %edx
imull %r9d, %edx
addl %r10d, %ecx
addl %edx, %ecx
andl %r11d, %ecx
movl %ecx, %edx
shrl $0x8, %edx
addl %ecx, %edx
movb %dh, -0x2(%rbp)
movzbl -0x1(%rbp), %ecx
movzbl (%r12,%r8), %edx
imull %edx, %ecx
movl $0xff, %r13d
xorl %r13d, %edx
imull %r14d, %edx
addl %r10d, %ecx
addl %edx, %ecx
andl %r11d, %ecx
movl %ecx, %edx
shrl $0x8, %edx
addl %ecx, %edx
movb %dh, -0x1(%rbp)
movzbl (%rbp), %ecx
movzbl (%r12,%r8), %edx
imull %edx, %ecx
xorl %r13d, %edx
imull %r15d, %edx
addl %r10d, %ecx
addl %edx, %ecx
andl %r11d, %ecx
movl %ecx, %edx
shrl $0x8, %edx
addl %ecx, %edx
movb %dh, (%rbp)
incq %r8
addq $0x3, %rbp
cmpq %r8, %rax
jne 0x8d91b
movl 0x124(%rbx), %ecx
movl 0x10(%rsp), %ebp
andl $0xfffbff7f, %ecx       # imm = 0xFFFBFF7F
orl $0x40000, %ecx          # imm = 0x40000
jmp 0x8de83
testb %bpl, %bpl
je 0x8da8d
movq 0x238(%rbx), %r14
movzwl 0x240(%rbx), %r15d
movzbl 0x258(%rbx), %eax
cmpl $0x1, %eax
movl %ebp, 0x10(%rsp)
je 0x8db18
cmpl $0x3, %eax
je 0x8dadc
cmpl $0x2, %eax
jne 0x8db56
movzwl 0x262(%rbx), %eax
movq 0x298(%rbx), %rcx
movq 0x2a8(%rbx), %rdx
movb (%rcx,%rax), %sil
movl %esi, 0x8(%rsp)
movzwl 0x264(%rbx), %esi
movb (%rcx,%rsi), %dil
movl %edi, 0x20(%rsp)
movzwl 0x266(%rbx), %edi
movb (%rcx,%rdi), %cl
movl %ecx, 0x30(%rsp)
movb (%rdx,%rax), %bpl
movb (%rdx,%rsi), %r12b
movb (%rdx,%rdi), %dl
jmp 0x8dcff
movb $0x1, %bpl
testb $0x1, %dl
je 0x8d7f2
andb $-0x21, 0x125(%rbx)
jmp 0x8d7f2
movb 0x24f(%rbx), %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
shll %cl, %eax
notl %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x8(%rsp)
movzbl 0x258(%rbx), %eax
cmpl $0x3, %eax
je 0x8db2b
cmpl $0x2, %eax
je 0x8db04
cmpl $0x1, %eax
jne 0x8df3b
xorps %xmm1, %xmm1
cvtss2sd 0x290(%rbx), %xmm1
shufpd $0x2, 0x1f3a9(%rip), %xmm1 # xmm1 = xmm1[0],mem[1]
jmp 0x8df43
movss 0x25c(%rbx), %xmm0
movss 0x290(%rbx), %xmm1
mulss %xmm0, %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
cvtps2pd %xmm0, %xmm0
movapd 0x15462(%rip), %xmm2    # 0xa2f60
divpd %xmm0, %xmm2
jmp 0x8db5e
movsd 0x28c(%rbx), %xmm0
movaps %xmm0, %xmm1
shufps $0x55, %xmm0, %xmm1     # xmm1 = xmm1[1,1],xmm0[1,1]
mulps %xmm0, %xmm1
jmp 0x8db3f
cvtss2sd 0x290(%rbx), %xmm2
shufpd $0x2, 0x1f357(%rip), %xmm2 # xmm2 = xmm2[0],mem[1]
jmp 0x8db5e
movss 0x25c(%rbx), %xmm0
movss 0x290(%rbx), %xmm1
mulss %xmm0, %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
cvtps2pd %xmm0, %xmm0
movapd 0x15413(%rip), %xmm1    # 0xa2f60
divpd %xmm0, %xmm1
jmp 0x8df43
movapd 0x15402(%rip), %xmm2    # 0xa2f60
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
movsd 0x144da(%rip), %xmm0    # 0xa2048
addsd %xmm1, %xmm0
andpd 0x146f6(%rip), %xmm0    # 0xa2270
movsd 0x1f2ee(%rip), %xmm3    # 0xace70
ucomisd %xmm0, %xmm3
movzwl 0x262(%rbx), %eax
movapd %xmm2, 0x40(%rsp)
jbe 0x8dbb4
movb 0x264(%rbx), %cl
movl %ecx, 0x20(%rsp)
movb 0x266(%rbx), %cl
movl %ecx, 0x30(%rsp)
movl %eax, %ecx
movl %ecx, 0x8(%rsp)
jmp 0x8dc67
movzwl %ax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x14652(%rip), %xmm0    # 0xa2218
movapd %xmm1, 0x30(%rsp)
callq 0xe7d0
movsd 0x1463f(%rip), %xmm1    # 0xa2218
mulsd %xmm1, %xmm0
addsd 0x1444b(%rip), %xmm0    # 0xa2030
cvttsd2si %xmm0, %eax
movl %eax, 0x8(%rsp)
movzwl 0x264(%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm1, %xmm0
movaps 0x30(%rsp), %xmm1
callq 0xe7d0
movsd 0x14607(%rip), %xmm1    # 0xa2218
mulsd %xmm1, %xmm0
addsd 0x14413(%rip), %xmm0    # 0xa2030
cvttsd2si %xmm0, %eax
movl %eax, 0x20(%rsp)
movzwl 0x266(%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm1, %xmm0
movapd 0x30(%rsp), %xmm1
callq 0xe7d0
movapd 0x40(%rsp), %xmm2
mulsd 0x145c8(%rip), %xmm0    # 0xa2218
addsd 0x143d8(%rip), %xmm0    # 0xa2030
cvttsd2si %xmm0, %eax
movl %eax, 0x30(%rsp)
movzwl 0x262(%rbx), %eax
movzwl %ax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x1459f(%rip), %xmm0    # 0xa2218
movapd %xmm2, %xmm1
callq 0xe7d0
movsd 0x1458e(%rip), %xmm1    # 0xa2218
mulsd %xmm1, %xmm0
addsd 0x1439a(%rip), %xmm0    # 0xa2030
cvttsd2si %xmm0, %ebp
movzwl 0x264(%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm1, %xmm0
movaps 0x40(%rsp), %xmm1
callq 0xe7d0
movsd 0x1455a(%rip), %xmm1    # 0xa2218
mulsd %xmm1, %xmm0
addsd 0x14366(%rip), %xmm0    # 0xa2030
cvttsd2si %xmm0, %r12d
movzwl 0x266(%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm1, %xmm0
movaps 0x40(%rsp), %xmm1
callq 0xe7d0
mulsd 0x14525(%rip), %xmm0    # 0xa2218
addsd 0x14335(%rip), %xmm0    # 0xa2030
cvttsd2si %xmm0, %edx
testq %r15, %r15
je 0x8de6e
movzbl %bpl, %eax
movzbl %r12b, %ecx
movzbl %dl, %edx
addq $0x2, %r14
xorl %esi, %esi
movl $0x80, %edi
movl $0xff, %r8d
movzwl 0x242(%rbx), %r9d
cmpq %r9, %rsi
jae 0x8dd65
movq 0x2d8(%rbx), %r10
movzbl (%r10,%rsi), %ebp
cmpl $0xff, %ebp
je 0x8dd65
testl %ebp, %ebp
jne 0x8dda2
movl 0x8(%rsp), %r9d
movb %r9b, -0x2(%r14)
movl 0x20(%rsp), %r9d
movb %r9b, -0x1(%r14)
movl 0x30(%rsp), %r9d
movb %r9b, (%r14)
jmp 0x8dd91
movq 0x298(%rbx), %r9
movzbl -0x2(%r14), %r10d
movb (%r9,%r10), %r10b
movb %r10b, -0x2(%r14)
movzbl -0x1(%r14), %r10d
movb (%r9,%r10), %r10b
movb %r10b, -0x1(%r14)
movzbl (%r14), %r10d
movb (%r9,%r10), %r9b
movb %r9b, (%r14)
incq %rsi
addq $0x3, %r14
cmpq %rsi, %r15
jne 0x8dd24
jmp 0x8de6e
movq 0x2a0(%rbx), %r9
movq 0x2a8(%rbx), %r11
movzbl -0x2(%r14), %r12d
movzbl (%r11,%r12), %r12d
imull %ebp, %r12d
notb %bpl
movzbl %bpl, %r13d
imull %eax, %r13d
addl %r12d, %r13d
leal (%rdi,%r13), %r12d
shrl $0x8, %r12d
andl %r8d, %r12d
addl %r13d, %r12d
addl $0x80, %r12d
shrl $0x8, %r12d
andl %r8d, %r12d
movb (%r9,%r12), %bpl
movb %bpl, -0x2(%r14)
movzbl -0x1(%r14), %r12d
movzbl (%r11,%r12), %ebp
movzbl (%r10,%rsi), %r12d
imull %r12d, %ebp
xorl %r8d, %r12d
imull %ecx, %r12d
addl %ebp, %r12d
leal (%r12,%rdi), %r13d
shrl $0x8, %r13d
andl %r8d, %r13d
addl %r13d, %r12d
addl $0x80, %r12d
shrl $0x8, %r12d
andl %r8d, %r12d
movb (%r9,%r12), %bpl
movb %bpl, -0x1(%r14)
movzbl (%r14), %r12d
movzbl (%r11,%r12), %r11d
movzbl (%r10,%rsi), %r10d
imull %r10d, %r11d
xorl %r8d, %r10d
imull %edx, %r10d
addl %r11d, %r10d
leal (%r10,%rdi), %r11d
shrl $0x8, %r11d
andl %r8d, %r11d
addl %r11d, %r10d
addl $0x80, %r10d
shrl $0x8, %r10d
andl %r8d, %r10d
jmp 0x8dd8a
movl $0xfffbdf7f, %ecx       # imm = 0xFFFBDF7F
andl 0x124(%rbx), %ecx
orl $0x40000, %ecx          # imm = 0x40000
movl 0x10(%rsp), %ebp
movl %ecx, 0x124(%rbx)
testb $0x8, %cl
sete %al
xorb $0x1, %bpl
orb %al, %bpl
jne 0x8e164
movzbl 0x2c8(%rbx), %ecx
movl $0x8, %eax
movl $0x8, %edx
subl %ecx, %edx
movzbl 0x2c9(%rbx), %edi
movl $0x8, %esi
subl %edi, %esi
movzbl 0x2ca(%rbx), %r8d
subl %r8d, %eax
xorl %r9d, %r9d
cmpl $0x9, %ecx
cmovael %r9d, %edx
movzwl 0x240(%rbx), %ecx
cmpl $0x9, %edi
cmovael %r9d, %esi
cmpl $0x9, %r8d
cmovael %r9d, %eax
testq %rcx, %rcx
je 0x8e164
movq 0x238(%rbx), %rdi
leaq (%rcx,%rcx,2), %r8
xorl %r9d, %r9d
movzbl (%rdi,%r9), %r10d
movl %edx, %ecx
shrl %cl, %r10d
movb %r10b, (%rdi,%r9)
movzbl 0x1(%rdi,%r9), %r10d
movl %esi, %ecx
shrl %cl, %r10d
movb %r10b, 0x1(%rdi,%r9)
movzbl 0x2(%rdi,%r9), %r10d
movl %eax, %ecx
shrl %cl, %r10d
movb %r10b, 0x2(%rdi,%r9)
addq $0x3, %r9
cmpq %r9, %r8
jne 0x8deff
jmp 0x8e164
movapd 0x1501d(%rip), %xmm1    # 0xa2f60
movzwl 0x268(%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x8(%rsp), %xmm0
movapd %xmm1, 0x10(%rsp)
callq 0xe7d0
movsd 0x8(%rsp), %xmm1
mulsd %xmm1, %xmm0
addsd 0x140bc(%rip), %xmm0    # 0xa2030
cvttsd2si %xmm0, %eax
movw %ax, 0x272(%rbx)
movzwl 0x268(%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm1, %xmm0
movaps 0x10(%rsp), %xmm1
movhlps %xmm1, %xmm1            # xmm1 = xmm1[1,1]
movaps %xmm1, 0x20(%rsp)
callq 0xe7d0
mulsd 0x8(%rsp), %xmm0
addsd 0x1407f(%rip), %xmm0    # 0xa2030
cvttsd2si %xmm0, %eax
movw %ax, 0x268(%rbx)
movzwl 0x262(%rbx), %ecx
cmpw 0x264(%rbx), %cx
jne 0x8e010
cmpw 0x266(%rbx), %cx
jne 0x8e010
cmpw %ax, %cx
jne 0x8e010
movzwl 0x272(%rbx), %ecx
movw %cx, 0x270(%rbx)
movw %cx, 0x26e(%rbx)
movw %cx, 0x26c(%rbx)
movw %ax, 0x266(%rbx)
movw %ax, 0x264(%rbx)
movw %ax, 0x262(%rbx)
jmp 0x8e164
movzwl %cx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x8(%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
callq 0xe7d0
movsd 0x8(%rsp), %xmm2
mulsd %xmm2, %xmm0
movsd 0x13ff4(%rip), %xmm1    # 0xa2030
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movw %ax, 0x26c(%rbx)
movzwl 0x264(%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm2, %xmm0
movaps 0x10(%rsp), %xmm1
callq 0xe7d0
movsd 0x8(%rsp), %xmm1
mulsd %xmm1, %xmm0
addsd 0x13fb7(%rip), %xmm0    # 0xa2030
cvttsd2si %xmm0, %eax
movw %ax, 0x26e(%rbx)
movzwl 0x266(%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm1, %xmm0
movaps 0x10(%rsp), %xmm1
callq 0xe7d0
movsd 0x8(%rsp), %xmm1
mulsd %xmm1, %xmm0
addsd 0x13f7e(%rip), %xmm0    # 0xa2030
cvttsd2si %xmm0, %eax
movw %ax, 0x270(%rbx)
movzwl 0x262(%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm1, %xmm0
movaps 0x20(%rsp), %xmm1
callq 0xe7d0
movsd 0x8(%rsp), %xmm1
mulsd %xmm1, %xmm0
addsd 0x13f45(%rip), %xmm0    # 0xa2030
cvttsd2si %xmm0, %eax
movw %ax, 0x262(%rbx)
movzwl 0x264(%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm1, %xmm0
movaps 0x20(%rsp), %xmm1
callq 0xe7d0
movsd 0x8(%rsp), %xmm1
mulsd %xmm1, %xmm0
addsd 0x13f0c(%rip), %xmm0    # 0xa2030
cvttsd2si %xmm0, %eax
movw %ax, 0x264(%rbx)
movzwl 0x266(%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm1, %xmm0
movaps 0x20(%rsp), %xmm1
callq 0xe7d0
mulsd 0x8(%rsp), %xmm0
addsd 0x13ed7(%rip), %xmm0    # 0xa2030
cvttsd2si %xmm0, %eax
movw %ax, 0x266(%rbx)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzwl 0x268(%rbx), %eax
movw %ax, 0x272(%rbx)
movq 0x260(%rbx), %rax
movq %rax, 0x26a(%rbx)
jmp 0x8d769