// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/png/pngread.c
// Function: png_read_row
void PNGAPI
png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
{
   PNG_IDAT;
   PNG_CONST int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55,
      0xff};
   PNG_CONST int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
   int ret;
 
   if (png_ptr == NULL)
      return;
 
   png_debug2(1, "in png_read_row (row %lu, pass %d)",
      (unsigned long) png_ptr->row_number, png_ptr->pass);

   if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
      png_read_start_row(png_ptr);
   if (png_ptr->row_number == 0 && png_ptr->pass == 0)
   {
   /* Check for transforms that have been set but were defined out */
#if defined(PNG_WRITE_INVERT_SUPPORTED) && !defined(PNG_READ_INVERT_SUPPORTED)
   if (png_ptr->transformations & PNG_INVERT_MONO)
      png_warning(png_ptr, "PNG_READ_INVERT_SUPPORTED is not defined");
#endif
#if defined(PNG_WRITE_FILLER_SUPPORTED) && !defined(PNG_READ_FILLER_SUPPORTED)
   if (png_ptr->transformations & PNG_FILLER)
      png_warning(png_ptr, "PNG_READ_FILLER_SUPPORTED is not defined");
#endif
#if defined(PNG_WRITE_PACKSWAP_SUPPORTED) && \
    !defined(PNG_READ_PACKSWAP_SUPPORTED)
   if (png_ptr->transformations & PNG_PACKSWAP)
      png_warning(png_ptr, "PNG_READ_PACKSWAP_SUPPORTED is not defined");
#endif
#if defined(PNG_WRITE_PACK_SUPPORTED) && !defined(PNG_READ_PACK_SUPPORTED)
   if (png_ptr->transformations & PNG_PACK)
      png_warning(png_ptr, "PNG_READ_PACK_SUPPORTED is not defined");
#endif
#if defined(PNG_WRITE_SHIFT_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED)
   if (png_ptr->transformations & PNG_SHIFT)
      png_warning(png_ptr, "PNG_READ_SHIFT_SUPPORTED is not defined");
#endif
#if defined(PNG_WRITE_BGR_SUPPORTED) && !defined(PNG_READ_BGR_SUPPORTED)
   if (png_ptr->transformations & PNG_BGR)
      png_warning(png_ptr, "PNG_READ_BGR_SUPPORTED is not defined");
#endif
#if defined(PNG_WRITE_SWAP_SUPPORTED) && !defined(PNG_READ_SWAP_SUPPORTED)
   if (png_ptr->transformations & PNG_SWAP_BYTES)
      png_warning(png_ptr, "PNG_READ_SWAP_SUPPORTED is not defined");
#endif
   }

#ifdef PNG_READ_INTERLACING_SUPPORTED
   /* If interlaced and we do not need a new row, combine row and return */
   if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
   {
      switch (png_ptr->pass)
      {
         case 0:
            if (png_ptr->row_number & 0x07)
            {
               if (dsp_row != NULL)
                  png_combine_row(png_ptr, dsp_row,
                     png_pass_dsp_mask[png_ptr->pass]);
               png_read_finish_row(png_ptr);
               return;
            }
            break;
         case 1:
            if ((png_ptr->row_number & 0x07) || png_ptr->width < 5)
            {
               if (dsp_row != NULL)
                  png_combine_row(png_ptr, dsp_row,
                     png_pass_dsp_mask[png_ptr->pass]);
               png_read_finish_row(png_ptr);
               return;
            }
            break;
         case 2:
            if ((png_ptr->row_number & 0x07) != 4)
            {
               if (dsp_row != NULL && (png_ptr->row_number & 4))
                  png_combine_row(png_ptr, dsp_row,
                     png_pass_dsp_mask[png_ptr->pass]);
               png_read_finish_row(png_ptr);
               return;
            }
            break;
         case 3:
            if ((png_ptr->row_number & 3) || png_ptr->width < 3)
            {
               if (dsp_row != NULL)
                  png_combine_row(png_ptr, dsp_row,
                     png_pass_dsp_mask[png_ptr->pass]);
               png_read_finish_row(png_ptr);
               return;
            }
            break;
         case 4:
            if ((png_ptr->row_number & 3) != 2)
            {
               if (dsp_row != NULL && (png_ptr->row_number & 2))
                  png_combine_row(png_ptr, dsp_row,
                     png_pass_dsp_mask[png_ptr->pass]);
               png_read_finish_row(png_ptr);
               return;
            }
            break;
         case 5:
            if ((png_ptr->row_number & 1) || png_ptr->width < 2)
            {
               if (dsp_row != NULL)
                  png_combine_row(png_ptr, dsp_row,
                     png_pass_dsp_mask[png_ptr->pass]);
               png_read_finish_row(png_ptr);
               return;
            }
            break;
         case 6:
            if (!(png_ptr->row_number & 1))
            {
               png_read_finish_row(png_ptr);
               return;
            }
            break;
      }
   }
