// File: /workspace/github_c_makefile_star2_O3/tditlu[P]shadetabler/src/lodepng/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(data + chunkLength + 4 > in + insize) 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.zlibsettings, data, chunkLength);
  } else if(lodepng_chunk_type_equals(chunk, "iTXt")) {
    error = readChunk_iTXt(&state->info_png, &state->decoder.zlibsettings, 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.zlibsettings, 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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
addq $0x4, %rsi
movl $0x1e, %eax
cmpq %rcx, %rsi
ja 0x866b
addq %rdx, %rbx
movzbl (%rbx), %esi
shll $0x18, %esi
js 0x8520
movq %rdi, %r14
movzbl 0x1(%rbx), %edi
shll $0x10, %edi
movzbl 0x2(%rbx), %r8d
shll $0x8, %r8d
movzbl 0x3(%rbx), %r15d
orl %edi, %r15d
orl %r8d, %r15d
orl %esi, %r15d
leaq (%rbx,%r15), %rsi
addq $0xc, %rsi
addq %rcx, %rdx
cmpq %rdx, %rsi
ja 0x866b
leaq 0x8(%rbx), %r12
leaq 0xa790(%rip), %rsi      # 0x12c8d
movq %rbx, %rdi
callq 0x55b2
testb %al, %al
je 0x852a
leaq 0xc8(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x8747
jmp 0x8648
movl $0x3f, %eax
jmp 0x866b
leaq 0xa761(%rip), %rsi      # 0x12c92
movq %rbx, %rdi
callq 0x55b2
testb %al, %al
je 0x8554
leaq 0xc8(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x881f
jmp 0x8648
leaq 0xa73c(%rip), %rsi      # 0x12c97
movq %rbx, %rdi
callq 0x55b2
testb %al, %al
je 0x857e
leaq 0xb8(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x88e0
jmp 0x8648
leaq 0xa717(%rip), %rsi      # 0x12c9c
movq %rbx, %rdi
callq 0x55b2
testb %al, %al
je 0x85a8
leaq 0xb8(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x898c
jmp 0x8648
leaq 0xa6f2(%rip), %rsi      # 0x12ca1
movq %rbx, %rdi
callq 0x55b2
testb %al, %al
je 0x85d2
leaq 0xb8(%r14), %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x8a84
jmp 0x8648
leaq 0xa6cd(%rip), %rsi      # 0x12ca6
movq %rbx, %rdi
callq 0x55b2
testb %al, %al
je 0x85fc
leaq 0xb8(%r14), %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x8ba6
jmp 0x8648
leaq 0xa6a8(%rip), %rsi      # 0x12cab
movq %rbx, %rdi
callq 0x55b2
testb %al, %al
je 0x8623
leaq 0xb8(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x8e1d
jmp 0x8648
leaq 0xa686(%rip), %rsi      # 0x12cb0
movq %rbx, %rdi
callq 0x55b2
testb %al, %al
je 0x8677
leaq 0xb8(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x8e77
testl %eax, %eax
jne 0x866b
cmpl $0x0, 0x20(%r14)
je 0x8657
xorl %eax, %eax
jmp 0x866b
movq %rbx, %rdi
callq 0x561d
movl %eax, %ecx
testl %eax, %eax
movl $0x39, %eax
cmovel %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xa637(%rip), %rsi      # 0x12cb5
movq %rbx, %rdi
callq 0x55b2
testb %al, %al
je 0x86ae
movl $0x60, %eax
cmpl $0x4, %r15d
jne 0x866b
movl $0x1, 0x16c(%r14)
movl 0x8(%rbx), %eax
bswapl %eax
movl %eax, 0x170(%r14)
jmp 0x864c
leaq 0xa605(%rip), %rsi      # 0x12cba
movq %rbx, %rdi
callq 0x55b2
testb %al, %al
je 0x86d8
leaq 0xb8(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x8eae
jmp 0x8648
leaq 0xa5e0(%rip), %rsi      # 0x12cbf
movq %rbx, %rdi
callq 0x55b2
testb %al, %al
je 0x8716
movl $0x62, %eax
cmpl $0x1, %r15d
jne 0x866b
movl $0x1, 0x198(%r14)
movzbl (%r12), %eax
movl %eax, 0x19c(%r14)
jmp 0x864c
leaq 0xa5a7(%rip), %rsi      # 0x12cc4
movq %rbx, %rdi
callq 0x55b2
testb %al, %al
je 0x8653
leaq 0xb8(%r14), %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x8f1d
jmp 0x8648