LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: readChunk_mDCV(LodePNGInfo*, unsigned char const*, unsigned long)
static unsigned readChunk_mDCV(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) {
  if(chunkLength != 24) return 119; /*invalid mDCV chunk size*/

  info->mdcv_defined = 1;
  info->mdcv_red_x = 256u * data[0] + data[1];
  info->mdcv_red_y = 256u * data[2] + data[3];
  info->mdcv_green_x = 256u * data[4] + data[5];
  info->mdcv_green_y = 256u * data[6] + data[7];
  info->mdcv_blue_x = 256u * data[8] + data[9];
  info->mdcv_blue_y = 256u * data[10] + data[11];
  info->mdcv_white_x = 256u * data[12] + data[13];
  info->mdcv_white_y = 256u * data[14] + data[15];
  info->mdcv_max_luminance = 16777216u * data[16] + 65536u * data[17] + 256u * data[18] + data[19];
  info->mdcv_min_luminance = 16777216u * data[20] + 65536u * data[21] + 256u * data[22] + data[23];

  return 0; /* OK */
}

// Assembly:
cmpq $0x18, %rdx
jne 0x7f4d
movl $0x1, 0x128(%rdi)
movzwl (%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x12c(%rdi)
movzwl 0x2(%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x130(%rdi)
movzwl 0x4(%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x134(%rdi)
movzwl 0x6(%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x138(%rdi)
movzwl 0x8(%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x13c(%rdi)
movzwl 0xa(%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x140(%rdi)
movzwl 0xc(%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x144(%rdi)
movzwl 0xe(%rsi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x148(%rdi)
movl 0x10(%rsi), %eax
bswapl %eax
movl %eax, 0x14c(%rdi)
movl 0x14(%rsi), %eax
bswapl %eax
movl %eax, 0x150(%rdi)
xorl %eax, %eax
retq
pushq $0x77
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: readChunk_cLLI(LodePNGInfo*, unsigned char const*, unsigned long)
static unsigned readChunk_cLLI(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) {
  if(chunkLength != 8) return 120; /*invalid cLLI chunk size*/

  info->clli_defined = 1;
  info->clli_max_cll = 16777216u * data[0] + 65536u * data[1] + 256u * data[2] + data[3];
  info->clli_max_fall = 16777216u * data[4] + 65536u * data[5] + 256u * data[6] + data[7];

  return 0; /* OK */
}

// Assembly:
cmpq $0x8, %rdx
jne 0x7f79
movl $0x1, 0x154(%rdi)
movl (%rsi), %eax
bswapl %eax
movl %eax, 0x158(%rdi)
movl 0x4(%rsi), %eax
bswapl %eax
movl %eax, 0x15c(%rdi)
xorl %eax, %eax
retq
pushq $0x78
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/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;
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
  /*disable reading things that this function doesn't output*/
  state.decoder.read_text_chunks = 0;
  state.decoder.remember_unknown_chunks = 0;
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
  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 $0x288, %rsp            # imm = 0x288
movl %r9d, %ebx
movq %r8, (%rsp)
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbp
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x904f
movl %ebx, 0xa8(%r14)
movl 0x2c0(%rsp), %eax
movl %eax, 0xac(%r14)
andq $0x0, 0x38(%r14)
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
movq %r15, %r8
movq (%rsp), %r9
callq 0x8171
movl %eax, %ebx
movq %r14, %rdi
callq 0x90c7
movl %ebx, %eax
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: addChunk_PLTE(ucvector*, LodePNGColorMode const*)
static unsigned addChunk_PLTE(ucvector* out, const LodePNGColorMode* info) {
  unsigned char* chunk;
  size_t i, j = 8;

  if(info->palettesize == 0 || info->palettesize > 256) {
    return 68; /*invalid palette size, it is only allowed to be 1-256*/
  }

  CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, info->palettesize * 3, "PLTE"));

  for(i = 0; i != info->palettesize; ++i) {
    /*add all channels except alpha channel*/
    chunk[j++] = info->palette[i * 4 + 0];
    chunk[j++] = info->palette[i * 4 + 1];
    chunk[j++] = info->palette[i * 4 + 2];
  }

  lodepng_chunk_generate_crc(chunk);
  return 0;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq 0x10(%rsi), %rax
leaq -0x101(%rax), %rcx
cmpq $-0x100, %rcx
jae 0xb399
pushq $0x44
popq %rax
jmp 0xb3f5
movq %rdi, %rsi
leaq (%rax,%rax,2), %rdx
leaq 0x533d1(%rip), %rcx     # 0x5e778
leaq 0x8(%rsp), %rdi
callq 0xcdb2
testl %eax, %eax
jne 0xb3f5
movq 0x8(%rsp), %rdi
leaq 0xa(%rdi), %rax
xorl %ecx, %ecx
cmpq 0x10(%rbx), %rcx
je 0xb3ee
movq 0x8(%rbx), %rdx
movb (%rdx,%rcx,4), %dl
movb %dl, -0x2(%rax)
movq 0x8(%rbx), %rdx
movb 0x1(%rdx,%rcx,4), %dl
movb %dl, -0x1(%rax)
movq 0x8(%rbx), %rdx
movb 0x2(%rdx,%rcx,4), %dl
movb %dl, (%rax)
incq %rcx
addq $0x3, %rax
jmp 0xb3c0
callq 0x4657
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: addChunk_tEXt(ucvector*, char const*, char const*)
static unsigned addChunk_tEXt(ucvector* out, const char* keyword, const char* textstring) {
  unsigned char* chunk = 0;
  size_t keysize = lodepng_strlen(keyword), textsize = lodepng_strlen(textstring);
  size_t size = keysize + 1 + textsize;
  if(keysize < 1 || keysize > 79) return 89; /*error: invalid keyword size*/
  CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, size, "tEXt"));
  lodepng_memcpy(chunk + 8, keyword, keysize);
  chunk[8 + keysize] = 0; /*null termination char*/
  lodepng_memcpy(chunk + 9 + keysize, textstring, textsize);
  lodepng_chunk_generate_crc(chunk);
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r13
andq $0x0, 0x8(%rsp)
movq %rsi, %rdi
callq 0x45e5
movq %rax, %r15
movq %rbx, %rdi
callq 0x45e5
movq %rax, %r12
leaq -0x50(%r15), %rax
cmpq $-0x4f, %rax
jae 0xb43c
pushq $0x59
popq %rax
jmp 0xb492
leaq (%r15,%r12), %rdx
incq %rdx
leaq 0x5333d(%rip), %rcx     # 0x5e787
leaq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0xcdb2
testl %eax, %eax
jne 0xb492
movq 0x8(%rsp), %r13
leaq 0x8(%r13), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x4a08
movb $0x0, 0x8(%r13,%r15)
leaq (%r15,%r13), %rdi
addq $0x9, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x4a08
movq %r13, %rdi
callq 0x4657
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: lodepng::load_file(std::vector<unsigned char, std::allocator<unsigned char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
unsigned load_file(std::vector<unsigned char>& buffer, const std::string& filename) {
  unsigned error;
  FILE* file = fopen(filename.c_str(), "rb");
  if(!file) return 78;
  error = load_file_(buffer, file);
  fclose(file);
  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq (%rsi), %rdi
leaq 0x53172(%rip), %rsi     # 0x5e76d
callq 0x2250
testq %rax, %rax
je 0xb655
movq %rax, %rbx
movq %rax, %rdi
callq 0xbd0e
testq %rax, %rax
js 0xb65a
movq %rax, %r15
xorl %ebp, %ebp
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xe6d8
testq %r15, %r15
je 0xb65d
movq (%r14), %rdi
movq 0x8(%r14), %rdx
subq %rdi, %rdx
pushq $0x1
popq %rsi
movq %rbx, %rcx
callq 0x22c0
movq 0x8(%r14), %rcx
subq (%r14), %rcx
xorl %edx, %edx
cmpq %rcx, %rax
pushq $0x4e
popq %rbp
cmovel %edx, %ebp
jmp 0xb65d
pushq $0x4e
popq %rbp
jmp 0xb665
pushq $0x4e
popq %rbp
movq %rbx, %rdi
callq 0x2200
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: lodepng::decompress(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned char const*, unsigned long, LodePNGDecompressSettings const&)
unsigned decompress(std::vector<unsigned char>& out, const unsigned char* in, size_t insize,
                    const LodePNGDecompressSettings& settings) {
  unsigned char* buffer = 0;
  size_t buffersize = 0;
  unsigned error = zlib_decompress(&buffer, &buffersize, 0, in, insize, &settings);
  if(buffer) {
    out.insert(out.end(), buffer, &buffer[buffersize]);
    lodepng_free(buffer);
  }
  return error;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r9
movq %rdx, %r8
movq %rsi, %rcx
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
andq $0x0, (%r14)
movq %rsp, %rsi
andq $0x0, (%rsi)
movq %r14, %rdi
xorl %edx, %edx
callq 0xb6ed
movl %eax, %ebp
movq (%r14), %rdx
testq %rdx, %rdx
je 0xb6e2
movq 0x8(%rbx), %rsi
movq (%rsp), %rcx
addq %rdx, %rcx
movq %rbx, %rdi
callq 0xe8f0
movq 0x8(%rsp), %rdi
callq 0x2260
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: zlib_decompress(unsigned char**, unsigned long*, unsigned long, unsigned char const*, unsigned long, LodePNGDecompressSettings const*)
static unsigned zlib_decompress(unsigned char** out, size_t* outsize, size_t expected_size,
                                const unsigned char* in, size_t insize, const LodePNGDecompressSettings* settings) {
  unsigned error;
  if(settings->custom_zlib) {
    error = settings->custom_zlib(out, outsize, in, insize, settings);
    if(error) {
      /*the custom zlib is allowed to have its own error codes, however, we translate it to code 110*/
      error = 110;
      /*if there's a max output size, and the custom zlib returned error, then indicate that error instead*/
      if(settings->max_output_size && *outsize > settings->max_output_size) error = 109;
    }
  } else {
    ucvector v = ucvector_init(*out, *outsize);
    if(expected_size) {
      /*reserve the memory to avoid intermediate reallocations*/
      ucvector_resize(&v, *outsize + expected_size);
      v.size = *outsize;
    }
    error = lodepng_zlib_decompressv(&v, in, insize, settings);
    *out = v.data;
    *outsize = v.size;
  }
  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r14
movq %r8, %r12
movq %rcx, %r13
movq %rsi, %rbx
movq %rdi, %r15
movq 0x10(%r9), %rax
testq %rax, %rax
je 0xb73c
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r12, %rcx
movq %r14, %r8
callq *%rax
testl %eax, %eax
je 0xb78e
movq 0x8(%r14), %rax
testq %rax, %rax
je 0xb792
cmpq (%rbx), %rax
pushq $0x6e
popq %rax
sbbl $0x0, %eax
jmp 0xb795
movq (%r15), %rax
movq (%rbx), %rsi
movq %rax, (%rsp)
movq %rsi, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
testq %rdx, %rdx
je 0xb76a
addq %rdx, %rsi
movq %rsp, %rbp
movq %rbp, %rdi
callq 0xbda6
movq (%rbx), %rax
movq %rax, 0x8(%rbp)
movq %rsp, %rbp
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x4227
movq (%rbp), %rcx
movq %rcx, (%r15)
movq 0x8(%rbp), %rcx
movq %rcx, (%rbx)
jmp 0xb795
xorl %eax, %eax
jmp 0xb795
pushq $0x6e
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: lodepng::compress(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned char const*, unsigned long, LodePNGCompressSettings const&)
unsigned compress(std::vector<unsigned char>& out, const unsigned char* in, size_t insize,
                  const LodePNGCompressSettings& settings) {
  unsigned char* buffer = 0;
  size_t buffersize = 0;
  unsigned error = zlib_compress(&buffer, &buffersize, in, insize, &settings);
  if(buffer) {
    out.insert(out.end(), buffer, &buffer[buffersize]);
    lodepng_free(buffer);
  }
  return error;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r8
movq %rdx, %rcx
movq %rsi, %rdx
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
andq $0x0, (%r14)
movq %rsp, %rsi
andq $0x0, (%rsi)
movq %r14, %rdi
callq 0xb81a
movl %eax, %ebp
movq (%r14), %rdx
testq %rdx, %rdx
je 0xb80f
movq 0x8(%rbx), %rsi
movq (%rsp), %rcx
addq %rdx, %rcx
movq %rbx, %rdi
callq 0xe8f0
movq 0x8(%rsp), %rdi
callq 0x2260
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: lodepng_filesize(_IO_FILE*)
static long lodepng_filesize(FILE* file) {
  long size;
  if(fseek(file, 0, SEEK_END) != 0) return -1;
  size = ftell(file);
  /* It may give LONG_MAX as directory size, this is invalid for us. */
  if(size == LONG_MAX) return -1;
  if(fseek(file, 0, SEEK_SET) != 0) return -1;
  return size;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
pushq $0x2
popq %rdx
xorl %esi, %esi
callq 0x2240
pushq $-0x1
popq %rbx
testl %eax, %eax
jne 0xbd57
movq %r14, %rdi
callq 0x2030
movq %rax, %r15
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
cmpq %rax, %r15
je 0xbd57
xorl %ebx, %ebx
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2240
negl %eax
sbbq %rbx, %rbx
orq %r15, %rbx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: ensureBits9(LodePNGBitReader*, unsigned long)
static LODEPNG_INLINE void 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);
  } else {
    reader->buffer = 0;
    if(start + 0u < size) reader->buffer = reader->data[start + 0];
    reader->buffer >>= (reader->bp & 7u);
  }
  (void)nbits;
}

// Assembly:
movq 0x8(%rdi), %r8
movq 0x18(%rdi), %rcx
movq %rcx, %rsi
shrq $0x3, %rsi
leaq 0x1(%rsi), %rax
cmpq %r8, %rax
jae 0xbd88
movq (%rdi), %rax
movzwl (%rax,%rsi), %eax
addq $0x20, %rdi
movq %rdi, %rdx
jmp 0xbd9e
andl $0x0, 0x20(%rdi)
leaq 0x20(%rdi), %rdx
xorl %eax, %eax
cmpq %r8, %rsi
jae 0xbd9e
movq (%rdi), %rax
movzbl (%rax,%rsi), %eax
andb $0x7, %cl
shrl %cl, %eax
movl %eax, (%rdx)
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: ucvector_reserve(ucvector*, unsigned long)
static unsigned ucvector_reserve(ucvector* p, size_t size) {
  if(size > p->allocsize) {
    size_t newsize = size + (p->allocsize >> 1u);
    void* data = lodepng_realloc(p->data, newsize);
    if(data) {
      p->allocsize = newsize;
      p->data = (unsigned char*)data;
    }
    else return 0; /*error: not enough memory*/
  }
  return 1; /*success*/
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x10(%rdi), %r15
pushq $0x1
popq %rbx
cmpq %rsi, %r15
jae 0xbde1
movq %rdi, %r14
shrq %r15
addq %rsi, %r15
movq (%rdi), %rdi
movq %r15, %rsi
callq 0x2330
testq %rax, %rax
je 0xbddf
movq %r15, 0x10(%r14)
movq %rax, (%r14)
jmp 0xbde1
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: ensureBits32(LodePNGBitReader*, unsigned long)
static LODEPNG_INLINE void ensureBits32(LodePNGBitReader* reader, size_t nbits) {
  size_t start = reader->bp >> 3u;
  size_t size = reader->size;
  if(start + 4u < size) {
    reader->buffer = (unsigned)reader->data[start + 0] | ((unsigned)reader->data[start + 1] << 8u) |
                     ((unsigned)reader->data[start + 2] << 16u) | ((unsigned)reader->data[start + 3] << 24u);
    reader->buffer >>= (reader->bp & 7u);
    reader->buffer |= (((unsigned)reader->data[start + 4] << 24u) << (8u - (reader->bp & 7u)));
  } 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);
    if(start + 2u < size) reader->buffer |= ((unsigned)reader->data[start + 2] << 16u);
    if(start + 3u < size) reader->buffer |= ((unsigned)reader->data[start + 3] << 24u);
    reader->buffer >>= (reader->bp & 7u);
  }
  (void)nbits;
}

// Assembly:
movq 0x8(%rdi), %rsi
movq 0x18(%rdi), %rcx
movq %rcx, %rax
shrq $0x3, %rax
leaq 0x4(%rax), %rdx
cmpq %rsi, %rdx
jae 0xbe23
movq (%rdi), %rdx
movl (%rdx,%rax), %esi
andb $0x7, %cl
shrl %cl, %esi
movl %esi, 0x20(%rdi)
movzbl 0x4(%rdx,%rax), %edx
shll $0x18, %edx
movb $0x8, %al
subb %cl, %al
movl %eax, %ecx
shll %cl, %edx
orl %esi, %edx
jmp 0xbe88
andl $0x0, 0x20(%rdi)
xorl %edx, %edx
cmpq %rsi, %rax
jae 0xbe38
movq (%rdi), %rdx
movzbl (%rdx,%rax), %edx
movl %edx, 0x20(%rdi)
leaq 0x1(%rax), %r8
cmpq %rsi, %r8
jae 0xbe53
movq (%rdi), %r9
movzbl (%r9,%r8), %r8d
shll $0x8, %r8d
orl %r8d, %edx
movl %edx, 0x20(%rdi)
leaq 0x2(%rax), %r8
cmpq %rsi, %r8
jae 0xbe6e
movq (%rdi), %r9
movzbl (%r9,%r8), %r8d
shll $0x10, %r8d
orl %r8d, %edx
movl %edx, 0x20(%rdi)
addq $0x3, %rax
cmpq %rsi, %rax
jae 0xbe83
movq (%rdi), %rsi
movzbl (%rsi,%rax), %eax
shll $0x18, %eax
orl %eax, %edx
andb $0x7, %cl
shrl %cl, %edx
movl %edx, 0x20(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/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 {
    advanceBits(reader, FIRSTBITS);
    value += peekBits(reader, l - FIRSTBITS);
    advanceBits(reader, codetree->table_len[value] - FIRSTBITS);
    return codetree->table_value[value];
  }
}

// Assembly:
movl 0x20(%rdi), %eax
movl %eax, %r9d
andl $0x1ff, %r9d            # imm = 0x1FF
movq 0x18(%rsi), %r8
movq 0x20(%rsi), %rdx
movzbl (%r8,%r9), %ecx
movl %r9d, %esi
movzwl (%rdx,%rsi,2), %esi
cmpq $0x9, %rcx
ja 0xbebe
shrl %cl, %eax
movl %eax, 0x20(%rdi)
addq %rcx, 0x18(%rdi)
jmp 0xbf0b
shrl $0x9, %eax
movl %eax, 0x20(%rdi)
movq 0x18(%rdi), %r9
leaq 0x9(%r9), %r10
movq %r10, 0x18(%rdi)
addb $-0x9, %cl
pushq $-0x1
popq %r10
shll %cl, %r10d
notl %r10d
andl %eax, %r10d
addl %r10d, %esi
movzwl %si, %esi
movzbl (%r8,%rsi), %r8d
movl $0xfffffff7, %ecx       # imm = 0xFFFFFFF7
addq %r8, %rcx
movl %ecx, %r8d
shrl %cl, %eax
movl %eax, 0x20(%rdi)
leaq (%r8,%r9), %rax
addq $0x9, %rax
movq %rax, 0x18(%rdi)
movzwl (%rdx,%rsi,2), %esi
movzwl %si, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/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, tree_ll->codes[val], tree_ll->lengths[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, tree_d->codes[distance_code], tree_d->lengths[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)
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
xorl %ebx, %ebx
cmpq 0x8(%r15), %rbx
je 0xcb1c
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 0xcb44
cmpq $0x101, %r13            # imm = 0x101
jb 0xcb14
addl $0xfffffeff, %r13d      # imm = 0xFFFFFEFF
leaq 0x5185d(%rip), %rax     # 0x5e310
movl (%rax,%r13,4), %edx
movq (%r15), %rax
movl 0x4(%rax,%rbx,4), %esi
movq %r14, %r13
movl 0x8(%rax,%rbx,4), %r14d
leaq 0x51943(%rip), %rcx     # 0x5e410
movl (%rcx,%r14,4), %ecx
movq %rcx, 0x10(%rsp)
movl 0xc(%rax,%rbx,4), %ebp
addq $0x3, %rbx
movq %r12, %rdi
callq 0xc4ae
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 0xcb44
movq %r12, %rdi
movl %ebp, %esi
movq 0x10(%rsp), %rdx
callq 0xc4ae
incq %rbx
jmp 0xca74
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: uivector_resize(uivector*, unsigned long)
static unsigned uivector_resize(uivector* p, size_t size) {
  size_t allocsize = size * sizeof(unsigned);
  if(allocsize > p->allocsize) {
    size_t newsize = allocsize + (p->allocsize >> 1u);
    void* data = lodepng_realloc(p->data, newsize);
    if(data) {
      p->allocsize = newsize;
      p->data = (unsigned*)data;
    }
    else return 0; /*error: not enough memory*/
  }
  p->size = size;
  return 1; /*success*/
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq (,%rsi,4), %rax
movq 0x10(%rdi), %r15
cmpq %r15, %rax
jbe 0xccdb
shrq %r15
addq %rax, %r15
movq (%r14), %rdi
movq %r15, %rsi
callq 0x2330
testq %rax, %rax
je 0xcce8
movq %r15, 0x10(%r14)
movq %rax, (%r14)
movq %rbx, 0x8(%r14)
pushq $0x1
popq %rax
popq %rbx
popq %r14
popq %r15
retq
xorl %eax, %eax
jmp 0xcce2
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: HuffmanTree_makeFromFrequencies(HuffmanTree*, unsigned int const*, unsigned long, unsigned long, unsigned int)
static unsigned HuffmanTree_makeFromFrequencies(HuffmanTree* tree, const unsigned* frequencies,
                                                size_t mincodes, size_t numcodes, unsigned maxbitlen) {
  unsigned error = 0;
  while(!frequencies[numcodes - 1] && numcodes > mincodes) --numcodes; /*trim zeroes*/
  tree->lengths = (unsigned*)lodepng_malloc(numcodes * sizeof(unsigned));
  if(!tree->lengths) return 83; /*alloc fail*/
  tree->maxbitlen = maxbitlen;
  tree->numcodes = (unsigned)numcodes; /*number of symbols*/

  error = lodepng_huffman_code_lengths(tree->lengths, frequencies, numcodes, maxbitlen);
  if(!error) error = HuffmanTree_makeFromLengths2(tree);
  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r8d, %ebp
movq %rcx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4(,%rcx,4), %rcx
pushq $0x1
popq %r12
xorl %eax, %eax
leaq (%r15,%rax), %rsi
leaq -0x4(%rcx), %rdi
decq %r12
cmpq %rdx, %rsi
jbe 0xcd69
decq %rax
cmpl $0x0, -0x8(%r14,%rcx)
movq %rdi, %rcx
je 0xcd4b
callq 0x2280
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0xcda6
leaq (%r15,%r12), %rdx
movl %ebp, 0x10(%rbx)
addl %r12d, %r15d
movl %r15d, 0x14(%rbx)
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %ecx
callq 0x2614
testl %eax, %eax
jne 0xcda9
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xc10f
pushq $0x53
popq %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: lodepng_chunk_init(unsigned char**, ucvector*, unsigned long, char const*)
static unsigned lodepng_chunk_init(unsigned char** chunk,
                                   ucvector* out,
                                   size_t length, const char* type) {
  size_t new_length = out->size;
  if(lodepng_addofl(new_length, length, &new_length)) return 77;
  if(lodepng_addofl(new_length, 12, &new_length)) return 77;
  if(!ucvector_resize(out, new_length)) return 83; /*alloc fail*/
  *chunk = out->data + new_length - length - 12u;

  /*1: length*/
  lodepng_set32bitInt(*chunk, (unsigned)length);

  /*2: chunk name (4 letters)*/
  lodepng_memcpy(*chunk + 4, type, 4);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x8(%rsi), %rbp
pushq $0x4d
popq %rax
addq %rdx, %rbp
jb 0xce24
subq $-0xc, %rbp
jae 0xce24
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r15
movq %rsi, %rdi
movq %rbp, %rsi
callq 0xbda6
testl %eax, %eax
je 0xce21
addq (%r12), %rbp
subq %rbx, %rbp
leaq -0xc(%rbp), %rax
movq %rax, (%r15)
movl %ebx, %eax
shrl $0x18, %eax
movb %al, -0xc(%rbp)
movl %ebx, %eax
shrl $0x10, %eax
movb %al, -0xb(%rbp)
movb %bh, -0xa(%rbp)
movb %bl, -0x9(%rbp)
movq (%r15), %rdi
addq $0x4, %rdi
pushq $0x4
popq %rdx
movq %r14, %rsi
callq 0x4a08
xorl %eax, %eax
jmp 0xce24
pushq $0x53
popq %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: alloc_string_sized(char const*, unsigned long)
static char* alloc_string_sized(const char* in, size_t insize) {
  char* out = (char*)lodepng_malloc(insize + 1);
  if(out) {
    lodepng_memcpy(out, in, insize);
    out[insize] = 0;
  }
  return out;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x1(%rsi), %rdi
callq 0x2280
movq %rax, %r14
testq %rax, %rax
je 0xce5c
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x4a08
movb $0x0, (%r14,%rbx)
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng.cpp
// Function: paethPredictor(unsigned char, unsigned char, unsigned char)
static unsigned char paethPredictor(unsigned char a, unsigned char b, unsigned char c) {
  /* the subtractions of unsigned char cast it to a signed type.
  With gcc, short is faster than int, with clang int is as fast (as of april 2023)*/
  short pa = (b - c) < 0 ? -(b - c) : (b - c);
  short pb = (a - c) < 0 ? -(a - c) : (a - c);
  /* writing it out like this compiles to something faster than introducing a temp variable*/
  short pc = (a + b - c - c) < 0 ? -(a + b - c - c) : (a + b - c - c);
  /* return input value associated with smallest of pa, pb, pc (with certain priority if equal) */
  if(pb < pa) { a = b; pa = pb; }
  return (pc < pa) ? c : a;
}

// Assembly:
movl %edi, %eax
movl %esi, %ecx
subl %edx, %ecx
movl %ecx, %edi
negl %edi
cmovsl %ecx, %edi
movl %eax, %ecx
subl %edx, %ecx
movl %ecx, %r8d
negl %r8d
cmovsl %ecx, %r8d
leal (%rsi,%rax), %ecx
subl %edx, %ecx
subl %edx, %ecx
movl %ecx, %r9d
negl %r9d
cmovsl %ecx, %r9d
cmpl %edi, %r8d
cmovael %edi, %r8d
cmovbl %esi, %eax
cmpl %r8d, %r9d
cmovbl %edx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_util.cpp
// Function: lodepng::getPNGHeaderInfo(std::vector<unsigned char, std::allocator<unsigned char>> const&)
LodePNGInfo getPNGHeaderInfo(const std::vector<unsigned char>& png) {
  unsigned w, h;
  lodepng::State state;
  lodepng_inspect(&w, &h, &state, png.empty() ? NULL : &png[0], png.size());
  return state.info_png;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x290, %rsp            # imm = 0x290
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0xb84c
movq (%r14), %rax
movq 0x8(%r14), %r8
xorl %ecx, %ecx
subq %rax, %r8
cmovneq %rax, %rcx
leaq 0xc(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq %r15, %rdx
callq 0x6f45
leaq 0xe0(%rsp), %rsi
movl $0x1a8, %edx            # imm = 0x1A8
movq %rbx, %rdi
callq 0x21a0
leaq 0x10(%rsp), %rdi
callq 0xb874
movq %rbx, %rax
addq $0x290, %rsp            # imm = 0x290
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xb874
movq %rbx, %rdi
callq 0x2380
movq %rax, %rdi
callq 0xe6cc
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_util.cpp
// Function: lodepng::getChunkInfo(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, std::vector<unsigned long, std::allocator<unsigned long>>&, std::vector<unsigned char, std::allocator<unsigned char>> const&)
unsigned getChunkInfo(std::vector<std::string>& names, std::vector<size_t>& sizes,
                      const std::vector<unsigned char>& png) {
  // Listing chunks is based on the original file, not the decoded png info.
  const unsigned char *chunk, *end;
  end = &png.back() + 1;
  chunk = &png.front() + 8;

  while(chunk < end && end - chunk >= 8) {
    char type[5];
    lodepng_chunk_type(type, chunk);
    if(std::string(type).size() != 4) return 1;

    unsigned length = lodepng_chunk_length(chunk);
    names.push_back(type);
    sizes.push_back(length);
    chunk = lodepng_chunk_next_const(chunk, end);
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, 0x10(%rsp)
movq %rdi, 0x18(%rsp)
movq (%rdx), %r12
movq 0x8(%rdx), %r15
addq $0x8, %r12
leaq 0x23(%rsp), %r13
leaq 0x28(%rsp), %rbp
leaq 0xf(%rsp), %rbx
xorl %eax, %eax
movq %r15, %rcx
subq %r12, %rcx
jbe 0xebe8
cmpq $0x8, %rcx
jl 0xebe8
movq %r13, %rdi
movq %r12, %rsi
callq 0x4574
movq %rbp, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x20c0
movq 0x30(%rsp), %r14
movq %rbp, %rdi
callq 0x2270
cmpq $0x4, %r14
jne 0xebe5
movq %r12, %rdi
callq 0x456d
movl %eax, %r14d
movq %rbp, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x20c0
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0x12164
movq %rbp, %rdi
callq 0x2270
movl %r14d, %eax
movq %rax, 0x28(%rsp)
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0x12190
movq %r12, %rdi
movq %r15, %rsi
callq 0x4705
movq %rax, %r12
jmp 0xeb4b
pushq $0x1
popq %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2270
movq %rbx, %rdi
callq 0x2380
movq %rax, %rdi
callq 0xe6cc
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_util.cpp
// Function: lodepng::getFilterTypes(std::vector<unsigned char, std::allocator<unsigned char>>&, std::vector<unsigned char, std::allocator<unsigned char>> const&)
unsigned getFilterTypes(std::vector<unsigned char>& filterTypes, const std::vector<unsigned char>& png) {
  std::vector<std::vector<unsigned char> > passes;
  unsigned error = getFilterTypesInterlaced(passes, png);
  if(error) return error;

  if(passes.size() == 1) {
    filterTypes.swap(passes[0]);
  } else {
    // Simplify interlaced filter types to get a single filter value per scanline:
    // put pass 6 and 7 alternating in the one vector, these filters
    // correspond to the closest to what it would be for non-interlaced
    // image. If the image is only 1 pixel wide, pass 6 doesn't exist so the
    // alternative values column0 are used. The shift values are to match
    // the y position in the interlaced sub-images.
    // NOTE: the values 0-6 match Adam7's passes 1-7.
    const unsigned column0[8] = {0, 6, 4, 6, 2, 6, 4, 6};
    const unsigned column1[8] = {5, 6, 5, 6, 5, 6, 5, 6};
    const unsigned shift0[8] = {3, 1, 2, 1, 3, 1, 2, 1};
    const unsigned shift1[8] = {1, 1, 1, 1, 1, 1, 1, 1};
    lodepng::State state;
    unsigned w, h;
    lodepng_inspect(&w, &h, &state, png.empty() ? NULL : &png[0], png.size());
    const unsigned* column = w > 1 ? column1 : column0;
    const unsigned* shift = w > 1 ? shift1 : shift0;
    for(size_t i = 0; i < h; i++) {
      filterTypes.push_back(passes[column[i & 7u]][i >> shift[i & 7u]]);
    }
  }
  return 0; /* OK */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x2b0, %rsp            # imm = 0x2B0
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
callq 0xf0aa
movl %eax, %ebp
testl %eax, %eax
jne 0xf58e
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rax
subq %rsi, %rax
cmpq $0x18, %rax
jne 0xf4ee
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x13262
jmp 0xf58e
leaq 0x30(%rsp), %rdi
callq 0xb84c
movq (%r14), %rax
movq 0x8(%r14), %r8
xorl %ecx, %ecx
subq %rax, %r8
cmovneq %rax, %rcx
leaq 0xc(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x6f45
cmpl $0x2, 0xc(%rsp)
leaq 0x50a88(%rip), %rax     # 0x5ffb0
leaq 0x50a61(%rip), %r14     # 0x5ff90
cmovaeq %rax, %r14
leaq 0x50ab6(%rip), %rax     # 0x5fff0
leaq 0x50a8f(%rip), %r15     # 0x5ffd0
cmovaeq %rax, %r15
xorl %r12d, %r12d
movl 0x8(%rsp), %eax
cmpq %rax, %r12
jae 0xf582
movl %r12d, %eax
andl $0x7, %eax
shll $0x2, %eax
movl (%r14,%rax), %edx
movb (%r15,%rax), %cl
movq %r12, %rsi
shrq %cl, %rsi
movq 0x10(%rsp), %rax
imulq $0x18, %rdx, %rcx
addq (%rax,%rcx), %rsi
movq %rbx, %rdi
callq 0x1231e
incq %r12
jmp 0xf548
leaq 0x30(%rsp), %rdi
callq 0xb874
xorl %ebp, %ebp
leaq 0x10(%rsp), %rdi
callq 0x12338
movl %ebp, %eax
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0xf5b3
jmp 0xf5ae
movq %rax, %rbx
jmp 0xf5c0
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xb874
leaq 0x10(%rsp), %rdi
callq 0x12338
movq %rbx, %rdi
callq 0x2380
movq %rax, %rdi
callq 0xe6cc
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_util.cpp
// Function: lodepng::getPaletteValue(unsigned char const*, unsigned long, int)
int getPaletteValue(const unsigned char* data, size_t i, int bits) {
  if(bits == 8) return data[i];
  else if(bits == 4) return (data[i / 2] >> ((i % 2) * 4)) & 15;
  else if(bits == 2) return (data[i / 4] >> ((i % 4) * 2)) & 3;
  else if(bits == 1) return (data[i / 8] >> (i % 8)) & 1;
  else return 0;
}

// Assembly:
xorl %eax, %eax
decl %edx
cmpl $0x7, %edx
ja 0xf609
leaq 0x50636(%rip), %rcx     # 0x5fc20
movslq (%rcx,%rdx,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
movq %rsi, %rax
shrq $0x3, %rax
movzbl (%rdi,%rax), %ecx
andl $0x7, %esi
xorl %eax, %eax
btl %esi, %ecx
setb %al
retq
movq %rsi, %rax
shrq %rax
movzbl (%rdi,%rax), %eax
shll $0x2, %esi
andb $0x4, %sil
movl %esi, %ecx
shrl %cl, %eax
andl $0xf, %eax
retq
movq %rsi, %rax
shrq $0x2, %rax
movzbl (%rdi,%rax), %eax
addl %esi, %esi
andb $0x6, %sil
movl %esi, %ecx
shrl %cl, %eax
andl $0x3, %eax
retq
movzbl (%rdi,%rsi), %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_util.cpp
// Function: lodepng::validateICC(lodepng::LodePNGICC const*)
static unsigned validateICC(const LodePNGICC* icc) {
  /* disable for unsupported things in the icc profile */
  if(icc->inputspace == 0) return 0;
  /* if we didn't recognize both chrm and trc, then maybe the ICC uses data
  types not supported here yet, so fall back to not using it. */
  if(icc->inputspace == 2) {
    /* RGB profile should have chromaticities */
    if(!icc->has_chromaticity) return 0;
  }
  /* An ICC profile without whitepoint is invalid for the kind of profiles used here. */
  if(!icc->has_whitepoint) return 0;
  if(!icc->has_trc) return 0;
  return 1; /* ok */
}

// Assembly:
movl (%rdi), %eax
testl %eax, %eax
je 0x100e4
cmpl $0x2, %eax
jne 0x100d5
cmpl $0x0, 0x54(%rdi)
je 0x100e5
cmpl $0x0, 0x44(%rdi)
je 0x100e5
xorl %eax, %eax
cmpl $0x0, 0x7c(%rdi)
setne %al
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_util.cpp
// Function: lodepng::convertToXYZ_gamma_table(float*, unsigned long, unsigned long, LodePNGInfo const*, unsigned int, lodepng::LodePNGICC const*)
static void convertToXYZ_gamma_table(float* out, size_t n, size_t c,
                                     const LodePNGInfo* info, unsigned use_icc, const LodePNGICC* icc) {
  size_t i;
  float mul = 1.0f / (n - 1);
  if(use_icc) {
    for(i = 0; i < n; i++) {
      float v = i * mul;
      out[i] = iccForwardTRC(&icc->trc[c], v);
    }
  } else if(info->gama_defined && !info->srgb_defined) {
    /* no power needed if gamma is 1 */
    if(info->gama_gamma == 100000) {
      for(i = 0; i < n; i++) {
        out[i] = i * mul;
      }
    } else {
      float gamma = 100000.0f / info->gama_gamma;
      for(i = 0; i < n; i++) {
        float v = i * mul;
        out[i] = lodepng_powf(v, gamma);
      }
    }
  } else {
    for(i = 0; i < n; i++) {
      /* sRGB gamma expand */
      float v = i * mul;
      out[i] = (v < 0.04045f) ? (v / 12.92f) : lodepng_powf((v + 0.055f) / 1.055f, 2.4f);
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq -0x1(%rsi), %rax
cvtsi2ss %rax, %xmm0
movq %rdi, %r14
movss 0x4fc89(%rip), %xmm1    # 0x5fd90
divss %xmm0, %xmm1
movss %xmm1, (%rsp)
testl %r8d, %r8d
je 0x1014d
imulq $0x38, %rdx, %rax
leaq (%r9,%rax), %r15
addq $0x80, %r15
xorl %r12d, %r12d
cmpq %r12, %rbx
je 0x10226
cvtsi2ss %r12, %xmm0
mulss (%rsp), %xmm0
movq %r15, %rdi
callq 0x11151
movss %xmm0, (%r14,%r12,4)
incq %r12
jmp 0x10127
cmpl $0x0, 0xc8(%rcx)
je 0x1015f
cmpl $0x0, 0xf4(%rcx)
je 0x101bc
xorl %r15d, %r15d
movss 0x4fc2e(%rip), %xmm1    # 0x5fd98
cmpq %r15, %rbx
je 0x10226
cvtsi2ss %r15, %xmm0
mulss (%rsp), %xmm0
ucomiss %xmm0, %xmm1
jbe 0x1018c
divss 0x4fc1e(%rip), %xmm0    # 0x5fda8
jmp 0x101b1
addss 0x4fc08(%rip), %xmm0    # 0x5fd9c
divss 0x4fc04(%rip), %xmm0    # 0x5fda0
movss 0x4fc00(%rip), %xmm1    # 0x5fda4
callq 0x11328
movss 0x4fbe7(%rip), %xmm1    # 0x5fd98
movss %xmm0, (%r14,%r15,4)
incq %r15
jmp 0x1016a
movl 0xcc(%rcx), %eax
cmpl $0x186a0, %eax          # imm = 0x186A0
jne 0x101e5
xorl %eax, %eax
cmpq %rax, %rbx
je 0x10226
cvtsi2ss %rax, %xmm0
mulss (%rsp), %xmm0
movss %xmm0, (%r14,%rax,4)
incq %rax
jmp 0x101cb
movl %eax, %eax
cvtsi2ss %rax, %xmm0
movss 0x4fba0(%rip), %xmm1    # 0x5fd94
divss %xmm0, %xmm1
movss %xmm1, 0x4(%rsp)
xorl %r15d, %r15d
cmpq %r15, %rbx
je 0x10226
cvtsi2ss %r15, %xmm0
mulss (%rsp), %xmm0
movss 0x4(%rsp), %xmm1
callq 0x11328
movss %xmm0, (%r14,%r15,4)
incq %r15
jmp 0x10201
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_util.cpp
// Function: lodepng::convertToXYZ_chrm(float*, unsigned int, unsigned int, LodePNGInfo const*, unsigned int, lodepng::LodePNGICC const*, float*)
static unsigned convertToXYZ_chrm(float* im, unsigned w, unsigned h,
                                  const LodePNGInfo* info, unsigned use_icc, const LodePNGICC* icc,
                                  float whitepoint[3]) {
  unsigned error = 0;
  size_t i, n;
  float m[9]; /* XYZ to linear RGB matrix */
  if(lodepng_mulofl((size_t)w, (size_t)h, &n)) return 92;

  /* Must be called even for grayscale, to get the correct whitepoint to output */
  error = getChrm(m, whitepoint, use_icc, icc, info);
  if(error) return error;

  /* Note: no whitepoint adaptation done to m here, because we only do the
  adaptation in convertFromXYZ (we only whitepoint adapt when going to the
  target RGB space, but here we're going from the source RGB space to XYZ) */

  /* Apply the above computed linear-RGB-to-XYZ matrix to the pixels.
  Skip the transform if it's the unit matrix (which is the case if grayscale profile) */
  if(!use_icc || icc->inputspace == 2) {
    for(i = 0; i < n; i++) {
      size_t j = i * 4;
      mulMatrix(&im[j + 0], &im[j + 1], &im[j + 2], m, im[j + 0], im[j + 1], im[j + 2]);
    }
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %r9, %r14
movl %r8d, %r12d
movq %rcx, %r8
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %rbx
movq 0x60(%rsp), %rsi
movq %rsp, %rdi
movl %r12d, %edx
movq %r9, %rcx
callq 0x1170d
testl %eax, %eax
je 0x1026b
pushq $0x1
popq %rax
jmp 0x102b6
testl %r12d, %r12d
je 0x10276
cmpl $0x2, (%r14)
jne 0x102b4
movl %r15d, %eax
movl %ebp, %r15d
imulq %rax, %r15
addq $0x8, %rbx
movq %rsp, %r14
subq $0x1, %r15
jb 0x102b4
leaq -0x8(%rbx), %rdi
leaq -0x4(%rbx), %rsi
cvtss2sd -0x8(%rbx), %xmm0
cvtss2sd -0x4(%rbx), %xmm1
cvtss2sd (%rbx), %xmm2
movq %rbx, %rdx
movq %r14, %rcx
callq 0x11b49
addq $0x10, %rbx
jmp 0x10287
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_util.cpp
// Function: lodepng::convertFromXYZFloat(float*, float const*, unsigned int, unsigned int, LodePNGState const*, float const*, unsigned int)
unsigned convertFromXYZFloat(float* out, const float* in, unsigned w, unsigned h,
                             const LodePNGState* state,
                             const float whitepoint[3], unsigned rendering_intent) {
  unsigned error = 0;
  const LodePNGInfo* info = &state->info_png;

  /* parse ICC if present */
  unsigned use_icc = 0;
  LodePNGICC icc;
  lodepng_icc_init(&icc);
  if(info->iccp_defined) {
    error = parseICC(&icc, info->iccp_profile, info->iccp_profile_size);
    if(error) goto cleanup; /* corrupted ICC profile */
    use_icc = validateICC(&icc);
  }

  /* Handle gamut */
  error = convertFromXYZ_chrm(out, in, w, h, info, use_icc, &icc, whitepoint, rendering_intent);
  if(error) goto cleanup;

  /* Handle transfer function */
  error = convertFromXYZ_gamma(out, w, h, info, use_icc, &icc);
  if(error) goto cleanup;

cleanup:
  lodepng_icc_cleanup(&icc);
  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %r9, %r11
movq %r8, %rbx
movl %ecx, %r14d
movl %edx, %r12d
movq %rsi, %r13
movq %rdi, %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x98(%rsp)
movups %xmm0, 0xd0(%rsp)
movups %xmm0, 0x108(%rsp)
cmpl $0x0, 0x1cc(%r8)
je 0x10d19
movq %r11, 0x8(%rsp)
movq 0x1d8(%rbx), %rsi
movl 0x1e0(%rbx), %edx
leaq 0x10(%rsp), %rdi
callq 0xf9f5
testl %eax, %eax
je 0x10d1d
pushq $0x1
popq %r12
jmp 0x10d8b
xorl %ebp, %ebp
jmp 0x10d2e
leaq 0x10(%rsp), %rdi
callq 0x100c4
movl %eax, %ebp
movq 0x8(%rsp), %r11
movl 0x170(%rsp), %eax
addq $0xd0, %rbx
subq $0x8, %rsp
leaq 0x18(%rsp), %r10
movq %r15, %rdi
movq %r13, %rsi
movl %r12d, %r13d
movl %r12d, %edx
movl %r14d, %ecx
movq %rbx, %r8
movl %ebp, %r9d
pushq %rax
pushq %r11
pushq %r10
callq 0x1083c
addq $0x20, %rsp
movl %eax, %r12d
testl %eax, %eax
jne 0x10d8b
leaq 0x10(%rsp), %r9
movq %r15, %rdi
movl %r13d, %esi
movl %r14d, %edx
movq %rbx, %rcx
movl %ebp, %r8d
callq 0x109a1
movl %eax, %r12d
leaq 0x10(%rsp), %rdi
callq 0xf66b
movl %r12d, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_util.cpp
// Function: lodepng::convertToSrgb(unsigned char*, unsigned char const*, unsigned int, unsigned int, LodePNGState const*)
unsigned convertToSrgb(unsigned char* out, const unsigned char* in,
                       unsigned w, unsigned h,
                       const LodePNGState* state_in) {
  LodePNGState srgb;
  lodepng_state_init(&srgb);
  lodepng_color_mode_copy(&srgb.info_raw, &state_in->info_raw);
  return convertRGBModel(out, in, w, h, &srgb, state_in, 1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %r8, %rbx
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %r12
leaq 0x8(%rsp), %r13
movq %r13, %rdi
callq 0x904f
movl $0xa8, %esi
leaq (%rsi,%r13), %rdi
addq %rbx, %rsi
callq 0x49a4
movl $0x1, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
movq %r13, %r8
movq %rbx, %r9
callq 0x10daa
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_util.cpp
// Function: lodepng::convertFromSrgb(unsigned char*, unsigned char const*, unsigned int, unsigned int, LodePNGState const*)
unsigned convertFromSrgb(unsigned char* out, const unsigned char* in,
                         unsigned w, unsigned h,
                         const LodePNGState* state_out) {
  LodePNGState srgb;
  lodepng_state_init(&srgb);
  lodepng_color_mode_copy(&srgb.info_raw, &state_out->info_raw);
  return convertRGBModel(out, in, w, h, state_out, &srgb, 1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %r8, %rbx
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %r12
leaq 0x8(%rsp), %r13
movq %r13, %rdi
callq 0x904f
movl $0xa8, %esi
leaq (%rsi,%r13), %rdi
addq %rbx, %rsi
callq 0x49a4
movl $0x1, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
movq %rbx, %r8
movq %r13, %r9
callq 0x10daa
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_util.cpp
// Function: lodepng::decodeICC15Fixed16(unsigned char const*, unsigned long, unsigned long*)
static int decodeICCInt32(const unsigned char* data, size_t size, size_t* pos) {
  *pos += 4;
  if (*pos > size) return 0;
  /*TODO: this is incorrect if sizeof(int) != 4*/
  return (data[*pos - 4] << 24) | (data[*pos - 3] << 16) | (data[*pos - 2] << 8) | (data[*pos - 1] << 0);
}

// Assembly:
movq (%rdx), %rax
leaq 0x4(%rax), %rcx
movq %rcx, (%rdx)
xorps %xmm0, %xmm0
cmpq %rsi, %rcx
ja 0x11119
movl (%rdi,%rax), %eax
bswapl %eax
cvtsi2ss %eax, %xmm0
mulss 0x4ecab(%rip), %xmm0    # 0x5fdc4
retq
// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]lodepng/lodepng_util.cpp
// Function: lodepng::isICCword(unsigned char const*, unsigned long, unsigned long, char const*)
static unsigned isICCword(const unsigned char* data, size_t size, size_t pos, const char* word) {
  if(pos + 4 > size) return 0;
  return data[pos + 0] == (unsigned char)word[0] &&
         data[pos + 1] == (unsigned char)word[1] &&
         data[pos + 2] == (unsigned char)word[2] &&
         data[pos + 3] == (unsigned char)word[3];
}

// Assembly:
leaq 0x4(%rdx), %r8
xorl %eax, %eax
cmpq %rsi, %r8
ja 0x11150
movb (%rdi,%rdx), %sil
cmpb (%rcx), %sil
jne 0x11150
movb 0x1(%rdi,%rdx), %sil
cmpb 0x1(%rcx), %sil
jne 0x11150
movb 0x2(%rdi,%rdx), %sil
cmpb 0x2(%rcx), %sil
jne 0x11150
movb 0x3(%rdi,%rdx), %dl
xorl %eax, %eax
cmpb 0x3(%rcx), %dl
sete %al
retq