// File: /workspace/github_c_makefile_star2_O0/aap[P]pdp11/lodepng.c
// Function: readChunk_sBIT
static unsigned readChunk_sBIT(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) {
  unsigned bitdepth = (info->color.colortype == LCT_PALETTE) ? 8 : info->color.bitdepth;
  if(info->color.colortype == LCT_GREY) {
    /*error: this chunk must be 1 bytes for grayscale image*/
    if(chunkLength != 1) return 114;
    if(data[0] == 0 || data[0] > bitdepth) return 115;
    info->sbit_defined = 1;
    info->sbit_r = info->sbit_g = info->sbit_b = data[0]; /*setting g and b is not required, but sensible*/
  } else if(info->color.colortype == LCT_RGB || info->color.colortype == LCT_PALETTE) {
    /*error: this chunk must be 3 bytes for RGB and palette image*/
    if(chunkLength != 3) return 114;
    if(data[0] == 0 || data[1] == 0 || data[2] == 0) return 115;
    if(data[0] > bitdepth || data[1] > bitdepth || data[2] > bitdepth) return 115;
    info->sbit_defined = 1;
    info->sbit_r = data[0];
    info->sbit_g = data[1];
    info->sbit_b = data[2];
  } else if(info->color.colortype == LCT_GREY_ALPHA) {
    /*error: this chunk must be 2 byte for grayscale with alpha image*/
    if(chunkLength != 2) return 114;
    if(data[0] == 0 || data[1] == 0) return 115;
    if(data[0] > bitdepth || data[1] > bitdepth) return 115;
    info->sbit_defined = 1;
    info->sbit_r = info->sbit_g = info->sbit_b = data[0]; /*setting g and b is not required, but sensible*/
    info->sbit_a = data[1];
  } else if(info->color.colortype == LCT_RGBA) {
    /*error: this chunk must be 4 bytes for grayscale image*/
    if(chunkLength != 4) return 114;
    if(data[0] == 0 || data[1] == 0 || data[2] == 0 || data[3] == 0) return 115;
    if(data[0] > bitdepth || data[1] > bitdepth || data[2] > bitdepth || data[3] > bitdepth) return 115;
    info->sbit_defined = 1;
    info->sbit_r = data[0];
    info->sbit_g = data[1];
    info->sbit_b = data[2];
    info->sbit_a = data[3];
  }

  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 0x118d4
movl $0x8, %eax
movl %eax, -0x28(%rbp)
jmp 0x118de
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x1195d
cmpq $0x1, -0x20(%rbp)
je 0x11901
movl $0x72, -0x4(%rbp)
jmp 0x11be7
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0x11919
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl -0x24(%rbp), %eax
jbe 0x11925
movl $0x73, -0x4(%rbp)
jmp 0x11be7
movq -0x10(%rbp), %rax
movl $0x1, 0x104(%rax)
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x110(%rax)
movq -0x10(%rbp), %rax
movl %ecx, 0x10c(%rax)
movq -0x10(%rbp), %rax
movl %ecx, 0x108(%rax)
jmp 0x11be0
movq -0x10(%rbp), %rax
cmpl $0x2, 0x10(%rax)
je 0x11975
movq -0x10(%rbp), %rax
cmpl $0x3, 0x10(%rax)
jne 0x11a34
cmpq $0x3, -0x20(%rbp)
je 0x11988
movl $0x72, -0x4(%rbp)
jmp 0x11be7
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0x119ae
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x0, %eax
je 0x119ae
movq -0x18(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl $0x0, %eax
jne 0x119ba
movl $0x73, -0x4(%rbp)
jmp 0x11be7
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl -0x24(%rbp), %eax
ja 0x119e0
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl -0x24(%rbp), %eax
ja 0x119e0
movq -0x18(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl -0x24(%rbp), %eax
jbe 0x119ec
movl $0x73, -0x4(%rbp)
jmp 0x11be7
movq -0x10(%rbp), %rax
movl $0x1, 0x104(%rax)
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x108(%rax)
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x10c(%rax)
movq -0x18(%rbp), %rax
movzbl 0x2(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x110(%rax)
jmp 0x11bde
movq -0x10(%rbp), %rax
cmpl $0x4, 0x10(%rax)
jne 0x11ae9
cmpq $0x2, -0x20(%rbp)
je 0x11a55
movl $0x72, -0x4(%rbp)
jmp 0x11be7
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0x11a6e
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0x11a7a
movl $0x73, -0x4(%rbp)
jmp 0x11be7
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl -0x24(%rbp), %eax
ja 0x11a93
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl -0x24(%rbp), %eax
jbe 0x11a9f
movl $0x73, -0x4(%rbp)
jmp 0x11be7
movq -0x10(%rbp), %rax
movl $0x1, 0x104(%rax)
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x110(%rax)
movq -0x10(%rbp), %rax
movl %ecx, 0x10c(%rax)
movq -0x10(%rbp), %rax
movl %ecx, 0x108(%rax)
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x114(%rax)
jmp 0x11bdc
movq -0x10(%rbp), %rax
cmpl $0x6, 0x10(%rax)
jne 0x11bda
cmpq $0x4, -0x20(%rbp)
je 0x11b0a
movl $0x72, -0x4(%rbp)
jmp 0x11be7
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0x11b3d
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x0, %eax
je 0x11b3d
movq -0x18(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl $0x0, %eax
je 0x11b3d
movq -0x18(%rbp), %rax
movzbl 0x3(%rax), %eax
cmpl $0x0, %eax
jne 0x11b49
movl $0x73, -0x4(%rbp)
jmp 0x11be7
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl -0x24(%rbp), %eax
ja 0x11b7c
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl -0x24(%rbp), %eax
ja 0x11b7c
movq -0x18(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl -0x24(%rbp), %eax
ja 0x11b7c
movq -0x18(%rbp), %rax
movzbl 0x3(%rax), %eax
cmpl -0x24(%rbp), %eax
jbe 0x11b85
movl $0x73, -0x4(%rbp)
jmp 0x11be7
movq -0x10(%rbp), %rax
movl $0x1, 0x104(%rax)
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x108(%rax)
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x10c(%rax)
movq -0x18(%rbp), %rax
movzbl 0x2(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x110(%rax)
movq -0x18(%rbp), %rax
movzbl 0x3(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x114(%rax)
jmp 0x11bdc
jmp 0x11bde
jmp 0x11be0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax)