// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/lodepng.c
// Function: lodepng_inspect_chunk
unsigned lodepng_inspect_chunk(LodePNGState* state, size_t pos,
                               const unsigned char* in, size_t insize) {
  const unsigned char* chunk = in + pos;
  unsigned chunkLength;
  const unsigned char* data;
  unsigned unhandled = 0;
  unsigned error = 0;

  if(pos + 4 > insize) return 30;
  chunkLength = lodepng_chunk_length(chunk);
  if(chunkLength > 2147483647) return 63;
  data = lodepng_chunk_data_const(chunk);
  if(chunkLength + 12 > insize - pos) return 30;

  if(lodepng_chunk_type_equals(chunk, "PLTE")) {
    error = readChunk_PLTE(&state->info_png.color, data, chunkLength);
  } else if(lodepng_chunk_type_equals(chunk, "tRNS")) {
    error = readChunk_tRNS(&state->info_png.color, data, chunkLength);
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
  } else if(lodepng_chunk_type_equals(chunk, "bKGD")) {
    error = readChunk_bKGD(&state->info_png, data, chunkLength);
  } else if(lodepng_chunk_type_equals(chunk, "tEXt")) {
    error = readChunk_tEXt(&state->info_png, data, chunkLength);
  } else if(lodepng_chunk_type_equals(chunk, "zTXt")) {
    error = readChunk_zTXt(&state->info_png, &state->decoder, data, chunkLength);
  } else if(lodepng_chunk_type_equals(chunk, "iTXt")) {
    error = readChunk_iTXt(&state->info_png, &state->decoder, data, chunkLength);
  } else if(lodepng_chunk_type_equals(chunk, "tIME")) {
    error = readChunk_tIME(&state->info_png, data, chunkLength);
  } else if(lodepng_chunk_type_equals(chunk, "pHYs")) {
    error = readChunk_pHYs(&state->info_png, data, chunkLength);
  } else if(lodepng_chunk_type_equals(chunk, "gAMA")) {
    error = readChunk_gAMA(&state->info_png, data, chunkLength);
  } else if(lodepng_chunk_type_equals(chunk, "cHRM")) {
    error = readChunk_cHRM(&state->info_png, data, chunkLength);
  } else if(lodepng_chunk_type_equals(chunk, "sRGB")) {
    error = readChunk_sRGB(&state->info_png, data, chunkLength);
  } else if(lodepng_chunk_type_equals(chunk, "iCCP")) {
    error = readChunk_iCCP(&state->info_png, &state->decoder, data, chunkLength);
  } else if(lodepng_chunk_type_equals(chunk, "sBIT")) {
    error = readChunk_sBIT(&state->info_png, data, chunkLength);
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
  } else {
    /* unhandled chunk is ok (is not an error) */
    unhandled = 1;
  }

  if(!error && !unhandled && !state->decoder.ignore_crc) {
    if(lodepng_chunk_check_crc(chunk)) return 57; /*invalid CRC*/
  }

  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x4(%rsi), %rax
pushq $0x1e
popq %rbp
cmpq %rcx, %rax
ja 0xb2c8
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r14
addq %rsi, %rbx
movq %rbx, %rdi
callq 0x867d
testl %eax, %eax
js 0xb12d
movl %eax, %r12d
leal 0xc(%r12), %eax
subq %r13, %r15
cmpq %rax, %r15
jb 0xb2c8
leaq 0x8(%rbx), %r15
leaq 0xae8f(%rip), %rsi      # 0x15f99
movq %rbx, %rdi
callq 0x869b
testb %al, %al
je 0xb135
leaq 0xe0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0xb36c
jmp 0xb2a7
pushq $0x3f
popq %rbp
jmp 0xb2c8
leaq 0xae62(%rip), %rsi      # 0x15f9e
movq %rbx, %rdi
callq 0x869b
testb %al, %al
je 0xb15f
leaq 0xe0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0xb425
jmp 0xb2a7
leaq 0xae3d(%rip), %rsi      # 0x15fa3
movq %rbx, %rdi
callq 0x869b
testb %al, %al
je 0xb189
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0xb4cf
jmp 0xb2a7
leaq 0xae18(%rip), %rsi      # 0x15fa8
movq %rbx, %rdi
callq 0x869b
testb %al, %al
je 0xb1b3
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0xb570
jmp 0xb2a7
leaq 0xadf3(%rip), %rsi      # 0x15fad
movq %rbx, %rdi
callq 0x869b
testb %al, %al
je 0xb1e0
leaq 0xd0(%r14), %rdi
movl %r12d, %ecx
movq %r14, %rsi
movq %r15, %rdx
callq 0xb654
jmp 0xb2a7
leaq 0xadcb(%rip), %rsi      # 0x15fb2
movq %rbx, %rdi
callq 0x869b
testb %al, %al
je 0xb20d
leaq 0xd0(%r14), %rdi
movl %r12d, %ecx
movq %r14, %rsi
movq %r15, %rdx
callq 0xb7a9
jmp 0xb2a7
leaq 0xada3(%rip), %rsi      # 0x15fb7
movq %rbx, %rdi
callq 0x869b
testb %al, %al
je 0xb234
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0xba3c
jmp 0xb2a7
leaq 0xad81(%rip), %rsi      # 0x15fbc
movq %rbx, %rdi
callq 0x869b
testb %al, %al
je 0xb25b
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0xba95
jmp 0xb2a7
leaq 0xad5f(%rip), %rsi      # 0x15fc1
movq %rbx, %rdi
callq 0x869b
testb %al, %al
je 0xb282
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0xbacb
jmp 0xb2a7
leaq 0xad3d(%rip), %rsi      # 0x15fc6
movq %rbx, %rdi
callq 0x869b
testb %al, %al
je 0xb2d9
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0xbaec
movl %eax, %ebp
testl %eax, %eax
jne 0xb2c8
cmpl $0x0, 0x28(%r14)
je 0xb2b8
xorl %ebp, %ebp
jmp 0xb2c8
movq %rbx, %rdi
callq 0x8727
testl %eax, %eax
pushq $0x39
popq %rbp
cmovel %eax, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xaceb(%rip), %rsi      # 0x15fcb
movq %rbx, %rdi
callq 0x869b
testb %al, %al
je 0xb30a
cmpl $0x1, %r12d
jne 0xb337
movl $0x1, 0x1b0(%r14)
movzbl (%r15), %eax
movl %eax, 0x1b4(%r14)
jmp 0xb2ad
leaq 0xacbf(%rip), %rsi      # 0x15fd0
movq %rbx, %rdi
callq 0x869b
testb %al, %al
je 0xb33e
leaq 0xd0(%r14), %rdi
movl %r12d, %ecx
movq %r14, %rsi
movq %r15, %rdx
callq 0xbb5a
jmp 0xb2a7
pushq $0x62
jmp 0xb12f
leaq 0xac90(%rip), %rsi      # 0x15fd5
movq %rbx, %rdi
callq 0x869b
testb %al, %al
je 0xb2b4
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0xbcaa
jmp 0xb2a7