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

   png_debug(1, "in png_do_gray_to_rgb");

   if (row_info->bit_depth >= 8 &&
      !(row_info->color_type & PNG_COLOR_MASK_COLOR))
   {
      if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
      {
         if (row_info->bit_depth == 8)
         {
            png_bytep sp = row + (png_size_t)row_width - 1;
            png_bytep dp = sp  + (png_size_t)row_width * 2;
            for (i = 0; i < row_width; i++)
            {
               *(dp--) = *sp;
               *(dp--) = *sp;
               *(dp--) = *(sp--);
            }
         }
         else
         {
            png_bytep sp = row + (png_size_t)row_width * 2 - 1;
            png_bytep dp = sp  + (png_size_t)row_width * 4;
            for (i = 0; i < row_width; i++)
            {
               *(dp--) = *sp;
               *(dp--) = *(sp - 1);
               *(dp--) = *sp;
               *(dp--) = *(sp - 1);
               *(dp--) = *(sp--);
               *(dp--) = *(sp--);
            }
         }
      }
      else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
      {
         if (row_info->bit_depth == 8)
         {
            png_bytep sp = row + (png_size_t)row_width * 2 - 1;
            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--);
            }
         }
         else
         {
            png_bytep sp = row + (png_size_t)row_width * 4 - 1;
            png_bytep dp = sp  + (png_size_t)row_width * 4;
            for (i = 0; i < row_width; i++)
            {
               *(dp--) = *(sp--);
               *(dp--) = *(sp--);
               *(dp--) = *sp;
               *(dp--) = *(sp - 1);
               *(dp--) = *sp;
               *(dp--) = *(sp - 1);
               *(dp--) = *(sp--);
               *(dp--) = *(sp--);
            }
         }
      }
      row_info->channels += (png_byte)2;
      row_info->color_type |= PNG_COLOR_MASK_COLOR;
      row_info->pixel_depth = (png_byte)(row_info->channels *
         row_info->bit_depth);
      row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
   }
}

// Assembly:
movb 0x11(%rdi), %al
cmpb $0x8, %al
jb 0x82775
movzbl 0x10(%rdi), %edx
testb $0x2, %dl
jne 0x82775
movl (%rdi), %ecx
cmpl $0x4, %edx
je 0x82669
testl %edx, %edx
jne 0x8273d
cmpb $0x8, %al
jne 0x8269d
leaq (%rcx,%rcx,2), %rax
movq %rcx, %rdx
testl %edx, %edx
je 0x8273d
movb -0x1(%rsi,%rdx), %r8b
movb %r8b, -0x1(%rsi,%rax)
movb %r8b, -0x2(%rsi,%rax)
movb -0x1(%rsi,%rdx), %r8b
movb %r8b, -0x3(%rsi,%rax)
decq %rdx
addq $-0x3, %rax
jmp 0x8263f
cmpb $0x8, %al
jne 0x826f1
movq %rcx, %rax
testl %eax, %eax
je 0x8273d
movb -0x1(%rsi,%rax,2), %dl
movb %dl, -0x1(%rsi,%rax,4)
movb -0x2(%rsi,%rax,2), %dl
movb %dl, -0x2(%rsi,%rax,4)
movb %dl, -0x3(%rsi,%rax,4)
movb -0x2(%rsi,%rax,2), %dl
movb %dl, -0x4(%rsi,%rax,4)
decq %rax
jmp 0x82674
leaq (%rcx,%rcx,2), %rax
movq %rcx, %rdx
testl %edx, %edx
je 0x8273d
movb -0x1(%rsi,%rdx,2), %r8b
movb %r8b, -0x1(%rsi,%rax,2)
movb -0x2(%rsi,%rdx,2), %r8b
movb %r8b, -0x2(%rsi,%rax,2)
movb -0x1(%rsi,%rdx,2), %r8b
movb %r8b, -0x3(%rsi,%rax,2)
movb -0x2(%rsi,%rdx,2), %r8b
movb %r8b, -0x4(%rsi,%rax,2)
movb -0x1(%rsi,%rdx,2), %r8b
movb %r8b, -0x5(%rsi,%rax,2)
movb -0x2(%rsi,%rdx,2), %r8b
movb %r8b, -0x6(%rsi,%rax,2)
decq %rdx
addq $-0x3, %rax
jmp 0x826a4
movq %rcx, %rax
testl %eax, %eax
je 0x8273d
movb -0x1(%rsi,%rax,4), %dl
movb %dl, -0x1(%rsi,%rax,8)
movb -0x2(%rsi,%rax,4), %dl
movb %dl, -0x2(%rsi,%rax,8)
movb -0x3(%rsi,%rax,4), %dl
movb %dl, -0x3(%rsi,%rax,8)
movb -0x4(%rsi,%rax,4), %dl
movb %dl, -0x4(%rsi,%rax,8)
movb -0x3(%rsi,%rax,4), %dl
movb %dl, -0x5(%rsi,%rax,8)
movb -0x4(%rsi,%rax,4), %dl
movb %dl, -0x6(%rsi,%rax,8)
movb -0x3(%rsi,%rax,4), %dl
movb %dl, -0x7(%rsi,%rax,8)
movb -0x4(%rsi,%rax,4), %dl
movb %dl, -0x8(%rsi,%rax,8)
decq %rax
jmp 0x826f4
movb 0x11(%rdi), %al
movb 0x12(%rdi), %dl
addb $0x2, %dl
movb %dl, 0x12(%rdi)
orb $0x2, 0x10(%rdi)
mulb %dl
movb %al, 0x13(%rdi)
cmpb $0x8, %al
jb 0x82762
shrb $0x3, %al
movzbl %al, %eax
imulq %rcx, %rax
jmp 0x82771
movzbl %al, %eax
imulq %rcx, %rax
addq $0x7, %rax
shrq $0x3, %rax
movq %rax, 0x8(%rdi)
retq