// File: /workspace/github_cpp_makefile_star2_O1/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 0x908e0
movzbl 0x10(%rdi), %edx
testb $0x2, %dl
jne 0x908e0
movl (%rdi), %ecx
cmpl $0x4, %edx
je 0x907c5
testl %edx, %edx
jne 0x908a8
cmpb $0x8, %al
jne 0x90804
testl %ecx, %ecx
je 0x908a8
leaq (%rsi,%rcx), %rax
decq %rax
addq %rcx, %rsi
leaq (%rsi,%rcx,2), %rdx
decq %rdx
movl %ecx, %esi
movb (%rax), %r8b
movb %r8b, (%rdx)
movb (%rax), %r8b
movb %r8b, -0x1(%rdx)
movb (%rax), %r8b
decq %rax
movb %r8b, -0x2(%rdx)
addq $-0x3, %rdx
decl %esi
jne 0x907a1
jmp 0x908a8
cmpb $0x8, %al
jne 0x9085a
testl %ecx, %ecx
je 0x908a8
movq %rcx, %rax
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 -0x2(%rsi,%rax,2), %dl
movb %dl, -0x3(%rsi,%rax,4)
movb -0x2(%rsi,%rax,2), %dl
movb %dl, -0x4(%rsi,%rax,4)
decq %rax
testl %eax, %eax
jne 0x907d8
jmp 0x908a8
testl %ecx, %ecx
je 0x908a8
leaq (%rsi,%rcx,2), %rdx
leaq (%rsi,%rcx,2), %rax
decq %rax
leaq (%rdx,%rcx,4), %rdx
decq %rdx
movl %ecx, %esi
movb (%rax), %r8b
movb %r8b, (%rdx)
movb -0x1(%rax), %r8b
movb %r8b, -0x1(%rdx)
movb (%rax), %r8b
movb %r8b, -0x2(%rdx)
movb -0x1(%rax), %r8b
movb %r8b, -0x3(%rdx)
movb (%rax), %r8b
movb %r8b, -0x4(%rdx)
movb -0x1(%rax), %r8b
movb %r8b, -0x5(%rdx)
addq $-0x6, %rdx
addq $-0x2, %rax
decl %esi
jne 0x90820
jmp 0x908a8
testl %ecx, %ecx
je 0x908a8
movq %rcx, %rax
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
testl %eax, %eax
jne 0x90861
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 0x908cd
shrb $0x3, %al
movzbl %al, %eax
imulq %rcx, %rax
jmp 0x908dc
movzbl %al, %eax
imulq %rcx, %rax
addq $0x7, %rax
shrq $0x3, %rax
movq %rax, 0x8(%rdi)
retq