#endif

   if (!(png_ptr->mode & PNG_HAVE_IDAT))
      png_error(png_ptr, "Invalid attempt to read row data");

   png_ptr->zstream.next_out = png_ptr->row_buf;
   png_ptr->zstream.avail_out =
       (uInt)(PNG_ROWBYTES(png_ptr->pixel_depth,
       png_ptr->iwidth) + 1);
   do
   {
      if (!(png_ptr->zstream.avail_in))
      {
         while (!png_ptr->idat_size)
         {
            png_crc_finish(png_ptr, 0);

            png_ptr->idat_size = png_read_chunk_header(png_ptr);
            if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
               png_error(png_ptr, "Not enough image data");
         }
         png_ptr->zstream.avail_in = (uInt)png_ptr->zbuf_size;
         png_ptr->zstream.next_in = png_ptr->zbuf;
         if (png_ptr->zbuf_size > png_ptr->idat_size)
            png_ptr->zstream.avail_in = (uInt)png_ptr->idat_size;
         png_crc_read(png_ptr, png_ptr->zbuf,
            (png_size_t)png_ptr->zstream.avail_in);
         png_ptr->idat_size -= png_ptr->zstream.avail_in;
      }
      ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH);
      if (ret == Z_STREAM_END)
      {
         if (png_ptr->zstream.avail_out || png_ptr->zstream.avail_in ||
            png_ptr->idat_size)
            png_benign_error(png_ptr, "Extra compressed data");
         png_ptr->mode |= PNG_AFTER_IDAT;
         png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
         break;
      }
      if (ret != Z_OK)
         png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg :
                   "Decompression error");

   } while (png_ptr->zstream.avail_out);

   png_ptr->row_info.color_type = png_ptr->color_type;
   png_ptr->row_info.width = png_ptr->iwidth;
   png_ptr->row_info.channels = png_ptr->channels;
   png_ptr->row_info.bit_depth = png_ptr->bit_depth;
   png_ptr->row_info.pixel_depth = png_ptr->pixel_depth;
   png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
       png_ptr->row_info.width);

   if (png_ptr->row_buf[0])
   png_read_filter_row(png_ptr, &(png_ptr->row_info),
      png_ptr->row_buf + 1, png_ptr->prev_row + 1,
      (int)(png_ptr->row_buf[0]));

   png_memcpy(png_ptr->prev_row, png_ptr->row_buf, png_ptr->rowbytes + 1);

#ifdef PNG_MNG_FEATURES_SUPPORTED
   if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
      (png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
   {
      /* Intrapixel differencing */
      png_do_read_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1);
   }
#endif


   if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA))
      png_do_read_transformations(png_ptr);

#ifdef PNG_READ_INTERLACING_SUPPORTED
   /* Blow up interlaced rows to full size */
   if (png_ptr->interlaced &&
      (png_ptr->transformations & PNG_INTERLACE))
   {
      if (png_ptr->pass < 6)
         /* Old interface (pre-1.0.9):
          * png_do_read_interlace(&(png_ptr->row_info),
          *    png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
          */
         png_do_read_interlace(png_ptr);

      if (dsp_row != NULL)
         png_combine_row(png_ptr, dsp_row,
            png_pass_dsp_mask[png_ptr->pass]);
      if (row != NULL)
         png_combine_row(png_ptr, row,
            png_pass_mask[png_ptr->pass]);
   }
   else
#endif
   {
      if (row != NULL)
         png_combine_row(png_ptr, row, 0xff);
      if (dsp_row != NULL)
         png_combine_row(png_ptr, dsp_row, 0xff);
   }
   png_read_finish_row(png_ptr);

   if (png_ptr->read_row_fn != NULL)
      (*(png_ptr->read_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x8a7ca
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
testb $0x40, 0x120(%rdi)
jne 0x8a46e
movq %rbx, %rdi
callq 0x9d02a
cmpb $0x0, 0x24b(%rbx)
je 0x8a484
testb $0x2, 0x124(%rbx)
jne 0x8a5ad
testb $0x4, 0x11c(%rbx)
jne 0x8a49c
leaq 0x22528(%rip), %rsi     # 0xac9bc
movq %rbx, %rdi
callq 0x920b4
movq 0x1f0(%rbx), %rax
movq %rax, 0x140(%rbx)
movzbl 0x251(%rbx), %ecx
movl 0x1e0(%rbx), %eax
cmpq $0x8, %rcx
jb 0x8a4c6
shrl $0x3, %ecx
imulq %rcx, %rax
jmp 0x8a4d2
imulq %rcx, %rax
addq $0x7, %rax
shrq $0x3, %rax
leaq 0x128(%rbx), %r12
incl %eax
movl %eax, 0x148(%rbx)
leaq 0x224f5(%rip), %r13     # 0xac9dd
leaq 0x2251a(%rip), %rbp     # 0xaca09
cmpl $0x0, 0x130(%rbx)
jne 0x8a572
movl 0x230(%rbx), %eax
testl %eax, %eax
jne 0x8a533
movq %rbx, %rdi
xorl %esi, %esi
callq 0x99b4f
movq %rbx, %rdi
callq 0x99a09
movl %eax, 0x230(%rbx)
cmpl $0x54414449, 0x244(%rbx) # imm = 0x54414449
je 0x8a4fe
movq %rbx, %rdi
movq %r13, %rsi
callq 0x920b4
jmp 0x8a4f8
movq 0x198(%rbx), %rsi
movq 0x1a0(%rbx), %rdx
movl %edx, 0x130(%rbx)
movq %rsi, 0x128(%rbx)
movl %eax, %ecx
cmpq %rcx, %rdx
jbe 0x8a55e
movl %eax, 0x130(%rbx)
movq %rcx, %rdx
movq %rbx, %rdi
callq 0x99b23
movl 0x130(%rbx), %eax
subl %eax, 0x230(%rbx)
movq %r12, %rdi
movl $0x1, %esi
callq 0x9516a
testl %eax, %eax
je 0x8a59e
cmpl $0x1, %eax
je 0x8a5ea
movq 0x158(%rbx), %rsi
testq %rsi, %rsi
cmoveq %rbp, %rsi
movq %rbx, %rdi
callq 0x920b4
cmpl $0x0, 0x148(%rbx)
jne 0x8a4ef
jmp 0x8a625
movzbl 0x24c(%rbx), %ecx
cmpq $0x6, %rcx
ja 0x8a484
movl 0x1e4(%rbx), %eax
leaq 0x22201(%rip), %rdx     # 0xac7cc
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
testb $0x7, %al
je 0x8a484
testq %r14, %r14
jne 0x8a80e
jmp 0x8a887
cmpl $0x0, 0x148(%rbx)
jne 0x8a605
cmpl $0x0, 0x130(%rbx)
jne 0x8a605
cmpl $0x0, 0x230(%rbx)
je 0x8a614
leaq 0x223e7(%rip), %rsi     # 0xac9f3
movq %rbx, %rdi
callq 0x920b4
movabsq $0x2000000008, %rax     # imm = 0x2000000008
orq %rax, 0x11c(%rbx)
movzwl 0x24e(%rbx), %eax
movw %ax, 0x228(%rbx)
movl 0x1e0(%rbx), %ecx
movl %ecx, 0x218(%rbx)
movb 0x252(%rbx), %al
movb %al, 0x22a(%rbx)
movzbl 0x251(%rbx), %eax
movb %al, 0x22b(%rbx)
cmpq $0x8, %rax
jb 0x8a667
shrl $0x3, %eax
imulq %rcx, %rax
jmp 0x8a673
imulq %rcx, %rax
addq $0x7, %rax
shrq $0x3, %rax
leaq 0x218(%rbx), %r12
movq %rax, 0x220(%rbx)
movq 0x1f0(%rbx), %rax
movzbl (%rax), %r8d
testl %r8d, %r8d
je 0x8a6b3
incq %rax
movq 0x1e8(%rbx), %rcx
incq %rcx
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x9cb9a
movq 0x1f0(%rbx), %rax
movq 0x1d0(%rbx), %rdx
movq 0x1e8(%rbx), %rdi
incq %rdx
movq %rax, %rsi
callq 0xe370
testb $0x4, 0x408(%rbx)
je 0x8a6f0
cmpb $0x40, 0x410(%rbx)
jne 0x8a6f0
movq 0x1f0(%rbx), %rsi
incq %rsi
movq %r12, %rdi
callq 0x91736
cmpl $0x0, 0x124(%rbx)
jne 0x8a702
testb $0x40, 0x122(%rbx)
je 0x8a70a
movq %rbx, %rdi
callq 0x8e9c0
cmpb $0x0, 0x24b(%rbx)
je 0x8a71c
testb $0x2, 0x124(%rbx)
jne 0x8a743
testq %r15, %r15
je 0x8a731
movq %rbx, %rdi
movq %r15, %rsi
movl $0xff, %edx
callq 0x9c4c8
testq %r14, %r14
je 0x8a796
movq %rbx, %rdi
movq %r14, %rsi
movl $0xff, %edx
jmp 0x8a791
cmpb $0x5, 0x24c(%rbx)
ja 0x8a754
movq %rbx, %rdi
callq 0x9c7b6
testq %r14, %r14
je 0x8a775
movzbl 0x24c(%rbx), %eax
leaq 0x22089(%rip), %rcx     # 0xac7f0
movl (%rcx,%rax,4), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9c4c8
testq %r15, %r15
je 0x8a796
movzbl 0x24c(%rbx), %eax
leaq 0x22088(%rip), %rcx     # 0xac810
movl (%rcx,%rax,4), %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9c4c8
movq %rbx, %rdi
callq 0x9cd33
movq 0x2f0(%rbx), %rax
testq %rax, %rax
je 0x8a7ca
movl 0x1e4(%rbx), %esi
movzbl 0x24c(%rbx), %edx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %ecx
andl $0x3, %ecx
cmpl $0x2, %ecx
je 0x8a484
testq %r14, %r14
sete %cl
testb $0x2, %al
jmp 0x8a807
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
je 0x8a484
testq %r14, %r14
sete %cl
testb $0x4, %al
sete %al
orb %cl, %al
jne 0x8a887
movq %rbx, %rdi
movq %r14, %rsi
movl $0xff, %edx
jmp 0x8a882
testb $0x3, %al
jne 0x8a82c
cmpl $0x2, 0x1bc(%rbx)
ja 0x8a484
testq %r14, %r14
je 0x8a887
movq %rbx, %rdi
movq %r14, %rsi
movl $0x33, %edx
jmp 0x8a882
testb $0x7, %al
jne 0x8a84f
cmpl $0x4, 0x1bc(%rbx)
ja 0x8a484
testq %r14, %r14
je 0x8a887
movq %rbx, %rdi
movq %r14, %rsi
movl $0xf, %edx
jmp 0x8a882
testb $0x1, %al
jne 0x8a872
cmpl $0x1, 0x1bc(%rbx)
ja 0x8a484
testq %r14, %r14
je 0x8a887
movq %rbx, %rdi
movq %r14, %rsi
movl $0x55, %edx
callq 0x9c4c8
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9cd33
testb $0x1, %al
jne 0x8a484
jmp 0x8a887