// File: /workspace/github_c_makefile_star2_O0/aap[P]pdp11/lodepng.c
// Function: addChunk_sBIT
static unsigned addChunk_sBIT(ucvector* out, const LodePNGInfo* info) {
  unsigned bitdepth = (info->color.colortype == LCT_PALETTE) ? 8 : info->color.bitdepth;
  unsigned char* chunk = 0;
  if(info->color.colortype == LCT_GREY) {
    if(info->sbit_r == 0 || info->sbit_r > bitdepth) return 115;
    CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 1, "sBIT"));
    chunk[8] = info->sbit_r;
  } else if(info->color.colortype == LCT_RGB || info->color.colortype == LCT_PALETTE) {
    if(info->sbit_r == 0 || info->sbit_g == 0 || info->sbit_b == 0) return 115;
    if(info->sbit_r > bitdepth || info->sbit_g > bitdepth || info->sbit_b > bitdepth) return 115;
    CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 3, "sBIT"));
    chunk[8] = info->sbit_r;
    chunk[9] = info->sbit_g;
    chunk[10] = info->sbit_b;
  } else if(info->color.colortype == LCT_GREY_ALPHA) {
    if(info->sbit_r == 0 || info->sbit_a == 0) return 115;
    if(info->sbit_r > bitdepth || info->sbit_a > bitdepth) return 115;
    CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 2, "sBIT"));
    chunk[8] = info->sbit_r;
    chunk[9] = info->sbit_a;
  } else if(info->color.colortype == LCT_RGBA) {
    if(info->sbit_r == 0 || info->sbit_g == 0 || info->sbit_b == 0 || info->sbit_a == 0 ||
       info->sbit_r > bitdepth || info->sbit_g > bitdepth ||
       info->sbit_b > bitdepth || info->sbit_a > bitdepth) {
      return 115;
    }
    CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 4, "sBIT"));
    chunk[8] = info->sbit_r;
    chunk[9] = info->sbit_g;
    chunk[10] = info->sbit_b;
    chunk[11] = info->sbit_a;
  }
  if(chunk) lodepng_chunk_generate_crc(chunk);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x3, 0x10(%rax)
