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

#ifdef PNG_READ_EXPAND_SUPPORTED
   if (png_ptr->transformations & PNG_EXPAND)
   {
      if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
      {
         if (png_ptr->num_trans &&
              (png_ptr->transformations & PNG_EXPAND_tRNS))
            info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
         else
            info_ptr->color_type = PNG_COLOR_TYPE_RGB;
         info_ptr->bit_depth = 8;
         info_ptr->num_trans = 0;
      }
      else
      {
         if (png_ptr->num_trans)
         {
            if (png_ptr->transformations & PNG_EXPAND_tRNS)
              info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
         }
         if (info_ptr->bit_depth < 8)
            info_ptr->bit_depth = 8;
         info_ptr->num_trans = 0;
      }
   }
#endif

#ifdef PNG_READ_BACKGROUND_SUPPORTED
   if (png_ptr->transformations & PNG_BACKGROUND)
   {
      info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA;
      info_ptr->num_trans = 0;
      info_ptr->background = png_ptr->background;
   }
#endif

#ifdef PNG_READ_GAMMA_SUPPORTED
   if (png_ptr->transformations & PNG_GAMMA)
   {
#ifdef PNG_FLOATING_POINT_SUPPORTED
      info_ptr->gamma = png_ptr->gamma;
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
      info_ptr->int_gamma = png_ptr->int_gamma;
#endif
   }
#endif

#ifdef PNG_READ_16_TO_8_SUPPORTED
   if ((png_ptr->transformations & PNG_16_TO_8) && (info_ptr->bit_depth == 16))
      info_ptr->bit_depth = 8;
#endif

#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
   if (png_ptr->transformations & PNG_GRAY_TO_RGB)
      info_ptr->color_type |= PNG_COLOR_MASK_COLOR;
#endif

#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
   if (png_ptr->transformations & PNG_RGB_TO_GRAY)
      info_ptr->color_type &= ~PNG_COLOR_MASK_COLOR;
#endif

#ifdef PNG_READ_QUANTIZE_SUPPORTED
   if (png_ptr->transformations & PNG_QUANTIZE)
   {
      if (((info_ptr->color_type == PNG_COLOR_TYPE_RGB) ||
          (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)) &&
          png_ptr->palette_lookup && info_ptr->bit_depth == 8)
      {
         info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
      }
   }
#endif

#ifdef PNG_READ_PACK_SUPPORTED
   if ((png_ptr->transformations & PNG_PACK) && (info_ptr->bit_depth < 8))
      info_ptr->bit_depth = 8;
#endif

   if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
      info_ptr->channels = 1;
   else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
      info_ptr->channels = 3;
   else
      info_ptr->channels = 1;

#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
   if (png_ptr->flags & PNG_FLAG_STRIP_ALPHA)
      info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA;
#endif

   if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
      info_ptr->channels++;

#ifdef PNG_READ_FILLER_SUPPORTED
   /* STRIP_ALPHA and FILLER allowed:  MASK_ALPHA bit stripped above */
   if ((png_ptr->transformations & PNG_FILLER) &&
       ((info_ptr->color_type == PNG_COLOR_TYPE_RGB) ||
       (info_ptr->color_type == PNG_COLOR_TYPE_GRAY)))
   {
      info_ptr->channels++;
      /* If adding a true alpha channel not just filler */
      if (png_ptr->transformations & PNG_ADD_ALPHA)
        info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
   }
#endif

#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) && \
defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
   if (png_ptr->transformations & PNG_USER_TRANSFORM)
     {
       if (info_ptr->bit_depth < png_ptr->user_transform_depth)
         info_ptr->bit_depth = png_ptr->user_transform_depth;
       if (info_ptr->channels < png_ptr->user_transform_channels)
         info_ptr->channels = png_ptr->user_transform_channels;
     }
#endif

   info_ptr->pixel_depth = (png_byte)(info_ptr->channels *
      info_ptr->bit_depth);

   info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, info_ptr->width);

#ifndef PNG_READ_EXPAND_SUPPORTED
   if (png_ptr)
      return;
#endif
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq -0x8(%rsp), %rax
movl 0x124(%rax), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x10a36e
movq -0x10(%rsp), %rax
movzbl 0x25(%rax), %eax
cmpl $0x3, %eax
jne 0x10a313
movq -0x8(%rsp), %rax
movzwl 0x242(%rax), %eax
cmpl $0x0, %eax
je 0x10a2f4
movq -0x8(%rsp), %rax
movl 0x124(%rax), %eax
andq $0x2000000, %rax        # imm = 0x2000000
cmpq $0x0, %rax
je 0x10a2f4
movq -0x10(%rsp), %rax
movb $0x6, 0x25(%rax)
jmp 0x10a2fd
movq -0x10(%rsp), %rax
movb $0x2, 0x25(%rax)
movq -0x10(%rsp), %rax
movb $0x8, 0x24(%rax)
movq -0x10(%rsp), %rax
movw $0x0, 0x22(%rax)
jmp 0x10a36c
movq -0x8(%rsp), %rax
cmpw $0x0, 0x242(%rax)
je 0x10a34a
movq -0x8(%rsp), %rax
movl 0x124(%rax), %eax
andq $0x2000000, %rax        # imm = 0x2000000
cmpq $0x0, %rax
je 0x10a348
movq -0x10(%rsp), %rax
movzbl 0x25(%rax), %ecx
orl $0x4, %ecx
movb %cl, 0x25(%rax)
jmp 0x10a34a
movq -0x10(%rsp), %rax
movzbl 0x24(%rax), %eax
cmpl $0x8, %eax
jge 0x10a361
movq -0x10(%rsp), %rax
movb $0x8, 0x24(%rax)
movq -0x10(%rsp), %rax
movw $0x0, 0x22(%rax)
jmp 0x10a36e
movq -0x8(%rsp), %rax
movl 0x124(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x10a3bd
movq -0x10(%rsp), %rax
movzbl 0x25(%rax), %ecx
andl $-0x5, %ecx
movb %cl, 0x25(%rax)
movq -0x10(%rsp), %rax
movw $0x0, 0x22(%rax)
movq -0x10(%rsp), %rax
movq -0x8(%rsp), %rcx
movq 0x260(%rcx), %rdx
movq %rdx, 0x72(%rax)
movw 0x268(%rcx), %cx
movw %cx, 0x7a(%rax)
movq -0x8(%rsp), %rax
movl 0x124(%rax), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0x10a3ff
movq -0x8(%rsp), %rax
movss 0x28c(%rax), %xmm0
movq -0x10(%rsp), %rax
movss %xmm0, 0x34(%rax)
movq -0x8(%rsp), %rax
movl 0x40c(%rax), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x148(%rax)
movq -0x8(%rsp), %rax
movl 0x124(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x10a42b
movq -0x10(%rsp), %rax
movzbl 0x24(%rax), %eax
cmpl $0x10, %eax
jne 0x10a42b
movq -0x10(%rsp), %rax
movb $0x8, 0x24(%rax)
movq -0x8(%rsp), %rax
movl 0x124(%rax), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x10a44f
movq -0x10(%rsp), %rax
movzbl 0x25(%rax), %ecx
orl $0x2, %ecx
movb %cl, 0x25(%rax)
movq -0x8(%rsp), %rax
movl 0x124(%rax), %eax
andq $0x600000, %rax         # imm = 0x600000
cmpq $0x0, %rax
je 0x10a475
movq -0x10(%rsp), %rax
movzbl 0x25(%rax), %ecx
andl $-0x3, %ecx
movb %cl, 0x25(%rax)
movq -0x8(%rsp), %rax
movl 0x124(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x10a4cc
movq -0x10(%rsp), %rax
movzbl 0x25(%rax), %eax
cmpl $0x2, %eax
je 0x10a4a4
movq -0x10(%rsp), %rax
movzbl 0x25(%rax), %eax
cmpl $0x6, %eax
jne 0x10a4ca
movq -0x8(%rsp), %rax
cmpq $0x0, 0x388(%rax)
je 0x10a4ca
movq -0x10(%rsp), %rax
movzbl 0x24(%rax), %eax
cmpl $0x8, %eax
jne 0x10a4ca
movq -0x10(%rsp), %rax
movb $0x3, 0x25(%rax)
jmp 0x10a4cc
movq -0x8(%rsp), %rax
movl 0x124(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x10a4f6
movq -0x10(%rsp), %rax
movzbl 0x24(%rax), %eax
cmpl $0x8, %eax
jge 0x10a4f6
movq -0x10(%rsp), %rax
movb $0x8, 0x24(%rax)
movq -0x10(%rsp), %rax
movzbl 0x25(%rax), %eax
cmpl $0x3, %eax
jne 0x10a50f
movq -0x10(%rsp), %rax
movb $0x1, 0x29(%rax)
jmp 0x10a536
movq -0x10(%rsp), %rax
movzbl 0x25(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x10a52b
movq -0x10(%rsp), %rax
movb $0x3, 0x29(%rax)
jmp 0x10a534
movq -0x10(%rsp), %rax
movb $0x1, 0x29(%rax)
jmp 0x10a536
movq -0x8(%rsp), %rax
movl 0x120(%rax), %eax
andq $0x400000, %rax         # imm = 0x400000
cmpq $0x0, %rax
je 0x10a55c
movq -0x10(%rsp), %rax
movzbl 0x25(%rax), %ecx
andl $-0x5, %ecx
movb %cl, 0x25(%rax)
movq -0x10(%rsp), %rax
movzbl 0x25(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x10a57b
movq -0x10(%rsp), %rax
movb 0x29(%rax), %cl
addb $0x1, %cl
movb %cl, 0x29(%rax)
movq -0x8(%rsp), %rax
movl 0x124(%rax), %eax
andq $0x8000, %rax           # imm = 0x8000
cmpq $0x0, %rax
je 0x10a5e4
movq -0x10(%rsp), %rax
movzbl 0x25(%rax), %eax
cmpl $0x2, %eax
je 0x10a5ae
movq -0x10(%rsp), %rax
movzbl 0x25(%rax), %eax
cmpl $0x0, %eax
jne 0x10a5e4
movq -0x10(%rsp), %rax
movb 0x29(%rax), %cl
addb $0x1, %cl
movb %cl, 0x29(%rax)
movq -0x8(%rsp), %rax
movl 0x124(%rax), %eax
andq $0x1000000, %rax        # imm = 0x1000000
cmpq $0x0, %rax
je 0x10a5e2
movq -0x10(%rsp), %rax
movzbl 0x25(%rax), %ecx
orl $0x4, %ecx
movb %cl, 0x25(%rax)
jmp 0x10a5e4
movq -0x8(%rsp), %rax
movl 0x124(%rax), %eax
andq $0x100000, %rax         # imm = 0x100000
cmpq $0x0, %rax
je 0x10a655
movq -0x10(%rsp), %rax
movzbl 0x24(%rax), %eax
movq -0x8(%rsp), %rcx
movzbl 0x118(%rcx), %ecx
cmpl %ecx, %eax
jge 0x10a627
movq -0x8(%rsp), %rax
movb 0x118(%rax), %cl
movq -0x10(%rsp), %rax
movb %cl, 0x24(%rax)
movq -0x10(%rsp), %rax
movzbl 0x29(%rax), %eax
movq -0x8(%rsp), %rcx
movzbl 0x119(%rcx), %ecx
cmpl %ecx, %eax
jge 0x10a653
movq -0x8(%rsp), %rax
movb 0x119(%rax), %cl
movq -0x10(%rsp), %rax
movb %cl, 0x29(%rax)
jmp 0x10a655
movq -0x10(%rsp), %rax
movzbl 0x29(%rax), %eax
movq -0x10(%rsp), %rcx
movzbl 0x24(%rcx), %ecx
imull %ecx, %eax
movb %al, %cl
movq -0x10(%rsp), %rax
movb %cl, 0x2a(%rax)
movq -0x10(%rsp), %rax
movzbl 0x2a(%rax), %eax
cmpl $0x8, %eax
jl 0x10a6a1
movq -0x10(%rsp), %rax
movl (%rax), %eax
movq -0x10(%rsp), %rcx
movzbl 0x2a(%rcx), %ecx
shrq $0x3, %rcx
imulq %rcx, %rax
movq %rax, -0x18(%rsp)
jmp 0x10a6c2
movq -0x10(%rsp), %rax
movl (%rax), %eax
movq -0x10(%rsp), %rcx
movzbl 0x2a(%rcx), %ecx
imulq %rcx, %rax
addq $0x7, %rax
shrq $0x3, %rax
movq %rax, -0x18(%rsp)
movq -0x18(%rsp), %rcx
movq -0x10(%rsp), %rax
movq %rcx, 0x10(%rax)
retq
nopw %cs:(%rax,%rax)