// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/png/pngrtran.c
// Function: png_do_read_filler
void /* PRIVATE */
png_do_read_filler(png_row_infop row_info, png_bytep row,
   png_uint_32 filler, png_uint_32 flags)
{
   png_uint_32 i;
   png_uint_32 row_width = row_info->width;

   png_byte hi_filler = (png_byte)((filler>>8) & 0xff);
   png_byte lo_filler = (png_byte)(filler & 0xff);

   png_debug(1, "in png_do_read_filler");

   if (
       row_info->color_type == PNG_COLOR_TYPE_GRAY)
   {
      if (row_info->bit_depth == 8)
      {
         /* This changes the data from G to GX */
         if (flags & PNG_FLAG_FILLER_AFTER)
         {
            png_bytep sp = row + (png_size_t)row_width;
            png_bytep dp =  sp + (png_size_t)row_width;
            for (i = 1; i < row_width; i++)
            {
               *(--dp) = lo_filler;
               *(--dp) = *(--sp);
            }
            *(--dp) = lo_filler;
            row_info->channels = 2;
            row_info->pixel_depth = 16;
            row_info->rowbytes = row_width * 2;
         }
      /* This changes the data from G to XG */
         else
         {
            png_bytep sp = row + (png_size_t)row_width;
            png_bytep dp = sp  + (png_size_t)row_width;
            for (i = 0; i < row_width; i++)
            {
               *(--dp) = *(--sp);
               *(--dp) = lo_filler;
            }
            row_info->channels = 2;
            row_info->pixel_depth = 16;
            row_info->rowbytes = row_width * 2;
         }
      }
      else if (row_info->bit_depth == 16)
      {
         /* This changes the data from GG to GGXX */
         if (flags & PNG_FLAG_FILLER_AFTER)
         {
            png_bytep sp = row + (png_size_t)row_width * 2;
            png_bytep dp = sp  + (png_size_t)row_width * 2;
            for (i = 1; i < row_width; i++)
            {
               *(--dp) = hi_filler;
               *(--dp) = lo_filler;
               *(--dp) = *(--sp);
               *(--dp) = *(--sp);
            }
            *(--dp) = hi_filler;
            *(--dp) = lo_filler;
            row_info->channels = 2;
            row_info->pixel_depth = 32;
            row_info->rowbytes = row_width * 4;
         }
         /* This changes the data from GG to XXGG */
         else
         {
            png_bytep sp = row + (png_size_t)row_width * 2;
            png_bytep dp = sp  + (png_size_t)row_width * 2;
            for (i = 0; i < row_width; i++)
            {
               *(--dp) = *(--sp);
               *(--dp) = *(--sp);
               *(--dp) = hi_filler;
               *(--dp) = lo_filler;
            }
            row_info->channels = 2;
            row_info->pixel_depth = 32;
            row_info->rowbytes = row_width * 4;
         }
      }
   } /* COLOR_TYPE == GRAY */
   else if (row_info->color_type == PNG_COLOR_TYPE_RGB)
   {
      if (row_info->bit_depth == 8)
      {
         /* This changes the data from RGB to RGBX */
         if (flags & PNG_FLAG_FILLER_AFTER)
         {
            png_bytep sp = row + (png_size_t)row_width * 3;
            png_bytep dp = sp  + (png_size_t)row_width;
            for (i = 1; i < row_width; i++)
            {
               *(--dp) = lo_filler;
               *(--dp) = *(--sp);
               *(--dp) = *(--sp);
               *(--dp) = *(--sp);
            }
            *(--dp) = lo_filler;
            row_info->channels = 4;
            row_info->pixel_depth = 32;
            row_info->rowbytes = row_width * 4;
         }
      /* This changes the data from RGB to XRGB */
         else
         {
            png_bytep sp = row + (png_size_t)row_width * 3;
            png_bytep dp = sp + (png_size_t)row_width;
            for (i = 0; i < row_width; i++)
            {
               *(--dp) = *(--sp);
               *(--dp) = *(--sp);
               *(--dp) = *(--sp);
               *(--dp) = lo_filler;
            }
            row_info->channels = 4;
            row_info->pixel_depth = 32;
            row_info->rowbytes = row_width * 4;
         }
      }
      else if (row_info->bit_depth == 16)
      {
         /* This changes the data from RRGGBB to RRGGBBXX */
         if (flags & PNG_FLAG_FILLER_AFTER)
         {
            png_bytep sp = row + (png_size_t)row_width * 6;
            png_bytep dp = sp  + (png_size_t)row_width * 2;
            for (i = 1; i < row_width; i++)
            {
               *(--dp) = hi_filler;
               *(--dp) = lo_filler;
               *(--dp) = *(--sp);
               *(--dp) = *(--sp);
               *(--dp) = *(--sp);
               *(--dp) = *(--sp);
               *(--dp) = *(--sp);
               *(--dp) = *(--sp);
            }
            *(--dp) = hi_filler;
            *(--dp) = lo_filler;
            row_info->channels = 4;
            row_info->pixel_depth = 64;
            row_info->rowbytes = row_width * 8;
         }
         /* This changes the data from RRGGBB to XXRRGGBB */
         else
         {
            png_bytep sp = row + (png_size_t)row_width * 6;
            png_bytep dp = sp  + (png_size_t)row_width * 2;
            for (i = 0; i < row_width; i++)
            {
               *(--dp) = *(--sp);
               *(--dp) = *(--sp);
               *(--dp) = *(--sp);
               *(--dp) = *(--sp);
               *(--dp) = *(--sp);
               *(--dp) = *(--sp);
               *(--dp) = hi_filler;
               *(--dp) = lo_filler;
            }
            row_info->channels = 4;
            row_info->pixel_depth = 64;
            row_info->rowbytes = row_width * 8;
         }
      }
   } /* COLOR_TYPE == RGB */
}