jne 0x14e44
movl $0x8, %eax
movl %eax, -0x3c(%rbp)
jmp 0x14e4e
movq -0x18(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x14ed3
movq -0x18(%rbp), %rax
cmpl $0x0, 0x108(%rax)
je 0x14e82
movq -0x18(%rbp), %rax
movl 0x108(%rax), %eax
cmpl -0x1c(%rbp), %eax
jbe 0x14e8e
movl $0x73, -0x4(%rbp)
jmp 0x15195
movq -0x10(%rbp), %rsi
leaq -0x28(%rbp), %rdi
movl $0x1, %edx
leaq 0xdfc7(%rip), %rcx      # 0x22e69
callq 0x1aa10
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x14ebb
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15195
movq -0x18(%rbp), %rax
movl 0x108(%rax), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x8(%rax)
jmp 0x1517e
movq -0x18(%rbp), %rax
cmpl $0x2, 0x10(%rax)
je 0x14eeb
movq -0x18(%rbp), %rax
cmpl $0x3, 0x10(%rax)
jne 0x14fc2
movq -0x18(%rbp), %rax
cmpl $0x0, 0x108(%rax)
je 0x14f12
movq -0x18(%rbp), %rax
cmpl $0x0, 0x10c(%rax)
je 0x14f12
movq -0x18(%rbp), %rax
cmpl $0x0, 0x110(%rax)
jne 0x14f1e
movl $0x73, -0x4(%rbp)
jmp 0x15195
movq -0x18(%rbp), %rax
movl 0x108(%rax), %eax
cmpl -0x1c(%rbp), %eax
ja 0x14f4b
movq -0x18(%rbp), %rax
movl 0x10c(%rax), %eax
cmpl -0x1c(%rbp), %eax
ja 0x14f4b
movq -0x18(%rbp), %rax
movl 0x110(%rax), %eax
cmpl -0x1c(%rbp), %eax
jbe 0x14f57
movl $0x73, -0x4(%rbp)
jmp 0x15195
movq -0x10(%rbp), %rsi
leaq -0x28(%rbp), %rdi
movl $0x3, %edx
leaq 0xdefe(%rip), %rcx      # 0x22e69
callq 0x1aa10
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0x14f84
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15195
movq -0x18(%rbp), %rax
movl 0x108(%rax), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x8(%rax)
movq -0x18(%rbp), %rax
movl 0x10c(%rax), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x9(%rax)
movq -0x18(%rbp), %rax
movl 0x110(%rax), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0xa(%rax)
jmp 0x1517c
movq -0x18(%rbp), %rax
cmpl $0x4, 0x10(%rax)
jne 0x15078
movq -0x18(%rbp), %rax
cmpl $0x0, 0x108(%rax)
je 0x14fea
movq -0x18(%rbp), %rax
cmpl $0x0, 0x114(%rax)
jne 0x14ff6
movl $0x73, -0x4(%rbp)
jmp 0x15195
movq -0x18(%rbp), %rax
movl 0x108(%rax), %eax
cmpl -0x1c(%rbp), %eax
ja 0x15014
movq -0x18(%rbp), %rax
movl 0x114(%rax), %eax
cmpl -0x1c(%rbp), %eax
jbe 0x15020
movl $0x73, -0x4(%rbp)
jmp 0x15195
movq -0x10(%rbp), %rsi
leaq -0x28(%rbp), %rdi
movl $0x2, %edx
leaq 0xde35(%rip), %rcx      # 0x22e69
callq 0x1aa10
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x1504d
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15195
movq -0x18(%rbp), %rax
movl 0x108(%rax), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x8(%rax)
movq -0x18(%rbp), %rax
movl 0x114(%rax), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x9(%rax)
jmp 0x1517a
movq -0x18(%rbp), %rax
cmpl $0x6, 0x10(%rax)
jne 0x15178
movq -0x18(%rbp), %rax
cmpl $0x0, 0x108(%rax)
je 0x150f6
movq -0x18(%rbp), %rax
cmpl $0x0, 0x10c(%rax)
je 0x150f6
movq -0x18(%rbp), %rax
cmpl $0x0, 0x110(%rax)
je 0x150f6
movq -0x18(%rbp), %rax
cmpl $0x0, 0x114(%rax)
je 0x150f6
movq -0x18(%rbp), %rax
movl 0x108(%rax), %eax
cmpl -0x1c(%rbp), %eax
ja 0x150f6
movq -0x18(%rbp), %rax
movl 0x10c(%rax), %eax
cmpl -0x1c(%rbp), %eax
ja 0x150f6
movq -0x18(%rbp), %rax
movl 0x110(%rax), %eax
cmpl -0x1c(%rbp), %eax
ja 0x150f6
movq -0x18(%rbp), %rax
movl 0x114(%rax), %eax
cmpl -0x1c(%rbp), %eax
jbe 0x15102
movl $0x73, -0x4(%rbp)
jmp 0x15195
movq -0x10(%rbp), %rsi
leaq -0x28(%rbp), %rdi
movl $0x4, %edx
leaq 0xdd53(%rip), %rcx      # 0x22e69
callq 0x1aa10
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
je 0x1512c
movl -0x38(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x15195
movq -0x18(%rbp), %rax
movl 0x108(%rax), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x8(%rax)
movq -0x18(%rbp), %rax
movl 0x10c(%rax), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x9(%rax)
movq -0x18(%rbp), %rax
movl 0x110(%rax), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0xa(%rax)
movq -0x18(%rbp), %rax
movl 0x114(%rax), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0xb(%rax)
jmp 0x1517a
jmp 0x1517c
jmp 0x1517e
cmpq $0x0, -0x28(%rbp)
je 0x1518e
movq -0x28(%rbp), %rdi
callq 0xb0e0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop