// File: /workspace/github_cpp_makefile_star2_O3/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 0x9d008
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cmpb $0x0, 0x24b(%rdi)
je 0x9ce2c
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 0x15a94(%rip), %rsi     # 0xb2830
leaq 0x15a6d(%rip), %rdi     # 0xb2810
leaq 0x15a46(%rip), %r8      # 0xb27f0
leaq 0x15a1f(%rip), %r9      # 0xb27d0
movl %eax, %r10d
cmpb $0x6, %al
ja 0x9ce25
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 0x9ce19
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 0x9cdb1
movb %r10b, 0x24c(%rbx)
jmp 0x9cffa
movb %r10b, 0x24c(%rbx)
testb $0x20, 0x120(%rbx)
jne 0x9cfc6
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 0x9cf58
jmp 0x9cf06
movq %rbx, %rdi
xorl %esi, %esi
callq 0x99b4f
movl $0x4, %edx
movq %rbx, %rdi
leaq 0xb(%rsp), %rsi
callq 0x8b300
movzbl 0xb(%rsp), %r13d
shll $0x18, %r13d
movzbl 0xc(%rsp), %ebp
movzbl 0xd(%rsp), %r14d
movzbl 0xe(%rsp), %r12d
jns 0x9cebc
movq %rbx, %rdi
leaq 0x15999(%rip), %rsi     # 0xb2850
callq 0x920b4
shll $0x10, %ebp
orl %r12d, %ebp
shll $0x8, %r14d
orl %ebp, %r14d
orl %r13d, %r14d
movl %r14d, 0x230(%rbx)
movq %rbx, %rdi
callq 0x86daf
movl $0x4, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x99b23
cmpl $0x54414449, 0x244(%rbx) # imm = 0x54414449
je 0x9cf06
movq %rbx, %rdi
leaq 0xfadc(%rip), %rsi      # 0xac9dd
callq 0x920b4
movl 0x230(%rbx), %eax
testl %eax, %eax
je 0x9ce74
movq 0x198(%rbx), %rsi
movq 0x1a0(%rbx), %rdx
movl %edx, 0x130(%rbx)
movq %rsi, 0x128(%rbx)
movl %eax, %ecx
cmpq %rcx, %rdx
jbe 0x9cf3f
movl %eax, 0x130(%rbx)
movq %rcx, %rdx
movq %rbx, %rdi
callq 0x99b23
movl 0x130(%rbx), %eax
subl %eax, 0x230(%rbx)
movq 0x10(%rsp), %r14
movq %r14, %rdi
movl $0x1, %esi
callq 0x9516a
testl %eax, %eax
je 0x9cf8f
cmpl $0x1, %eax
je 0x9d009
movq 0x158(%rbx), %rsi
testq %rsi, %rsi
leaq 0x1671f(%rip), %rax     # 0xb36a2
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0x920b4
cmpl $0x0, 0x148(%rbx)
jne 0x9ce62
leaq 0xfa50(%rip), %rsi      # 0xac9f3
movq %rbx, %rdi
callq 0x9214d
movabsq $0x2000000008, %rax     # imm = 0x2000000008
orq %rax, 0x11c(%rbx)
movl $0x0, 0x148(%rbx)
cmpl $0x0, 0x230(%rbx)
jne 0x9cfd8
cmpl $0x0, 0x130(%rbx)
je 0x9cfe7
leaq 0x166d7(%rip), %rsi     # 0xb36b6
movq %rbx, %rdi
callq 0x9214d
leaq 0x128(%rbx), %rdi
callq 0x94f20
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 0x9cf9c
cmpl $0x0, 0x130(%rbx)
jne 0x9cf9c
cmpl $0x0, 0x230(%rbx)
jne 0x9cf9c
jmp 0x9cfab