// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %rbp
pushq %rbx
movl (%rdi), %eax
movl %edx, %r10d
shrl $0x8, %r10d
movzbl 0x10(%rdi), %r8d
cmpl $0x2, %r8d
je 0x91fd2
testl %r8d, %r8d
jne 0x92265
movzbl 0x11(%rdi), %r8d
cmpl $0x10, %r8d
je 0x92043
cmpl $0x8, %r8d
jne 0x92265
testb %cl, %cl
js 0x92102
movl $0x1, %ecx
movb $0x10, %r9b
movb $0x2, %r11b
testl %eax, %eax
je 0x92257
movq %rax, %r8
movb -0x1(%rsi,%r8), %r10b
movb %r10b, -0x1(%rsi,%r8,2)
movb %dl, -0x2(%rsi,%r8,2)
decq %r8
testl %r8d, %r8d
jne 0x91fb6
jmp 0x92257
movzbl 0x11(%rdi), %r8d
cmpl $0x10, %r8d
je 0x9208c
cmpl $0x8, %r8d
jne 0x92265
testb %cl, %cl
js 0x9213e
movl $0x2, %ecx
movb $0x20, %r9b
movb $0x4, %r11b
testl %eax, %eax
je 0x92257
leaq (%rax,%rax,2), %r10
leaq (%rsi,%rax,4), %r8
decq %r8
addq %r10, %rsi
decq %rsi
movl %eax, %r10d
movb (%rsi), %bl
movb %bl, (%r8)
movb -0x1(%rsi), %bl
movb %bl, -0x1(%r8)
movb -0x2(%rsi), %bl
movb %bl, -0x2(%r8)
movb %dl, -0x3(%r8)
addq $-0x4, %r8
addq $-0x3, %rsi
decl %r10d
jne 0x9201a
jmp 0x92257
testb %cl, %cl
js 0x9218e
movl $0x2, %ecx
movb $0x20, %r9b
movb $0x2, %r11b
testl %eax, %eax
je 0x92257
movq %rax, %r8
movb -0x1(%rsi,%r8,2), %bl
movb %bl, -0x1(%rsi,%r8,4)
movb -0x2(%rsi,%r8,2), %bl
movb %bl, -0x2(%rsi,%r8,4)
movb %r10b, -0x3(%rsi,%r8,4)
movb %dl, -0x4(%rsi,%r8,4)
decq %r8
testl %r8d, %r8d
jne 0x92061
jmp 0x92257
testb %cl, %cl
js 0x921e0
movl $0x3, %ecx
movb $0x40, %r9b
movb $0x4, %r11b
testl %eax, %eax
je 0x92257
leaq (%rax,%rax,2), %rbx
leaq (%rsi,%rax,8), %r8
decq %r8
leaq (%rsi,%rbx,2), %rsi
decq %rsi
movl %eax, %ebx
movb (%rsi), %bpl
movb %bpl, (%r8)
movb -0x1(%rsi), %bpl
movb %bpl, -0x1(%r8)
movb -0x2(%rsi), %bpl
movb %bpl, -0x2(%r8)
movb -0x3(%rsi), %bpl
movb %bpl, -0x3(%r8)
movb -0x4(%rsi), %bpl
movb %bpl, -0x4(%r8)
movb -0x5(%rsi), %bpl
movb %bpl, -0x5(%r8)
movb %r10b, -0x6(%r8)
movb %dl, -0x7(%r8)
addq $-0x8, %r8
addq $-0x6, %rsi
decl %ebx
jne 0x920bb
jmp 0x92257
leaq (%rsi,%rax), %r8
addq %rax, %r8
cmpl $0x2, %eax
jb 0x9212e
leaq (%rax,%rsi), %rcx
decq %rcx
leal -0x1(%rax), %esi
movb %dl, -0x1(%r8)
movb (%rcx), %r9b
movb %r9b, -0x2(%r8)
addq $-0x2, %r8
decq %rcx
decl %esi
jne 0x92118
decq %r8
movl $0x1, %ecx
movb $0x10, %r9b
jmp 0x921db
leaq (%rax,%rax,2), %rcx
leaq (%rsi,%rax), %r8
addq %rcx, %r8
cmpl $0x2, %eax
jb 0x9217e
addq %rsi, %rcx
decq %rcx
leal -0x1(%rax), %esi
movb %dl, -0x1(%r8)
movb (%rcx), %r9b
movb %r9b, -0x2(%r8)
movb -0x1(%rcx), %r9b
movb %r9b, -0x3(%r8)
movb -0x2(%rcx), %r9b
movb %r9b, -0x4(%r8)
addq $-0x4, %r8
addq $-0x3, %rcx
decl %esi
jne 0x92157
decq %r8
movl $0x2, %ecx
movb $0x20, %r9b
jmp 0x92251
leaq (%rsi,%rax,2), %rcx
leaq (%rcx,%rax,2), %r8
cmpl $0x2, %eax
jb 0x921cb
leaq (%rax,%rax), %rcx
addq %rsi, %rcx
decq %rcx
leal -0x1(%rax), %esi
movb %r10b, -0x1(%r8)
movb %dl, -0x2(%r8)
movb (%rcx), %r9b
movb %r9b, -0x3(%r8)
movb -0x1(%rcx), %r9b
movb %r9b, -0x4(%r8)
addq $-0x4, %r8
addq $-0x2, %rcx
decl %esi
jne 0x921a8
movb %r10b, -0x1(%r8)
addq $-0x2, %r8
movl $0x2, %ecx
movb $0x20, %r9b
movb $0x2, %r11b
jmp 0x92254
leaq (%rax,%rax), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rsi,%rcx), %r8
leaq (%r8,%rax,2), %r8
cmpl $0x2, %eax
jb 0x92241
addq %rsi, %rcx
decq %rcx
leal -0x1(%rax), %esi
movb %r10b, -0x1(%r8)
movb %dl, -0x2(%r8)
movb (%rcx), %r9b
movb %r9b, -0x3(%r8)
movb -0x1(%rcx), %r9b
movb %r9b, -0x4(%r8)
movb -0x2(%rcx), %r9b
movb %r9b, -0x5(%r8)
movb -0x3(%rcx), %r9b
movb %r9b, -0x6(%r8)
movb -0x4(%rcx), %r9b
movb %r9b, -0x7(%r8)
movb -0x5(%rcx), %r9b
movb %r9b, -0x8(%r8)
addq $-0x8, %r8
addq $-0x6, %rcx
decl %esi
jne 0x921fe
movb %r10b, -0x1(%r8)
addq $-0x2, %r8
movl $0x3, %ecx
movb $0x40, %r9b
movb $0x4, %r11b
movb %dl, (%r8)
movb %r11b, 0x12(%rdi)
movb %r9b, 0x13(%rdi)
shll %cl, %eax
movq %rax, 0x8(%rdi)
popq %rbx
popq %rbp
retq