// File: /workspace/github_cpp_makefile_star2_O1/lvandeve[P]lodepng/lodepng.cpp
// Function: getPixelColorsRGBA8(unsigned char*, unsigned long, unsigned char const*, LodePNGColorMode const*)
static void getPixelColorsRGBA8(unsigned char* LODEPNG_RESTRICT buffer, size_t numpixels,
                                const unsigned char* LODEPNG_RESTRICT in,
                                const LodePNGColorMode* mode) {
  unsigned num_channels = 4;
  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];
        buffer[3] = 255;
      }
      if(mode->key_defined) {
        buffer -= numpixels * num_channels;
        for(i = 0; i != numpixels; ++i, buffer += num_channels) {
          if(buffer[0] == mode->key_r) buffer[3] = 0;
        }
      }
    } else if(mode->bitdepth == 16) {
      for(i = 0; i != numpixels; ++i, buffer += num_channels) {
        buffer[0] = buffer[1] = buffer[2] = in[i * 2];
        buffer[3] = mode->key_defined && 256U * in[i * 2 + 0] + in[i * 2 + 1] == mode->key_r ? 0 : 255;
      }
    } 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;
        buffer[3] = mode->key_defined && value == mode->key_r ? 0 : 255;
      }
    }
  } else if(mode->colortype == LCT_RGB) {
    if(mode->bitdepth == 8) {
      for(i = 0; i != numpixels; ++i, buffer += num_channels) {
        lodepng_memcpy(buffer, &in[i * 3], 3);
        buffer[3] = 255;
      }
      if(mode->key_defined) {
        buffer -= numpixels * num_channels;
        for(i = 0; i != numpixels; ++i, buffer += num_channels) {
          if(buffer[0] == mode->key_r && buffer[1]== mode->key_g && buffer[2] == mode->key_b) buffer[3] = 0;
        }
      }
    } 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];
        buffer[3] = mode->key_defined
           && 256U * in[i * 6 + 0] + in[i * 6 + 1] == mode->key_r
           && 256U * in[i * 6 + 2] + in[i * 6 + 3] == mode->key_g
           && 256U * in[i * 6 + 4] + in[i * 6 + 5] == mode->key_b ? 0 : 255;
      }
    }
  } 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], 4);
      }
    } 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], 4);
      }
    }
  } 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];
        buffer[3] = in[i * 2 + 1];
      }
    } else {
      for(i = 0; i != numpixels; ++i, buffer += num_channels) {
        buffer[0] = buffer[1] = buffer[2] = in[i * 4 + 0];
        buffer[3] = in[i * 4 + 2];
      }
    }
  } else if(mode->colortype == LCT_RGBA) {
    if(mode->bitdepth == 8) {
      lodepng_memcpy(buffer, in, numpixels * 4);
    } 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];
        buffer[3] = in[i * 8 + 6];
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl (%rcx), %eax
cmpq $0x6, %rax
ja 0x6b0e
movq %rcx, %r10
movq %rdx, %r9
movq %rsi, %r8
leaq 0x6b959(%rip), %rcx     # 0x720a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x4(%r10), %ecx
cmpq $0x8, %rcx
je 0x6a24
cmpl $0x10, %ecx
jne 0x6a7b
testq %r8, %r8
je 0x6b0e
movl 0x18(%r10), %eax
xorl %ecx, %ecx
movzbl (%r9,%rcx,2), %edx
movb %dl, 0x2(%rdi,%rcx,4)
movb %dl, 0x1(%rdi,%rcx,4)
movb %dl, (%rdi,%rcx,4)
testl %eax, %eax
je 0x67a0
shll $0x8, %edx
movzbl 0x1(%r9,%rcx,2), %esi
orl %edx, %esi
cmpl 0x1c(%r10), %esi
setne %dl
negb %dl
jmp 0x67a2
movb $-0x1, %dl
movb %dl, 0x3(%rdi,%rcx,4)
incq %rcx
cmpq %rcx, %r8
jne 0x6776
jmp 0x6b0e
movl 0x4(%r10), %eax
cmpq $0x8, %rax
jne 0x68ce
testq %r8, %r8
je 0x6b0e
movq 0x8(%r10), %rax
xorl %ecx, %ecx
movzbl (%r9,%rcx), %edx
movl (%rax,%rdx,4), %edx
movl %edx, (%rdi,%rcx,4)
incq %rcx
cmpq %rcx, %r8
jne 0x67d0
jmp 0x6b0e
cmpl $0x8, 0x4(%r10)
jne 0x693c
testq %r8, %r8
je 0x681a
movq %r8, %rax
movb 0x2(%r9), %cl
movb %cl, 0x2(%rdi)
movzwl (%r9), %ecx
movw %cx, (%rdi)
movb $-0x1, 0x3(%rdi)
addq $0x4, %rdi
addq $0x3, %r9
decq %rax
jne 0x67fb
cmpl $0x0, 0x18(%r10)
sete %al
testq %r8, %r8
sete %cl
orb %al, %cl
jne 0x6b0e
negq %r8
movzbl (%rdi,%r8,4), %eax
cmpl %eax, 0x1c(%r10)
jne 0x685c
movzbl 0x1(%rdi,%r8,4), %eax
cmpl %eax, 0x20(%r10)
jne 0x685c
movzbl 0x2(%rdi,%r8,4), %eax
cmpl %eax, 0x24(%r10)
jne 0x685c
movb $0x0, 0x3(%rdi,%r8,4)
incq %r8
jne 0x6833
jmp 0x6b0e
cmpl $0x8, 0x4(%r10)
jne 0x69ba
testq %r8, %r8
je 0x6b0e
xorl %eax, %eax
movb (%r9,%rax,2), %cl
movb %cl, 0x2(%rdi,%rax,4)
movb %cl, 0x1(%rdi,%rax,4)
movb %cl, (%rdi,%rax,4)
movb 0x1(%r9,%rax,2), %cl
movb %cl, 0x3(%rdi,%rax,4)
incq %rax
cmpq %rax, %r8
jne 0x687c
jmp 0x6b0e
cmpl $0x8, 0x4(%r10)
jne 0x69ea
shlq $0x2, %r8
testq %r8, %r8
je 0x6b0e
movq %r9, %rsi
movq %r8, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21d0
testq %r8, %r8
je 0x6b0e
movq 0x8(%r10), %rcx
xorl %edx, %edx
xorl %esi, %esi
xorl %r10d, %r10d
testl %eax, %eax
je 0x6924
movq %rax, %r11
movq %rsi, %rbx
movq %rbx, %r14
shrq $0x3, %r14
movzbl (%r9,%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 0x68ec
addq %rax, %rsi
shll $0x2, %r10d
movl (%rcx,%r10), %r10d
movl %r10d, (%rdi)
incq %rdx
addq $0x4, %rdi
cmpq %r8, %rdx
jne 0x68df
jmp 0x6b0e
testq %r8, %r8
je 0x6b0e
movl 0x18(%r10), %eax
addq $0x5, %r9
xorl %ecx, %ecx
movzbl -0x5(%r9), %ebx
movb %bl, (%rdi,%rcx,4)
movzbl -0x3(%r9), %r11d
movb %r11b, 0x1(%rdi,%rcx,4)
movzbl -0x1(%r9), %esi
movb %sil, 0x2(%rdi,%rcx,4)
movb $-0x1, %dl
testl %eax, %eax
je 0x69a5
shll $0x8, %ebx
movzbl -0x4(%r9), %ebp
orl %ebx, %ebp
cmpl 0x1c(%r10), %ebp
jne 0x69a5
shll $0x8, %r11d
movzbl -0x2(%r9), %ebx
orl %r11d, %ebx
cmpl 0x20(%r10), %ebx
jne 0x69a5
shll $0x8, %esi
movzbl (%r9), %edx
orl %esi, %edx
cmpl 0x24(%r10), %edx
setne %dl
negb %dl
movb %dl, 0x3(%rdi,%rcx,4)
incq %rcx
addq $0x6, %r9
cmpq %rcx, %r8
jne 0x694f
jmp 0x6b0e
testq %r8, %r8
je 0x6b0e
xorl %eax, %eax
movb (%r9,%rax,4), %cl
movb %cl, 0x2(%rdi,%rax,4)
movb %cl, 0x1(%rdi,%rax,4)
movb %cl, (%rdi,%rax,4)
movb 0x2(%r9,%rax,4), %cl
movb %cl, 0x3(%rdi,%rax,4)
incq %rax
cmpq %rax, %r8
jne 0x69c5
jmp 0x6b0e
testq %r8, %r8
je 0x6b0e
xorl %eax, %eax
movb (%r9,%rax,8), %cl
movb %cl, (%rdi,%rax,4)
movb 0x2(%r9,%rax,8), %cl
movb %cl, 0x1(%rdi,%rax,4)
movb 0x4(%r9,%rax,8), %cl
movb %cl, 0x2(%rdi,%rax,4)
movb 0x6(%r9,%rax,8), %cl
movb %cl, 0x3(%rdi,%rax,4)
incq %rax
cmpq %rax, %r8
jne 0x69f5
jmp 0x6b0e
testq %r8, %r8
je 0x6a47
xorl %eax, %eax
movb (%r9,%rax), %cl
movb %cl, 0x2(%rdi)
movb %cl, 0x1(%rdi)
movb %cl, (%rdi)
movb $-0x1, 0x3(%rdi)
incq %rax
addq $0x4, %rdi
cmpq %rax, %r8
jne 0x6a2b
cmpl $0x0, 0x18(%r10)
sete %al
testq %r8, %r8
sete %cl
orb %al, %cl
jne 0x6b0e
negq %r8
movzbl (%rdi,%r8,4), %eax
cmpl %eax, 0x1c(%r10)
jne 0x6a71
movb $0x0, 0x3(%rdi,%r8,4)
incq %r8
jne 0x6a60
jmp 0x6b0e
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
shll %cl, %esi
testq %r8, %r8
je 0x6b0e
notl %esi
movl 0x18(%r10), %r11d
xorl %ebx, %ebx
xorl %r14d, %r14d
xorl %r15d, %r15d
testl %ecx, %ecx
je 0x6ad8
movq %rcx, %rax
movq %r14, %rdx
movq %rdx, %r12
shrq $0x3, %r12
movzbl (%r9,%r12), %ebp
movl %edx, %r12d
notb %r12b
movzbl %r12b, %r12d
andl $0x7, %r12d
xorl %r13d, %r13d
btl %r12d, %ebp
setb %r13b
incq %rdx
leal (%r13,%r15,2), %r15d
decq %rax
jne 0x6aa3
addq %rcx, %r14
movl %r15d, %eax
shll $0x8, %eax
subl %r15d, %eax
xorl %edx, %edx
divl %esi
movb %al, 0x2(%rdi)
movb %al, 0x1(%rdi)
movb %al, (%rdi)
testl %r11d, %r11d
je 0x6afd
cmpl 0x1c(%r10), %r15d
setne %al
negb %al
jmp 0x6aff
movb $-0x1, %al
movb %al, 0x3(%rdi)
incq %rbx
addq $0x4, %rdi
cmpq %r8, %rbx
jne 0x6a96
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq