// File: 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
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x27f62
cmpq $0x0, -0x10(%rbp)
jne 0x27f75
movq -0x8(%rbp), %rax
movl $0x30, 0x120(%rax)
jmp 0x281a7
cmpq $0x1d, -0x18(%rbp)
jae 0x27f8f
movq -0x8(%rbp), %rax
movl $0x1b, 0x120(%rax)
jmp 0x281a7
movq -0x8(%rbp), %rdi
addq $0x40, %rdi
callq 0x26e10
movq -0x8(%rbp), %rdi
addq $0x40, %rdi
callq 0x26d40
movq -0x8(%rbp), %rax
movl $0x0, 0x120(%rax)
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x89, %eax
jne 0x28020
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x50, %eax
jne 0x28020
movq -0x10(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl $0x4e, %eax
jne 0x28020
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %eax
cmpl $0x47, %eax
jne 0x28020
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %eax
cmpl $0xd, %eax
jne 0x28020
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %eax
cmpl $0xa, %eax
jne 0x28020
movq -0x10(%rbp), %rax
movzbl 0x6(%rax), %eax
cmpl $0x1a, %eax
jne 0x28020
movq -0x10(%rbp), %rax
movzbl 0x7(%rax), %eax
cmpl $0xa, %eax
je 0x28033
movq -0x8(%rbp), %rax
movl $0x1c, 0x120(%rax)
jmp 0x281a7
movq -0x10(%rbp), %rax
movzbl 0xc(%rax), %eax
cmpl $0x49, %eax
jne 0x28067
movq -0x10(%rbp), %rax
movzbl 0xd(%rax), %eax
cmpl $0x48, %eax
jne 0x28067
movq -0x10(%rbp), %rax
movzbl 0xe(%rax), %eax
cmpl $0x44, %eax
jne 0x28067
movq -0x10(%rbp), %rax
movzbl 0xf(%rax), %eax
cmpl $0x52, %eax
je 0x2807a
movq -0x8(%rbp), %rax
movl $0x1d, 0x120(%rax)
jmp 0x281a7
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
callq 0x25a50
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x10(%rbp), %rdi
addq $0x14, %rdi
callq 0x25a50
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x44(%rax)
movq -0x10(%rbp), %rax
movzbl 0x18(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x5c(%rax)
movq -0x10(%rbp), %rax
movzbl 0x19(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x58(%rax)
movq -0x10(%rbp), %rax
movzbl 0x1a(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x48(%rax)
movq -0x10(%rbp), %rax
movzbl 0x1b(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4c(%rax)
movq -0x10(%rbp), %rax
movzbl 0x1c(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x50(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0x2813a
movq -0x10(%rbp), %rdi
addq $0x1d, %rdi
callq 0x25a50
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
addq $0xc, %rdi
movl $0x11, %esi
callq 0x25c90
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
je 0x28138
movq -0x8(%rbp), %rax
movl $0x39, 0x120(%rax)
jmp 0x281a7
jmp 0x2813a
movq -0x8(%rbp), %rax
cmpl $0x0, 0x48(%rax)
je 0x28154
movq -0x8(%rbp), %rax
movl $0x20, 0x120(%rax)
jmp 0x281a7
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4c(%rax)
je 0x2816e
movq -0x8(%rbp), %rax
movl $0x21, 0x120(%rax)
jmp 0x281a7
movq -0x8(%rbp), %rax
cmpl $0x1, 0x50(%rax)
jbe 0x28188
movq -0x8(%rbp), %rax
movl $0x22, 0x120(%rax)
jmp 0x281a7
movq -0x8(%rbp), %rax
movl 0x58(%rax), %edi
movq -0x8(%rbp), %rax
movl 0x5c(%rax), %esi
callq 0x281b0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x120(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)