// File: /workspace/github_c_makefile_star2_O0/tditlu[P]shadetabler/src/lodepng/lodepng.c
// Function: readChunk_bKGD
static unsigned readChunk_bKGD(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) {
  if(info->color.colortype == LCT_PALETTE) {
    /*error: this chunk must be 1 byte for indexed color image*/
    if(chunkLength != 1) return 43;

    /*error: invalid palette index, or maybe this chunk appeared before PLTE*/
    if(data[0] >= info->color.palettesize) return 103;

    info->background_defined = 1;
    info->background_r = info->background_g = info->background_b = data[0];
  } else if(info->color.colortype == LCT_GREY || info->color.colortype == LCT_GREY_ALPHA) {
    /*error: this chunk must be 2 bytes for grayscale image*/
    if(chunkLength != 2) return 44;

    /*the values are truncated to bitdepth in the PNG file*/
    info->background_defined = 1;
    info->background_r = info->background_g = info->background_b = 256u * data[0] + data[1];
  } else if(info->color.colortype == LCT_RGB || info->color.colortype == LCT_RGBA) {
    /*error: this chunk must be 6 bytes for grayscale image*/
    if(chunkLength != 6) return 45;

    /*the values are truncated to bitdepth in the PNG file*/
    info->background_defined = 1;
    info->background_r = 256u * data[0] + data[1];
    info->background_g = 256u * data[2] + data[3];
    info->background_b = 256u * data[4] + data[5];
  }

  return 0; /* OK */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x3, 0x10(%rax)
jne 0xb576
cmpq $0x1, -0x20(%rbp)
je 0xb52d
movl $0x2b, -0x4(%rbp)
jmp 0xb663
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
movq -0x10(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jb 0xb54a
movl $0x67, -0x4(%rbp)
jmp 0xb663
movq -0x10(%rbp), %rax
movl $0x1, 0x38(%rax)
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x44(%rax)
movq -0x10(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x10(%rbp), %rax
movl %ecx, 0x3c(%rax)
jmp 0xb65c
movq -0x10(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0xb58a
movq -0x10(%rbp), %rax
cmpl $0x4, 0x10(%rax)
jne 0xb5d6
cmpq $0x2, -0x20(%rbp)
je 0xb59d
movl $0x2c, -0x4(%rbp)
jmp 0xb663
movq -0x10(%rbp), %rax
movl $0x1, 0x38(%rax)
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
shll $0x8, %ecx
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %eax
addl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x44(%rax)
movq -0x10(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x10(%rbp), %rax
movl %ecx, 0x3c(%rax)
jmp 0xb65a
movq -0x10(%rbp), %rax
cmpl $0x2, 0x10(%rax)
je 0xb5ea
movq -0x10(%rbp), %rax
cmpl $0x6, 0x10(%rax)
jne 0xb658
cmpq $0x6, -0x20(%rbp)
je 0xb5fa
movl $0x2d, -0x4(%rbp)
jmp 0xb663
movq -0x10(%rbp), %rax
movl $0x1, 0x38(%rax)
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
shll $0x8, %ecx
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %eax
addl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x3c(%rax)
movq -0x18(%rbp), %rax
movzbl 0x2(%rax), %ecx
shll $0x8, %ecx
movq -0x18(%rbp), %rax
movzbl 0x3(%rax), %eax
addl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x18(%rbp), %rax
movzbl 0x4(%rax), %ecx
shll $0x8, %ecx
movq -0x18(%rbp), %rax
movzbl 0x5(%rax), %eax
addl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x44(%rax)
jmp 0xb65a
jmp 0xb65c
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax,%rax)