// File: /workspace/github_cpp_makefile_star2_O1/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 0x8b5b7
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
testb $0x40, 0x120(%rdi)
jne 0x8b266
movq %rbx, %rdi
callq 0x9da2c
cmpb $0x0, 0x24b(%rbx)
je 0x8b27c
testb $0x2, 0x124(%rbx)
jne 0x8b3a8
testb $0x4, 0x11c(%rbx)
jne 0x8b294
leaq 0x216f0(%rip), %rsi     # 0xac97c
movq %rbx, %rdi
callq 0x92dd0
movq 0x1f0(%rbx), %rax
movq %rax, 0x140(%rbx)
movzbl 0x251(%rbx), %ecx
movl 0x1e0(%rbx), %eax
cmpq $0x8, %rcx
jb 0x8b2be
shrl $0x3, %ecx
imulq %rcx, %rax
jmp 0x8b2ca
imulq %rcx, %rax
addq $0x7, %rax
shrq $0x3, %rax
leaq 0x128(%rbx), %r12
incl %eax
movl %eax, 0x148(%rbx)
leaq 0x216bd(%rip), %r13     # 0xac99d
leaq 0x216e2(%rip), %rbp     # 0xac9c9
cmpl $0x0, 0x130(%rbx)
jne 0x8b36d
jmp 0x8b321
movq %rbx, %rdi
xorl %esi, %esi
callq 0x9a507
movq %rbx, %rdi
callq 0x9a3c1
movl %eax, 0x230(%rbx)
cmpl $0x54414449, 0x244(%rbx) # imm = 0x54414449
je 0x8b321
movq %rbx, %rdi
movq %r13, %rsi
callq 0x92dd0
movl 0x230(%rbx), %eax
testl %eax, %eax
je 0x8b2f2
movq 0x198(%rbx), %rsi
movq 0x1a0(%rbx), %rcx
movl %ecx, 0x130(%rbx)
movq %rsi, 0x128(%rbx)
movl %eax, %edx
cmpq %rdx, %rcx
jbe 0x8b353
movl %eax, 0x130(%rbx)
movl 0x130(%rbx), %edx
movq %rbx, %rdi
callq 0x9a4db
movl 0x130(%rbx), %eax
subl %eax, 0x230(%rbx)
movq %r12, %rdi
movl $0x1, %esi
callq 0x95e04
testl %eax, %eax
je 0x8b399
cmpl $0x1, %eax
je 0x8b3dd
movq 0x158(%rbx), %rsi
testq %rsi, %rsi
cmoveq %rbp, %rsi
movq %rbx, %rdi
callq 0x92dd0
cmpl $0x0, 0x148(%rbx)
jne 0x8b2e7
jmp 0x8b418
movzbl 0x24c(%rbx), %eax
cmpq $0x6, %rax
ja 0x8b27c
movl 0x1e4(%rbx), %ecx
leaq 0x213c6(%rip), %rdx     # 0xac78c
movslq (%rdx,%rax,4), %rsi
addq %rdx, %rsi
jmpq *%rsi
testb $0x7, %cl
jne 0x8b639
jmp 0x8b27c
cmpl $0x0, 0x148(%rbx)
jne 0x8b3f8
cmpl $0x0, 0x130(%rbx)
jne 0x8b3f8
cmpl $0x0, 0x230(%rbx)
je 0x8b407
leaq 0x215b4(%rip), %rsi     # 0xac9b3
movq %rbx, %rdi
callq 0x92dd0
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 0x8b45a
shrl $0x3, %eax
imulq %rcx, %rax
jmp 0x8b466
imulq %rcx, %rax
addq $0x7, %rax
shrq $0x3, %rax
leaq 0x218(%rbx), %r12
movq %rax, 0x220(%rbx)
movq 0x1f0(%rbx), %rdx
movzbl (%rdx), %r8d
testl %r8d, %r8d
je 0x8b49c
incq %rdx
movq 0x1e8(%rbx), %rcx
incq %rcx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x9d59b
movq 0x1d0(%rbx), %rdx
movq 0x1e8(%rbx), %rdi
movq 0x1f0(%rbx), %rsi
incq %rdx
callq 0xe370
testb $0x4, 0x408(%rbx)
je 0x8b4dd
cmpb $0x40, 0x410(%rbx)
jne 0x8b4dd
movq 0x1f0(%rbx), %rsi
incq %rsi
movq %r12, %rdi
callq 0x9242d
cmpl $0x0, 0x124(%rbx)
jne 0x8b4ef
testb $0x40, 0x122(%rbx)
je 0x8b4f7
movq %rbx, %rdi
callq 0x8f6cd
cmpb $0x0, 0x24b(%rbx)
je 0x8b509
testb $0x2, 0x124(%rbx)
jne 0x8b530
testq %r15, %r15
je 0x8b51e
movq %rbx, %rdi
movq %r15, %rsi
movl $0xff, %edx
callq 0x9cea0
testq %r14, %r14
je 0x8b583
movq %rbx, %rdi
movq %r14, %rsi
movl $0xff, %edx
jmp 0x8b57e
cmpb $0x5, 0x24c(%rbx)
ja 0x8b541
movq %rbx, %rdi
callq 0x9d18e
testq %r14, %r14
je 0x8b562
movzbl 0x24c(%rbx), %eax
leaq 0x2125c(%rip), %rcx     # 0xac7b0
movl (%rcx,%rax,4), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9cea0
testq %r15, %r15
je 0x8b583
movzbl 0x24c(%rbx), %eax
leaq 0x2125b(%rip), %rcx     # 0xac7d0
movl (%rcx,%rax,4), %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9cea0
movq %rbx, %rdi
callq 0x9d734
movq 0x2f0(%rbx), %rax
testq %rax, %rax
je 0x8b5b7
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 %ecx, %edx
andl $0x3, %edx
cmpl $0x2, %edx
je 0x8b27c
testq %r14, %r14
sete %dl
testb $0x2, %cl
jmp 0x8b5f6
movl %ecx, %edx
andl $0x7, %edx
cmpl $0x4, %edx
je 0x8b27c
testq %r14, %r14
sete %dl
testb $0x4, %cl
sete %cl
orb %dl, %cl
je 0x8b63e
jmp 0x8b653
testb $0x3, %cl
jne 0x8b639
cmpl $0x2, 0x1bc(%rbx)
ja 0x8b27c
jmp 0x8b639
testb $0x7, %cl
jne 0x8b639
cmpl $0x4, 0x1bc(%rbx)
ja 0x8b27c
jmp 0x8b639
testb $0x1, %cl
jne 0x8b639
cmpl $0x1, 0x1bc(%rbx)
ja 0x8b27c
testq %r14, %r14
je 0x8b653
leaq 0x2116b(%rip), %rcx     # 0xac7b0
movl (%rcx,%rax,4), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9cea0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9d734
testb $0x1, %cl
jne 0x8b27c
jmp 0x8b653