// Assembly:
movl (%rdi), %eax
movl %edx, %r8d
shrl $0x8, %r8d
movzbl 0x10(%rdi), %r9d
cmpl $0x2, %r9d
je 0x83cdd
testl %r9d, %r9d
jne 0x83f26
movzbl 0x11(%rdi), %r9d
cmpl $0x10, %r9d
je 0x83d3f
cmpl $0x8, %r9d
jne 0x83f26
testb %cl, %cl
js 0x83de2
pushq $0x1
popq %rcx
movq %rax, %r8
testl %r8d, %r8d
je 0x83e0e
movb -0x1(%rsi,%r8), %r9b
movb %r9b, -0x1(%rsi,%r8,2)
movb %dl, -0x2(%rsi,%r8,2)
decq %r8
jmp 0x83cc0
movzbl 0x11(%rdi), %r9d
cmpl $0x10, %r9d
je 0x83d79
cmpl $0x8, %r9d
jne 0x83f26
leaq (%rax,%rax,2), %r8
addq %rsi, %r8
decq %r8
testb %cl, %cl
js 0x83e1e
pushq $0x2
popq %rcx
movq %rax, %r9
testl %r9d, %r9d
je 0x83e57
movb (%r8), %r10b
movb %r10b, -0x1(%rsi,%r9,4)
movb -0x1(%r8), %r10b
movb %r10b, -0x2(%rsi,%r9,4)
movb -0x2(%r8), %r10b
movb %r10b, -0x3(%rsi,%r9,4)
movb %dl, -0x4(%rsi,%r9,4)
decq %r9
addq $-0x3, %r8
jmp 0x83d0e
testb %cl, %cl
js 0x83e5f
pushq $0x2
popq %rcx
movq %rax, %r9
testl %r9d, %r9d
je 0x83e9d
movb -0x1(%rsi,%r9,2), %r10b
movb %r10b, -0x1(%rsi,%r9,4)
movb -0x2(%rsi,%r9,2), %r10b
movb %r10b, -0x2(%rsi,%r9,4)
movb %r8b, -0x3(%rsi,%r9,4)
movb %dl, -0x4(%rsi,%r9,4)
decq %r9
jmp 0x83d4d
imulq $0x6, %rax, %r9
addq %rsi, %r9
decq %r9
testb %cl, %cl
js 0x83eb2
pushq $0x3
popq %rcx
movq %rax, %r10
testl %r10d, %r10d
je 0x83f08
movb (%r9), %r11b
movb %r11b, -0x1(%rsi,%r10,8)
movb -0x1(%r9), %r11b
movb %r11b, -0x2(%rsi,%r10,8)
movb -0x2(%r9), %r11b
movb %r11b, -0x3(%rsi,%r10,8)
movb -0x3(%r9), %r11b
movb %r11b, -0x4(%rsi,%r10,8)
movb -0x4(%r9), %r11b
movb %r11b, -0x5(%rsi,%r10,8)
movb -0x5(%r9), %r11b
movb %r11b, -0x6(%rsi,%r10,8)
movb %r8b, -0x7(%rsi,%r10,8)
movb %dl, -0x8(%rsi,%r10,8)
decq %r10
addq $-0x6, %r9
jmp 0x83d91
leaq (%rax,%rsi), %r8
decq %r8
leaq -0x1(%rsi,%rax,2), %rsi
pushq $0x1
popq %rcx
movl %ecx, %r9d
cmpl %eax, %r9d
jae 0x83e16
movb %dl, (%rsi)
movb (%r8), %r10b
movb %r10b, -0x1(%rsi)
incl %r9d
decq %r8
addq $-0x2, %rsi
jmp 0x83df4
movb $0x10, %r8b
jmp 0x83ea0
movb $0x10, %r8b
jmp 0x83ead
leaq (%rsi,%rax,4), %rsi
decq %rsi
pushq $0x1
popq %r9
pushq $0x2
popq %rcx
cmpl %eax, %r9d
jae 0x83ea5
movb %dl, (%rsi)
movb (%r8), %r10b
movb %r10b, -0x1(%rsi)
movb -0x1(%r8), %r10b
movb %r10b, -0x2(%rsi)
movb -0x2(%r8), %r10b
movb %r10b, -0x3(%rsi)
incl %r9d
addq $-0x3, %r8
addq $-0x4, %rsi
jmp 0x83e2c
movb $0x20, %r8b
jmp 0x83f0b
leaq (%rax,%rax), %rcx
leaq (%rcx,%rsi), %r9
decq %r9
leaq -0x2(%rsi,%rax,4), %rsi
pushq $0x1
popq %r10
pushq $0x2
popq %rcx
movb %r8b, 0x1(%rsi)
cmpl %eax, %r10d
jae 0x83eaa
movb %dl, (%rsi)
movb (%r9), %r11b
movb %r11b, -0x1(%rsi)
movb -0x1(%r9), %r11b
movb %r11b, -0x2(%rsi)
incl %r10d
addq $-0x2, %r9
addq $-0x4, %rsi
jmp 0x83e76
movb $0x20, %r8b
movb $0x2, %r9b
jmp 0x83f18
movb $0x20, %r8b
jmp 0x83f13
movb $0x20, %r8b
movb $0x2, %r9b
jmp 0x83f16
leaq (%rsi,%rax,8), %rsi
addq $-0x2, %rsi
pushq $0x1
popq %r10
pushq $0x3
popq %rcx
movb %r8b, 0x1(%rsi)
cmpl %eax, %r10d
jae 0x83f10
movb %dl, (%rsi)
movb (%r9), %r11b
movb %r11b, -0x1(%rsi)
movb -0x1(%r9), %r11b
movb %r11b, -0x2(%rsi)
movb -0x2(%r9), %r11b
movb %r11b, -0x3(%rsi)
movb -0x3(%r9), %r11b
movb %r11b, -0x4(%rsi)
movb -0x4(%r9), %r11b
movb %r11b, -0x5(%rsi)
movb -0x5(%r9), %r11b
movb %r11b, -0x6(%rsi)
incl %r10d
addq $-0x6, %r9
addq $-0x8, %rsi
jmp 0x83ec1
movb $0x40, %r8b
movb $0x4, %r9b
jmp 0x83f18
movb $0x40, %r8b
movb $0x4, %r9b
movb %dl, (%rsi)
movb %r9b, 0x12(%rdi)
movb %r8b, 0x13(%rdi)
shll %cl, %eax
movq %rax, 0x8(%rdi)
retq