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

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

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

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

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

   int ret;

   png_debug(1, "in png_write_finish_row");

   /* Next row */
   png_ptr->row_number++;

   /* See if we are done */
   if (png_ptr->row_number < png_ptr->num_rows)
      return;

#ifdef PNG_WRITE_INTERLACING_SUPPORTED
   /* If interlaced, go to next pass */
   if (png_ptr->interlaced)
   {
      png_ptr->row_number = 0;
      if (png_ptr->transformations & PNG_INTERLACE)
      {
         png_ptr->pass++;
      }
      else
      {
         /* Loop until we find a non-zero width or height pass */
         do
         {
            png_ptr->pass++;
            if (png_ptr->pass >= 7)
               break;
            png_ptr->usr_width = (png_ptr->width +
               png_pass_inc[png_ptr->pass] - 1 -
               png_pass_start[png_ptr->pass]) /
               png_pass_inc[png_ptr->pass];
            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->transformations & PNG_INTERLACE)
               break;
         } while (png_ptr->usr_width == 0 || png_ptr->num_rows == 0);

      }

      /* Reset the row above the image for the next pass */
      if (png_ptr->pass < 7)
      {
         if (png_ptr->prev_row != NULL)
            png_memset(png_ptr->prev_row, 0,
               (png_size_t)(PNG_ROWBYTES(png_ptr->usr_channels*
               png_ptr->usr_bit_depth, png_ptr->width)) + 1);
         return;
      }
   }
#endif

   /* If we get here, we've just written the last row, so we need
      to flush the compressor */
   do
   {
      /* Tell the compressor we are done */
      ret = deflate(&png_ptr->zstream, Z_FINISH);
      /* Check for an error */
      if (ret == Z_OK)
      {
         /* Check to see if we need more room */
         if (!(png_ptr->zstream.avail_out))
         {
            png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);
            png_ptr->zstream.next_out = png_ptr->zbuf;
            png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
         }
      }
      else if (ret != Z_STREAM_END)
      {
         if (png_ptr->zstream.msg != NULL)
            png_error(png_ptr, png_ptr->zstream.msg);
         else
            png_error(png_ptr, "zlib error");
      }
   } while (ret != Z_STREAM_END);

   /* Write any extra space */
   if (png_ptr->zstream.avail_out < png_ptr->zbuf_size)
   {
      png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size -
         png_ptr->zstream.avail_out);
   }

   deflateReset(&png_ptr->zstream);
   png_ptr->zstream.data_type = Z_BINARY;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl 0x1e4(%rdi), %eax
incl %eax
movl %eax, 0x1e4(%rdi)
cmpl 0x1c4(%rdi), %eax
jb 0x9fb29
movq %rdi, %rbx
cmpb $0x0, 0x24b(%rdi)
je 0x9fa7e
movl $0x0, 0x1e4(%rbx)
testb $0x2, 0x124(%rbx)
movb 0x24c(%rbx), %al
jne 0x9fa30
incb %al
leaq 0x14193(%rip), %rdi     # 0xb3b50
leaq 0x1416c(%rip), %r9      # 0xb3b30
leaq 0x14145(%rip), %r10     # 0xb3b10
leaq 0x1411e(%rip), %r11     # 0xb3af0
movl %eax, %r8d
cmpb $0x6, %al
ja 0x9fa35
movzbl %r8b, %ecx
shll $0x2, %ecx
movl (%rcx,%rdi), %ebp
movl 0x1bc(%rbx), %eax
addl %ebp, %eax
movl (%rcx,%r9), %esi
notl %esi
addl %eax, %esi
movl %esi, %eax
xorl %edx, %edx
divl %ebp
movl %eax, 0x1c8(%rbx)
movl (%rcx,%r10), %r14d
movl 0x1c0(%rbx), %eax
addl %r14d, %eax
movl (%rcx,%r11), %ecx
notl %ecx
addl %eax, %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %r14d
movl %eax, 0x1c4(%rbx)
leal 0x1(%r8), %eax
cmpl %esi, %ebp
ja 0x9f9d2
cmpl %ecx, %r14d
ja 0x9f9d2
jmp 0x9fa35
incb %al
movl %eax, %r8d
movb %r8b, 0x24c(%rbx)
cmpb $0x6, %r8b
ja 0x9fa7e
movq 0x1e8(%rbx), %rdi
testq %rdi, %rdi
je 0x9fb29
movzbl 0x253(%rbx), %ecx
movzbl 0x250(%rbx), %eax
imull %ecx, %eax
movl 0x1bc(%rbx), %edx
cmpl $0x8, %eax
jb 0x9fb34
shrl $0x3, %eax
imulq %rax, %rdx
jmp 0x9fb42
leaq 0x128(%rbx), %r14
leaq 0xce76(%rip), %r15      # 0xac902
movq %r14, %rdi
movl $0x4, %esi
callq 0x92f18
testl %eax, %eax
je 0x9fabb
cmpl $0x1, %eax
je 0x9faf6
movq 0x158(%rbx), %rsi
movq %rbx, %rdi
testq %rsi, %rsi
jne 0x9fab4
movq %r15, %rsi
callq 0x920b4
jmp 0x9fa8c
cmpl $0x0, 0x148(%rbx)
jne 0x9fa8c
movq 0x198(%rbx), %rsi
movq 0x1a0(%rbx), %rdx
movq %rbx, %rdi
callq 0x9ded8
movq 0x198(%rbx), %rax
movq %rax, 0x140(%rbx)
movl 0x1a0(%rbx), %eax
movl %eax, 0x148(%rbx)
jmp 0x9fa8c
movl 0x148(%rbx), %eax
movq 0x1a0(%rbx), %rdx
subq %rax, %rdx
jbe 0x9fb17
movq 0x198(%rbx), %rsi
movq %rbx, %rdi
callq 0x9ded8
movq %r14, %rdi
callq 0x92b77
movl $0x0, 0x180(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %eax
imulq %rax, %rdx
addq $0x7, %rdx
shrq $0x3, %rdx
incq %rdx
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xe260