// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x20(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movq -0x18(%rbp), %rax
addq $0x4, %rax
cmpq -0x28(%rbp), %rax
jbe 0x1031c
movl $0x1e, -0x4(%rbp)
jmp 0x1067b
movq -0x30(%rbp), %rdi
callq 0xae40
movl %eax, -0x34(%rbp)
cmpl $0x7fffffff, -0x34(%rbp) # imm = 0x7FFFFFFF
jbe 0x1033d
movl $0x3f, -0x4(%rbp)
jmp 0x1067b
movq -0x30(%rbp), %rdi
callq 0xb050
movq %rax, -0x40(%rbp)
movl -0x34(%rbp), %eax
addl $0xc, %eax
movl %eax, %eax
movq -0x28(%rbp), %rcx
subq -0x18(%rbp), %rcx
cmpq %rcx, %rax
jbe 0x1036b
movl $0x1e, -0x4(%rbp)
jmp 0x1067b
movq -0x30(%rbp), %rdi
leaq 0x12ab7(%rip), %rsi     # 0x22e2d
callq 0xaef0
cmpb $0x0, %al
je 0x103a4
movq -0x10(%rbp), %rdi
addq $0xd0, %rdi
addq $0x10, %rdi
movq -0x40(%rbp), %rsi
movl -0x34(%rbp), %eax
movl %eax, %edx
callq 0x10690
movl %eax, -0x48(%rbp)
jmp 0x10646
movq -0x30(%rbp), %rdi
leaq 0x12a83(%rip), %rsi     # 0x22e32
callq 0xaef0
cmpb $0x0, %al
je 0x103dd
movq -0x10(%rbp), %rdi
addq $0xd0, %rdi
addq $0x10, %rdi
movq -0x40(%rbp), %rsi
movl -0x34(%rbp), %eax
movl %eax, %edx
callq 0x107f0
movl %eax, -0x48(%rbp)
jmp 0x10644
movq -0x30(%rbp), %rdi
leaq 0x12a4f(%rip), %rsi     # 0x22e37
callq 0xaef0
cmpb $0x0, %al
je 0x10412
movq -0x10(%rbp), %rdi
addq $0xd0, %rdi
movq -0x40(%rbp), %rsi
movl -0x34(%rbp), %eax
movl %eax, %edx
callq 0x10950
movl %eax, -0x48(%rbp)
jmp 0x10642
movq -0x30(%rbp), %rdi
leaq 0x12a1f(%rip), %rsi     # 0x22e3c
callq 0xaef0
cmpb $0x0, %al
je 0x10447
movq -0x10(%rbp), %rdi
addq $0xd0, %rdi
movq -0x40(%rbp), %rsi
movl -0x34(%rbp), %eax
movl %eax, %edx
callq 0x10ac0
movl %eax, -0x48(%rbp)
jmp 0x10640
movq -0x30(%rbp), %rdi
leaq 0x129ef(%rip), %rsi     # 0x22e41
callq 0xaef0
cmpb $0x0, %al
je 0x10480
movq -0x10(%rbp), %rdi
addq $0xd0, %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
movl -0x34(%rbp), %eax
movl %eax, %ecx
callq 0x10c40
movl %eax, -0x48(%rbp)
jmp 0x1063e
movq -0x30(%rbp), %rdi
leaq 0x129bb(%rip), %rsi     # 0x22e46
callq 0xaef0
cmpb $0x0, %al
je 0x104b9
movq -0x10(%rbp), %rdi
addq $0xd0, %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
movl -0x34(%rbp), %eax
movl %eax, %ecx
callq 0x10e30
movl %eax, -0x48(%rbp)
jmp 0x1063c
movq -0x30(%rbp), %rdi
leaq 0x12987(%rip), %rsi     # 0x22e4b
callq 0xaef0
cmpb $0x0, %al
je 0x104ee
movq -0x10(%rbp), %rdi
addq $0xd0, %rdi
movq -0x40(%rbp), %rsi
movl -0x34(%rbp), %eax
movl %eax, %edx
callq 0x11220
movl %eax, -0x48(%rbp)
jmp 0x1063a
movq -0x30(%rbp), %rdi
leaq 0x12957(%rip), %rsi     # 0x22e50
callq 0xaef0
cmpb $0x0, %al
je 0x10523
movq -0x10(%rbp), %rdi
addq $0xd0, %rdi
movq -0x40(%rbp), %rsi
movl -0x34(%rbp), %eax
movl %eax, %edx
callq 0x112e0
movl %eax, -0x48(%rbp)
jmp 0x10638
movq -0x30(%rbp), %rdi
leaq 0x12927(%rip), %rsi     # 0x22e55
callq 0xaef0
cmpb $0x0, %al
je 0x10558
movq -0x10(%rbp), %rdi
addq $0xd0, %rdi
movq -0x40(%rbp), %rsi
movl -0x34(%rbp), %eax
movl %eax, %edx
callq 0x113a0
movl %eax, -0x48(%rbp)
jmp 0x10636
movq -0x30(%rbp), %rdi
leaq 0x128f7(%rip), %rsi     # 0x22e5a
callq 0xaef0
cmpb $0x0, %al
je 0x1058d
movq -0x10(%rbp), %rdi
addq $0xd0, %rdi
movq -0x40(%rbp), %rsi
movl -0x34(%rbp), %eax
movl %eax, %edx
callq 0x11420
movl %eax, -0x48(%rbp)
jmp 0x10634
movq -0x30(%rbp), %rdi
leaq 0x128c7(%rip), %rsi     # 0x22e5f
callq 0xaef0
cmpb $0x0, %al
je 0x105bf
movq -0x10(%rbp), %rdi
addq $0xd0, %rdi
movq -0x40(%rbp), %rsi
movl -0x34(%rbp), %eax
movl %eax, %edx
callq 0x11630
movl %eax, -0x48(%rbp)
jmp 0x10632
movq -0x30(%rbp), %rdi
leaq 0x1289a(%rip), %rsi     # 0x22e64
callq 0xaef0
cmpb $0x0, %al
je 0x105f5
movq -0x10(%rbp), %rdi
addq $0xd0, %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
movl -0x34(%rbp), %eax
movl %eax, %ecx
callq 0x11680
movl %eax, -0x48(%rbp)
jmp 0x10630
movq -0x30(%rbp), %rdi
leaq 0x12869(%rip), %rsi     # 0x22e69
callq 0xaef0
cmpb $0x0, %al
je 0x10627
movq -0x10(%rbp), %rdi
addq $0xd0, %rdi
movq -0x40(%rbp), %rsi
movl -0x34(%rbp), %eax
movl %eax, %edx
callq 0x118b0
movl %eax, -0x48(%rbp)
jmp 0x1062e
movl $0x1, -0x44(%rbp)
jmp 0x10630
jmp 0x10632
jmp 0x10634
jmp 0x10636
jmp 0x10638
jmp 0x1063a
jmp 0x1063c
jmp 0x1063e
jmp 0x10640
jmp 0x10642
jmp 0x10644
jmp 0x10646
cmpl $0x0, -0x48(%rbp)
jne 0x10675
cmpl $0x0, -0x44(%rbp)
jne 0x10675
movq -0x10(%rbp), %rax
cmpl $0x0, 0x28(%rax)
jne 0x10675
movq -0x30(%rbp), %rdi
callq 0xb070
cmpl $0x0, %eax
je 0x10673
movl $0x39, -0x4(%rbp)
jmp 0x1067b
jmp 0x10675
movl -0x48(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)