// File: /workspace/github_c_makefile_star2_O0/Joy-Division[P]tools-mgs/lodepng/lodepng.c
// Function: rgba16ToPixel
static void rgba16ToPixel(unsigned char* out, size_t i,
                         const LodePNGColorMode* mode,
                         unsigned short r, unsigned short g, unsigned short b, unsigned short a)
{
  if(mode->colortype == LCT_GREY)
  {
    unsigned short grey = r; /*((unsigned)r + g + b) / 3*/;
    out[i * 2 + 0] = (grey >> 8) & 255;
    out[i * 2 + 1] = grey & 255;
  }
  else if(mode->colortype == LCT_RGB)
  {
    out[i * 6 + 0] = (r >> 8) & 255;
    out[i * 6 + 1] = r & 255;
    out[i * 6 + 2] = (g >> 8) & 255;
    out[i * 6 + 3] = g & 255;
    out[i * 6 + 4] = (b >> 8) & 255;
    out[i * 6 + 5] = b & 255;
  }
  else if(mode->colortype == LCT_GREY_ALPHA)
  {
    unsigned short grey = r; /*((unsigned)r + g + b) / 3*/;
    out[i * 4 + 0] = (grey >> 8) & 255;
    out[i * 4 + 1] = grey & 255;
    out[i * 4 + 2] = (a >> 8) & 255;
    out[i * 4 + 3] = a & 255;
  }
  else if(mode->colortype == LCT_RGBA)
  {
    out[i * 8 + 0] = (r >> 8) & 255;
    out[i * 8 + 1] = r & 255;
    out[i * 8 + 2] = (g >> 8) & 255;
    out[i * 8 + 3] = g & 255;
    out[i * 8 + 4] = (b >> 8) & 255;
    out[i * 8 + 5] = b & 255;
    out[i * 8 + 6] = (a >> 8) & 255;
    out[i * 8 + 7] = a & 255;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %r8d, -0x40(%rbp)
movl %ecx, %eax
movl -0x40(%rbp), %ecx
movl %eax, -0x3c(%rbp)
movq %rdx, %rax
movl -0x3c(%rbp), %edx
movq %rax, -0x38(%rbp)
movq %rsi, %rax
movq -0x38(%rbp), %rsi
movq %rax, -0x30(%rbp)
movq %rdi, %r8
movq -0x30(%rbp), %rdi
movw %r9w, %ax
movw 0x10(%rbp), %r9w
movq %r8, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movw %dx, -0x1a(%rbp)
movw %cx, -0x1c(%rbp)
movw %ax, -0x1e(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x49e9
movw -0x1a(%rbp), %ax
movw %ax, -0x20(%rbp)
movzwl -0x20(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
shlq %rcx
movb %dl, (%rax,%rcx)
movzwl -0x20(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
shlq %rcx
movb %dl, 0x1(%rax,%rcx)
jmp 0x4c10
movq -0x18(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x4a93
movzwl -0x1a(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
imulq $0x6, -0x10(%rbp), %rcx
movb %dl, (%rax,%rcx)
movzwl -0x1a(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
imulq $0x6, -0x10(%rbp), %rcx
movb %dl, 0x1(%rax,%rcx)
movzwl -0x1c(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
imulq $0x6, -0x10(%rbp), %rcx
movb %dl, 0x2(%rax,%rcx)
movzwl -0x1c(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
imulq $0x6, -0x10(%rbp), %rcx
movb %dl, 0x3(%rax,%rcx)
movzwl -0x1e(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
imulq $0x6, -0x10(%rbp), %rcx
movb %dl, 0x4(%rax,%rcx)
movzwl -0x1e(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
imulq $0x6, -0x10(%rbp), %rcx
movb %dl, 0x5(%rax,%rcx)
jmp 0x4c0e
movq -0x18(%rbp), %rax
cmpl $0x4, (%rax)
jne 0x4b1a
movw -0x1a(%rbp), %ax
movw %ax, -0x22(%rbp)
movzwl -0x22(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, (%rax,%rcx)
movzwl -0x22(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, 0x1(%rax,%rcx)
movzwl 0x10(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, 0x2(%rax,%rcx)
movzwl 0x10(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
shlq $0x2, %rcx
movb %dl, 0x3(%rax,%rcx)
jmp 0x4c0c
movq -0x18(%rbp), %rax
cmpl $0x6, (%rax)
jne 0x4c0a
movzwl -0x1a(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
shlq $0x3, %rcx
movb %dl, (%rax,%rcx)
movzwl -0x1a(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
shlq $0x3, %rcx
movb %dl, 0x1(%rax,%rcx)
movzwl -0x1c(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
shlq $0x3, %rcx
movb %dl, 0x2(%rax,%rcx)
movzwl -0x1c(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
shlq $0x3, %rcx
movb %dl, 0x3(%rax,%rcx)
movzwl -0x1e(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
shlq $0x3, %rcx
movb %dl, 0x4(%rax,%rcx)
movzwl -0x1e(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
shlq $0x3, %rcx
movb %dl, 0x5(%rax,%rcx)
movzwl 0x10(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
shlq $0x3, %rcx
movb %dl, 0x6(%rax,%rcx)
movzwl 0x10(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
shlq $0x3, %rcx
movb %dl, 0x7(%rax,%rcx)
jmp 0x4c0c
jmp 0x4c0e
jmp 0x4c10
popq %rbp
retq
nopw %cs:(%rax,%rax)