// File: /workspace/github_cpp_makefile_star2_O2/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
subq $0x18, %rsp
testq %rdi, %rdi
je 0x7d599
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
testb $0x40, 0x120(%rdi)
jne 0x7d226
movq %rbx, %rdi
callq 0x8e9df
cmpb $0x0, 0x24b(%rbx)
je 0x7d23c
testb $0x2, 0x124(%rbx)
jne 0x7d372
testb $0x4, 0x11c(%rbx)
jne 0x7d254
leaq 0x20450(%rip), %rsi     # 0x9d69c
movq %rbx, %rdi
callq 0x849c0
movq 0x1f0(%rbx), %rax
movq %rax, 0x140(%rbx)
movzbl 0x251(%rbx), %ecx
movl 0x1e0(%rbx), %eax
cmpq $0x8, %rcx
movq %r14, 0x10(%rsp)
movq %r15, 0x8(%rsp)
jb 0x7d288
shrl $0x3, %ecx
imulq %rcx, %rax
jmp 0x7d294
imulq %rcx, %rax
addq $0x7, %rax
shrq $0x3, %rax
leaq 0x128(%rbx), %r12
incl %eax
movl %eax, 0x148(%rbx)
leaq 0x244(%rbx), %r14
leaq 0x2040c(%rip), %r13     # 0x9d6bd
pushq $0x1
popq %rbp
leaq 0x2042e(%rip), %r15     # 0x9d6e9
cmpl $0x0, 0x130(%rbx)
jne 0x7d33a
jmp 0x7d2f2
movq %rbx, %rdi
xorl %esi, %esi
callq 0x8b703
movq %rbx, %rdi
callq 0x8b5f5
movl %eax, 0x230(%rbx)
cmpl $0x54414449, (%r14)     # imm = 0x54414449
je 0x7d2f2
movq %rbx, %rdi
movq %r13, %rsi
callq 0x849c0
movl 0x230(%rbx), %eax
testq %rax, %rax
je 0x7d2c6
movq 0x198(%rbx), %rsi
movq 0x1a0(%rbx), %rdx
movl %edx, 0x130(%rbx)
movq %rsi, 0x128(%rbx)
cmpq %rax, %rdx
jbe 0x7d326
movl %eax, 0x130(%rbx)
movq %rax, %rdx
movq %rbx, %rdi
callq 0x8b6d7
movl 0x130(%rbx), %eax
subl %eax, 0x230(%rbx)
movq %r12, %rdi
movl %ebp, %esi
callq 0x877fc
testl %eax, %eax
je 0x7d363
cmpl $0x1, %eax
je 0x7d3af
movq 0x158(%rbx), %rsi
testq %rsi, %rsi
cmoveq %r15, %rsi
movq %rbx, %rdi
callq 0x849c0
cmpl $0x0, 0x148(%rbx)
jne 0x7d2bb
jmp 0x7d3ea
movzbl 0x24c(%rbx), %ecx
cmpq $0x6, %rcx
ja 0x7d23c
movl 0x1e4(%rbx), %eax
leaq 0x2011c(%rip), %rdx     # 0x9d4ac
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
testb $0x7, %al
je 0x7d23c
testq %r14, %r14
jne 0x7d5dd
jmp 0x7d642
cmpl $0x0, 0x148(%rbx)
jne 0x7d3ca
cmpl $0x0, 0x130(%rbx)
jne 0x7d3ca
cmpl $0x0, 0x230(%rbx)
je 0x7d3d9
leaq 0x20302(%rip), %rsi     # 0x9d6d3
movq %rbx, %rdi
callq 0x849c0
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 0x7d42c
shrl $0x3, %eax
imulq %rcx, %rax
jmp 0x7d438
imulq %rcx, %rax
addq $0x7, %rax
shrq $0x3, %rax
movq 0x10(%rsp), %r14
movq 0x8(%rsp), %r15
leaq 0x218(%rbx), %r12
movq %rax, 0x220(%rbx)
movq 0x1f0(%rbx), %rax
movzbl (%rax), %r8d
testl %r8d, %r8d
je 0x7d482
incq %rax
movq 0x1e8(%rbx), %rcx
incq %rcx
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x8e5cc
movq 0x1f0(%rbx), %rax
movq 0x1d0(%rbx), %rdx
movq 0x1e8(%rbx), %rdi
incq %rdx
movq %rax, %rsi
callq 0xe380
testb $0x4, 0x408(%rbx)
je 0x7d4bf
cmpb $0x40, 0x410(%rbx)
jne 0x7d4bf
movq 0x1f0(%rbx), %rsi
incq %rsi
movq %r12, %rdi
callq 0x840a8
cmpl $0x0, 0x124(%rbx)
jne 0x7d4d1
testb $0x40, 0x122(%rbx)
je 0x7d4d9
movq %rbx, %rdi
callq 0x815bd
cmpb $0x0, 0x24b(%rbx)
je 0x7d4eb
testb $0x2, 0x124(%rbx)
jne 0x7d512
testq %r15, %r15
je 0x7d500
movq %rbx, %rdi
movq %r15, %rsi
movl $0xff, %edx
callq 0x8df71
testq %r14, %r14
je 0x7d565
movq %rbx, %rdi
movq %r14, %rsi
movl $0xff, %edx
jmp 0x7d560
cmpb $0x5, 0x24c(%rbx)
ja 0x7d523
movq %rbx, %rdi
callq 0x8e21b
testq %r14, %r14
je 0x7d544
movzbl 0x24c(%rbx), %eax
leaq 0x1ff9a(%rip), %rcx     # 0x9d4d0
movl (%rcx,%rax,4), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8df71
testq %r15, %r15
je 0x7d565
movzbl 0x24c(%rbx), %eax
leaq 0x1ff99(%rip), %rcx     # 0x9d4f0
movl (%rcx,%rax,4), %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x8df71
movq %rbx, %rdi
callq 0x8e734
movq 0x2f0(%rbx), %rax
testq %rax, %rax
je 0x7d599
movl 0x1e4(%rbx), %esi
movzbl 0x24c(%rbx), %edx
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %ecx
andl $0x3, %ecx
cmpl $0x2, %ecx
je 0x7d23c
testq %r14, %r14
sete %cl
testb $0x2, %al
jmp 0x7d5d6
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
je 0x7d23c
testq %r14, %r14
sete %cl
testb $0x4, %al
sete %al
orb %cl, %al
jne 0x7d642
movq %rbx, %rdi
movq %r14, %rsi
movl $0xff, %edx
jmp 0x7d63d
testb $0x3, %al
jne 0x7d5fb
cmpl $0x2, 0x1bc(%rbx)
ja 0x7d23c
testq %r14, %r14
je 0x7d642
pushq $0x33
jmp 0x7d636
testb $0x7, %al
jne 0x7d615
cmpl $0x4, 0x1bc(%rbx)
ja 0x7d23c
testq %r14, %r14
je 0x7d642
pushq $0xf
jmp 0x7d636
testb $0x1, %al
jne 0x7d62f
cmpl $0x1, 0x1bc(%rbx)
ja 0x7d23c
testq %r14, %r14
je 0x7d642
pushq $0x55
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8df71
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8e734
testb $0x1, %al
jne 0x7d23c
jmp 0x7d642