// File: /workspace/github_cpp_makefile_star2_O3/lvandeve[P]lodepng/lodepng.cpp
// Function: getPixelColorsRGB8(unsigned char*, unsigned long, unsigned char const*, LodePNGColorMode const*)
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 0x7341
movq %rdx, %r8
leaq 0x6b167(%rip), %rdx     # 0x721dc
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
movl 0x4(%rcx), %ecx
cmpq $0x8, %rcx
je 0x729d
cmpl $0x10, %ecx
jne 0x72c6
testq %rsi, %rsi
je 0x7341
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 0x70a3
jmp 0x7341
movl 0x4(%rcx), %eax
cmpq $0x8, %rax
jne 0x7193
testq %rsi, %rsi
je 0x7341
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 0x70dc
jmp 0x7341
cmpl $0x8, 0x4(%rcx)
jne 0x720d
testq %rsi, %rsi
je 0x7341
leaq (%rsi,%rsi,2), %rdx
movq %r8, %rsi
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x21e0
cmpl $0x8, 0x4(%rcx)
jne 0x723f
testq %rsi, %rsi
je 0x7341
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 0x7140
jmp 0x7341
cmpl $0x8, 0x4(%rcx)
jne 0x726b
testq %rsi, %rsi
je 0x7341
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 0x7172
jmp 0x7341
testq %rsi, %rsi
je 0x7341
movq 0x8(%rcx), %rcx
xorl %edx, %edx
xorl %r9d, %r9d
xorl %r10d, %r10d
testl %eax, %eax
je 0x71ea
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 0x71b2
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 0x71a5
jmp 0x7341
testq %rsi, %rsi
je 0x7341
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 0x7218
jmp 0x7341
testq %rsi, %rsi
je 0x7341
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 0x724e
jmp 0x7341
testq %rsi, %rsi
je 0x7341
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 0x7276
jmp 0x7341
testq %rsi, %rsi
je 0x7341
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 0x72ac
jmp 0x7341
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
shll %cl, %r9d
testq %rsi, %rsi
je 0x7341
notl %r9d
xorl %r10d, %r10d
xorl %r11d, %r11d
testl %ecx, %ecx
je 0x7326
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 0x72e9
addq %rcx, %r11
movl %edx, %eax
shll $0x8, %eax
subl %edx, %eax
jmp 0x7328
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 0x72dd
popq %rbx
popq %r14
popq %r15
popq %rbp
retq