// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: lodepng_inspect_chunk(LodePNGState*, unsigned long, unsigned char const*, unsigned long)
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, "cICP")) {
    error = readChunk_cICP(&state->info_png, data, chunkLength);
  } else if(lodepng_chunk_type_equals(chunk, "mDCV")) {
    error = readChunk_mDCV(&state->info_png, data, chunkLength);
  } else if(lodepng_chunk_type_equals(chunk, "cLLI")) {
    error = readChunk_cLLI(&state->info_png, data, chunkLength);
  } else if(lodepng_chunk_type_equals(chunk, "eXIf")) {
    error = readChunk_eXIf(&state->info_png, 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 0x73d2
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r14
addq %rsi, %rbx
movq %rbx, %rdi
callq 0x456f
testl %eax, %eax
js 0x7237
movl %eax, %r12d
leal 0xc(%r12), %eax
subq %r13, %r15
cmpq %rax, %r15
jb 0x73d2
leaq 0x8(%rbx), %r15
leaq 0x57564(%rip), %rsi     # 0x5e778
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x723f
leaq 0xe0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0x751e
jmp 0x73b1
pushq $0x3f
popq %rbp
jmp 0x73d2
leaq 0x57537(%rip), %rsi     # 0x5e77d
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x7269
leaq 0xe0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0x75d7
jmp 0x73b1
leaq 0x57512(%rip), %rsi     # 0x5e782
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x7293
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0x7681
jmp 0x73b1
leaq 0x574ed(%rip), %rsi     # 0x5e787
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x72bd
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0x7722
jmp 0x73b1
leaq 0x574c8(%rip), %rsi     # 0x5e78c
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x72ea
leaq 0xd0(%r14), %rdi
movl %r12d, %ecx
movq %r14, %rsi
movq %r15, %rdx
callq 0x7806
jmp 0x73b1
leaq 0x574a0(%rip), %rsi     # 0x5e791
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x7317
leaq 0xd0(%r14), %rdi
movl %r12d, %ecx
movq %r14, %rsi
movq %r15, %rdx
callq 0x795b
jmp 0x73b1
leaq 0x57478(%rip), %rsi     # 0x5e796
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x733e
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0x7bee
jmp 0x73b1
leaq 0x57456(%rip), %rsi     # 0x5e79b
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x7365
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0x7c47
jmp 0x73b1
leaq 0x57434(%rip), %rsi     # 0x5e7a0
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x738c
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0x7c7d
jmp 0x73b1
leaq 0x57412(%rip), %rsi     # 0x5e7a5
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x73e3
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0x7c9e
movl %eax, %ebp
testl %eax, %eax
jne 0x73d2
cmpl $0x0, 0x28(%r14)
je 0x73c2
xorl %ebp, %ebp
jmp 0x73d2
movq %rbx, %rdi
callq 0x4619
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 0x573c0(%rip), %rsi     # 0x5e7aa
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x7414
cmpl $0x1, %r12d
jne 0x7441
movl $0x1, 0x1c4(%r14)
movzbl (%r15), %eax
movl %eax, 0x1c8(%r14)
jmp 0x73b7
leaq 0x57394(%rip), %rsi     # 0x5e7af
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x7448
leaq 0xd0(%r14), %rdi
movl %r12d, %ecx
movq %r14, %rsi
movq %r15, %rdx
callq 0x7d0c
jmp 0x73b1
pushq $0x62
jmp 0x7239
leaq 0x57365(%rip), %rsi     # 0x5e7b4
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x7472
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0x7e5b
jmp 0x73b1
leaq 0x57340(%rip), %rsi     # 0x5e7b9
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x749c
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0x7e99
jmp 0x73b1
leaq 0x5731b(%rip), %rsi     # 0x5e7be
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x74c6
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0x7f51
jmp 0x73b1
leaq 0x572f6(%rip), %rsi     # 0x5e7c3
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x74f0
leaq 0xd0(%r14), %rdi
movq %r15, %rsi
movl %r12d, %edx
callq 0x5002
jmp 0x73b1
leaq 0x572d1(%rip), %rsi     # 0x5e7c8
movq %rbx, %rdi
callq 0x458d
testb %al, %al
je 0x73be
leaq 0xd0(%r14), %rdi
movl %r12d, %edx
movq %r15, %rsi
callq 0x7f7d
jmp 0x73b1