LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: ensureBits17(LodePNGBitReader*, unsigned long)
static unsigned ensureBits17(LodePNGBitReader* reader, size_t nbits) {
  size_t start = reader->bp >> 3u;
  size_t size = reader->size;
  if(start + 2u < size) {
    reader->buffer = (unsigned)reader->data[start + 0] | ((unsigned)reader->data[start + 1] << 8u) |
                     ((unsigned)reader->data[start + 2] << 16u);
    reader->buffer >>= (reader->bp & 7u);
    return 1;
  } else {
    reader->buffer = 0;
    if(start + 0u < size) reader->buffer |= reader->data[start + 0];
    if(start + 1u < size) reader->buffer |= ((unsigned)reader->data[start + 1] << 8u);
    reader->buffer >>= (reader->bp & 7u);
    return reader->bp + nbits <= reader->bitsize;
  }
}

// Assembly:
movq 0x8(%rdi), %r8
movq 0x18(%rdi), %rax
movq %rax, %rcx
shrq $0x3, %rcx
leaq 0x2(%rcx), %rdx
cmpq %r8, %rdx
jae 0x73d11
movq (%rdi), %rdx
movzwl (%rdx,%rcx), %esi
movzbl 0x2(%rdx,%rcx), %edx
shll $0x10, %edx
orl %esi, %edx
andb $0x7, %al
movl %eax, %ecx
shrl %cl, %edx
movl %edx, 0x20(%rdi)
pushq $0x1
popq %rax
retq
andl $0x0, 0x20(%rdi)
xorl %edx, %edx
cmpq %r8, %rcx
jae 0x73d26
movq (%rdi), %rdx
movzbl (%rdx,%rcx), %edx
movl %edx, 0x20(%rdi)
incq %rcx
cmpq %r8, %rcx
jae 0x73d3b
movq (%rdi), %r8
movzbl (%r8,%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %edx
movl %eax, %ecx
andb $0x7, %cl
shrl %cl, %edx
movl %edx, 0x20(%rdi)
addq %rax, %rsi
xorl %eax, %eax
cmpq 0x10(%rdi), %rsi
setbe %al
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: ensureBits9(LodePNGBitReader*, unsigned long)
static unsigned ensureBits9(LodePNGBitReader* reader, size_t nbits) {
  size_t start = reader->bp >> 3u;
  size_t size = reader->size;
  if(start + 1u < size) {
    reader->buffer = (unsigned)reader->data[start + 0] | ((unsigned)reader->data[start + 1] << 8u);
    reader->buffer >>= (reader->bp & 7u);
    return 1;
  } else {
    reader->buffer = 0;
    if(start + 0u < size) reader->buffer |= reader->data[start + 0];
    reader->buffer >>= (reader->bp & 7u);
    return reader->bp + nbits <= reader->bitsize;
  }
}

// Assembly:
movq 0x8(%rdi), %r8
movq 0x18(%rdi), %rax
movq %rax, %rcx
shrq $0x3, %rcx
leaq 0x1(%rcx), %rdx
cmpq %r8, %rdx
jae 0x73d7e
movq (%rdi), %rdx
movzwl (%rdx,%rcx), %edx
andb $0x7, %al
movl %eax, %ecx
shrl %cl, %edx
movl %edx, 0x20(%rdi)
pushq $0x1
popq %rax
retq
andl $0x0, 0x20(%rdi)
xorl %edx, %edx
cmpq %r8, %rcx
jae 0x73d90
movq (%rdi), %rdx
movzbl (%rdx,%rcx), %edx
movl %eax, %ecx
andb $0x7, %cl
shrl %cl, %edx
movl %edx, 0x20(%rdi)
addq %rax, %rsi
xorl %eax, %eax
cmpq 0x10(%rdi), %rsi
setbe %al
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_zlib_compress(unsigned char**, unsigned long*, unsigned char const*, unsigned long, LodePNGCompressSettings const*)
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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r15
andq $0x0, 0x10(%rsp)
movq %rdx, %r12
andq $0x0, 0x8(%rsp)
movq %rsi, %rbx
movq %rdi, %r14
movq 0x20(%r8), %rax
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
testq %rax, %rax
je 0x75a50
callq *%rax
jmp 0x75a55
callq 0x74bf2
movl %eax, %ebp
andq $0x0, (%r14)
andq $0x0, (%rbx)
testl %eax, %eax
jne 0x75ac4
movq 0x8(%rsp), %rbp
leaq 0x6(%rbp), %rdi
movq %rdi, (%rbx)
callq 0x525b0
movq %rax, (%r14)
testq %rax, %rax
je 0x75ac1
movq %rax, %r13
movq %r12, %rdi
movl %r15d, %esi
callq 0x759bb
movw $0x178, (%r13)          # imm = 0x178
xorl %ecx, %ecx
cmpq %rbp, %rcx
je 0x75ab1
movq 0x10(%rsp), %rdx
movb (%rdx,%rcx), %dl
movq (%r14), %rsi
movb %dl, 0x2(%rsi,%rcx)
incq %rcx
movq 0x8(%rsp), %rbp
jmp 0x75a93
movq (%r14), %rcx
movq (%rbx), %rdx
bswapl %eax
movl %eax, -0x4(%rcx,%rdx)
xorl %ebp, %ebp
jmp 0x75ac4
pushq $0x53
popq %rbp
movq 0x10(%rsp), %rdi
callq 0x52530
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_crc32(unsigned char const*, unsigned long)
unsigned lodepng_crc32(const unsigned char* data, size_t length) {
  unsigned r = 0xffffffffu;
  size_t i;
  for(i = 0; i < length; ++i) {
    r = lodepng_crc32_table[(r ^ data[i]) & 0xffu] ^ (r >> 8u);
  }
  return r ^ 0xffffffffu;
}

// Assembly:
pushq $-0x1
popq %rax
xorl %ecx, %ecx
leaq 0x1ab85(%rip), %rdx     # 0x906a0
cmpq %rcx, %rsi
je 0x75b37
movb (%rdi,%rcx), %r8b
xorb %al, %r8b
movzbl %r8b, %r8d
shrl $0x8, %eax
xorl (%rdx,%r8,4), %eax
incq %rcx
jmp 0x75b1b
notl %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_chunk_next(unsigned char*, unsigned char*)
unsigned char* lodepng_chunk_next(unsigned char* chunk, unsigned char* end) {
  if(chunk >= end || end - chunk < 12) return end; /*too small to contain a chunk*/
  if(chunk[0] == 0x89 && chunk[1] == 0x50 && chunk[2] == 0x4e && chunk[3] == 0x47
    && chunk[4] == 0x0d && chunk[5] == 0x0a && chunk[6] == 0x1a && chunk[7] == 0x0a) {
    /* Is PNG magic header at start of PNG file. Jump to first actual chunk. */
    return chunk + 8;
  } else {
    size_t total_chunk_length;
    unsigned char* result;
    if(lodepng_addofl(lodepng_chunk_length(chunk), 12, &total_chunk_length)) return end;
    result = chunk + total_chunk_length;
    if(result < chunk) return end; /*pointer overflow*/
    return result;
  }
}

// Assembly:
movq %rsi, %rax
movq %rsi, %rcx
subq %rdi, %rcx
setbe %dl
cmpq $0xc, %rcx
setl %cl
orb %dl, %cl
jne 0x75cb4
pushq %rbx
movq %rdi, %rbx
cmpb $-0x77, (%rdi)
jne 0x75ca2
cmpb $0x50, 0x1(%rbx)
jne 0x75ca2
cmpb $0x4e, 0x2(%rbx)
jne 0x75ca2
cmpb $0x47, 0x3(%rbx)
jne 0x75ca2
cmpb $0xd, 0x4(%rbx)
jne 0x75ca2
cmpb $0xa, 0x5(%rbx)
jne 0x75ca2
cmpb $0x1a, 0x6(%rbx)
jne 0x75ca2
cmpb $0xa, 0x7(%rbx)
jne 0x75ca2
addq $0x8, %rbx
movq %rbx, %rax
jmp 0x75cb3
movq %rbx, %rdi
callq 0x759b6
movl %eax, %eax
addq %rbx, %rax
addq $0xc, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_chunk_next_const(unsigned char const*, unsigned char const*)
const unsigned char* lodepng_chunk_next_const(const unsigned char* chunk, const unsigned char* end) {
  if(chunk >= end || end - chunk < 12) return end; /*too small to contain a chunk*/
  if(chunk[0] == 0x89 && chunk[1] == 0x50 && chunk[2] == 0x4e && chunk[3] == 0x47
    && chunk[4] == 0x0d && chunk[5] == 0x0a && chunk[6] == 0x1a && chunk[7] == 0x0a) {
    /* Is PNG magic header at start of PNG file. Jump to first actual chunk. */
    return chunk + 8;
  } else {
    size_t total_chunk_length;
    const unsigned char* result;
    if(lodepng_addofl(lodepng_chunk_length(chunk), 12, &total_chunk_length)) return end;
    result = chunk + total_chunk_length;
    if(result < chunk) return end; /*pointer overflow*/
    return result;
  }
}

// Assembly:
movq %rsi, %rax
movq %rsi, %rcx
subq %rdi, %rcx
setbe %dl
cmpq $0xc, %rcx
setl %cl
orb %dl, %cl
jne 0x75d1a
pushq %rbx
movq %rdi, %rbx
cmpb $-0x77, (%rdi)
jne 0x75d08
cmpb $0x50, 0x1(%rbx)
jne 0x75d08
cmpb $0x4e, 0x2(%rbx)
jne 0x75d08
cmpb $0x47, 0x3(%rbx)
jne 0x75d08
cmpb $0xd, 0x4(%rbx)
jne 0x75d08
cmpb $0xa, 0x5(%rbx)
jne 0x75d08
cmpb $0x1a, 0x6(%rbx)
jne 0x75d08
cmpb $0xa, 0x7(%rbx)
jne 0x75d08
addq $0x8, %rbx
movq %rbx, %rax
jmp 0x75d19
movq %rbx, %rdi
callq 0x759b6
movl %eax, %eax
addq %rbx, %rax
addq $0xc, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_chunk_find(unsigned char*, unsigned char*, char const*)
unsigned char* lodepng_chunk_find(unsigned char* chunk, unsigned char* end, const char type[5]) {
  for(;;) {
    if(chunk >= end || end - chunk < 12) return 0; /* past file end: chunk + 12 > end */
    if(lodepng_chunk_type_equals(chunk, type)) return chunk;
    chunk = lodepng_chunk_next(chunk, end);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
xorl %ebx, %ebx
movq %r15, %rax
subq %r12, %rax
jbe 0x75d5e
cmpq $0xc, %rax
jl 0x75d5e
movq %r12, %rdi
movq %r14, %rsi
callq 0x75b58
testb %al, %al
jne 0x75d5b
movq %r12, %rdi
movq %r15, %rsi
callq 0x75c4f
movq %rax, %r12
jmp 0x75d2e
movq %r12, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_chunk_find_const(unsigned char const*, unsigned char const*, char const*)
const unsigned char* lodepng_chunk_find_const(const unsigned char* chunk, const unsigned char* end, const char type[5]) {
  for(;;) {
    if(chunk >= end || end - chunk < 12) return 0; /* past file end: chunk + 12 > end */
    if(lodepng_chunk_type_equals(chunk, type)) return chunk;
    chunk = lodepng_chunk_next_const(chunk, end);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
xorl %ebx, %ebx
movq %r15, %rax
subq %r12, %rax
jbe 0x75db0
cmpq $0xc, %rax
jl 0x75db0
movq %r12, %rdi
movq %r14, %rsi
callq 0x75b58
testb %al, %al
jne 0x75dad
movq %r12, %rdi
movq %r15, %rsi
callq 0x75cb5
movq %rax, %r12
jmp 0x75d80
movq %r12, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_chunk_append(unsigned char**, unsigned long*, unsigned char const*)
unsigned lodepng_chunk_append(unsigned char** out, size_t* outlength, const unsigned char* chunk) {
  unsigned i;
  size_t total_chunk_length, new_length;
  unsigned char *chunk_start, *new_buffer;

  if(lodepng_addofl(lodepng_chunk_length(chunk), 12, &total_chunk_length)) return 77;
  if(lodepng_addofl(*outlength, total_chunk_length, &new_length)) return 77;

  new_buffer = (unsigned char*)lodepng_realloc(*out, new_length);
  if(!new_buffer) return 83; /*alloc fail*/
  (*out) = new_buffer;
  (*outlength) = new_length;
  chunk_start = &(*out)[new_length - total_chunk_length];

  for(i = 0; i != total_chunk_length; ++i) chunk_start[i] = chunk[i];

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %rdx, %rdi
callq 0x759b6
movl %eax, %r13d
addq $0xc, %r13
movq (%r14), %rbp
movq %r13, %r12
addq %rbp, %r12
jae 0x75df1
pushq $0x4d
jmp 0x75e22
movq (%r15), %rdi
movq %r12, %rsi
callq 0x52730
testq %rax, %rax
je 0x75e20
movq %rax, (%r15)
movq %r12, (%r14)
addq %rax, %rbp
xorl %eax, %eax
xorl %ecx, %ecx
movl %ecx, %ecx
cmpq %rcx, %r13
je 0x75e23
movb (%rbx,%rcx), %dl
movb %dl, (%rbp,%rcx)
incl %ecx
jmp 0x75e0e
pushq $0x53
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_chunk_create(unsigned char**, unsigned long*, unsigned int, char const*, unsigned char const*)
unsigned lodepng_chunk_create(unsigned char** out, size_t* outlength, unsigned length,
                              const char* type, const unsigned char* data) {
  unsigned i;
  unsigned char *chunk, *new_buffer;
  size_t new_length = *outlength;
  if(lodepng_addofl(new_length, length, &new_length)) return 77;
  if(lodepng_addofl(new_length, 12, &new_length)) return 77;
  new_buffer = (unsigned char*)lodepng_realloc(*out, new_length);
  if(!new_buffer) return 83; /*alloc fail*/
  (*out) = new_buffer;
  (*outlength) = new_length;
  chunk = &(*out)[(*outlength) - length - 12];

  /*1: length*/
  lodepng_set32bitInt(chunk, (unsigned)length);

  /*2: chunk name (4 letters)*/
  chunk[4] = (unsigned char)type[0];
  chunk[5] = (unsigned char)type[1];
  chunk[6] = (unsigned char)type[2];
  chunk[7] = (unsigned char)type[3];

  /*3: the data*/
  for(i = 0; i != length; ++i) chunk[8 + i] = data[i];

  /*4: CRC (of the chunkname characters and the data)*/
  lodepng_chunk_generate_crc(chunk);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r13d
movq (%rsi), %rbp
pushq $0x4d
popq %rax
addq %r13, %rbp
jb 0x75eda
subq $-0xc, %rbp
jae 0x75eda
movq %r8, %rbx
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl %edx, 0x4(%rsp)
movq (%rdi), %rdi
movq %rbp, %rsi
callq 0x52730
testq %rax, %rax
je 0x75ed7
movq %rax, (%r12)
movq %rbp, (%r15)
subq %r13, %rbp
leaq (%rax,%rbp), %rdi
addq $-0xc, %rdi
movl 0x4(%rsp), %edx
movl %edx, %ecx
shrl $0x18, %ecx
movb %cl, -0xc(%rax,%rbp)
movl %edx, %ecx
shrl $0x10, %ecx
movb %cl, -0xb(%rax,%rbp)
movb %dh, -0xa(%rax,%rbp)
movb %dl, -0x9(%rax,%rbp)
movl (%r14), %ecx
movl %ecx, -0x8(%rax,%rbp)
negq %r13
pushq $0x8
popq %rax
leaq (%rax,%r13), %rcx
cmpq $0x8, %rcx
je 0x75ece
movb -0x8(%rbx,%rax), %cl
movl %eax, %edx
movb %cl, (%rdi,%rdx)
incq %rax
jmp 0x75eb6
callq 0x75c22
xorl %eax, %eax
jmp 0x75eda
pushq $0x53
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_color_mode_alloc_palette(LodePNGColorMode*)
void lodepng_color_mode_alloc_palette(LodePNGColorMode* info) {
  size_t i;
  /*room for 256 colors with 4 bytes each. Using realloc to avoid leak if it is being overwritten*/
  info->palette = (unsigned char*)lodepng_realloc(info->palette, 1024);
  if(!info->palette) return; /*alloc fail*/
  for(i = 0; i != 256; ++i) {
    /*Initialize all unused colors with black, the value used for invalid palette indices.
    This is an error according to the PNG spec, but common PNG decoders make it black instead.
    That makes color conversion slightly faster due to no error handling needed.*/
    info->palette[i * 4 + 0] = 0;
    info->palette[i * 4 + 1] = 0;
    info->palette[i * 4 + 2] = 0;
    info->palette[i * 4 + 3] = 255;
  }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x52730
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x75f4f
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0x100, %rcx            # imm = 0x100
je 0x75f4f
movq 0x8(%rbx), %rdx
movb %al, (%rdx,%rcx,4)
movq 0x8(%rbx), %rdx
movb %al, 0x1(%rdx,%rcx,4)
movq 0x8(%rbx), %rdx
movb %al, 0x2(%rdx,%rcx,4)
movq 0x8(%rbx), %rdx
movb $-0x1, 0x3(%rdx,%rcx,4)
incq %rcx
jmp 0x75f21
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_palette_add(LodePNGColorMode*, unsigned char, unsigned char, unsigned char, unsigned char)
unsigned lodepng_palette_add(LodePNGColorMode* info,
                             unsigned char r, unsigned char g, unsigned char b, unsigned char a) {
  if(!info->palette) /*allocate palette if empty*/ {
    lodepng_color_mode_alloc_palette(info);
    if(!info->palette) return 83; /*alloc fail*/
  }
  if(info->palettesize >= 256) {
    return 108; /*too many palette values*/
  }
  info->palette[4 * info->palettesize + 0] = r;
  info->palette[4 * info->palettesize + 1] = g;
  info->palette[4 * info->palettesize + 2] = b;
  info->palette[4 * info->palettesize + 3] = a;
  ++info->palettesize;
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r8d, %ebx
movl %ecx, %ebp
movl %edx, %r15d
movl %esi, %r12d
movq %rdi, %r14
movq 0x8(%rdi), %rax
testq %rax, %rax
jne 0x7602b
movq %r14, %rdi
callq 0x75f02
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x7606e
movq 0x10(%r14), %rcx
cmpq $0xff, %rcx
jbe 0x7603c
pushq $0x6c
jmp 0x76070
movb %r12b, (%rax,%rcx,4)
movq 0x8(%r14), %rax
movq 0x10(%r14), %rcx
movb %r15b, 0x1(%rax,%rcx,4)
movq 0x8(%r14), %rax
movq 0x10(%r14), %rcx
movb %bpl, 0x2(%rax,%rcx,4)
movq 0x8(%r14), %rax
movq 0x10(%r14), %rcx
movb %bl, 0x3(%rax,%rcx,4)
incq 0x10(%r14)
xorl %eax, %eax
jmp 0x76071
pushq $0x53
popq %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_add_text(LodePNGInfo*, char const*, char const*)
unsigned lodepng_add_text(LodePNGInfo* info, const char* key, const char* str) {
  char** new_keys = (char**)(lodepng_realloc(info->text_keys, sizeof(char*) * (info->text_num + 1)));
  char** new_strings = (char**)(lodepng_realloc(info->text_strings, sizeof(char*) * (info->text_num + 1)));
  if(!new_keys || !new_strings) {
    lodepng_free(new_keys);
    lodepng_free(new_strings);
    return 83; /*alloc fail*/
  }

  ++info->text_num;
  info->text_keys = new_keys;
  info->text_strings = new_strings;

  info->text_keys[info->text_num - 1] = alloc_string(key);
  info->text_strings[info->text_num - 1] = alloc_string(str);

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x48(%rdi), %rax
movq 0x50(%rdi), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x52730
movq %rax, %r12
movq 0x48(%rbx), %rax
movq 0x58(%rbx), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x52730
movq %rax, %r13
testq %r12, %r12
setne %al
testq %r13, %r13
setne %cl
testb %cl, %al
je 0x76217
incq 0x48(%rbx)
movq %r12, 0x50(%rbx)
movq %r13, 0x58(%rbx)
movq %r15, %rdi
callq 0x76234
movq 0x48(%rbx), %rcx
movq 0x50(%rbx), %rdx
movq %rax, -0x8(%rdx,%rcx,8)
movq %r14, %rdi
callq 0x76234
movq 0x48(%rbx), %rcx
movq 0x58(%rbx), %rdx
movq %rax, -0x8(%rdx,%rcx,8)
xorl %eax, %eax
jmp 0x7622a
movq %r12, %rdi
callq 0x52530
movq %r13, %rdi
callq 0x52530
pushq $0x53
popq %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: alloc_string(char const*)
static char* alloc_string(const char* in) {
  size_t insize = lodepng_strlen(in);
  char* out = (char*)lodepng_malloc(insize + 1);
  if(out) {
    size_t i;
    for(i = 0; i != insize; ++i) {
      out[i] = in[i];
    }
    out[i] = 0;
  }
  return out;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x75bb0
movq %rax, %r14
leaq 0x1(%rax), %rdi
callq 0x525b0
testq %rax, %rax
je 0x76268
xorl %ecx, %ecx
cmpq %rcx, %r14
je 0x76263
movb (%rbx,%rcx), %dl
movb %dl, (%rax,%rcx)
incq %rcx
jmp 0x76253
movb $0x0, (%rax,%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_clear_icc(LodePNGInfo*)
void lodepng_clear_icc(LodePNGInfo* info) {
  string_cleanup(&info->iccp_name);
  lodepng_free(info->iccp_profile);
  info->iccp_profile = NULL;
  info->iccp_profile_size = 0;
  info->iccp_defined = 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
addq $0xf0, %rdi
callq 0x76546
movq 0xf8(%rbx), %rdi
callq 0x52530
andq $0x0, 0xf8(%rbx)
andl $0x0, 0x100(%rbx)
andl $0x0, 0xe8(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_assign_icc(LodePNGInfo*, char const*, unsigned char const*, unsigned int)
static unsigned lodepng_assign_icc(LodePNGInfo* info, const char* name, const unsigned char* profile, unsigned profile_size) {
  if(profile_size == 0) return 100; /*invalid ICC profile size*/

  info->iccp_name = alloc_string(name);
  info->iccp_profile = (unsigned char*)lodepng_malloc(profile_size);

  if(!info->iccp_name || !info->iccp_profile) return 83; /*alloc fail*/

  lodepng_memcpy(info->iccp_profile, profile, profile_size);
  info->iccp_profile_size = profile_size;

  return 0; /*ok*/
}

// Assembly:
testl %ecx, %ecx
je 0x76521
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %ecx, %ebx
movq %rdx, %r15
movq %rdi, %r14
movq %rsi, %rdi
callq 0x76234
movq %rax, %r13
movq %rax, 0xf0(%r14)
movl %ebx, %r12d
movq %r12, %rdi
callq 0x525b0
movq %rax, 0xf8(%r14)
testq %r13, %r13
sete %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
je 0x76525
pushq $0x53
popq %rax
jmp 0x7653c
pushq $0x64
popq %rax
retq
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x7c104
movl %ebx, 0x100(%r14)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_info_init(LodePNGInfo*)
void lodepng_color_mode_init(LodePNGColorMode* info) {
  info->key_defined = 0;
  info->key_r = info->key_g = info->key_b = 0;
  info->colortype = LCT_RGBA;
  info->bitdepth = 8;
  info->palette = 0;
  info->palettesize = 0;
}

// Assembly:
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rdi)
movabsq $0x800000006, %rax      # imm = 0x800000006
movq %rax, 0x10(%rdi)
movups %xmm0, 0x18(%rdi)
andl $0x0, 0x8(%rdi)
andq $0x0, (%rdi)
andl $0x0, 0xa4(%rdi)
andl $0x0, 0xb4(%rdi)
andl $0x0, 0xbc(%rdi)
andl $0x0, 0xe0(%rdi)
andl $0x0, 0xe8(%rdi)
movups %xmm0, 0x38(%rdi)
movups %xmm0, 0x48(%rdi)
movups %xmm0, 0x58(%rdi)
andl $0x0, 0x88(%rdi)
movups %xmm0, 0x68(%rdi)
movups %xmm0, 0x78(%rdi)
movups %xmm0, 0xf0(%rdi)
jmp 0x765c0
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_info_cleanup(LodePNGInfo*)
void lodepng_info_cleanup(LodePNGInfo* info) {
  lodepng_color_mode_cleanup(&info->color);
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
  LodePNGText_cleanup(info);
  LodePNGIText_cleanup(info);

  lodepng_clear_icc(info);

  LodePNGUnknownChunks_cleanup(info);
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
addq $0x10, %rdi
callq 0x75f56
movq %rbx, %rdi
callq 0x76143
movq %rbx, %rdi
callq 0x76272
movq %rbx, %rdi
callq 0x7649f
movq %rbx, %rdi
popq %rbx
jmp 0x76618
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_info_copy(LodePNGInfo*, LodePNGInfo const*)
unsigned lodepng_info_copy(LodePNGInfo* dest, const LodePNGInfo* source) {
  lodepng_info_cleanup(dest);
  *dest = *source;
  lodepng_color_mode_init(&dest->color);
  CERROR_TRY_RETURN(lodepng_color_mode_copy(&dest->color, &source->color));

#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
  CERROR_TRY_RETURN(LodePNGText_copy(dest, source));
  CERROR_TRY_RETURN(LodePNGIText_copy(dest, source));
  if(source->iccp_defined) {
    CERROR_TRY_RETURN(lodepng_assign_icc(dest, source->iccp_name, source->iccp_profile, source->iccp_profile_size));
  }

  LodePNGUnknownChunks_init(dest);
  CERROR_TRY_RETURN(LodePNGUnknownChunks_copy(dest, source));
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x765ed
movl $0x138, %edx            # imm = 0x138
movq %r14, %rdi
movq %rbx, %rsi
callq 0x523c0
leaq 0x10(%r14), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%r14)
movabsq $0x800000006, %rax      # imm = 0x800000006
movq %rax, 0x10(%r14)
movups %xmm0, 0x18(%r14)
leaq 0x10(%rbx), %rsi
callq 0x75f6c
testl %eax, %eax
jne 0x7674a
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%r14)
andq $0x0, 0x58(%r14)
xorl %r12d, %r12d
cmpq 0x48(%rbx), %r12
je 0x766cf
movq 0x50(%rbx), %rax
movq 0x58(%rbx), %rcx
movq (%rax,%r12,8), %rsi
movq (%rcx,%r12,8), %rdx
movq %r14, %rdi
callq 0x7618b
incq %r12
testl %eax, %eax
je 0x766a8
jmp 0x7674a
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%r14)
movups %xmm0, 0x60(%r14)
andq $0x0, 0x80(%r14)
xorl %r12d, %r12d
cmpq 0x60(%rbx), %r12
je 0x76721
movq 0x68(%rbx), %rax
movq 0x70(%rbx), %rcx
movq (%rax,%r12,8), %rsi
movq (%rcx,%r12,8), %rdx
movq 0x78(%rbx), %rax
movq (%rax,%r12,8), %rcx
movq 0x80(%rbx), %rax
movq (%rax,%r12,8), %r8
movq %r14, %rdi
callq 0x762ea
incq %r12
testl %eax, %eax
je 0x766e7
jmp 0x7674a
cmpl $0x0, 0xe8(%rbx)
je 0x7675f
movq 0xf0(%rbx), %rsi
movq 0xf8(%rbx), %rdx
movl 0x100(%rbx), %ecx
movq %r14, %rdi
callq 0x764d3
testl %eax, %eax
je 0x7675f
movl %eax, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x765c0
movq %r14, %rdi
callq 0x76618
xorl %r15d, %r15d
pushq $0x53
popq %rbp
xorl %r13d, %r13d
cmpq $0x3, %r13
je 0x7674d
movq 0x120(%rbx,%r13,8), %r12
movq %r12, 0x120(%r14,%r13,8)
movq %r12, %rdi
callq 0x525b0
movq %rax, 0x108(%r14,%r13,8)
testq %rax, %rax
sete %al
testq %r12, %r12
setne %cl
testb %al, %cl
jne 0x767dd
xorl %eax, %eax
cmpq %r12, %rax
jae 0x767d8
movq 0x108(%rbx,%r13,8), %rcx
movb (%rcx,%rax), %cl
movq 0x108(%r14,%r13,8), %rdx
movb %cl, (%rdx,%rax)
incq %rax
movq 0x120(%rbx,%r13,8), %r12
jmp 0x767b0
incq %r13
jmp 0x76778
movl %ebp, %r15d
jmp 0x7674d
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: checkColorValidity(LodePNGColorType, unsigned int)
static unsigned checkColorValidity(LodePNGColorType colortype, unsigned bd) {
  switch(colortype) {
    case LCT_GREY:       if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 || bd == 16)) return 37; break;
    case LCT_RGB:        if(!(                                 bd == 8 || bd == 16)) return 37; break;
    case LCT_PALETTE:    if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8            )) return 37; break;
    case LCT_GREY_ALPHA: if(!(                                 bd == 8 || bd == 16)) return 37; break;
    case LCT_RGBA:       if(!(                                 bd == 8 || bd == 16)) return 37; break;
    default: return 31; /* invalid color type */
  }
  return 0; /*allowed color type / bits combination*/
}

// Assembly:
pushq $0x1f
popq %rax
cmpl $0x6, %edi
ja 0x784d5
movl %edi, %ecx
leaq 0x18129(%rip), %rdx     # 0x905c0
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
addl $-0x8, %esi
andl $-0x9, %esi
pushq $0x25
popq %rax
cmovel %esi, %eax
retq
pushq $0x25
popq %rax
cmpl $0x10, %esi
ja 0x784d5
movl $0x10116, %ecx          # imm = 0x10116
btl %esi, %ecx
jae 0x784d5
xorl %eax, %eax
retq
decl %esi
cmpl $0x8, %esi
jae 0x784d6
movl %esi, %eax
leaq 0x19cde(%rip), %rcx     # 0x921b0
movl (%rcx,%rax,4), %eax
retq
pushq $0x25
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: readChunk_PLTE(LodePNGColorMode*, unsigned char const*, unsigned long)
static unsigned readChunk_PLTE(LodePNGColorMode* color, const unsigned char* data, size_t chunkLength) {
  unsigned pos = 0, i;
  color->palettesize = chunkLength / 3u;
  if(color->palettesize == 0 || color->palettesize > 256) return 38; /*error: palette too small or big*/
  lodepng_color_mode_alloc_palette(color);
  if(!color->palette && color->palettesize) {
    color->palettesize = 0;
    return 83; /*alloc fail*/
  }

  for(i = 0; i != color->palettesize; ++i) {
    color->palette[4 * i + 0] = data[pos++]; /*R*/
    color->palette[4 * i + 1] = data[pos++]; /*G*/
    color->palette[4 * i + 2] = data[pos++]; /*B*/
    color->palette[4 * i + 3] = 255; /*alpha*/
  }

  return 0; /* OK */
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rcx
movq %rsi, %r14
pushq $0x3
popq %rsi
movq %rdx, %rax
xorl %edx, %edx
divq %rsi
movq %rax, 0x10(%rdi)
addq $-0x303, %rcx           # imm = 0xFCFD
cmpq $-0x300, %rcx           # imm = 0xFD00
jae 0x787a5
pushq $0x26
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rdi, %rbx
callq 0x75f02
cmpq $0x0, 0x8(%rbx)
je 0x78817
xorl %eax, %eax
pushq $0x2
popq %rcx
pushq $0x3
popq %rdx
xorl %esi, %esi
movl %esi, %edi
cmpq %rdi, 0x10(%rbx)
je 0x7879d
leal -0x2(%rcx), %edi
leal -0x1(%rcx), %r8d
movl %edi, %edi
movb (%r14,%rdi), %dil
movq 0x8(%rbx), %r9
leal -0x3(%rdx), %r10d
movb %dil, (%r9,%r10)
movb (%r14,%r8), %dil
movq 0x8(%rbx), %r8
leal -0x2(%rdx), %r9d
movb %dil, (%r8,%r9)
movl %ecx, %edi
movb (%r14,%rdi), %dil
movq 0x8(%rbx), %r8
leal -0x1(%rdx), %r9d
movb %dil, (%r8,%r9)
movq 0x8(%rbx), %rdi
movl %edx, %r8d
movb $-0x1, (%rdi,%r8)
incl %esi
addl $0x3, %ecx
addl $0x4, %edx
jmp 0x787be
cmpq $0x0, 0x10(%rbx)
je 0x787b4
andq $0x0, 0x10(%rbx)
pushq $0x53
jmp 0x7879c
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: readChunk_tRNS(LodePNGColorMode*, unsigned char const*, unsigned long)
static unsigned readChunk_tRNS(LodePNGColorMode* color, const unsigned char* data, size_t chunkLength) {
  unsigned i;
  if(color->colortype == LCT_PALETTE) {
    /*error: more alpha values given than there are palette entries*/
    if(chunkLength > color->palettesize) return 39;

    for(i = 0; i != chunkLength; ++i) color->palette[4 * i + 3] = data[i];
  } else if(color->colortype == LCT_GREY) {
    /*error: this chunk must be 2 bytes for grayscale image*/
    if(chunkLength != 2) return 30;

    color->key_defined = 1;
    color->key_r = color->key_g = color->key_b = 256u * data[0] + data[1];
  } else if(color->colortype == LCT_RGB) {
    /*error: this chunk must be 6 bytes for RGB image*/
    if(chunkLength != 6) return 41;

    color->key_defined = 1;
    color->key_r = 256u * data[0] + data[1];
    color->key_g = 256u * data[2] + data[3];
    color->key_b = 256u * data[4] + data[5];
  }
  else return 42; /*error: tRNS chunk not allowed for other color models*/

  return 0; /* OK */
}

// Assembly:
movl (%rdi), %eax
testl %eax, %eax
je 0x7887b
cmpl $0x2, %eax
je 0x78844
cmpl $0x3, %eax
jne 0x788a1
cmpq %rdx, 0x10(%rdi)
jae 0x788ad
pushq $0x27
jmp 0x788ab
cmpq $0x6, %rdx
jne 0x788a5
movl $0x1, 0x18(%rdi)
movzwl (%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x1c(%rdi)
movzwl 0x2(%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x20(%rdi)
movzwl 0x4(%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
pushq $0x24
jmp 0x7889a
cmpq $0x2, %rdx
jne 0x788a9
movl $0x1, 0x18(%rdi)
movzwl (%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x24(%rdi)
movl %eax, 0x20(%rdi)
pushq $0x1c
popq %rcx
movl %eax, (%rdi,%rcx)
xorl %eax, %eax
retq
pushq $0x2a
jmp 0x788ab
pushq $0x29
jmp 0x788ab
pushq $0x1e
popq %rax
retq
xorl %eax, %eax
pushq $0x3
popq %rcx
xorl %r8d, %r8d
movl %r8d, %r8d
cmpq %rdx, %r8
je 0x788a0
movb (%rsi,%r8), %r9b
movq 0x8(%rdi), %r10
movl %ecx, %r11d
movb %r9b, (%r10,%r11)
incl %r8d
addl $0x4, %ecx
jmp 0x788b5
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: readChunk_bKGD(LodePNGInfo*, unsigned char const*, unsigned long)
static unsigned readChunk_bKGD(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) {
  if(info->color.colortype == LCT_PALETTE) {
    /*error: this chunk must be 1 byte for indexed color image*/
    if(chunkLength != 1) return 43;

    /*error: invalid palette index, or maybe this chunk appeared before PLTE*/
    if(data[0] >= info->color.palettesize) return 103;

    info->background_defined = 1;
    info->background_r = info->background_g = info->background_b = data[0];
  } else if(info->color.colortype == LCT_GREY || info->color.colortype == LCT_GREY_ALPHA) {
    /*error: this chunk must be 2 bytes for grayscale image*/
    if(chunkLength != 2) return 44;

    /*the values are truncated to bitdepth in the PNG file*/
    info->background_defined = 1;
    info->background_r = info->background_g = info->background_b = 256u * data[0] + data[1];
  } else if(info->color.colortype == LCT_RGB || info->color.colortype == LCT_RGBA) {
    /*error: this chunk must be 6 bytes for grayscale image*/
    if(chunkLength != 6) return 45;

    /*the values are truncated to bitdepth in the PNG file*/
    info->background_defined = 1;
    info->background_r = 256u * data[0] + data[1];
    info->background_g = 256u * data[2] + data[3];
    info->background_b = 256u * data[4] + data[5];
  }

  return 0; /* OK */
}

// Assembly:
movl 0x10(%rdi), %ecx
xorl %eax, %eax
cmpq $0x6, %rcx
ja 0x78949
leaq 0x17cf6(%rip), %r8      # 0x905dc
movslq (%r8,%rcx,4), %rcx
addq %r8, %rcx
jmpq *%rcx
cmpq $0x2, %rdx
jne 0x7894e
movl $0x1, 0x38(%rdi)
movzwl (%rsi), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
movl %ecx, 0x44(%rdi)
movl %ecx, 0x40(%rdi)
pushq $0x3c
jmp 0x78945
cmpq $0x6, %rdx
jne 0x7894a
movl $0x1, 0x38(%rdi)
movzwl (%rsi), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
movl %ecx, 0x3c(%rdi)
movzwl 0x2(%rsi), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
movl %ecx, 0x40(%rdi)
movzwl 0x4(%rsi), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
pushq $0x44
popq %rdx
movl %ecx, (%rdi,%rdx)
retq
pushq $0x2d
jmp 0x78973
pushq $0x2c
jmp 0x78973
cmpq $0x1, %rdx
jne 0x7896d
movzbl (%rsi), %ecx
cmpq %rcx, 0x20(%rdi)
jbe 0x78971
movl $0x1, 0x38(%rdi)
movzbl (%rsi), %ecx
jmp 0x78906
pushq $0x2b
jmp 0x78973
pushq $0x67
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: readChunk_tEXt(LodePNGInfo*, unsigned char const*, unsigned long)
static unsigned readChunk_tEXt(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) {
  unsigned error = 0;
  char *key = 0, *str = 0;
  unsigned i;

  while(!error) /*not really a while loop, only used to break on error*/ {
    unsigned length, string2_begin;

    length = 0;
    while(length < chunkLength && data[length] != 0) ++length;
    /*even though it's not allowed by the standard, no error is thrown if
    there's no null termination char, if the text is empty*/
    if(length < 1 || length > 79) CERROR_BREAK(error, 89); /*keyword too short or long*/

    key = (char*)lodepng_malloc(length + 1);
    if(!key) CERROR_BREAK(error, 83); /*alloc fail*/

    key[length] = 0;
    for(i = 0; i != length; ++i) key[i] = (char)data[i];

    string2_begin = length + 1; /*skip keyword null terminator*/

    length = (unsigned)(chunkLength < string2_begin ? 0 : chunkLength - string2_begin);
    str = (char*)lodepng_malloc(length + 1);
    if(!str) CERROR_BREAK(error, 83); /*alloc fail*/

    str[length] = 0;
    for(i = 0; i != length; ++i) str[i] = (char)data[string2_begin + i];

    error = lodepng_add_text(info, key, str);

    break;
  }

  lodepng_free(key);
  lodepng_free(str);

  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rsi, %r12
pushq $0x1
popq %rbp
leal -0x1(%rbp), %r13d
cmpq %r15, %r13
jae 0x789a0
cmpb $0x0, (%r12,%r13)
je 0x789a0
incl %ebp
jmp 0x7898c
leal -0x51(%rbp), %eax
cmpl $-0x4f, %eax
jae 0x789b5
xorl %ebx, %ebx
pushq $0x59
popq %rbp
xorl %r13d, %r13d
jmp 0x78a5d
movq %rdi, 0x10(%rsp)
movl %ebp, %edi
movq %rdi, %r14
callq 0x525b0
testq %rax, %rax
je 0x78a55
movq %rax, %rbx
movb $0x0, (%rax,%r13)
movl %r13d, %eax
xorl %ecx, %ecx
movq %r14, %rsi
cmpq %rcx, %rax
je 0x789ee
movb (%r12,%rcx), %dl
movb %dl, (%rbx,%rcx)
incq %rcx
jmp 0x789dd
xorl %eax, %eax
movq %r15, %r14
subq %rsi, %r14
cmovbq %rax, %r14
movq %rsi, 0x8(%rsp)
leal 0x1(%r14), %edi
callq 0x525b0
testq %rax, %rax
je 0x78a57
movq %rax, %r13
movl %r14d, %eax
movb $0x0, (%r13,%rax)
movq 0x8(%rsp), %rax
cmpq %rax, %r15
cmovbq %r15, %rax
subl %eax, %r15d
xorl %eax, %eax
movq 0x10(%rsp), %rdi
cmpq %rax, %r15
je 0x78a46
movl %ebp, %ecx
movb (%r12,%rcx), %cl
movb %cl, (%r13,%rax)
incq %rax
incl %ebp
jmp 0x78a2f
movq %rbx, %rsi
movq %r13, %rdx
callq 0x7618b
movl %eax, %ebp
jmp 0x78a5d
xorl %ebx, %ebx
xorl %r13d, %r13d
pushq $0x53
popq %rbp
movq %rbx, %rdi
callq 0x52530
movq %r13, %rdi
callq 0x52530
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: readChunk_zTXt(LodePNGInfo*, LodePNGDecompressSettings const*, unsigned char const*, unsigned long)
static unsigned readChunk_zTXt(LodePNGInfo* info, const LodePNGDecompressSettings* zlibsettings,
                               const unsigned char* data, size_t chunkLength) {
  unsigned error = 0;
  unsigned i;

  unsigned length, string2_begin;
  char *key = 0;
  ucvector decoded;

  ucvector_init(&decoded);

  while(!error) /*not really a while loop, only used to break on error*/ {
    for(length = 0; length < chunkLength && data[length] != 0; ++length) ;
    if(length + 2 >= chunkLength) CERROR_BREAK(error, 75); /*no null termination, corrupt?*/
    if(length < 1 || length > 79) CERROR_BREAK(error, 89); /*keyword too short or long*/

    key = (char*)lodepng_malloc(length + 1);
    if(!key) CERROR_BREAK(error, 83); /*alloc fail*/

    key[length] = 0;
    for(i = 0; i != length; ++i) key[i] = (char)data[i];

    if(data[length + 1] != 0) CERROR_BREAK(error, 72); /*the 0 byte indicating compression must be 0*/

    string2_begin = length + 2;
    if(string2_begin > chunkLength) CERROR_BREAK(error, 75); /*no null termination, corrupt?*/

    length = (unsigned)chunkLength - string2_begin;
    /*will fail if zlib error, e.g. if length is too small*/
    error = zlib_decompress(&decoded.data, &decoded.size,
                            &data[string2_begin],
                            length, zlibsettings);
    if(error) break;
    ucvector_push_back(&decoded, 0);

    error = lodepng_add_text(info, key, (char*)decoded.data);

    break;
  }

  lodepng_free(key);
  ucvector_cleanup(&decoded);

  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r15
movq %rdx, %r13
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
pushq $0x2
popq %rbx
leal -0x2(%rbx), %ebp
cmpq %r15, %rbp
jae 0x78ab6
cmpb $0x0, (%r13,%rbp)
je 0x78ab6
incl %ebx
jmp 0x78aa2
movl %ebx, %r12d
cmpq %r15, %r12
jae 0x78aca
leal -0x52(%rbx), %eax
cmpl $-0x4f, %eax
jae 0x78ad2
pushq $0x59
jmp 0x78b1f
xorl %r14d, %r14d
pushq $0x4b
popq %rbp
jmp 0x78b23
movq %rsi, 0x28(%rsp)
movq %rdi, 0x20(%rsp)
leal -0x1(%rbx), %edi
movq %rdi, 0x30(%rsp)
callq 0x525b0
testq %rax, %rax
je 0x78b1d
movq %rax, %r14
movb $0x0, (%rax,%rbp)
movl %ebp, %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x78b0c
movb (%r13,%rcx), %dl
movb %dl, (%r14,%rcx)
incq %rcx
jmp 0x78af9
movq 0x30(%rsp), %rax
cmpb $0x0, (%r13,%rax)
je 0x78b44
pushq $0x48
jmp 0x78acf
pushq $0x53
popq %rbp
xorl %r14d, %r14d
movq %r14, %rdi
callq 0x52530
movq %rsp, %rdi
callq 0x7d131
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
subl %ebx, %r15d
leaq 0x8(%rsp), %rsi
addq %r12, %r13
movq %rsp, %rdi
movq %r13, %rdx
movq %r15, %rcx
movq 0x28(%rsp), %r8
callq 0x7bbaa
testl %eax, %eax
jne 0x78b83
movq %rsp, %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x7c707
movq (%r15), %rdx
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x7618b
movl %eax, %ebp
jmp 0x78b23
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: readChunk_tIME(LodePNGInfo*, unsigned char const*, unsigned long)
static unsigned readChunk_tIME(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) {
  if(chunkLength != 7) return 73; /*invalid tIME chunk size*/

  info->time_defined = 1;
  info->time.year = 256u * data[0] + data[1];
  info->time.month = data[2];
  info->time.day = data[3];
  info->time.hour = data[4];
  info->time.minute = data[5];
  info->time.second = data[6];

  return 0; /* OK */
}

// Assembly:
cmpq $0x7, %rdx
jne 0x78e7b
movl $0x1, 0x88(%rdi)
movzwl (%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x8c(%rdi)
movzbl 0x2(%rsi), %eax
movl %eax, 0x90(%rdi)
movzbl 0x3(%rsi), %eax
movl %eax, 0x94(%rdi)
movzbl 0x4(%rsi), %eax
movl %eax, 0x98(%rdi)
movzbl 0x5(%rsi), %eax
movl %eax, 0x9c(%rdi)
movzbl 0x6(%rsi), %eax
movl %eax, 0xa0(%rdi)
xorl %eax, %eax
retq
pushq $0x49
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: readChunk_pHYs(LodePNGInfo*, unsigned char const*, unsigned long)
static unsigned readChunk_pHYs(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) {
  if(chunkLength != 9) return 74; /*invalid pHYs chunk size*/

  info->phys_defined = 1;
  info->phys_x = 16777216u * data[0] + 65536u * data[1] + 256u * data[2] + data[3];
  info->phys_y = 16777216u * data[4] + 65536u * data[5] + 256u * data[6] + data[7];
  info->phys_unit = data[8];

  return 0; /* OK */
}

// Assembly:
cmpq $0x9, %rdx
jne 0x78eb1
movl $0x1, 0xa4(%rdi)
movl (%rsi), %eax
bswapl %eax
movl %eax, 0xa8(%rdi)
movl 0x4(%rsi), %eax
bswapl %eax
movl %eax, 0xac(%rdi)
movzbl 0x8(%rsi), %eax
movl %eax, 0xb0(%rdi)
xorl %eax, %eax
retq
pushq $0x4a
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: readChunk_cHRM(LodePNGInfo*, unsigned char const*, unsigned long)
static unsigned readChunk_cHRM(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) {
  if(chunkLength != 32) return 97; /*invalid cHRM chunk size*/

  info->chrm_defined = 1;
  info->chrm_white_x = 16777216u * data[ 0] + 65536u * data[ 1] + 256u * data[ 2] + data[ 3];
  info->chrm_white_y = 16777216u * data[ 4] + 65536u * data[ 5] + 256u * data[ 6] + data[ 7];
  info->chrm_red_x   = 16777216u * data[ 8] + 65536u * data[ 9] + 256u * data[10] + data[11];
  info->chrm_red_y   = 16777216u * data[12] + 65536u * data[13] + 256u * data[14] + data[15];
  info->chrm_green_x = 16777216u * data[16] + 65536u * data[17] + 256u * data[18] + data[19];
  info->chrm_green_y = 16777216u * data[20] + 65536u * data[21] + 256u * data[22] + data[23];
  info->chrm_blue_x  = 16777216u * data[24] + 65536u * data[25] + 256u * data[26] + data[27];
  info->chrm_blue_y  = 16777216u * data[28] + 65536u * data[29] + 256u * data[30] + data[31];

  return 0; /* OK */
}

// Assembly:
cmpq $0x20, %rdx
jne 0x78f40
movl $0x1, 0xbc(%rdi)
movl (%rsi), %eax
bswapl %eax
movl %eax, 0xc0(%rdi)
movl 0x4(%rsi), %eax
bswapl %eax
movl %eax, 0xc4(%rdi)
movl 0x8(%rsi), %eax
bswapl %eax
movl %eax, 0xc8(%rdi)
movl 0xc(%rsi), %eax
bswapl %eax
movl %eax, 0xcc(%rdi)
movl 0x10(%rsi), %eax
bswapl %eax
movl %eax, 0xd0(%rdi)
movl 0x14(%rsi), %eax
bswapl %eax
movl %eax, 0xd4(%rdi)
movl 0x18(%rsi), %eax
bswapl %eax
movl %eax, 0xd8(%rdi)
movl 0x1c(%rsi), %eax
bswapl %eax
movl %eax, 0xdc(%rdi)
xorl %eax, %eax
retq
pushq $0x61
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_decode_memory(unsigned char**, unsigned int*, unsigned int*, unsigned char const*, unsigned long, LodePNGColorType, unsigned int)
unsigned lodepng_decode_memory(unsigned char** out, unsigned* w, unsigned* h, const unsigned char* in,
                               size_t insize, LodePNGColorType colortype, unsigned bitdepth) {
  unsigned error;
  LodePNGState state;
  lodepng_state_init(&state);
  state.info_raw.colortype = colortype;
  state.info_raw.bitdepth = bitdepth;
  error = lodepng_decode(out, w, h, &state, in, insize);
  lodepng_state_cleanup(&state);
  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movl %r9d, %ebx
movq %r8, 0x8(%rsp)
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbp
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x79d77
movl %ebx, 0x90(%r14)
movl 0x240(%rsp), %eax
movl %eax, 0x94(%r14)
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
movq %r15, %r8
movq 0x8(%rsp), %r9
callq 0x79089
movl %eax, %ebx
movq %r14, %rdi
callq 0x79dde
movl %ebx, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_state_init(LodePNGState*)
void lodepng_state_init(LodePNGState* state) {
#ifdef LODEPNG_COMPILE_DECODER
  lodepng_decoder_settings_init(&state->decoder);
#endif /*LODEPNG_COMPILE_DECODER*/
#ifdef LODEPNG_COMPILE_ENCODER
  lodepng_encoder_settings_init(&state->encoder);
#endif /*LODEPNG_COMPILE_ENCODER*/
  lodepng_color_mode_init(&state->info_raw);
  lodepng_info_init(&state->info_png);
  state->error = 1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x2c(%rdi)
andl $0x0, 0x34(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, 0x1c(%rdi)
addq $0x38, %rdi
callq 0x79ee5
xorps %xmm0, %xmm0
movups %xmm0, 0xa8(%rbx)
movabsq $0x800000006, %rax      # imm = 0x800000006
movq %rax, 0x90(%rbx)
movups %xmm0, 0x98(%rbx)
leaq 0xb8(%rbx), %rdi
callq 0x76558
movl $0x1, 0x1f0(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_decode_file(unsigned char**, unsigned int*, unsigned int*, char const*, LodePNGColorType, unsigned int)
unsigned lodepng_decode_file(unsigned char** out, unsigned* w, unsigned* h, const char* filename,
                             LodePNGColorType colortype, unsigned bitdepth) {
  unsigned char* buffer = 0;
  size_t buffersize;
  unsigned error;
  /* safe output values in case error happens */
  *out = 0;
  *w = *h = 0;
  error = lodepng_load_file(&buffer, &buffersize, filename);
  if(!error) error = lodepng_decode_memory(out, w, h, buffer, buffersize, colortype, bitdepth);
  lodepng_free(buffer);
  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %ebp
movl %r8d, 0x14(%rsp)
leaq 0x20(%rsp), %r12
andq $0x0, (%r12)
movq %rdi, %r14
andq $0x0, (%rdi)
movq %rdx, %r15
andl $0x0, (%rdx)
movq %rsi, %r13
andl $0x0, (%rsi)
leaq 0x18(%rsp), %rsi
movq %r12, %rdi
movq %rcx, %rdx
callq 0x73958
movl %eax, %ebx
movq (%r12), %r12
testl %eax, %eax
jne 0x79e91
movq 0x18(%rsp), %r8
movl %ebp, (%rsp)
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r12, %rcx
movl 0x14(%rsp), %r9d
callq 0x79cf9
movl %eax, %ebx
movq %r12, %rdi
callq 0x52530
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_encoder_settings_init(LodePNGEncoderSettings*)
void lodepng_compress_settings_init(LodePNGCompressSettings* settings) {
  /*compress with dynamic huffman tree (not in the mathematical sense, just not the predefined one)*/
  settings->btype = 2;
  settings->use_lz77 = 1;
  settings->windowsize = DEFAULT_WINDOWSIZE;
  settings->minmatch = 3;
  settings->nicematch = 128;
  settings->lazymatching = 1;

  settings->custom_zlib = 0;
  settings->custom_deflate = 0;
  settings->custom_context = 0;
}

// Assembly:
movaps 0x165c4(%rip), %xmm0    # 0x904b0
movups %xmm0, (%rdi)
movabsq $0x100000080, %rax      # imm = 0x100000080
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
andq $0x0, 0x28(%rdi)
movl $0x5, 0x38(%rdi)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x30(%rdi)
movups %xmm0, 0x40(%rdi)
movl $0x1, 0x50(%rdi)
retq