// File: /workspace/github_c_makefile_star2_O0/tditlu[P]shadetabler/src/lodepng/lodepng.c
// Function: lodepng_zlib_compress
unsigned lodepng_zlib_compress(unsigned char** out, size_t* outsize, const unsigned char* in,
                               size_t insize, const LodePNGCompressSettings* settings) {
  size_t i;
  unsigned error;
  unsigned char* deflatedata = 0;
  size_t deflatesize = 0;

  error = deflate(&deflatedata, &deflatesize, in, insize, settings);

  *out = NULL;
  *outsize = 0;
  if(!error) {
    *outsize = deflatesize + 6;
    *out = (unsigned char*)lodepng_malloc(*outsize);
    if(!*out) error = 83; /*alloc fail*/
  }

  if(!error) {
    unsigned ADLER32 = adler32(in, (unsigned)insize);
    /*zlib data: 1 byte CMF (CM+CINFO), 1 byte FLG, deflate data, 4 byte ADLER32 checksum of the Decompressed data*/
    unsigned CMF = 120; /*0b01111000: CM 8, CINFO 7. With CINFO 7, any window size up to 32768 can be used.*/
    unsigned FLEVEL = 0;
    unsigned FDICT = 0;
    unsigned CMFFLG = 256 * CMF + FDICT * 32 + FLEVEL * 64;
    unsigned FCHECK = 31 - CMFFLG % 31;
    CMFFLG += FCHECK;

    (*out)[0] = (unsigned char)(CMFFLG >> 8);
    (*out)[1] = (unsigned char)(CMFFLG & 255);
    for(i = 0; i != deflatesize; ++i) (*out)[i + 2] = deflatedata[i];
    lodepng_set32bitInt(&(*out)[*outsize - 4], ADLER32);
  }

  lodepng_free(deflatedata);
  return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x5830
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
cmpl $0x0, -0x34(%rbp)
jne 0x572c
movq -0x48(%rbp), %rcx
addq $0x6, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x3de0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x572a
movl $0x53, -0x34(%rbp)
jmp 0x572c
cmpl $0x0, -0x34(%rbp)
jne 0x5811
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movl %eax, %esi
callq 0x58a0
movl %eax, -0x4c(%rbp)
movl $0x78, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x50(%rbp), %eax
shll $0x8, %eax
movl -0x58(%rbp), %ecx
shll $0x5, %ecx
addl %ecx, %eax
movl -0x54(%rbp), %ecx
shll $0x6, %ecx
addl %ecx, %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movl $0x1f, %ecx
xorl %edx, %edx
divl %ecx
movl $0x1f, %eax
subl %edx, %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
addl -0x5c(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb %cl, (%rax)
movl -0x5c(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb %cl, 0x1(%rax)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x48(%rbp), %rax
je 0x57f4
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movb %dl, 0x2(%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x57c2
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
subq $0x4, %rax
addq %rax, %rdi
movl -0x4c(%rbp), %esi
callq 0x58d0
movq -0x40(%rbp), %rdi
callq 0x5060
movl -0x34(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)