// File: /workspace/github_cpp_makefile_star2_O1/mhe[P]raytracerframework_cpp/lodepng.cpp
// Function: LodePNG_inspect(LodePNG_Decoder*, unsigned char const*, unsigned long)
void LodePNG_inspect(LodePNG_Decoder* decoder, const unsigned char* in, size_t inlength)
{
  if(inlength == 0 || in == 0) { decoder->error = 48; return; } /*the given data is empty*/
  if(inlength < 29) { decoder->error = 27; return; } /*error: the data length is smaller than the length of the header*/
  
  /*when decoding a new PNG image, make sure all parameters created after previous decoding are reset*/
  LodePNG_InfoPng_cleanup(&decoder->infoPng);
  LodePNG_InfoPng_init(&decoder->infoPng);
  decoder->error = 0;

  if(in[0] != 137 || in[1] != 80 || in[2] != 78 || in[3] != 71 || in[4] != 13 || in[5] != 10 || in[6] != 26 || in[7] != 10) { decoder->error = 28; return; } /*error: the first 8 bytes are not the correct PNG signature*/
  if(in[12] != 'I' || in[13] != 'H' || in[14] != 'D' || in[15] != 'R') { decoder->error = 29; return; } /*error: it doesn't start with a IHDR chunk!*/
  
  /*read the values given in the header*/
  decoder->infoPng.width = LodePNG_read32bitInt(&in[16]);
  decoder->infoPng.height = LodePNG_read32bitInt(&in[20]);
  decoder->infoPng.color.bitDepth = in[24];
  decoder->infoPng.color.colorType = in[25];
  decoder->infoPng.compressionMethod = in[26];
  decoder->infoPng.filterMethod = in[27];
  decoder->infoPng.interlaceMethod = in[28];

  if(!decoder->settings.ignoreCrc)
  {
    unsigned CRC = LodePNG_read32bitInt(&in[29]);
    unsigned checksum = Crc32_crc(&in[12], 17);
    if(CRC != checksum) { decoder->error = 57; return; }
  }
  
  if(decoder->infoPng.compressionMethod != 0) { decoder->error = 32; return; } /*error: only compression method 0 is allowed in the specification*/
  if(decoder->infoPng.filterMethod != 0)      { decoder->error = 33; return; } /*error: only filter method 0 is allowed in the specification*/
  if(decoder->infoPng.interlaceMethod > 1)    { decoder->error = 34; return; } /*error: only interlace methods 0 and 1 exist in the specification*/
  
  decoder->error = checkColorValidity(decoder->infoPng.color.colorType, decoder->infoPng.color.bitDepth);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rdx, %rdx
setne %al
testq %rsi, %rsi
setne %cl
testb %al, %cl
jne 0x1e86f
movl $0x30, 0x120(%rbx)
jmp 0x1e9f9
cmpq $0x1c, %rdx
ja 0x1e884
movl $0x1b, 0x120(%rbx)
jmp 0x1e9f9
movq %rsi, %r14
leaq 0x40(%rbx), %rdi
callq 0x1dd19
xorps %xmm0, %xmm0
movups %xmm0, 0x44(%rbx)
xorl %eax, %eax
movl %eax, 0x40(%rbx)
movups %xmm0, 0x70(%rbx)
movabsq $0x800000006, %rcx      # imm = 0x800000006
movq %rcx, 0x58(%rbx)
movups %xmm0, 0x60(%rbx)
movl %eax, 0xe0(%rbx)
movups %xmm0, 0x80(%rbx)
movups %xmm0, 0x90(%rbx)
movups %xmm0, 0xa0(%rbx)
movups %xmm0, 0xb0(%rbx)
movups %xmm0, 0xc0(%rbx)
movb $0x0, 0xd0(%rbx)
movups %xmm0, 0xf0(%rbx)
movups %xmm0, 0x100(%rbx)
movups %xmm0, 0x110(%rbx)
movl %eax, 0x120(%rbx)
cmpb $-0x77, (%r14)
jne 0x1e9ef
cmpb $0x50, 0x1(%r14)
jne 0x1e9ef
cmpb $0x4e, 0x2(%r14)
jne 0x1e9ef
cmpb $0x47, 0x3(%r14)
jne 0x1e9ef
cmpb $0xd, 0x4(%r14)
jne 0x1e9ef
cmpb $0xa, 0x5(%r14)
jne 0x1e9ef
cmpb $0x1a, 0x6(%r14)
jne 0x1e9ef
cmpb $0xa, 0x7(%r14)
jne 0x1e9ef
cmpb $0x49, 0xc(%r14)
jne 0x1ea04
cmpb $0x48, 0xd(%r14)
jne 0x1ea04
cmpb $0x44, 0xe(%r14)
jne 0x1ea04
cmpb $0x52, 0xf(%r14)
jne 0x1ea04
movl 0x10(%r14), %eax
bswapl %eax
movl %eax, 0x40(%rbx)
movl 0x14(%r14), %eax
bswapl %eax
movl %eax, 0x44(%rbx)
movzbl 0x18(%r14), %eax
movl %eax, 0x5c(%rbx)
movzbl 0x19(%r14), %eax
movl %eax, 0x58(%rbx)
movzbl 0x1a(%r14), %eax
movl %eax, 0x48(%rbx)
movzbl 0x1b(%r14), %eax
movl %eax, 0x4c(%rbx)
movzbl 0x1c(%r14), %eax
movl %eax, 0x50(%rbx)
cmpl $0x0, 0x4(%rbx)
jne 0x1e9dd
movl 0x1d(%r14), %r15d
addq $0xc, %r14
bswapl %r15d
movl $0x11, %esi
movq %r14, %rdi
callq 0x1d2a5
cmpl %eax, %r15d
jne 0x1ea22
cmpl $0x0, 0x48(%rbx)
je 0x1ea10
movl $0x20, 0x120(%rbx)
jmp 0x1e9f9
movl $0x1c, 0x120(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x1d, 0x120(%rbx)
jmp 0x1e9f9
cmpl $0x0, 0x4c(%rbx)
je 0x1ea2e
movl $0x21, 0x120(%rbx)
jmp 0x1e9f9
movl $0x39, 0x120(%rbx)
jmp 0x1e9f9
cmpl $0x2, 0x50(%rbx)
jb 0x1ea40
movl $0x22, 0x120(%rbx)
jmp 0x1e9f9
movl 0x58(%rbx), %edi
movl 0x5c(%rbx), %esi
callq 0x1ea53
movl %eax, 0x120(%rbx)
jmp 0x1e9f9