// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/png/pngrutil.c
// Function: png_read_finish_row
void /* PRIVATE */
png_read_finish_row(png_structp png_ptr)
{
#ifdef PNG_READ_INTERLACING_SUPPORTED
   /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */

   /* Start of interlace block */
   PNG_CONST int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};

   /* Offset to next interlace block */
   PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};

   /* Start of interlace block in the y direction */
   PNG_CONST int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};

   /* Offset to next interlace block in the y direction */
   PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif /* PNG_READ_INTERLACING_SUPPORTED */

   png_debug(1, "in png_read_finish_row");
   png_ptr->row_number++;
   if (png_ptr->row_number < png_ptr->num_rows)
      return;

#ifdef PNG_READ_INTERLACING_SUPPORTED
   if (png_ptr->interlaced)
   {
      png_ptr->row_number = 0;
      png_memset(png_ptr->prev_row, 0,
         png_ptr->rowbytes + 1);
      do
      {
         png_ptr->pass++;
         if (png_ptr->pass >= 7)
            break;
         png_ptr->iwidth = (png_ptr->width +
            png_pass_inc[png_ptr->pass] - 1 -
            png_pass_start[png_ptr->pass]) /
            png_pass_inc[png_ptr->pass];

         if (!(png_ptr->transformations & PNG_INTERLACE))
         {
            png_ptr->num_rows = (png_ptr->height +
               png_pass_yinc[png_ptr->pass] - 1 -
               png_pass_ystart[png_ptr->pass]) /
               png_pass_yinc[png_ptr->pass];
            if (!(png_ptr->num_rows))
               continue;
         }
         else  /* if (png_ptr->transformations & PNG_INTERLACE) */
            break;
      } while (png_ptr->iwidth == 0);

      if (png_ptr->pass < 7)
         return;
   }
#endif /* PNG_READ_INTERLACING_SUPPORTED */

   if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
   {
      PNG_IDAT;
      char extra;
      int ret;

      png_ptr->zstream.next_out = (Byte *)&extra;
      png_ptr->zstream.avail_out = (uInt)1;
      for (;;)
      {
         if (!(png_ptr->zstream.avail_in))
         {
            while (!png_ptr->idat_size)
            {
               png_byte chunk_length[4];

               png_crc_finish(png_ptr, 0);

               png_read_data(png_ptr, chunk_length, 4);
               png_ptr->idat_size = png_get_uint_31(png_ptr, chunk_length);
               png_reset_crc(png_ptr);
               png_crc_read(png_ptr, png_ptr->chunk_name, 4);
               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_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_warning(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");

         if (!(png_ptr->zstream.avail_out))
         {
            png_warning(png_ptr, "Extra compressed data");
            png_ptr->mode |= PNG_AFTER_IDAT;
            png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
            break;
         }

      }
      png_ptr->zstream.avail_out = 0;
   }

   if (png_ptr->idat_size || png_ptr->zstream.avail_in)
      png_warning(png_ptr, "Extra compression data");

   inflateReset(&png_ptr->zstream);

   png_ptr->mode |= PNG_AFTER_IDAT;
}

// Assembly:
movl 0x1e4(%rdi), %eax
incl %eax
movl %eax, 0x1e4(%rdi)
cmpl 0x1c4(%rdi), %eax
jb 0x8e9bd
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x0, 0x24b(%rdi)
je 0x8e827
andl $0x0, 0x1e4(%rbx)
movq 0x1d0(%rbx), %rdx
movq 0x1e8(%rbx), %rdi
incq %rdx
xorl %esi, %esi
callq 0xe270
movb 0x24c(%rbx), %al
incb %al
leaq 0x14d49(%rip), %rsi     # 0xa34e0
leaq 0x14d22(%rip), %rdi     # 0xa34c0
leaq 0x14cfb(%rip), %r8      # 0xa34a0
leaq 0x14cd4(%rip), %r9      # 0xa3480
movl %eax, %r10d
cmpb $0x6, %al
ja 0x8e820
movzbl %r10b, %r14d
leal (,%r14,4), %eax
movl (%rax,%rsi), %r11d
movl 0x1bc(%rbx), %edx
addl %r11d, %edx
movl (%rax,%rdi), %ecx
notl %ecx
addl %edx, %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %r11d
movl %eax, 0x1e0(%rbx)
testb $0x2, 0x124(%rbx)
jne 0x8e814
shll $0x2, %r14d
movl (%r14,%r8), %ebp
movl 0x1c0(%rbx), %edx
addl %ebp, %edx
movl (%r14,%r9), %eax
notl %eax
addl %edx, %eax
xorl %edx, %edx
divl %ebp
movl %eax, 0x1c4(%rbx)
leal 0x1(%r10), %eax
cmpl %ecx, %r11d
ja 0x8e7ac
movb %r10b, 0x24c(%rbx)
jmp 0x8e9af
movb %r10b, 0x24c(%rbx)
testb $0x20, 0x120(%rbx)
jne 0x8e97b
leaq 0x128(%rbx), %r14
leaq 0x3(%rsp), %rax
movq %rax, 0x140(%rbx)
movl $0x1, 0x148(%rbx)
leaq 0x244(%rbx), %r15
leaq 0x4(%rsp), %r12
pushq $0x4
popq %r13
leaq 0xee55(%rip), %rbp      # 0x9d6bd
cmpl $0x0, 0x130(%rbx)
jne 0x8e912
jmp 0x8e8ca
movq %rbx, %rdi
xorl %esi, %esi
callq 0x8b703
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x7e034
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8b5b0
movl %eax, 0x230(%rbx)
movq %rbx, %rdi
callq 0x7a213
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x8b6d7
cmpl $0x54414449, (%r15)     # imm = 0x54414449
je 0x8e8ca
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x849c0
movl 0x230(%rbx), %eax
testq %rax, %rax
je 0x8e877
movq 0x198(%rbx), %rsi
movq 0x1a0(%rbx), %rdx
movl %edx, 0x130(%rbx)
movq %rsi, 0x128(%rbx)
cmpq %rax, %rdx
jbe 0x8e8fe
movl %eax, 0x130(%rbx)
movq %rax, %rdx
movq %rbx, %rdi
callq 0x8b6d7
movl 0x130(%rbx), %eax
subl %eax, 0x230(%rbx)
movq %r14, %rdi
pushq $0x1
popq %rsi
callq 0x877fc
testl %eax, %eax
je 0x8e947
cmpl $0x1, %eax
je 0x8e9be
movq 0x158(%rbx), %rsi
testq %rsi, %rsi
leaq 0x15a17(%rip), %rax     # 0xa4352
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0x849c0
cmpl $0x0, 0x148(%rbx)
jne 0x8e868
leaq 0xed78(%rip), %rsi      # 0x9d6d3
movq %rbx, %rdi
callq 0x84a53
movabsq $0x2000000008, %rax     # imm = 0x2000000008
orq %rax, 0x11c(%rbx)
andl $0x0, 0x148(%rbx)
cmpl $0x0, 0x230(%rbx)
jne 0x8e98d
cmpl $0x0, 0x130(%rbx)
je 0x8e99c
leaq 0x159d2(%rip), %rsi     # 0xa4366
movq %rbx, %rdi
callq 0x84a53
leaq 0x128(%rbx), %rdi
callq 0x875dc
orb $0x8, 0x11c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x0, 0x148(%rbx)
je 0x8e954
cmpl $0x0, 0x130(%rbx)
jne 0x8e954
cmpl $0x0, 0x230(%rbx)
jne 0x8e954
jmp 0x8e963