// File: /workspace/github_c_makefile_star2_O3/tditlu[P]shadetabler/src/lodepng/lodepng.c
// Function: getPixelColorsRGBA8
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 0x702f
movq %rcx, %r10
movq %rdx, %r9
movq %rsi, %r8
leaq 0xb5fe(%rip), %rcx      # 0x12270
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x4(%r10), %ecx
cmpq $0x8, %rcx
je 0x6f4c
cmpl $0x10, %ecx
jne 0x6f9c
testq %r8, %r8
je 0x702f
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 0x6ccb
shll $0x8, %edx
movzbl 0x1(%r9,%rcx,2), %esi
orl %edx, %esi
cmpl 0x1c(%r10), %esi
setne %dl
negb %dl
jmp 0x6ccd
movb $-0x1, %dl
movb %dl, 0x3(%rdi,%rcx,4)
incq %rcx
cmpq %rcx, %r8
jne 0x6ca1
jmp 0x702f
movl 0x4(%r10), %eax
cmpq $0x8, %rax
jne 0x6df6
testq %r8, %r8
je 0x702f
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 0x6cfb
jmp 0x702f
cmpl $0x8, 0x4(%r10)
jne 0x6e64
testq %r8, %r8
je 0x702f
xorl %eax, %eax
leaq (%rax,%rax,2), %rcx
movb 0x2(%r9,%rcx), %dl
movb %dl, 0x2(%rdi)
movzwl (%r9,%rcx), %ecx
movw %cx, (%rdi)
movb $-0x1, 0x3(%rdi)
incq %rax
addq $0x4, %rdi
cmpq %r8, %rax
jne 0x6d29
cmpl $0x0, 0x18(%r10)
je 0x702f
negq %r8
movzbl (%rdi,%r8,4), %eax
cmpl %eax, 0x1c(%r10)
jne 0x6d84
movzbl 0x1(%rdi,%r8,4), %eax
cmpl %eax, 0x20(%r10)
jne 0x6d84
movzbl 0x2(%rdi,%r8,4), %eax
cmpl %eax, 0x24(%r10)
jne 0x6d84
movb $0x0, 0x3(%rdi,%r8,4)
incq %r8
jne 0x6d5b
jmp 0x702f
cmpl $0x8, 0x4(%r10)
jne 0x6ee2
testq %r8, %r8
je 0x702f
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 0x6da4
jmp 0x702f
cmpl $0x8, 0x4(%r10)
jne 0x6f12
shlq $0x2, %r8
testq %r8, %r8
je 0x702f
movq %r9, %rsi
movq %r8, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1130
testq %r8, %r8
je 0x702f
movq 0x8(%r10), %rcx
xorl %edx, %edx
xorl %esi, %esi
xorl %r10d, %r10d
testl %eax, %eax
je 0x6e4c
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 0x6e14
addq %rax, %rsi
shll $0x2, %r10d
movl (%rcx,%r10), %r10d
movl %r10d, (%rdi)
incq %rdx
addq $0x4, %rdi
cmpq %r8, %rdx
jne 0x6e07
jmp 0x702f
testq %r8, %r8
je 0x702f
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 0x6ecd
shll $0x8, %ebx
movzbl -0x4(%r9), %ebp
orl %ebx, %ebp
cmpl 0x1c(%r10), %ebp
jne 0x6ecd
shll $0x8, %r11d
movzbl -0x2(%r9), %ebx
orl %r11d, %ebx
cmpl 0x20(%r10), %ebx
jne 0x6ecd
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 0x6e77
jmp 0x702f
testq %r8, %r8
je 0x702f
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 0x6eed
jmp 0x702f
testq %r8, %r8
je 0x702f
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 0x6f1d
jmp 0x702f
testq %r8, %r8
je 0x702f
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 %r8, %rax
jne 0x6f57
cmpl $0x0, 0x18(%r10)
je 0x702f
negq %r8
movzbl (%rdi,%r8,4), %eax
cmpl %eax, 0x1c(%r10)
jne 0x6f92
movb $0x0, 0x3(%rdi,%r8,4)
incq %r8
jne 0x6f81
jmp 0x702f
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
shll %cl, %esi
testq %r8, %r8
je 0x702f
notl %esi
movl 0x18(%r10), %r11d
xorl %ebx, %ebx
xorl %r14d, %r14d
xorl %r15d, %r15d
testl %ecx, %ecx
je 0x6ff9
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 0x6fc4
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 0x701e
cmpl 0x1c(%r10), %r15d
setne %al
negb %al
jmp 0x7020
movb $-0x1, %al
movb %al, 0x3(%rdi)
incq %rbx
addq $0x4, %rdi
cmpq %r8, %rbx
jne 0x6fb7
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq