// File: /workspace/github_cpp_makefile_star2_O1/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 0x9da0a
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cmpb $0x0, 0x24b(%rdi)
je 0x9d82b
movl $0x0, 0x1e4(%rbx)
movq 0x1d0(%rbx), %rdx
movq 0x1e8(%rbx), %rdi
incq %rdx
xorl %esi, %esi
callq 0xe260
movb 0x24c(%rbx), %al
incb %al
leaq 0x15043(%rip), %rsi     # 0xb27e0
leaq 0x1501c(%rip), %rdi     # 0xb27c0
leaq 0x14ff5(%rip), %r8      # 0xb27a0
leaq 0x14fce(%rip), %r9      # 0xb2780
movl %eax, %r10d
cmpb $0x6, %al
ja 0x9d81a
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 0x9d81a
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 0x9d7b2
movb %r10b, 0x24c(%rbx)
cmpb $0x7, %r10b
jb 0x9d9fc
testb $0x20, 0x120(%rbx)
jne 0x9d9c8
leaq 0x128(%rbx), %r14
leaq 0xf(%rsp), %rax
movq %rax, 0x140(%rbx)
movl $0x1, 0x148(%rbx)
leaq 0x244(%rbx), %r15
movq %r14, 0x10(%rsp)
cmpl $0x0, 0x130(%rbx)
jne 0x9d95a
jmp 0x9d905
movq %rbx, %rdi
xorl %esi, %esi
callq 0x9a507
movl $0x4, %edx
movq %rbx, %rdi
leaq 0xb(%rsp), %rsi
callq 0x8c0a8
movzbl 0xb(%rsp), %r13d
shll $0x18, %r13d
movzbl 0xc(%rsp), %ebp
movzbl 0xd(%rsp), %r14d
movzbl 0xe(%rsp), %r12d
jns 0x9d8bb
movq %rbx, %rdi
leaq 0x14f46(%rip), %rsi     # 0xb27fc
callq 0x92dd0
shll $0x10, %ebp
orl %r12d, %ebp
shll $0x8, %r14d
orl %ebp, %r14d
orl %r13d, %r14d
movl %r14d, 0x230(%rbx)
movq %rbx, %rdi
callq 0x87b84
movl $0x4, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9a4db
cmpl $0x54414449, 0x244(%rbx) # imm = 0x54414449
je 0x9d905
movq %rbx, %rdi
leaq 0xf09d(%rip), %rsi      # 0xac99d
callq 0x92dd0
movl 0x230(%rbx), %eax
testl %eax, %eax
je 0x9d873
movq 0x198(%rbx), %rsi
movq 0x1a0(%rbx), %rcx
movl %ecx, 0x130(%rbx)
movq %rsi, 0x128(%rbx)
movl %eax, %edx
cmpq %rdx, %rcx
jbe 0x9d93b
movl %eax, 0x130(%rbx)
movl 0x130(%rbx), %edx
movq %rbx, %rdi
callq 0x9a4db
movl 0x130(%rbx), %eax
subl %eax, 0x230(%rbx)
movq 0x10(%rsp), %r14
movq %r14, %rdi
movl $0x1, %esi
callq 0x95e04
testl %eax, %eax
je 0x9d991
cmpl $0x1, %eax
je 0x9da0b
movq 0x158(%rbx), %rsi
testq %rsi, %rsi
leaq 0x15cc9(%rip), %rax     # 0xb364e
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0x92dd0
cmpl $0x0, 0x148(%rbx)
jne 0x9d861
leaq 0xf00e(%rip), %rsi      # 0xac9b3
movq %rbx, %rdi
callq 0x92e6e
movabsq $0x2000000008, %rax     # imm = 0x2000000008
orq %rax, 0x11c(%rbx)
movl $0x0, 0x148(%rbx)
cmpl $0x0, 0x230(%rbx)
jne 0x9d9da
cmpl $0x0, 0x130(%rbx)
je 0x9d9e9
leaq 0x15c81(%rip), %rsi     # 0xb3662
movq %rbx, %rdi
callq 0x92e6e
leaq 0x128(%rbx), %rdi
callq 0x95bc0
orb $0x8, 0x11c(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x0, 0x148(%rbx)
je 0x9d99e
cmpl $0x0, 0x130(%rbx)
jne 0x9d99e
cmpl $0x0, 0x230(%rbx)
jne 0x9d99e
jmp 0x9d9ad