// File: /workspace/github_c_makefile_star2_O1/tditlu[P]shadetabler/src/lodepng/lodepng.c
// Function: getPixelColorsRGB8
static void getPixelColorsRGB8(unsigned char* LODEPNG_RESTRICT buffer, size_t numpixels,
                               const unsigned char* LODEPNG_RESTRICT in,
                               const LodePNGColorMode* mode) {
  const unsigned num_channels = 3;
  size_t i;
  if(mode->colortype == LCT_GREY) {
    if(mode->bitdepth == 8) {
      for(i = 0; i != numpixels; ++i, buffer += num_channels) {
        buffer[0] = buffer[1] = buffer[2] = in[i];
      }
    } else if(mode->bitdepth == 16) {
      for(i = 0; i != numpixels; ++i, buffer += num_channels) {
        buffer[0] = buffer[1] = buffer[2] = in[i * 2];
      }
    } else {
      unsigned highest = ((1U << mode->bitdepth) - 1U); /*highest possible value for this bit depth*/
      size_t j = 0;
      for(i = 0; i != numpixels; ++i, buffer += num_channels) {
        unsigned value = readBitsFromReversedStream(&j, in, mode->bitdepth);
        buffer[0] = buffer[1] = buffer[2] = (value * 255) / highest;
      }
    }
  } else if(mode->colortype == LCT_RGB) {
    if(mode->bitdepth == 8) {
      lodepng_memcpy(buffer, in, numpixels * 3);
    } else {
      for(i = 0; i != numpixels; ++i, buffer += num_channels) {
        buffer[0] = in[i * 6 + 0];
        buffer[1] = in[i * 6 + 2];
        buffer[2] = in[i * 6 + 4];
      }
    }
  } else if(mode->colortype == LCT_PALETTE) {
    if(mode->bitdepth == 8) {
      for(i = 0; i != numpixels; ++i, buffer += num_channels) {
        unsigned index = in[i];
        /*out of bounds of palette not checked: see lodepng_color_mode_alloc_palette.*/
        lodepng_memcpy(buffer, &mode->palette[index * 4], 3);
      }
    } else {
      size_t j = 0;
      for(i = 0; i != numpixels; ++i, buffer += num_channels) {
        unsigned index = readBitsFromReversedStream(&j, in, mode->bitdepth);
        /*out of bounds of palette not checked: see lodepng_color_mode_alloc_palette.*/
        lodepng_memcpy(buffer, &mode->palette[index * 4], 3);
      }
    }
  } else if(mode->colortype == LCT_GREY_ALPHA) {
    if(mode->bitdepth == 8) {
      for(i = 0; i != numpixels; ++i, buffer += num_channels) {
        buffer[0] = buffer[1] = buffer[2] = in[i * 2 + 0];
      }
    } else {
      for(i = 0; i != numpixels; ++i, buffer += num_channels) {
        buffer[0] = buffer[1] = buffer[2] = in[i * 4 + 0];
      }
    }
  } else if(mode->colortype == LCT_RGBA) {
    if(mode->bitdepth == 8) {
      for(i = 0; i != numpixels; ++i, buffer += num_channels) {
        lodepng_memcpy(buffer, &in[i * 4], 3);
      }
    } else {
      for(i = 0; i != numpixels; ++i, buffer += num_channels) {
        buffer[0] = in[i * 8 + 0];
        buffer[1] = in[i * 8 + 2];
        buffer[2] = in[i * 8 + 4];
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movl (%rcx), %eax
cmpq $0x6, %rax
ja 0x70d5
movq %rdx, %r8
leaq 0xb383(%rip), %rdx      # 0x1218c
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
movl 0x4(%rcx), %ecx
cmpq $0x8, %rcx
je 0x7031
cmpl $0x10, %ecx
jne 0x705a
testq %rsi, %rsi
je 0x70d5
addq $0x2, %rdi
xorl %eax, %eax
movb (%r8,%rax,2), %cl
movb %cl, (%rdi)
movb %cl, -0x1(%rdi)
movb %cl, -0x2(%rdi)
incq %rax
addq $0x3, %rdi
cmpq %rax, %rsi
jne 0x6e37
jmp 0x70d5
movl 0x4(%rcx), %eax
cmpq $0x8, %rax
jne 0x6f27
testq %rsi, %rsi
je 0x70d5
movq 0x8(%rcx), %rax
xorl %ecx, %ecx
movzbl (%r8,%rcx), %edx
movb 0x2(%rax,%rdx,4), %r9b
movb %r9b, 0x2(%rdi)
movzwl (%rax,%rdx,4), %edx
movw %dx, (%rdi)
incq %rcx
addq $0x3, %rdi
cmpq %rcx, %rsi
jne 0x6e70
jmp 0x70d5
cmpl $0x8, 0x4(%rcx)
jne 0x6fa1
testq %rsi, %rsi
je 0x70d5
leaq (%rsi,%rsi,2), %rdx
movq %r8, %rsi
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1130
cmpl $0x8, 0x4(%rcx)
jne 0x6fd3
testq %rsi, %rsi
je 0x70d5
addq $0x2, %rdi
xorl %eax, %eax
movb (%r8,%rax,2), %cl
movb %cl, (%rdi)
movb %cl, -0x1(%rdi)
movb %cl, -0x2(%rdi)
incq %rax
addq $0x3, %rdi
cmpq %rax, %rsi
jne 0x6ed4
jmp 0x70d5
cmpl $0x8, 0x4(%rcx)
jne 0x6fff
testq %rsi, %rsi
je 0x70d5
xorl %eax, %eax
movb 0x2(%r8,%rax,4), %cl
movb %cl, 0x2(%rdi)
movzwl (%r8,%rax,4), %ecx
movw %cx, (%rdi)
incq %rax
addq $0x3, %rdi
cmpq %rax, %rsi
jne 0x6f06
jmp 0x70d5
testq %rsi, %rsi
je 0x70d5
movq 0x8(%rcx), %rcx
xorl %edx, %edx
xorl %r9d, %r9d
xorl %r10d, %r10d
testl %eax, %eax
je 0x6f7e
movq %rax, %r11
movq %r9, %rbx
movq %rbx, %r14
shrq $0x3, %r14
movzbl (%r8,%r14), %ebp
movl %ebx, %r14d
notb %r14b
movzbl %r14b, %r14d
andl $0x7, %r14d
xorl %r15d, %r15d
btl %r14d, %ebp
setb %r15b
incq %rbx
leal (%r15,%r10,2), %r10d
decq %r11
jne 0x6f46
addq %rax, %r9
shll $0x2, %r10d
movb 0x2(%rcx,%r10), %r11b
movb %r11b, 0x2(%rdi)
movzwl (%rcx,%r10), %r10d
movw %r10w, (%rdi)
incq %rdx
addq $0x3, %rdi
cmpq %rsi, %rdx
jne 0x6f39
jmp 0x70d5
testq %rsi, %rsi
je 0x70d5
xorl %eax, %eax
movb (%r8,%rax,2), %cl
movb %cl, (%rdi,%rax)
movb 0x2(%r8,%rax,2), %cl
movb %cl, 0x1(%rdi,%rax)
movb 0x4(%r8,%rax,2), %cl
movb %cl, 0x2(%rdi,%rax)
addq $0x3, %rax
decq %rsi
jne 0x6fac
jmp 0x70d5
testq %rsi, %rsi
je 0x70d5
addq $0x2, %rdi
xorl %eax, %eax
movb (%r8,%rax,4), %cl
movb %cl, (%rdi)
movb %cl, -0x1(%rdi)
movb %cl, -0x2(%rdi)
incq %rax
addq $0x3, %rdi
cmpq %rax, %rsi
jne 0x6fe2
jmp 0x70d5
testq %rsi, %rsi
je 0x70d5
xorl %eax, %eax
movb (%r8,%rax,8), %cl
movb %cl, (%rdi)
movb 0x2(%r8,%rax,8), %cl
movb %cl, 0x1(%rdi)
movb 0x4(%r8,%rax,8), %cl
movb %cl, 0x2(%rdi)
incq %rax
addq $0x3, %rdi
cmpq %rax, %rsi
jne 0x700a
jmp 0x70d5
testq %rsi, %rsi
je 0x70d5
addq $0x2, %rdi
xorl %eax, %eax
movb (%r8,%rax), %cl
movb %cl, (%rdi)
movb %cl, -0x1(%rdi)
movb %cl, -0x2(%rdi)
incq %rax
addq $0x3, %rdi
cmpq %rax, %rsi
jne 0x7040
jmp 0x70d5
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
shll %cl, %r9d
testq %rsi, %rsi
je 0x70d5
notl %r9d
xorl %r10d, %r10d
xorl %r11d, %r11d
testl %ecx, %ecx
je 0x70ba
xorl %edx, %edx
movq %rcx, %rax
movq %r11, %rbx
movq %rbx, %r14
shrq $0x3, %r14
movzbl (%r8,%r14), %ebp
movl %ebx, %r14d
notb %r14b
movzbl %r14b, %r14d
andl $0x7, %r14d
xorl %r15d, %r15d
btl %r14d, %ebp
setb %r15b
incq %rbx
leal (%r15,%rdx,2), %edx
decq %rax
jne 0x707d
addq %rcx, %r11
movl %edx, %eax
shll $0x8, %eax
subl %edx, %eax
jmp 0x70bc
xorl %eax, %eax
xorl %edx, %edx
divl %r9d
movb %al, 0x2(%rdi)
movb %al, 0x1(%rdi)
movb %al, (%rdi)
incq %r10
addq $0x3, %rdi
cmpq %rsi, %r10
jne 0x7071
popq %rbx
popq %r14
popq %r15
popq %rbp
retq