// File: /workspace/github_c_makefile_star2_O0/tditlu[P]shadetabler/src/lodepng/lodepng.c
// Function: rgba8ToPixel
static unsigned rgba8ToPixel(unsigned char* out, size_t i,
                             const LodePNGColorMode* mode, ColorTree* tree /*for palette*/,
                             unsigned char r, unsigned char g, unsigned char b, unsigned char a) {
  if(mode->colortype == LCT_GREY) {
    unsigned char gray = r; /*((unsigned short)r + g + b) / 3u;*/
    if(mode->bitdepth == 8) out[i] = gray;
    else if(mode->bitdepth == 16) out[i * 2 + 0] = out[i * 2 + 1] = gray;
    else {
      /*take the most significant bits of gray*/
      gray = ((unsigned)gray >> (8u - mode->bitdepth)) & ((1u << mode->bitdepth) - 1u);
      addColorBits(out, i, mode->bitdepth, gray);
    }
  } else if(mode->colortype == LCT_RGB) {
    if(mode->bitdepth == 8) {
      out[i * 3 + 0] = r;
      out[i * 3 + 1] = g;
      out[i * 3 + 2] = b;
    } else {
      out[i * 6 + 0] = out[i * 6 + 1] = r;
      out[i * 6 + 2] = out[i * 6 + 3] = g;
      out[i * 6 + 4] = out[i * 6 + 5] = b;
    }
  } else if(mode->colortype == LCT_PALETTE) {
    int index = color_tree_get(tree, r, g, b, a);
    if(index < 0) return 82; /*color not in palette*/
    if(mode->bitdepth == 8) out[i] = index;
    else addColorBits(out, i, mode->bitdepth, (unsigned)index);
  } else if(mode->colortype == LCT_GREY_ALPHA) {
    unsigned char gray = r; /*((unsigned short)r + g + b) / 3u;*/
    if(mode->bitdepth == 8) {
      out[i * 2 + 0] = gray;
      out[i * 2 + 1] = a;
    } else if(mode->bitdepth == 16) {
      out[i * 4 + 0] = out[i * 4 + 1] = gray;
      out[i * 4 + 2] = out[i * 4 + 3] = a;
    }
  } else if(mode->colortype == LCT_RGBA) {
    if(mode->bitdepth == 8) {
      out[i * 4 + 0] = r;
      out[i * 4 + 1] = g;
      out[i * 4 + 2] = b;
      out[i * 4 + 3] = a;
    } else {
      out[i * 8 + 0] = out[i * 8 + 1] = r;
      out[i * 8 + 2] = out[i * 8 + 3] = g;
      out[i * 8 + 4] = out[i * 8 + 5] = b;
      out[i * 8 + 6] = out[i * 8 + 7] = a;
    }
  }

  return 0; /*no error*/
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %r8d, -0x54(%rbp)
movq %rcx, %rax
movl -0x54(%rbp), %ecx
movq %rax, -0x50(%rbp)
movq %rdx, %rax
movq -0x50(%rbp), %rdx
movq %rax, -0x48(%rbp)
movq %rsi, %rax
movq -0x48(%rbp), %rsi
movq %rax, -0x40(%rbp)
movq %rdi, %r8
movq -0x40(%rbp), %rdi
movb %r9b, %al
movb 0x18(%rbp), %r9b
movb 0x10(%rbp), %r9b
movq %r8, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movb %cl, -0x29(%rbp)
movb %al, -0x2a(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x9616
movb -0x29(%rbp), %al
movb %al, -0x2b(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x8, 0x4(%rax)
jne 0x95a1
movb -0x2b(%rbp), %dl
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x9611
movq -0x20(%rbp), %rax
cmpl $0x10, 0x4(%rax)
jne 0x95cd
movb -0x2b(%rbp), %dl
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq %rcx
movb %dl, 0x1(%rax,%rcx)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq %rcx
movb %dl, (%rax,%rcx)
jmp 0x960f
movzbl -0x2b(%rbp), %eax
movq -0x20(%rbp), %rdx
movl $0x8, %ecx
subl 0x4(%rdx), %ecx
shrl %cl, %eax
movq -0x20(%rbp), %rcx
movl 0x4(%rcx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
andl %ecx, %eax
movb %al, -0x2b(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movl 0x4(%rax), %edx
movzbl -0x2b(%rbp), %ecx
callq 0x14340
jmp 0x9611
jmp 0x98c3
movq -0x20(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x96b9
movq -0x20(%rbp), %rax
cmpl $0x8, 0x4(%rax)
jne 0x965e
movb -0x29(%rbp), %dl
movq -0x10(%rbp), %rax
imulq $0x3, -0x18(%rbp), %rcx
movb %dl, (%rax,%rcx)
movb -0x2a(%rbp), %dl
movq -0x10(%rbp), %rax
imulq $0x3, -0x18(%rbp), %rcx
movb %dl, 0x1(%rax,%rcx)
movb 0x10(%rbp), %dl
movq -0x10(%rbp), %rax
imulq $0x3, -0x18(%rbp), %rcx
movb %dl, 0x2(%rax,%rcx)
jmp 0x96b4
movb -0x29(%rbp), %dl
movq -0x10(%rbp), %rax
imulq $0x6, -0x18(%rbp), %rcx
movb %dl, 0x1(%rax,%rcx)
movq -0x10(%rbp), %rax
imulq $0x6, -0x18(%rbp), %rcx
movb %dl, (%rax,%rcx)
movb -0x2a(%rbp), %dl
movq -0x10(%rbp), %rax
imulq $0x6, -0x18(%rbp), %rcx
movb %dl, 0x3(%rax,%rcx)
movq -0x10(%rbp), %rax
imulq $0x6, -0x18(%rbp), %rcx
movb %dl, 0x2(%rax,%rcx)
movb 0x10(%rbp), %dl
movq -0x10(%rbp), %rax
imulq $0x6, -0x18(%rbp), %rcx
movb %dl, 0x5(%rax,%rcx)
movq -0x10(%rbp), %rax
imulq $0x6, -0x18(%rbp), %rcx
movb %dl, 0x4(%rax,%rcx)
jmp 0x98c1
movq -0x20(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x972f
movq -0x28(%rbp), %rdi
movb -0x29(%rbp), %dl
movb -0x2a(%rbp), %cl
movb 0x10(%rbp), %al
movzbl %dl, %esi
movzbl %cl, %edx
movzbl %al, %ecx
movzbl 0x18(%rbp), %r8d
callq 0x14400
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jge 0x96f7
movl $0x52, -0x4(%rbp)
jmp 0x98ca
movq -0x20(%rbp), %rax
cmpl $0x8, 0x4(%rax)
jne 0x9713
movl -0x30(%rbp), %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x972a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movl 0x4(%rax), %edx
movl -0x30(%rbp), %ecx
callq 0x14340
jmp 0x98bf
movq -0x20(%rbp), %rax
cmpl $0x4, (%rax)
jne 0x97c7
movb -0x29(%rbp), %al
movb %al, -0x31(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x8, 0x4(%rax)
jne 0x9771
movb -0x31(%rbp), %dl
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq %rcx
movb %dl, (%rax,%rcx)
movb 0x18(%rbp), %dl
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq %rcx
movb %dl, 0x1(%rax,%rcx)
jmp 0x97c2
movq -0x20(%rbp), %rax
cmpl $0x10, 0x4(%rax)
jne 0x97c0
movb -0x31(%rbp), %dl
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, 0x1(%rax,%rcx)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, (%rax,%rcx)
movb 0x18(%rbp), %dl
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, 0x3(%rax,%rcx)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, 0x2(%rax,%rcx)
jmp 0x97c2
jmp 0x98bd
movq -0x20(%rbp), %rax
cmpl $0x6, (%rax)
jne 0x98bb
movq -0x20(%rbp), %rax
cmpl $0x8, 0x4(%rax)
jne 0x982e
movb -0x29(%rbp), %dl
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, (%rax,%rcx)
movb -0x2a(%rbp), %dl
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, 0x1(%rax,%rcx)
movb 0x10(%rbp), %dl
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, 0x2(%rax,%rcx)
movb 0x18(%rbp), %dl
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, 0x3(%rax,%rcx)
jmp 0x98b9
movb -0x29(%rbp), %dl
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x3, %rcx
movb %dl, 0x1(%rax,%rcx)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x3, %rcx
movb %dl, (%rax,%rcx)
movb -0x2a(%rbp), %dl
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x3, %rcx
movb %dl, 0x3(%rax,%rcx)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x3, %rcx
movb %dl, 0x2(%rax,%rcx)
movb 0x10(%rbp), %dl
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x3, %rcx
movb %dl, 0x5(%rax,%rcx)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x3, %rcx
movb %dl, 0x4(%rax,%rcx)
movb 0x18(%rbp), %dl
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x3, %rcx
movb %dl, 0x7(%rax,%rcx)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x3, %rcx
movb %dl, 0x6(%rax,%rcx)
jmp 0x98bb
jmp 0x98bd
jmp 0x98bf
jmp 0x98c1
jmp 0x98c3
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)