LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/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
movl $0x4d, %eax
addq %r13, %rbp
jb 0x67c23
subq $-0xc, %rbp
jae 0x67c23
movq %r8, %rbx
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl %edx, 0x4(%rsp)
movq (%rdi), %rdi
movq %rbp, %rsi
callq 0x3a730
testq %rax, %rax
je 0x67c1e
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)
testl %edx, %edx
je 0x67c15
negq %r13
movl $0x8, %eax
movb -0x8(%rbx,%rax), %cl
movl %eax, %edx
movb %cl, (%rdi,%rdx)
leaq (%rax,%r13), %rcx
incq %rcx
incq %rax
cmpq $0x8, %rcx
jne 0x67bfc
callq 0x678e7
xorl %eax, %eax
jmp 0x67c23
movl $0x53, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x3a730
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x67c96
xorl %eax, %eax
xorl %ecx, %ecx
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
cmpq $0x100, %rcx            # imm = 0x100
jne 0x67c6a
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/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), %rcx
testq %rcx, %rcx
jne 0x67db9
movq %r14, %rdi
callq 0x67c4b
movq 0x8(%r14), %rcx
testq %rcx, %rcx
je 0x67dfd
movq 0x10(%r14), %rdx
movl $0x6c, %eax
cmpq $0xff, %rdx
ja 0x67e02
movb %r12b, (%rcx,%rdx,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 0x67e02
movl $0x53, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x3a730
movq %rax, %r12
movq 0x48(%rbx), %rax
movq 0x58(%rbx), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x3a730
movq %rax, %r13
testq %r12, %r12
setne %al
testq %r13, %r13
setne %cl
testb %cl, %al
je 0x67fe8
incq 0x48(%rbx)
movq %r12, 0x50(%rbx)
movq %r13, 0x58(%rbx)
movq %r15, %rdi
callq 0x68007
movq 0x48(%rbx), %rcx
movq 0x50(%rbx), %rdx
movq %rax, -0x8(%rdx,%rcx,8)
movq %r14, %rdi
callq 0x68007
movq 0x48(%rbx), %rcx
movq 0x58(%rbx), %rdx
movq %rax, -0x8(%rdx,%rcx,8)
xorl %eax, %eax
jmp 0x67ffd
movq %r12, %rdi
callq 0x3a540
movq %r13, %rdi
callq 0x3a540
movl $0x53, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
xorl %ebx, %ebx
cmpb $0x0, (%r14,%rbx)
leaq 0x1(%rbx), %rbx
jne 0x68011
movq %rbx, %rdi
callq 0x3a5b0
movq %rax, %r15
testq %rax, %rax
je 0x6804c
cmpq $0x1, %rbx
je 0x68045
decq %rbx
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3a3b0
jmp 0x68047
xorl %ebx, %ebx
movb $0x0, (%r15,%rbx)
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xf0(%rdi), %rdi
callq 0x3a540
xorl %r14d, %r14d
movq %r14, 0xf0(%rbx)
movq 0xf8(%rbx), %rdi
callq 0x3a540
movq %r14, 0xf8(%rbx)
movl %r14d, 0x100(%rbx)
movl %r14d, 0xe8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x68388
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %ecx, %ebx
movq %rdx, %r15
movq %rdi, %r14
movq %rsi, %rdi
callq 0x68007
movq %rax, %r13
movq %rax, 0xf0(%r14)
movl %ebx, %r12d
movq %r12, %rdi
callq 0x3a5b0
movq %rax, 0xf8(%r14)
testq %r13, %r13
sete %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
movl $0x53, %ecx
jne 0x6837d
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3a3b0
movl %ebx, 0x100(%r14)
xorl %ecx, %ecx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x6838d
movl $0x64, %ecx
movl %ecx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x18(%rdi), %r14
movq 0x18(%rdi), %rdi
testq %rdi, %rdi
je 0x68423
callq 0x3a540
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq %rbx, %rdi
callq 0x67efc
movq %rbx, %rdi
callq 0x68057
movq 0xf0(%rbx), %rdi
callq 0x3a540
xorl %r14d, %r14d
movq %r14, 0xf0(%rbx)
movq 0xf8(%rbx), %rdi
callq 0x3a540
movq %r14, 0xf8(%rbx)
movl %r14d, 0x100(%rbx)
movl %r14d, 0xe8(%rbx)
movq 0x108(%rbx,%r14,8), %rdi
callq 0x3a540
incq %r14
cmpq $0x3, %r14
jne 0x68471
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x6840a
movl $0x138, %edx            # imm = 0x138
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3a3b0
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 0x67cd4
testl %eax, %eax
je 0x684e9
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%r14)
movq $0x0, 0x58(%r14)
cmpq $0x0, 0x48(%rbx)
je 0x68528
xorl %r15d, %r15d
movq 0x50(%rbx), %rax
movq 0x58(%rbx), %rcx
movq (%rax,%r15,8), %rsi
movq (%rcx,%r15,8), %rdx
movq %r14, %rdi
callq 0x67f5c
testl %eax, %eax
jne 0x684df
incq %r15
cmpq 0x48(%rbx), %r15
jne 0x68503
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%r14)
movups %xmm0, 0x60(%r14)
movq $0x0, 0x80(%r14)
cmpq $0x0, 0x60(%rbx)
je 0x68586
xorl %r15d, %r15d
movq 0x68(%rbx), %rax
movq 0x70(%rbx), %rcx
movq (%rax,%r15,8), %rsi
movq (%rcx,%r15,8), %rdx
movq 0x78(%rbx), %rax
movq (%rax,%r15,8), %rcx
movq 0x80(%rbx), %rax
movq (%rax,%r15,8), %r8
movq %r14, %rdi
callq 0x680f1
testl %eax, %eax
jne 0x684df
incq %r15
cmpq 0x60(%rbx), %r15
jne 0x6854a
cmpl $0x0, 0xe8(%rbx)
je 0x685b3
movq 0xf0(%rbx), %rsi
movq 0xf8(%rbx), %rdx
movl 0x100(%rbx), %ecx
movq %r14, %rdi
callq 0x68318
testl %eax, %eax
jne 0x684df
leaq 0x108(%r14), %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x128(%r14)
movups %xmm0, 0x118(%r14)
movups %xmm0, 0x108(%r14)
xorl %r15d, %r15d
movq (%r12,%r15,8), %rdi
callq 0x3a540
incq %r15
cmpq $0x3, %r15
jne 0x685d8
xorl %r13d, %r13d
movq 0x120(%rbx,%r13,8), %r15
movq %r15, 0x120(%r14,%r13,8)
movq %r15, %rdi
callq 0x3a5b0
movq %rax, 0x108(%r14,%r13,8)
testq %rax, %rax
sete %al
testq %r15, %r15
setne %cl
testb %al, %cl
jne 0x68653
testq %r15, %r15
je 0x68643
xorl %eax, %eax
movq 0x108(%rbx,%r13,8), %rcx
movb (%rcx,%rax), %cl
movq (%r12,%r13,8), %rdx
movb %cl, (%rdx,%rax)
incq %rax
cmpq 0x120(%rbx,%r13,8), %rax
jb 0x68624
incq %r13
cmpq $0x3, %r13
jne 0x685ed
xorl %eax, %eax
jmp 0x684df
movl $0x53, %eax
jmp 0x684df
// File: /workspace/github_cpp_makefile_star2_O3/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:
movl $0x1f, %eax
cmpl $0x6, %edi
ja 0x6a693
movl %edi, %ecx
leaq 0x1ded4(%rip), %rdx     # 0x88520
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
addl $-0x8, %esi
andl $-0x9, %esi
movl $0x25, %eax
cmovel %esi, %eax
retq
movl $0x25, %eax
cmpl $0x10, %esi
ja 0x6a693
movl $0x10116, %ecx          # imm = 0x10116
btl %esi, %ecx
jae 0x6a693
xorl %eax, %eax
retq
decl %esi
movl $0x25, %eax
cmpl $0x8, %esi
jae 0x6a693
movl %esi, %eax
leaq 0x1fa80(%rip), %rcx     # 0x8a110
movl (%rcx,%rax,4), %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
movq %rdx, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
movq %rcx, %rax
mulq %rdx
shrq %rdx
movq %rdx, 0x10(%rdi)
addq $-0x303, %rcx           # imm = 0xFCFD
movl $0x26, %eax
cmpq $-0x300, %rcx           # imm = 0xFD00
jb 0x6aa1d
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x67c4b
cmpq $0x0, 0x8(%rbx)
movq 0x10(%rbx), %rcx
je 0x6aa00
xorl %eax, %eax
testq %rcx, %rcx
je 0x6aa16
movl $0x3, %ecx
movl $0x1, %edx
movl $0x1, %esi
leal -0x1(%rdx), %edi
movb (%r14,%rdi), %dil
movq 0x8(%rbx), %r8
leal -0x3(%rcx), %r9d
movb %dil, (%r8,%r9)
leal 0x1(%rdx), %edi
movl %edx, %r8d
movb (%r14,%r8), %r8b
movq 0x8(%rbx), %r9
leal -0x2(%rcx), %r10d
movb %r8b, (%r9,%r10)
movb (%r14,%rdi), %dil
movq 0x8(%rbx), %r8
leal -0x1(%rcx), %r9d
movb %dil, (%r8,%r9)
movq 0x8(%rbx), %rdi
movl %ecx, %r8d
movb $-0x1, (%rdi,%r8)
movl %esi, %edi
incl %esi
addl $0x4, %ecx
addl $0x3, %edx
cmpq %rdi, 0x10(%rbx)
jne 0x6a9a9
jmp 0x6aa16
testq %rcx, %rcx
je 0x6aa14
movq $0x0, 0x10(%rbx)
movl $0x53, %eax
jmp 0x6aa16
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/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), %ecx
testl %ecx, %ecx
je 0x6aab2
cmpl $0x2, %ecx
je 0x6aa73
movl $0x2a, %eax
cmpl $0x3, %ecx
jne 0x6aa72
movl $0x27, %eax
cmpq %rdx, 0x10(%rdi)
jb 0x6aa72
testq %rdx, %rdx
je 0x6aadc
movl $0x3, %ecx
xorl %eax, %eax
xorl %r8d, %r8d
movb (%rsi,%r8), %r9b
movq 0x8(%rdi), %r10
movl %ecx, %r11d
movb %r9b, (%r10,%r11)
incq %r8
movl %r8d, %r9d
addl $0x4, %ecx
cmpq %rdx, %r9
jne 0x6aa55
retq
movl $0x29, %eax
cmpq $0x6, %rdx
jne 0x6aa72
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
movl $0x24, %ecx
jmp 0x6aad9
movl $0x1e, %eax
cmpq $0x2, %rdx
jne 0x6aa72
movl $0x1, 0x18(%rdi)
movzwl (%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x24(%rdi)
movl %eax, 0x20(%rdi)
movl $0x1c, %ecx
movl %eax, (%rdi,%rcx)
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x6ab65
leaq 0x1da4b(%rip), %r8      # 0x8853c
movslq (%r8,%rcx,4), %rcx
addq %r8, %rcx
jmpq *%rcx
movl $0x2c, %eax
cmpq $0x2, %rdx
jne 0x6ab65
movl $0x1, 0x38(%rdi)
movzwl (%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x44(%rdi)
movl %eax, 0x40(%rdi)
movl $0x3c, %ecx
jmp 0x6ab60
movl $0x2d, %eax
cmpq $0x6, %rdx
jne 0x6ab65
movl $0x1, 0x38(%rdi)
movzwl (%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x3c(%rdi)
movzwl 0x2(%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x40(%rdi)
movzwl 0x4(%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl $0x44, %ecx
movl %eax, (%rdi,%rcx)
xorl %eax, %eax
retq
movl $0x2b, %eax
cmpq $0x1, %rdx
jne 0x6ab65
movzbl (%rsi), %ecx
movl $0x67, %eax
cmpq %rcx, 0x20(%rdi)
jbe 0x6ab65
movl $0x1, 0x38(%rdi)
movzbl (%rsi), %eax
jmp 0x6ab16
// File: /workspace/github_cpp_makefile_star2_O3/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 %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %r8, %rax
movq %rcx, %r8
movl 0x220(%rsp), %ecx
xorps %xmm0, %xmm0
movq %rsp, %rbx
movups %xmm0, 0x1c(%rbx)
movaps %xmm0, 0x10(%rbx)
movaps %xmm0, (%rbx)
movaps 0x1c263(%rip), %xmm1    # 0x883d0
movups %xmm1, 0x2c(%rbx)
movaps 0x1c268(%rip), %xmm1    # 0x883e0
movups %xmm1, 0x3c(%rbx)
movl $0x1, %r10d
movl %r10d, 0x4c(%rbx)
movaps %xmm0, 0x50(%rbx)
xorl %r11d, %r11d
movq %r11, 0x60(%rbx)
movl $0x5, 0x70(%rbx)
movabsq $0x100000001, %r14      # imm = 0x100000001
movq %r14, 0x68(%rbx)
movups %xmm0, 0x78(%rbx)
movl %r10d, 0x88(%rbx)
movups %xmm0, 0xa8(%rbx)
movups %xmm0, 0x98(%rbx)
movaps %xmm0, 0xe0(%rbx)
movabsq $0x800000006, %r14      # imm = 0x800000006
movq %r14, 0xc8(%rbx)
movaps %xmm0, 0xd0(%rbx)
movl %r11d, 0xc0(%rbx)
movq %r11, 0xb8(%rbx)
movl %r11d, 0x15c(%rbx)
movl %r11d, 0x16c(%rbx)
movl %r11d, 0x174(%rbx)
movl %r11d, 0x198(%rbx)
movl %r11d, 0x1a0(%rbx)
movaps %xmm0, 0x1e0(%rbx)
movaps %xmm0, 0x1d0(%rbx)
movaps %xmm0, 0x1c0(%rbx)
movl %r11d, 0x140(%rbx)
movaps %xmm0, 0x130(%rbx)
movaps %xmm0, 0x120(%rbx)
movaps %xmm0, 0x110(%rbx)
movaps %xmm0, 0x100(%rbx)
movaps %xmm0, 0xf0(%rbx)
movups %xmm0, 0x1a8(%rbx)
movl %r10d, 0x1f0(%rbx)
movl %r9d, 0x90(%rbx)
movl %ecx, 0x94(%rbx)
movq %rbx, %rcx
movq %rax, %r9
callq 0x6b336
movl %eax, %ebp
movq %rbx, %rdi
callq 0x6c38c
movl %ebp, %eax
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_state_init(LodePNGState*)
void lodepng_decoder_settings_init(LodePNGDecoderSettings* settings) {
  settings->color_convert = 1;
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
  settings->read_text_chunks = 1;
  settings->remember_unknown_chunks = 0;
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
  settings->ignore_crc = 0;
  settings->ignore_critical = 0;
  settings->ignore_end = 0;
  lodepng_decompress_settings_init(&settings->zlibsettings);
}

// Assembly:
xorps %xmm0, %xmm0
movups %xmm0, 0x1c(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
movaps 0x1c12f(%rip), %xmm1    # 0x883d0
movups %xmm1, 0x2c(%rdi)
movaps 0x1c134(%rip), %xmm1    # 0x883e0
movups %xmm1, 0x3c(%rdi)
movl $0x1, %eax
movl %eax, 0x4c(%rdi)
movups %xmm0, 0x50(%rdi)
xorl %ecx, %ecx
movq %rcx, 0x60(%rdi)
movl $0x5, 0x70(%rdi)
movabsq $0x100000001, %rdx      # imm = 0x100000001
movq %rdx, 0x68(%rdi)
movups %xmm0, 0x78(%rdi)
movl %eax, 0x88(%rdi)
movups %xmm0, 0xa8(%rdi)
movabsq $0x800000006, %rdx      # imm = 0x800000006
movq %rdx, 0x90(%rdi)
movups %xmm0, 0x98(%rdi)
movups %xmm0, 0xe0(%rdi)
movq %rdx, 0xc8(%rdi)
movups %xmm0, 0xd0(%rdi)
movl %ecx, 0xc0(%rdi)
movq %rcx, 0xb8(%rdi)
movl %ecx, 0x15c(%rdi)
movl %ecx, 0x16c(%rdi)
movl %ecx, 0x174(%rdi)
movl %ecx, 0x198(%rdi)
movl %ecx, 0x1a0(%rdi)
movups %xmm0, 0x1e0(%rdi)
movups %xmm0, 0x1d0(%rdi)
movups %xmm0, 0x1c0(%rdi)
movl %ecx, 0x140(%rdi)
movups %xmm0, 0x130(%rdi)
movups %xmm0, 0x120(%rdi)
movups %xmm0, 0x110(%rdi)
movups %xmm0, 0x100(%rdi)
movups %xmm0, 0xf0(%rdi)
movups %xmm0, 0x1a8(%rdi)
movl %eax, 0x1f0(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/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)
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
xorl %eax, %eax
leaq 0x20(%rsp), %r13
movq %rax, (%r13)
movq %rax, (%rdi)
movl %eax, (%rdx)
movl %eax, (%rsi)
leaq 0x18(%rsp), %rsi
movq %r13, %rdi
movq %rcx, %rdx
callq 0x6459c
movl %eax, %ebx
movq (%r13), %r13
testl %eax, %eax
jne 0x6c45d
movq 0x18(%rsp), %r8
movl %ebp, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r13, %rcx
movl 0x14(%rsp), %r9d
callq 0x6c13d
movl %eax, %ebx
movq %r13, %rdi
callq 0x3a540
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_O3/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 0x1befd(%rip), %xmm0    # 0x883c0
movups %xmm0, (%rdi)
movabsq $0x100000080, %rax      # imm = 0x100000080
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
movq $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
// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng_color_stats_add(LodePNGColorStats*, unsigned int, unsigned int, unsigned int, unsigned int)
static void lodepng_color_stats_add(LodePNGColorStats* stats,
                                    unsigned r, unsigned g, unsigned b, unsigned a) {
  unsigned char image[8];
  LodePNGColorMode mode;
  lodepng_color_mode_init(&mode);
  image[0] = r >> 8; image[1] = r; image[2] = g >> 8; image[3] = g;
  image[4] = b >> 8; image[5] = b; image[6] = a >> 8; image[7] = a;
  mode.bitdepth = 16;
  mode.colortype = LCT_RGBA;
  lodepng_compute_color_stats(stats, image, 1, 1, &mode);
  lodepng_color_mode_cleanup(&mode);
}

// Assembly:
subq $0x38, %rsp
movl %esi, %eax
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r8
movups %xmm0, 0x18(%r8)
movups %xmm0, 0x8(%r8)
movb %ah, 0x8(%rsp)
leaq 0x8(%rsp), %rsi
movb %al, 0x1(%rsi)
movb %dh, 0xa(%rsp)
movb %dl, 0x3(%rsi)
movb %ch, 0xc(%rsp)
movb %cl, 0x5(%rsi)
movw $0xffff, 0x6(%rsi)      # imm = 0xFFFF
movabsq $0x1000000006, %rax     # imm = 0x1000000006
movq %rax, (%r8)
movl $0x1, %edx
movl $0x1, %ecx
callq 0x69a5d
addq $0x38, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: addChunk_IHDR(ucvector*, unsigned int, unsigned int, LodePNGColorType, unsigned int, unsigned int)
static unsigned addChunk_IHDR(ucvector* out, unsigned w, unsigned h,
                              LodePNGColorType colortype, unsigned bitdepth, unsigned interlace_method) {
  unsigned char data[13];

  lodepng_set32bitInt(data + 0, w); /*width*/
  lodepng_set32bitInt(data + 4, h); /*height*/
  data[8] = (unsigned char)bitdepth; /*bit depth*/
  data[9] = (unsigned char)colortype; /*color type*/
  data[10] = 0; /*compression method*/
  data[11] = 0; /*filter method*/
  data[12] = interlace_method; /*interlace method*/

  return addChunk(out, "IHDR", data, sizeof(data));
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl %r8d, %r10d
movl %esi, %eax
movq %rdi, %rbx
shrl $0x18, %esi
leaq 0x3(%rsp), %r8
movb %sil, (%r8)
movl %eax, %esi
shrl $0x10, %esi
movb %sil, 0x1(%r8)
movb %ah, 0x5(%rsp)
movb %al, 0x3(%r8)
movl %edx, %eax
shrl $0x18, %eax
movb %al, 0x4(%r8)
movl %edx, %eax
shrl $0x10, %eax
movb %al, 0x5(%r8)
movb %dh, 0x9(%rsp)
movb %dl, 0x7(%r8)
movb %r10b, 0x8(%r8)
movb %cl, 0x9(%r8)
movw $0x0, 0xa(%r8)
movb %r9b, 0xc(%r8)
leaq 0x8(%rdi), %rsi
leaq 0x1b5e2(%rip), %rcx     # 0x88ec4
movl $0xd, %edx
callq 0x67b70
testl %eax, %eax
jne 0x6d8f8
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: addUnknownChunks(ucvector*, unsigned char*, unsigned long)
static unsigned addUnknownChunks(ucvector* out, unsigned char* data, size_t datasize) {
  unsigned char* inchunk = data;
  while((size_t)(inchunk - data) < datasize) {
    CERROR_TRY_RETURN(lodepng_chunk_append(&out->data, &out->size, inchunk));
    out->allocsize = out->size; /*fix the allocsize again*/
    inchunk = lodepng_chunk_next(inchunk, data + datasize);
  }
  return 0;
}

// Assembly:
xorl %eax, %eax
testq %rdx, %rdx
je 0x6d966
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x8(%rdi), %r13
leaq (%rsi,%rdx), %rbp
movq %rsi, %r15
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x67afe
testl %eax, %eax
jne 0x6d958
movq 0x8(%r12), %rax
movq %rax, 0x10(%r12)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x67928
movq %rax, %r15
subq %rbx, %rax
cmpq %r14, %rax
jb 0x6d924
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: addChunk_cHRM(ucvector*, LodePNGInfo const*)
static unsigned addChunk_cHRM(ucvector* out, const LodePNGInfo* info) {
  unsigned char data[32];
  lodepng_set32bitInt(data + 0, info->chrm_white_x);
  lodepng_set32bitInt(data + 4, info->chrm_white_y);
  lodepng_set32bitInt(data + 8, info->chrm_red_x);
  lodepng_set32bitInt(data + 12, info->chrm_red_y);
  lodepng_set32bitInt(data + 16, info->chrm_green_x);
  lodepng_set32bitInt(data + 20, info->chrm_green_y);
  lodepng_set32bitInt(data + 24, info->chrm_blue_x);
  lodepng_set32bitInt(data + 28, info->chrm_blue_y);
  return addChunk(out, "cHRM", data, sizeof(data));
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movl 0xc0(%rsi), %eax
bswapl %eax
movq %rsp, %r8
movl %eax, (%r8)
movl 0xc4(%rsi), %eax
bswapl %eax
movl %eax, 0x4(%r8)
movl 0xc8(%rsi), %eax
bswapl %eax
movl %eax, 0x8(%r8)
movl 0xcc(%rsi), %eax
bswapl %eax
movl %eax, 0xc(%r8)
movl 0xd0(%rsi), %eax
bswapl %eax
movl %eax, 0x10(%r8)
movl 0xd4(%rsi), %eax
bswapl %eax
movl %eax, 0x14(%r8)
movl 0xd8(%rsi), %eax
bswapl %eax
movl %eax, 0x18(%r8)
movl 0xdc(%rsi), %eax
bswapl %eax
movl %eax, 0x1c(%r8)
leaq 0x8(%rdi), %rsi
leaq 0x1b227(%rip), %rcx     # 0x88ef6
movl $0x20, %edx
callq 0x67b70
testl %eax, %eax
jne 0x6dce5
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: addChunk_bKGD(ucvector*, LodePNGInfo const*)
static unsigned addChunk_bKGD(ucvector* out, const LodePNGInfo* info) {
  unsigned char data[6];
  size_t size = 0;
  if(info->color.colortype == LCT_GREY || info->color.colortype == LCT_GREY_ALPHA) {
    data[0] = (unsigned char)(info->background_r >> 8);
    data[1] = (unsigned char)(info->background_r & 255);
    size = 2;
  } else if(info->color.colortype == LCT_RGB || info->color.colortype == LCT_RGBA) {
    data[0] = (unsigned char)(info->background_r >> 8);
    data[1] = (unsigned char)(info->background_r & 255);
    data[2] = (unsigned char)(info->background_g >> 8);
    data[3] = (unsigned char)(info->background_g & 255);
    data[4] = (unsigned char)(info->background_b >> 8);
    data[5] = (unsigned char)(info->background_b & 255);
    size = 6;
  } else if(info->color.colortype == LCT_PALETTE) {
    data[0] =(unsigned char)(info->background_r & 255); /*palette index*/
    size = 1;
  }
  return addChunk(out, "bKGD", data, size);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl 0x10(%rsi), %eax
xorl %edx, %edx
cmpq $0x6, %rax
ja 0x6e2a3
leaq 0x1a30c(%rip), %rcx     # 0x88558
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzwl 0x3c(%rsi), %eax
rolw $0x8, %ax
movw %ax, 0xa(%rsp)
movl $0x2, %edx
jmp 0x6e2a3
movzwl 0x3c(%rsi), %eax
rolw $0x8, %ax
movw %ax, 0xa(%rsp)
movzwl 0x40(%rsi), %eax
rolw $0x8, %ax
movw %ax, 0xc(%rsp)
movzwl 0x44(%rsi), %eax
rolw $0x8, %ax
movw %ax, 0xe(%rsp)
movl $0x6, %edx
jmp 0x6e2a3
movb 0x3c(%rsi), %al
movb %al, 0xa(%rsp)
movl $0x1, %edx
leaq 0x8(%rbx), %rsi
leaq 0x1ac25(%rip), %rcx     # 0x88ed3
leaq 0xa(%rsp), %r8
movq %rbx, %rdi
callq 0x67b70
testl %eax, %eax
jne 0x6e2c7
movq 0x8(%rbx), %rcx
movq %rcx, 0x10(%rbx)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: addChunk_pHYs(ucvector*, LodePNGInfo const*)
static unsigned addChunk_pHYs(ucvector* out, const LodePNGInfo* info) {
  unsigned char data[9];
  lodepng_set32bitInt(data + 0, info->phys_x);
  lodepng_set32bitInt(data + 4, info->phys_y);  data[8] = info->phys_unit;
  return addChunk(out, "pHYs", data, sizeof(data));
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl 0xa8(%rsi), %eax
bswapl %eax
leaq 0x7(%rsp), %r8
movl %eax, (%r8)
movl 0xac(%rsi), %eax
bswapl %eax
movl %eax, 0x4(%r8)
movb 0xb0(%rsi), %al
movb %al, 0x8(%r8)
leaq 0x8(%rdi), %rsi
leaq 0x1abe6(%rip), %rcx     # 0x88eec
movl $0x9, %edx
callq 0x67b70
testl %eax, %eax
jne 0x6e31c
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: addChunk_tIME(ucvector*, LodePNGTime const*)
static unsigned addChunk_tIME(ucvector* out, const LodePNGTime* time) {
  unsigned char data[7];
  data[0] = (unsigned char)(time->year >> 8);
  data[1] = (unsigned char)(time->year & 255);
  data[2] = (unsigned char)time->month;
  data[3] = (unsigned char)time->day;
  data[4] = (unsigned char)time->hour;
  data[5] = (unsigned char)time->minute;
  data[6] = (unsigned char)time->second;
  return addChunk(out, "tIME", data, sizeof(data));
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movdqu (%rsi), %xmm0
movl (%rsi), %eax
movb %ah, 0x9(%rsp)
pand 0x1a029(%rip), %xmm0    # 0x883f0
packuswb %xmm0, %xmm0
packuswb %xmm0, %xmm0
leaq 0x9(%rsp), %r8
movd %xmm0, 0x1(%r8)
movb 0x10(%rsi), %al
movb %al, 0x5(%r8)
movb 0x14(%rsi), %al
movb %al, 0x6(%r8)
leaq 0x8(%rdi), %rsi
leaq 0x1aaf4(%rip), %rcx     # 0x88ee7
movl $0x7, %edx
callq 0x67b70
testl %eax, %eax
jne 0x6e409
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: lodepng::decode(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned int&, unsigned int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, LodePNGColorType, unsigned int)
unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h, const std::string& filename,
                LodePNGColorType colortype, unsigned bitdepth) {
  std::vector<unsigned char> buffer;
  /* safe output values in case error happens */
  w = h = 0;
  unsigned error = load_file(buffer, filename);
  if(error) return error;
  return decode(out, w, h, buffer, colortype, bitdepth);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %ebp
movl %r8d, %ebx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
xorl %eax, %eax
movl %eax, (%rdx)
movl %eax, (%rsi)
movq %rcx, %rsi
callq 0x6ef5f
movl %eax, %r13d
testl %eax, %eax
jne 0x6f42d
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %r8
xorl %ecx, %ecx
cmpq %r8, %rax
cmovneq %rax, %rcx
subl %eax, %r8d
movl %ebp, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movl %ebx, %r9d
callq 0x6f11c
movl %eax, %r13d
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6f444
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3a480
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6f470
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3a480
movq %rbx, %rdi
callq 0x3a790
// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: huffmanDecodeSymbol(LodePNGBitReader*, HuffmanTree const*)
static unsigned huffmanDecodeSymbol(LodePNGBitReader* reader, const HuffmanTree* codetree) {
  unsigned short code = peekBits(reader, FIRSTBITS);
  unsigned short l = codetree->table_len[code];
  unsigned short value = codetree->table_value[code];
  if(l <= FIRSTBITS) {
    advanceBits(reader, l);
    return value;
  } else {
    unsigned index2;
    advanceBits(reader, FIRSTBITS);
    index2 = value + peekBits(reader, l - FIRSTBITS);
    advanceBits(reader, codetree->table_len[index2] - FIRSTBITS);
    return codetree->table_value[index2];
  }
}

// Assembly:
movl 0x20(%rdi), %eax
movl %eax, %r8d
andl $0x1ff, %r8d            # imm = 0x1FF
movzbl (%rsi,%r8), %ecx
movl %r8d, %r8d
movzwl (%rdx,%r8,2), %r8d
cmpq $0x9, %rcx
ja 0x6f79c
shrl %cl, %eax
movl %eax, 0x20(%rdi)
addq %rcx, 0x18(%rdi)
jmp 0x6f7ec
movzwl %r8w, %r9d
shrl $0x9, %eax
movl %eax, 0x20(%rdi)
movq 0x18(%rdi), %r8
leaq 0x9(%r8), %r10
addb $-0x9, %cl
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
shll %cl, %r11d
movq %r10, 0x18(%rdi)
notl %r11d
andl %eax, %r11d
addq %r9, %r11
movzbl (%rsi,%r11), %esi
movl $0xfffffff7, %ecx       # imm = 0xFFFFFFF7
addq %rsi, %rcx
movl %ecx, %esi
shrl %cl, %eax
movl %eax, 0x20(%rdi)
leaq (%rsi,%r8), %rax
addq $0x9, %rax
movq %rax, 0x18(%rdi)
movzwl (%rdx,%r11,2), %r8d
movzwl %r8w, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: HuffmanTree_cleanup(HuffmanTree*)
static void HuffmanTree_cleanup(HuffmanTree* tree) {
  lodepng_free(tree->codes);
  lodepng_free(tree->lengths);
  lodepng_free(tree->table_len);
  lodepng_free(tree->table_value);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x3a540
movq 0x8(%rbx), %rdi
callq 0x3a540
movq 0x18(%rbx), %rdi
callq 0x3a540
movq 0x20(%rbx), %rdi
popq %rbx
jmp 0x3a540
// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: generateFixedLitLenTree(HuffmanTree*)
static unsigned generateFixedLitLenTree(HuffmanTree* tree) {
  unsigned i, error = 0;
  unsigned* bitlen = (unsigned*)lodepng_malloc(NUM_DEFLATE_CODE_SYMBOLS * sizeof(unsigned));
  if(!bitlen) return 83; /*alloc fail*/

  /*288 possible codes: 0-255=literals, 256=endcode, 257-285=lengthcodes, 286-287=unused*/
  for(i =   0; i <= 143; ++i) bitlen[i] = 8;
  for(i = 144; i <= 255; ++i) bitlen[i] = 9;
  for(i = 256; i <= 279; ++i) bitlen[i] = 7;
  for(i = 280; i <= 287; ++i) bitlen[i] = 8;

  error = HuffmanTree_makeFromLengths(tree, bitlen, NUM_DEFLATE_CODE_SYMBOLS, 15);

  lodepng_free(bitlen);
  return error;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x480, %edi            # imm = 0x480
callq 0x3a5b0
testq %rax, %rax
je 0x6f8b9
movq %rax, %rbx
xorl %eax, %eax
movaps 0x18bc1(%rip), %xmm0    # 0x88400
movups %xmm0, (%rbx,%rax,4)
addq $0x4, %rax
cmpq $0x90, %rax
jne 0x6f83f
movl $0x90, %eax
movaps 0x18bb5(%rip), %xmm1    # 0x88410
movups %xmm1, (%rbx,%rax,4)
addq $0x4, %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x6f85b
movl $0x100, %eax            # imm = 0x100
movaps 0x18ba9(%rip), %xmm1    # 0x88420
movups %xmm1, (%rbx,%rax,4)
addq $0x4, %rax
cmpq $0x118, %rax            # imm = 0x118
jne 0x6f877
movups %xmm0, 0x460(%rbx)
movups %xmm0, 0x470(%rbx)
movl $0x120, %edx            # imm = 0x120
movq %r14, %rdi
movq %rbx, %rsi
movl $0xf, %ecx
callq 0x6f91d
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3a540
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: writeBits(LodePNGBitWriter*, unsigned int, unsigned long)
static void writeBits(LodePNGBitWriter* writer, unsigned value, size_t nbits) {
  if(nbits == 1) { /* compiler should statically compile this case if nbits == 1 */
    WRITEBIT(writer, value);
  } else {
    /* TODO: increase output size nly once here rather than in each WRITEBIT */
    size_t i;
    for(i = 0; i != nbits; ++i) {
      WRITEBIT(writer, (unsigned char)((value >> i) & 1));
    }
  }
}

// Assembly:
testq %rdx, %rdx
je 0x6fe3d
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
cmpq $0x1, %rdx
jne 0x6fdd6
testb $0x7, 0x8(%rbx)
jne 0x6fdb9
movq (%rbx), %r14
movq 0x8(%r14), %rsi
incq %rsi
movq %r14, %rdi
callq 0x6f722
testl %eax, %eax
je 0x6fdb9
movq (%r14), %rax
movq 0x8(%r14), %rcx
movb $0x0, -0x1(%rax,%rcx)
movb 0x8(%rbx), %cl
andb $0x7, %cl
shll %cl, %ebp
movq (%rbx), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rax
orb %bpl, -0x1(%rcx,%rax)
incq 0x8(%rbx)
jmp 0x6fe35
movq 0x8(%rbx), %rax
xorl %r12d, %r12d
testb $0x7, %al
jne 0x6fe03
movq (%rbx), %r15
movq 0x8(%r15), %rsi
incq %rsi
movq %r15, %rdi
callq 0x6f722
testl %eax, %eax
je 0x6fe03
movq (%r15), %rax
movq 0x8(%r15), %rcx
movb $0x0, -0x1(%rax,%rcx)
xorl %eax, %eax
btl %r12d, %ebp
setb %al
movb 0x8(%rbx), %cl
andb $0x7, %cl
shll %cl, %eax
movq (%rbx), %rcx
movq (%rcx), %rdx
movq 0x8(%rcx), %rcx
orb %al, -0x1(%rdx,%rcx)
movq 0x8(%rbx), %rax
incq %rax
movq %rax, 0x8(%rbx)
incq %r12
cmpq %r12, %r14
jne 0x6fddd
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: writeLZ77data(LodePNGBitWriter*, uivector const*, HuffmanTree const*, HuffmanTree const*)
static void writeLZ77data(LodePNGBitWriter* writer, const uivector* lz77_encoded,
                          const HuffmanTree* tree_ll, const HuffmanTree* tree_d) {
  size_t i = 0;
  for(i = 0; i != lz77_encoded->size; ++i) {
    unsigned val = lz77_encoded->data[i];
    writeBitsReversed(writer, HuffmanTree_getCode(tree_ll, val), HuffmanTree_getLength(tree_ll, val));
    if(val > 256) /*for a length code, 3 more things have to be added*/ {
      unsigned length_index = val - FIRST_LENGTH_CODE_INDEX;
      unsigned n_length_extra_bits = LENGTHEXTRA[length_index];
      unsigned length_extra_bits = lz77_encoded->data[++i];

      unsigned distance_code = lz77_encoded->data[++i];

      unsigned distance_index = distance_code;
      unsigned n_distance_extra_bits = DISTANCEEXTRA[distance_index];
      unsigned distance_extra_bits = lz77_encoded->data[++i];

      writeBits(writer, length_extra_bits, n_length_extra_bits);
      writeBitsReversed(writer, HuffmanTree_getCode(tree_d, distance_code),
                       HuffmanTree_getLength(tree_d, distance_code));
      writeBits(writer, distance_extra_bits, n_distance_extra_bits);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, 0x8(%rsp)
cmpq $0x0, 0x8(%rsi)
je 0x705f6
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
xorl %ebx, %ebx
movq (%r15), %rax
movl (%rax,%rbx,4), %r13d
movq (%r14), %rax
movq 0x8(%r14), %rcx
movl (%rax,%r13,4), %esi
movl (%rcx,%r13,4), %edx
movq %r12, %rdi
callq 0x70605
cmpq $0x101, %r13            # imm = 0x101
jb 0x705e9
addl $0xfffffeff, %r13d      # imm = 0xFFFFFEFF
leaq 0x184f8(%rip), %rax     # 0x88a80
movl (%rax,%r13,4), %edx
movq (%r15), %rax
movl 0x4(%rax,%rbx,4), %esi
movq %r14, %r13
movl 0x8(%rax,%rbx,4), %r14d
leaq 0x185de(%rip), %rcx     # 0x88b80
movl (%rcx,%r14,4), %ecx
movq %rcx, 0x10(%rsp)
movl 0xc(%rax,%rbx,4), %ebp
addq $0x3, %rbx
movq %r12, %rdi
callq 0x6fd72
movq 0x8(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
movl (%rax,%r14,4), %esi
movl (%rcx,%r14,4), %edx
movq %r13, %r14
movq %r12, %rdi
callq 0x70605
movq %r12, %rdi
movl %ebp, %esi
movq 0x10(%rsp), %rdx
callq 0x6fd72
incq %rbx
cmpq 0x8(%r15), %rbx
jne 0x70553
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: writeBitsReversed(LodePNGBitWriter*, unsigned int, unsigned long)
static void writeBitsReversed(LodePNGBitWriter* writer, unsigned value, size_t nbits) {
  size_t i;
  for(i = 0; i != nbits; ++i) {
    /* TODO: increase output size only once here rather than in each WRITEBIT */
    WRITEBIT(writer, (unsigned char)((value >> (nbits - 1u - i)) & 1u));
  }
}

// Assembly:
testq %rdx, %rdx
je 0x7067f
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movq 0x8(%rdi), %rax
testb $0x7, %al
jne 0x70643
movq (%r14), %r15
movq 0x8(%r15), %rsi
incq %rsi
movq %r15, %rdi
callq 0x6f722
testl %eax, %eax
je 0x70643
movq (%r15), %rax
movq 0x8(%r15), %rcx
movb $0x0, -0x1(%rax,%rcx)
decq %rbx
xorl %eax, %eax
btl %ebx, %ebp
setb %al
movb 0x8(%r14), %cl
andb $0x7, %cl
shll %cl, %eax
movq (%r14), %rcx
movq (%rcx), %rdx
movq 0x8(%rcx), %rcx
orb %al, -0x1(%rdx,%rcx)
movq 0x8(%r14), %rax
incq %rax
movq %rax, 0x8(%r14)
testq %rbx, %rbx
jne 0x7061d
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq