// File: /workspace/github_c_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
addq $0x4, %rsi
movl $0x1e, %eax
cmpq %rcx, %rsi
ja 0x84a8
addq %rdx, %rbx
movzbl (%rbx), %esi
shll $0x18, %esi
js 0x836b
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 0x84a8
leaq 0x8(%rbx), %r12
leaq 0xa845(%rip), %rsi      # 0x12b8d
movq %rbx, %rdi
callq 0x52e9
testb %al, %al
je 0x8375
leaq 0xc8(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x85a5
jmp 0x8493
movl $0x3f, %eax
jmp 0x84a8
leaq 0xa816(%rip), %rsi      # 0x12b92
movq %rbx, %rdi
callq 0x52e9
testb %al, %al
je 0x839f
leaq 0xc8(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x8679
jmp 0x8493
leaq 0xa7f1(%rip), %rsi      # 0x12b97
movq %rbx, %rdi
callq 0x52e9
testb %al, %al
je 0x83c9
leaq 0xb8(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x873a
jmp 0x8493
leaq 0xa7cc(%rip), %rsi      # 0x12b9c
movq %rbx, %rdi
callq 0x52e9
testb %al, %al
je 0x83f3
leaq 0xb8(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x87e6
jmp 0x8493
leaq 0xa7a7(%rip), %rsi      # 0x12ba1
movq %rbx, %rdi
callq 0x52e9
testb %al, %al
je 0x841d
leaq 0xb8(%r14), %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x88fa
jmp 0x8493
leaq 0xa782(%rip), %rsi      # 0x12ba6
movq %rbx, %rdi
callq 0x52e9
testb %al, %al
je 0x8447
leaq 0xb8(%r14), %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x8a26
jmp 0x8493
leaq 0xa75d(%rip), %rsi      # 0x12bab
movq %rbx, %rdi
callq 0x52e9
testb %al, %al
je 0x846e
leaq 0xb8(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x8ca9
jmp 0x8493
leaq 0xa73b(%rip), %rsi      # 0x12bb0
movq %rbx, %rdi
callq 0x52e9
testb %al, %al
je 0x84c6
leaq 0xb8(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x8d03
movl %eax, %ebp
xorl %eax, %eax
testb %al, %al
jne 0x84a6
testl %ebp, %ebp
jne 0x84a6
cmpl $0x0, 0x20(%r14)
je 0x84b1
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x5354
movl %eax, %ecx
movl $0x39, %eax
testl %ecx, %ecx
jne 0x84a8
jmp 0x84a6
leaq 0xa6e8(%rip), %rsi      # 0x12bb5
movq %rbx, %rdi
callq 0x52e9
testb %al, %al
je 0x84fa
xorl %ebp, %ebp
cmpl $0x4, %r15d
jne 0x8524
movl $0x1, 0x16c(%r14)
movl 0x8(%rbx), %eax
bswapl %eax
movl %eax, 0x170(%r14)
jmp 0x8495
leaq 0xa6b9(%rip), %rsi      # 0x12bba
movq %rbx, %rdi
callq 0x52e9
testb %al, %al
je 0x852e
leaq 0xb8(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x8d3a
jmp 0x8493
movl $0x60, %ebp
jmp 0x8495
leaq 0xa68a(%rip), %rsi      # 0x12bbf
movq %rbx, %rdi
callq 0x52e9
testb %al, %al
je 0x8565
xorl %ebp, %ebp
cmpl $0x1, %r15d
jne 0x8592
movl $0x1, 0x198(%r14)
movzbl (%r12), %eax
movl %eax, 0x19c(%r14)
jmp 0x8495
leaq 0xa658(%rip), %rsi      # 0x12bc4
movq %rbx, %rdi
callq 0x52e9
testb %al, %al
je 0x859c
leaq 0xb8(%r14), %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x8da9
jmp 0x8493
movl $0x62, %ebp
jmp 0x8495
xorl %ebp, %ebp
movb $0x1, %al
jmp 0x8497