// File: /workspace/github_c_makefile_star2_O0/Joy-Division[P]tools-mgs/lodepng/lodepng.c
// Function: lodepng_zlib_decompress
unsigned lodepng_zlib_decompress(unsigned char** out, size_t* outsize, const unsigned char* in,
                                 size_t insize, const LodePNGDecompressSettings* settings)
{
  unsigned error = 0;
  unsigned CM, CINFO, FDICT;

  if(insize < 2) return 53; /*error, size of zlib data too small*/
  /*read information from zlib header*/
  if((in[0] * 256 + in[1]) % 31 != 0)
  {
    /*error: 256 * in[0] + in[1] must be a multiple of 31, the FCHECK value is supposed to be made that way*/
    return 24;
  }

  CM = in[0] & 15;
  CINFO = (in[0] >> 4) & 15;
  /*FCHECK = in[1] & 31;*/ /*FCHECK is already tested above*/
  FDICT = (in[1] >> 5) & 1;
  /*FLEVEL = (in[1] >> 6) & 3;*/ /*FLEVEL is not used here*/

  if(CM != 8 || CINFO > 7)
  {
    /*error: only compression method 8: inflate with sliding window of 32k is supported by the PNG spec*/
    return 25;
  }
  if(FDICT != 0)
  {
    /*error: the specification of PNG says about the zlib stream:
      "The additional flags shall not specify a preset dictionary."*/
    return 26;
  }

  error = inflate(out, outsize, in + 2, insize - 2, settings);
  if(error) return error;

  if(!settings->ignore_adler32)
  {
    unsigned ADLER32 = lodepng_read32bitInt(&in[insize - 4]);
    unsigned checksum = adler32(*out, (unsigned)(*outsize));
    if(checksum != ADLER32) return 58; /*error, adler checksum not correct, data must be corrupted*/
  }

  return 0; /*no error*/
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
cmpq $0x2, -0x28(%rbp)
jae 0x2346
movl $0x35, -0x4(%rbp)
jmp 0x244f
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
shll $0x8, %eax
movq -0x20(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
addl %ecx, %eax
movl $0x1f, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
je 0x2373
movl $0x18, -0x4(%rbp)
jmp 0x244f
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
andl $0xf, %eax
movl %eax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
sarl $0x4, %eax
andl $0xf, %eax
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
sarl $0x5, %eax
andl $0x1, %eax
movl %eax, -0x40(%rbp)
cmpl $0x8, -0x38(%rbp)
jne 0x23ad
cmpl $0x7, -0x3c(%rbp)
jbe 0x23b9
movl $0x19, -0x4(%rbp)
jmp 0x244f
cmpl $0x0, -0x40(%rbp)
je 0x23cb
movl $0x1a, -0x4(%rbp)
jmp 0x244f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
addq $0x2, %rdx
movq -0x28(%rbp), %rcx
subq $0x2, %rcx
movq -0x30(%rbp), %r8
callq 0x2460
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x23fd
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x244f
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x2448
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
subq $0x4, %rax
addq %rax, %rdi
callq 0x1240
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl %eax, %esi
callq 0x24d0
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x44(%rbp), %eax
je 0x2446
movl $0x3a, -0x4(%rbp)
jmp 0x244f
jmp 0x2448
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)