// File: tomfunkhouser[P]gaps/pkgs/png/pngwtran.c
// Function: png_do_write_invert_alpha
void /* PRIVATE */
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
{
   png_debug(1, "in png_do_write_invert_alpha");

   {
      if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
      {
         /* This inverts the alpha channel in RGBA */
         if (row_info->bit_depth == 8)
         {
            png_bytep sp, dp;
            png_uint_32 i;
            png_uint_32 row_width = row_info->width;
            for (i = 0, sp = dp = row; i < row_width; i++)
            {
               /* Does nothing
               *(dp++) = *(sp++);
               *(dp++) = *(sp++);
               *(dp++) = *(sp++);
               */
               sp+=3; dp = sp;
               *(dp++) = (png_byte)(255 - *(sp++));
            }
         }
         /* This inverts the alpha channel in RRGGBBAA */
         else
         {
            png_bytep sp, dp;
            png_uint_32 i;
            png_uint_32 row_width = row_info->width;

            for (i = 0, sp = dp = row; i < row_width; i++)
            {
               /* Does nothing
               *(dp++) = *(sp++);
               *(dp++) = *(sp++);
               *(dp++) = *(sp++);
               *(dp++) = *(sp++);
               *(dp++) = *(sp++);
               *(dp++) = *(sp++);
               */
               sp+=6; dp = sp;
               *(dp++) = (png_byte)(255 - *(sp++));
               *(dp++) = (png_byte)(255 - *(sp++));
            }
         }
      }
      else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
      {
         /* This inverts the alpha channel in GA */
         if (row_info->bit_depth == 8)
         {
            png_bytep sp, dp;
            png_uint_32 i;
            png_uint_32 row_width = row_info->width;

            for (i = 0, sp = dp = row; i < row_width; i++)
            {
               *(dp++) = *(sp++);
               *(dp++) = (png_byte)(255 - *(sp++));
            }
         }
         /* This inverts the alpha channel in GGAA */
         else
         {
            png_bytep sp, dp;
            png_uint_32 i;
            png_uint_32 row_width = row_info->width;

            for (i = 0, sp = dp = row; i < row_width; i++)
            {
               /* Does nothing
               *(dp++) = *(sp++);
               *(dp++) = *(sp++);
               */
               sp+=2; dp = sp;
               *(dp++) = (png_byte)(255 - *(sp++));
               *(dp++) = (png_byte)(255 - *(sp++));
            }
         }
      }
   }
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq -0x8(%rsp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x6, %eax
jne 0x112f83
movq -0x8(%rsp), %rax
movzbl 0x11(%rax), %eax
cmpl $0x8, %eax
jne 0x112ec4
movq -0x8(%rsp), %rax
movl (%rax), %eax
movl %eax, -0x28(%rsp)
movl $0x0, -0x24(%rsp)
movq -0x10(%rsp), %rax
movq %rax, -0x20(%rsp)
movq %rax, -0x18(%rsp)
movl -0x24(%rsp), %eax
cmpl -0x28(%rsp), %eax
jae 0x112ebf
movq -0x18(%rsp), %rax
addq $0x3, %rax
movq %rax, -0x18(%rsp)
movq -0x18(%rsp), %rax
movq %rax, -0x20(%rsp)
movq -0x18(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rsp)
movzbl (%rax), %ecx
movl $0xff, %eax
subl %ecx, %eax
movb %al, %cl
movq -0x20(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rsp)
movb %cl, (%rax)
movl -0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rsp)
jmp 0x112e60
jmp 0x112f7e
movq -0x8(%rsp), %rax
movl (%rax), %eax
movl %eax, -0x40(%rsp)
movl $0x0, -0x3c(%rsp)
movq -0x10(%rsp), %rax
movq %rax, -0x38(%rsp)
movq %rax, -0x30(%rsp)
movl -0x3c(%rsp), %eax
cmpl -0x40(%rsp), %eax
jae 0x112f7c
movq -0x30(%rsp), %rax
addq $0x6, %rax
movq %rax, -0x30(%rsp)
movq -0x30(%rsp), %rax
movq %rax, -0x38(%rsp)
movq -0x30(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rsp)
movzbl (%rax), %ecx
movl $0xff, %eax
subl %ecx, %eax
movb %al, %cl
movq -0x38(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rsp)
movb %cl, (%rax)
movq -0x30(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rsp)
movzbl (%rax), %ecx
movl $0xff, %eax
subl %ecx, %eax
movb %al, %cl
movq -0x38(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rsp)
movb %cl, (%rax)
movl -0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rsp)
jmp 0x112ee6
jmp 0x112f7e
jmp 0x1130f9
movq -0x8(%rsp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x4, %eax
jne 0x1130f7
movq -0x8(%rsp), %rax
movzbl 0x11(%rax), %eax
cmpl $0x8, %eax
jne 0x11303b
movq -0x8(%rsp), %rax
movl (%rax), %eax
movl %eax, -0x58(%rsp)
movl $0x0, -0x54(%rsp)
movq -0x10(%rsp), %rax
movq %rax, -0x50(%rsp)
movq %rax, -0x48(%rsp)
movl -0x54(%rsp), %eax
cmpl -0x58(%rsp), %eax
jae 0x113036
movq -0x48(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x48(%rsp)
movb (%rax), %cl
movq -0x50(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x50(%rsp)
movb %cl, (%rax)
movq -0x48(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x48(%rsp)
movzbl (%rax), %ecx
movl $0xff, %eax
subl %ecx, %eax
movb %al, %cl
movq -0x50(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x50(%rsp)
movb %cl, (%rax)
movl -0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rsp)
jmp 0x112fc9
jmp 0x1130f5
movq -0x8(%rsp), %rax
movl (%rax), %eax
movl %eax, -0x70(%rsp)
movl $0x0, -0x6c(%rsp)
movq -0x10(%rsp), %rax
movq %rax, -0x68(%rsp)
movq %rax, -0x60(%rsp)
movl -0x6c(%rsp), %eax
cmpl -0x70(%rsp), %eax
jae 0x1130f3
movq -0x60(%rsp), %rax
addq $0x2, %rax
movq %rax, -0x60(%rsp)
movq -0x60(%rsp), %rax
movq %rax, -0x68(%rsp)
movq -0x60(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x60(%rsp)
movzbl (%rax), %ecx
movl $0xff, %eax
subl %ecx, %eax
movb %al, %cl
movq -0x68(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x68(%rsp)
movb %cl, (%rax)
movq -0x60(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x60(%rsp)
movzbl (%rax), %ecx
movl $0xff, %eax
subl %ecx, %eax
movb %al, %cl
movq -0x68(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x68(%rsp)
movb %cl, (%rax)
movl -0x6c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rsp)
jmp 0x11305d
jmp 0x1130f5
jmp 0x1130f7
jmp 0x1130f9
retq
nopw (%rax,%rax)