LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/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) + length + 12;
  if(new_length < length + 12 || new_length < (*outlength)) return 77; /*integer overflow happened*/
  new_buffer = (unsigned char*)myrealloc(*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] = type[0];
  chunk[5] = type[1];
  chunk[6] = type[2];
  chunk[7] = 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
movq %rcx, %r14
movl %edx, %r13d
leaq 0xc(%r13), %rbp
addq (%rsi), %rbp
setb %al
leal 0xc(%rdx), %ecx
cmpq %rcx, %rbp
setb %cl
orb %al, %cl
movl $0x4d, %eax
jne 0x586a
movq %r8, %rbx
movq %rsi, %r15
movq %rdi, %r12
movq %rdx, (%rsp)
movq (%rdi), %rdi
movq %rbp, %rsi
callq 0x2320
testq %rax, %rax
je 0x5865
movq %rax, (%r12)
movq %rbp, (%r15)
subq %r13, %rbp
leaq (%rax,%rbp), %rdi
addq $-0xc, %rdi
movq (%rsp), %rdx
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)
movb (%r14), %cl
movb %cl, -0x8(%rax,%rbp)
movb 0x1(%r14), %cl
movb %cl, -0x7(%rax,%rbp)
movb 0x2(%r14), %cl
movb %cl, -0x6(%rax,%rbp)
movb 0x3(%r14), %cl
movb %cl, -0x5(%rax,%rbp)
testl %edx, %edx
je 0x585c
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 0x5843
callq 0x5694
xorl %eax, %eax
jmp 0x586a
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_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: lodepng_color_mode_copy(LodePNGColorMode*, LodePNGColorMode const*)
unsigned lodepng_color_mode_copy(LodePNGColorMode* dest, const LodePNGColorMode* source)
{
  size_t i;
  lodepng_color_mode_cleanup(dest);
  *dest = *source;
  if(source->palette)
  {
    dest->palette = (unsigned char*)mymalloc(source->palettesize * 4);
    if(!dest->palette && source->palettesize) return 83; /*alloc fail*/
    for(i = 0; i < source->palettesize * 4; i++) dest->palette[i] = source->palette[i];
  }
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x58e3
callq 0x2220
movq $0x0, 0x10(%r14)
movq 0x20(%rbx), %rax
movq %rax, 0x20(%r14)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups %xmm1, 0x10(%r14)
movups %xmm0, (%r14)
xorl %eax, %eax
cmpq $0x0, 0x8(%rbx)
je 0x596a
movq 0x10(%rbx), %r15
leaq (,%r15,4), %rdi
callq 0x2270
movq %rax, 0x8(%r14)
testq %rax, %rax
sete %cl
testq %r15, %r15
setne %dl
movl $0x53, %eax
testb %cl, %dl
jne 0x596a
movq 0x10(%rbx), %rcx
shlq $0x2, %rcx
movl $0x0, %eax
testq %rcx, %rcx
je 0x596a
xorl %eax, %eax
xorl %ecx, %ecx
movq 0x8(%rbx), %rdx
movb (%rdx,%rcx), %dl
movq 0x8(%r14), %rsi
movb %dl, (%rsi,%rcx)
incq %rcx
movq 0x10(%rbx), %rdx
shlq $0x2, %rdx
cmpq %rdx, %rcx
jb 0x594c
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/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)
{
  unsigned char* data;
  /*the same resize technique as C++ std::vectors is used, and here it's made so that for a palette with
  the max of 256 colors, it'll have the exact alloc size*/
  if(!(info->palettesize & (info->palettesize - 1))) /*if palettesize is 0 or a power of two*/
  {
    /*allocated data must be at least 4* palettesize (for 4 color bytes)*/
    size_t alloc_size = info->palettesize == 0 ? 4 : info->palettesize * 4 * 2;
    data = (unsigned char*)myrealloc(info->palette, alloc_size);
    if(!data) return 83; /*alloc fail*/
    else info->palette = data;
  }
  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 0x10(%rdi), %rax
leaq -0x1(%rax), %rcx
testq %rcx, %rax
jne 0x59b9
leaq (,%rax,8), %rcx
testq %rax, %rax
movl $0x4, %esi
cmovneq %rcx, %rsi
movq 0x8(%r14), %rdi
callq 0x2320
testq %rax, %rax
je 0x59fa
movq %rax, 0x8(%r14)
movq 0x8(%r14), %rax
movq 0x10(%r14), %rcx
movb %r12b, (%rax,%rcx,4)
movq 0x8(%r14), %rax
movq 0x10(%r14), %rcx
movb %r15b, 0x1(%rax,%rcx,4)
movq 0x8(%r14), %rax
movq 0x10(%r14), %rcx
movb %bpl, 0x2(%rax,%rcx,4)
movq 0x8(%r14), %rax
movq 0x10(%r14), %rcx
movb %bl, 0x3(%rax,%rcx,4)
incq 0x10(%r14)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x53, %eax
jmp 0x59f1
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: LodePNGText_cleanup(LodePNGInfo*)
static void LodePNGText_cleanup(LodePNGInfo* info)
{
  size_t i;
  for(i = 0; i < info->text_num; i++)
  {
    string_cleanup(&info->text_keys[i]);
    string_cleanup(&info->text_strings[i]);
  }
  myfree(info->text_keys);
  myfree(info->text_strings);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, 0x48(%rdi)
je 0x5b3b
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x50(%rbx), %r12
movq (%r12,%r15,8), %rdi
callq 0x2220
movq %r14, (%r12,%r15,8)
movq 0x58(%rbx), %r12
movq (%r12,%r15,8), %rdi
callq 0x2220
movq %r14, (%r12,%r15,8)
incq %r15
cmpq 0x48(%rbx), %r15
jb 0x5b10
movq 0x50(%rbx), %rdi
callq 0x2220
movq 0x58(%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2220
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/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**)(myrealloc(info->text_keys, sizeof(char*) * (info->text_num + 1)));
  char** new_strings = (char**)(myrealloc(info->text_strings, sizeof(char*) * (info->text_num + 1)));
  if(!new_keys || !new_strings)
  {
    myfree(new_keys);
    myfree(new_strings);
    return 83; /*alloc fail*/
  }

  info->text_num++;
  info->text_keys = new_keys;
  info->text_strings = new_strings;

  string_init(&info->text_keys[info->text_num - 1]);
  string_set(&info->text_keys[info->text_num - 1], key);

  string_init(&info->text_strings[info->text_num - 1]);
  string_set(&info->text_strings[info->text_num - 1], str);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq 0x48(%rdi), %rax
movq 0x50(%rdi), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x2320
movq %rax, %r12
movq 0x48(%r14), %rax
movq 0x58(%r14), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x2320
movq %rax, %r13
testq %r12, %r12
setne %al
testq %r13, %r13
setne %cl
testb %cl, %al
je 0x5c37
movq %rbx, (%rsp)
movq 0x48(%r14), %rbx
leaq 0x1(%rbx), %rbp
movq %rbp, 0x48(%r14)
movq %r12, 0x50(%r14)
movq %r13, 0x58(%r14)
movq $0x0, (%r12,%rbx,8)
movl $0x1, %edi
callq 0x2270
testq %rax, %rax
je 0x5be6
movb $0x0, (%rax)
movq %rax, (%r12,%rbx,8)
leaq (%r12,%rbp,8), %rdi
addq $-0x8, %rdi
movq %r15, %rsi
callq 0x5c5b
movq 0x48(%r14), %rbx
movq 0x58(%r14), %r15
movq $0x0, -0x8(%r15,%rbx,8)
movl $0x1, %edi
callq 0x2270
testq %rax, %rax
je 0x5c1e
movb $0x0, (%rax)
movq %rax, -0x8(%r15,%rbx,8)
movq 0x58(%r14), %rax
leaq (%rax,%rbx,8), %rdi
addq $-0x8, %rdi
movq (%rsp), %rsi
callq 0x5c5b
xorl %eax, %eax
jmp 0x5c4c
movq %r12, %rdi
callq 0x2220
movq %r13, %rdi
callq 0x2220
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_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: string_set(char**, char const*)
static void string_set(char** out, const char* in)
{
  size_t insize = strlen(in), i = 0;
  if(string_resize(out, insize))
  {
    for(i = 0; i < insize; i++)
    {
      (*out)[i] = in[i];
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x20d0
movq %rax, %r15
movq (%r14), %rdi
leaq 0x1(%rax), %rsi
callq 0x2320
testq %rax, %rax
je 0x5ca2
movb $0x0, (%rax,%r15)
movq %rax, (%r14)
testq %r15, %r15
je 0x5ca2
xorl %eax, %eax
movb (%rbx,%rax), %cl
movq (%r14), %rdx
movb %cl, (%rdx,%rax)
incq %rax
cmpq %rax, %r15
jne 0x5c91
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: LodePNGIText_cleanup(LodePNGInfo*)
static void LodePNGIText_cleanup(LodePNGInfo* info)
{
  size_t i;
  for(i = 0; i < info->itext_num; i++)
  {
    string_cleanup(&info->itext_keys[i]);
    string_cleanup(&info->itext_langtags[i]);
    string_cleanup(&info->itext_transkeys[i]);
    string_cleanup(&info->itext_strings[i]);
  }
  myfree(info->itext_keys);
  myfree(info->itext_langtags);
  myfree(info->itext_transkeys);
  myfree(info->itext_strings);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, 0x60(%rdi)
je 0x5d12
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x68(%rbx), %r12
movq (%r12,%r15,8), %rdi
callq 0x2220
movq %r14, (%r12,%r15,8)
movq 0x70(%rbx), %r12
movq (%r12,%r15,8), %rdi
callq 0x2220
movq %r14, (%r12,%r15,8)
movq 0x78(%rbx), %r12
movq (%r12,%r15,8), %rdi
callq 0x2220
movq %r14, (%r12,%r15,8)
movq 0x80(%rbx), %r12
movq (%r12,%r15,8), %rdi
callq 0x2220
movq %r14, (%r12,%r15,8)
incq %r15
cmpq 0x60(%rbx), %r15
jb 0x5cc2
movq 0x68(%rbx), %rdi
callq 0x2220
movq 0x70(%rbx), %rdi
callq 0x2220
movq 0x78(%rbx), %rdi
callq 0x2220
movq 0x80(%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2220
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: lodepng_info_init(LodePNGInfo*)
void lodepng_color_mode_init(LodePNGColorMode* info)
{
  info->key_defined = 0;
  info->key_r = info->key_g = info->key_b = 0;
  info->colortype = LCT_RGBA;
  info->bitdepth = 8;
  info->palette = 0;
  info->palettesize = 0;
}

// Assembly:
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rdi)
movabsq $0x800000006, %rax      # imm = 0x800000006
movq %rax, 0x10(%rdi)
movups %xmm0, 0x18(%rdi)
xorl %eax, %eax
movl %eax, 0x8(%rdi)
movq $0x0, (%rdi)
movl %eax, 0xa4(%rdi)
movups %xmm0, 0x38(%rdi)
movups %xmm0, 0x48(%rdi)
movups %xmm0, 0x58(%rdi)
movups %xmm0, 0x68(%rdi)
movups %xmm0, 0x78(%rdi)
movl %eax, 0x88(%rdi)
movups %xmm0, 0xb8(%rdi)
movups %xmm0, 0xc8(%rdi)
movups %xmm0, 0xd8(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: lodepng_color_mode_equal(LodePNGColorMode const*, LodePNGColorMode const*)
static int lodepng_color_mode_equal(const LodePNGColorMode* a, const LodePNGColorMode* b)
{
  size_t i;
  if(a->colortype != b->colortype) return 0;
  if(a->bitdepth != b->bitdepth) return 0;
  if(a->key_defined != b->key_defined) return 0;
  if(a->key_defined)
  {
    if(a->key_r != b->key_r) return 0;
    if(a->key_g != b->key_g) return 0;
    if(a->key_b != b->key_b) return 0;
  }
  if(a->palettesize != b->palettesize) return 0;
  for(i = 0; i < a->palettesize * 4; i++)
  {
    if(a->palette[i] != b->palette[i]) return 0;
  }
  return 1;
}

// Assembly:
movl (%rdi), %ecx
xorl %eax, %eax
cmpl (%rsi), %ecx
jne 0x68af
movl 0x4(%rdi), %ecx
cmpl 0x4(%rsi), %ecx
jne 0x68af
movl 0x18(%rdi), %ecx
cmpl 0x18(%rsi), %ecx
jne 0x68af
testl %ecx, %ecx
je 0x6877
movl 0x1c(%rdi), %ecx
cmpl 0x1c(%rsi), %ecx
jne 0x68af
movl 0x20(%rdi), %ecx
cmpl 0x20(%rsi), %ecx
jne 0x68af
movl 0x24(%rdi), %ecx
cmpl 0x24(%rsi), %ecx
jne 0x68af
movq 0x10(%rdi), %rcx
cmpq 0x10(%rsi), %rcx
jne 0x68af
shlq $0x2, %rcx
movl $0x1, %eax
testq %rcx, %rcx
je 0x68af
movq 0x8(%rdi), %rdx
movq 0x8(%rsi), %rsi
xorl %edi, %edi
movb (%rdx,%rdi), %r8b
cmpb (%rsi,%rdi), %r8b
jne 0x68ad
incq %rdi
cmpq %rdi, %rcx
jne 0x6899
jmp 0x68af
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: color_tree_add(ColorTree*, unsigned char, unsigned char, unsigned char, unsigned char, int)
static void color_tree_add(ColorTree* tree, unsigned char r, unsigned char g, unsigned char b, unsigned char a, int index)
{
  tree = &tree->next[r];
  if(tree->next == 0) color_tree_make_next(tree);
  tree = &tree->next[g];
  if(tree->next == 0) color_tree_make_next(tree);
  tree = &tree->next[b];
  if(tree->next == 0) color_tree_make_next(tree);
  tree = &tree->next[a];

  tree->index = index;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r9d, %ebx
movl %r8d, %ebp
movl %ecx, %r14d
movl %edx, %r15d
movq (%rdi), %rax
shll $0x4, %esi
leaq (%rax,%rsi), %r12
cmpq $0x0, (%rax,%rsi)
jne 0x6905
movl $0x1000, %edi           # imm = 0x1000
callq 0x2270
movq %rax, (%r12)
xorl %eax, %eax
movq (%r12), %rcx
movq $0x0, (%rcx,%rax)
movl $0xffffffff, 0x8(%rcx,%rax) # imm = 0xFFFFFFFF
addq $0x10, %rax
cmpq $0x1000, %rax           # imm = 0x1000
jne 0x68e5
movq (%r12), %rax
movzbl %r15b, %ecx
shll $0x4, %ecx
leaq (%rax,%rcx), %r15
cmpq $0x0, (%rax,%rcx)
jne 0x6949
movl $0x1000, %edi           # imm = 0x1000
callq 0x2270
movq %rax, (%r15)
xorl %eax, %eax
movq (%r15), %rcx
movq $0x0, (%rcx,%rax)
movl $0xffffffff, 0x8(%rcx,%rax) # imm = 0xFFFFFFFF
addq $0x10, %rax
cmpq $0x1000, %rax           # imm = 0x1000
jne 0x692a
movq (%r15), %rax
movzbl %r14b, %ecx
shll $0x4, %ecx
leaq (%rax,%rcx), %r14
cmpq $0x0, (%rax,%rcx)
jne 0x698c
movl $0x1000, %edi           # imm = 0x1000
callq 0x2270
movq %rax, (%r14)
xorl %eax, %eax
movq (%r14), %rcx
movq $0x0, (%rcx,%rax)
movl $0xffffffff, 0x8(%rcx,%rax) # imm = 0xFFFFFFFF
addq $0x10, %rax
cmpq $0x1000, %rax           # imm = 0x1000
jne 0x696d
movq (%r14), %rax
movzbl %bpl, %ecx
shll $0x4, %ecx
movl %ebx, 0x8(%rax,%rcx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: color_tree_cleanup(ColorTree*)
static void color_tree_cleanup(ColorTree* tree)
{
  if(tree->next)
  {
    int i;
    for(i = 0; i < 256; i++) color_tree_cleanup(&tree->next[i]);
    myfree(tree->next);
  }
}

// Assembly:
cmpq $0x0, (%rdi)
je 0x6e82
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movq (%rbx), %rdi
addq %r14, %rdi
callq 0x6e4b
addq $0x10, %r14
cmpq $0x1000, %r14           # imm = 0x1000
jne 0x6e5b
movq (%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2220
retq
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: addChunk_tIME(ucvector*, LodePNGTime const*)
static unsigned addChunk_tIME(ucvector* out, const LodePNGTime* time)
{
  unsigned error = 0;
  unsigned char* data = (unsigned char*)mymalloc(7);
  if(!data) return 83; /*alloc fail*/
  data[0] = (unsigned char)(time->year / 256);
  data[1] = (unsigned char)(time->year % 256);
  data[2] = time->month;
  data[3] = time->day;
  data[4] = time->hour;
  data[5] = time->minute;
  data[6] = time->second;
  error = addChunk(out, "tIME", data, 7);
  myfree(data);
  return error;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
movl $0x7, %edi
callq 0x2270
testq %rax, %rax
je 0xab1a
movq %rax, %r14
movzwl (%r15), %eax
rolw $0x8, %ax
movw %ax, (%r14)
movb 0x4(%r15), %al
movb %al, 0x2(%r14)
movb 0x8(%r15), %al
movb %al, 0x3(%r14)
movb 0xc(%r15), %al
movb %al, 0x4(%r14)
movb 0x10(%r15), %al
movb %al, 0x5(%r14)
movb 0x14(%r15), %al
movb %al, 0x6(%r14)
leaq 0x8(%rbx), %rsi
leaq 0x894c(%rip), %rcx      # 0x1343d
movq %rbx, %rdi
movl $0x7, %edx
movq %r14, %r8
callq 0x579a
testl %eax, %eax
jne 0xab0d
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2220
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: addChunk_tEXt(ucvector*, char const*, char const*)
static unsigned addChunk_tEXt(ucvector* out, const char* keyword, const char* textstring)
{
  unsigned error = 0;
  size_t i;
  ucvector text;
  ucvector_init(&text);
  for(i = 0; keyword[i] != 0; i++) ucvector_push_back(&text, (unsigned char)keyword[i]);
  ucvector_push_back(&text, 0);
  for(i = 0; textstring[i] != 0; i++) ucvector_push_back(&text, (unsigned char)textstring[i]);
  error = addChunk(out, "tEXt", text.data, text.size);
  ucvector_cleanup(&text);

  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rdi, 0x8(%rsp)
movb (%rsi), %r15b
testb %r15b, %r15b
je 0xadda
movq %rsi, %r12
incq %r12
xorl %r13d, %r13d
xorl %ebp, %ebp
xorl %eax, %eax
leaq 0x1(%rbp), %rbx
cmpq %rbx, %r13
jae 0xadb1
movq %r13, (%rsp)
leaq (%rbx,%rbx), %r13
movq %rax, %rdi
movq %r13, %rsi
movq %rax, 0x10(%rsp)
callq 0x2320
testq %rax, %rax
je 0xadcd
xorl %ecx, %ecx
movq %rbx, %rbp
testb %cl, %cl
jne 0xadbf
movb %r15b, -0x1(%rax,%rbp)
movb (%r12), %r15b
incq %r12
testb %r15b, %r15b
jne 0xad8b
jmp 0xade1
movb $0x1, %cl
movq 0x10(%rsp), %rax
movq (%rsp), %r13
jmp 0xadb6
xorl %eax, %eax
xorl %ebp, %ebp
xorl %r13d, %r13d
leaq 0x1(%rbp), %r12
cmpq %r12, %r13
jae 0xae08
movq %r13, %r15
leaq (%r12,%r12), %r13
movq %rax, %rdi
movq %r13, %rsi
movq %rax, %rbx
callq 0x2320
testq %rax, %rax
je 0xaeb1
xorl %ecx, %ecx
testb %cl, %cl
jne 0xae14
movb $0x0, -0x1(%rax,%r12)
movb (%r14), %bl
testb %bl, %bl
je 0xae6e
incq %r14
leaq 0x1(%r12), %r15
cmpq %r15, %r13
jae 0xae46
movq %r12, (%rsp)
movq %r13, %r12
leaq (%r15,%r15), %r13
movq %rax, %rdi
movq %r13, %rsi
movq %rax, %rbp
callq 0x2320
testq %rax, %rax
je 0xae60
xorl %ecx, %ecx
movq %r15, %r12
testb %cl, %cl
jne 0xae54
movb %bl, -0x1(%rax,%r12)
movb (%r14), %bl
incq %r14
testb %bl, %bl
jne 0xae1e
jmp 0xae6e
movb $0x1, %cl
movq %rbp, %rax
movq %r12, %r13
movq (%rsp), %r12
jmp 0xae4b
movq 0x8(%rsp), %rbx
leaq 0x8(%rbx), %rsi
leaq 0x85b0(%rip), %rcx      # 0x1342e
movq %rbx, %rdi
movl %r12d, %edx
movq %rax, %r14
movq %rax, %r8
callq 0x579a
testl %eax, %eax
jne 0xae9b
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220
movb $0x1, %cl
movq %rbp, %r12
movq %rbx, %rax
movq %r15, %r13
jmp 0xae0a
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/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[0], &buffer[buffersize]);
    myfree(buffer);
  }
  return error;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r8
movq %rdx, %rcx
movq %rsi, %rdx
movq %rdi, %rbx
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movq 0x10(%r8), %rax
leaq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
testq %rax, %rax
je 0xb768
callq *%rax
jmp 0xb76d
callq 0x5296
movl %eax, %ebp
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
je 0xb797
movq 0x8(%rbx), %rsi
movq 0x10(%rsp), %rcx
addq %rdx, %rcx
movq %rbx, %rdi
callq 0xe178
movq 0x8(%rsp), %rdi
callq 0x2220
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: lodepng::encode(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned char const*, unsigned int, unsigned int, LodePNGColorType, unsigned int)
unsigned encode(std::vector<unsigned char>& out, const unsigned char* in, unsigned w, unsigned h,
                LodePNGColorType colortype, unsigned bitdepth)
{
  unsigned char* buffer;
  size_t buffersize;
  unsigned error = lodepng_encode_memory(&buffer, &buffersize, in, w, h, colortype, bitdepth);
  if(buffer)
  {
    out.insert(out.end(), &buffer[0], &buffer[buffersize]);
    myfree(buffer);
  }
  return error;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %r8d, %eax
movl %ecx, %r8d
movl %edx, %ecx
movq %rsi, %rdx
movq %rdi, %rbx
movl %r9d, (%rsp)
leaq 0x18(%rsp), %r14
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
movl %eax, %r9d
callq 0xb361
movl %eax, %ebp
movq (%r14), %r14
testq %r14, %r14
je 0xbbcd
movq 0x8(%rbx), %rsi
movq 0x10(%rsp), %rcx
addq %r14, %rcx
movq %rbx, %rdi
movq %r14, %rdx
callq 0xe178
movq %r14, %rdi
callq 0x2220
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: uivector_resize(uivector*, unsigned long)
static unsigned uivector_resize(uivector* p, size_t size)
{
  if(size * sizeof(unsigned) > p->allocsize)
  {
    size_t newsize = size * sizeof(unsigned) * 2;
    void* data = myrealloc(p->data, newsize);
    if(data)
    {
      p->allocsize = newsize;
      p->data = (unsigned*)data;
      p->size = size;
    }
    else return 0;
  }
  else p->size = size;
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq (,%rsi,4), %rax
cmpq 0x10(%rdi), %rax
jbe 0xbde7
leaq (,%rbx,8), %r15
movq (%r14), %rdi
movq %r15, %rsi
callq 0x2320
testq %rax, %rax
je 0xbdf6
movq %r15, 0x10(%r14)
movq %rax, (%r14)
movq %rbx, 0x8(%r14)
movl $0x1, %eax
popq %rbx
popq %r14
popq %r15
retq
xorl %eax, %eax
jmp 0xbdf0
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: ucvector_resize(ucvector*, unsigned long)
static unsigned ucvector_resize(ucvector* p, size_t size)
{
  if(size * sizeof(unsigned char) > p->allocsize)
  {
    size_t newsize = size * sizeof(unsigned char) * 2;
    void* data = myrealloc(p->data, newsize);
    if(data)
    {
      p->allocsize = newsize;
      p->data = (unsigned char*)data;
      p->size = size;
    }
    else return 0; /*error: not enough memory*/
  }
  else p->size = size;
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
cmpq %rsi, 0x10(%rdi)
jae 0xbe26
leaq (%rbx,%rbx), %r15
movq (%r14), %rdi
movq %r15, %rsi
callq 0x2320
testq %rax, %rax
je 0xbe35
movq %r15, 0x10(%r14)
movq %rax, (%r14)
movq %rbx, 0x8(%r14)
movl $0x1, %eax
popq %rbx
popq %r14
popq %r15
retq
xorl %eax, %eax
jmp 0xbe2f
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: generateFixedLitLenTree(HuffmanTree*)
static unsigned generateFixedLitLenTree(HuffmanTree* tree)
{
  unsigned i, error = 0;
  unsigned* bitlen = (unsigned*)mymalloc(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);

  myfree(bitlen);
  return error;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x480, %edi            # imm = 0x480
callq 0x2270
testq %rax, %rax
je 0xbed3
movq %rax, %rbx
xorl %eax, %eax
movl $0x8, (%rbx,%rax,4)
incq %rax
cmpq $0x90, %rax
jne 0xbe58
movl $0x90, %eax
movl $0x9, (%rbx,%rax,4)
incq %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0xbe6f
movl $0x100, %eax            # imm = 0x100
movl $0x7, (%rbx,%rax,4)
incq %rax
cmpq $0x118, %rax            # imm = 0x118
jne 0xbe86
movl $0x118, %eax            # imm = 0x118
movl $0x8, (%rbx,%rax,4)
incq %rax
cmpq $0x120, %rax            # imm = 0x120
jne 0xbe9d
movl $0x120, %edx            # imm = 0x120
movq %r14, %rdi
movq %rbx, %rsi
movl $0xf, %ecx
callq 0xbf32
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2220
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: generateFixedDistanceTree(HuffmanTree*)
static unsigned generateFixedDistanceTree(HuffmanTree* tree)
{
  unsigned i, error = 0;
  unsigned* bitlen = (unsigned*)mymalloc(NUM_DISTANCE_SYMBOLS * sizeof(unsigned));
  if(!bitlen) return 83; /*alloc fail*/

  /*there are 32 distance codes, but 30-31 are unused*/
  for(i = 0; i < NUM_DISTANCE_SYMBOLS; i++) bitlen[i] = 5;
  error = HuffmanTree_makeFromLengths(tree, bitlen, NUM_DISTANCE_SYMBOLS, 15);

  myfree(bitlen);
  return error;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x80, %edi
callq 0x2270
testq %rax, %rax
je 0xbf2a
movq %rax, %rbx
xorl %eax, %eax
movl $0x5, (%rbx,%rax,4)
incq %rax
cmpq $0x20, %rax
jne 0xbef6
movl $0x20, %edx
movq %r14, %rdi
movq %rbx, %rsi
movl $0xf, %ecx
callq 0xbf32
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2220
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: HuffmanTree_makeFromLengths(HuffmanTree*, unsigned int const*, unsigned long, unsigned int)
static unsigned HuffmanTree_makeFromLengths(HuffmanTree* tree, const unsigned* bitlen,
                                            size_t numcodes, unsigned maxbitlen)
{
  unsigned i;
  tree->lengths = (unsigned*)mymalloc(numcodes * sizeof(unsigned));
  if(!tree->lengths) return 83; /*alloc fail*/
  for(i = 0; i < numcodes; i++) tree->lengths[i] = bitlen[i];
  tree->numcodes = (unsigned)numcodes; /*number of symbols*/
  tree->maxbitlen = maxbitlen;
  return HuffmanTree_makeFromLengths2(tree);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
leaq (,%rdx,4), %rdi
callq 0x2270
movq %rax, 0x10(%r14)
testq %rax, %rax
je 0xbf8b
testq %r15, %r15
je 0xbf73
xorl %ecx, %ecx
movl (%r12,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
incq %rcx
movl %ecx, %edx
cmpq %r15, %rdx
jb 0xbf62
movl %r15d, 0x1c(%r14)
movl %ebx, 0x18(%r14)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xbf9c
movl $0x53, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: addBitToStream(unsigned long*, ucvector*, unsigned char)
static void addBitToStream(size_t* bitpointer, ucvector* bitstream, unsigned char bit)
{
  /*add a new byte at the end*/
  if((*bitpointer) % 8 == 0) ucvector_push_back(bitstream, (unsigned char)0);
  /*earlier bit of huffman code is in a lesser significant bit of an earlier byte*/
  (bitstream->data[bitstream->size - 1]) |= (bit << ((*bitpointer) & 0x7));
  (*bitpointer)++;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
testb $0x7, (%rdi)
jne 0xc282
movq 0x8(%r15), %rsi
incq %rsi
movq %r15, %rdi
callq 0xbdfa
testl %eax, %eax
je 0xc282
movq (%r15), %rax
movq 0x8(%r15), %rcx
movb $0x0, -0x1(%rax,%rcx)
movb (%r14), %cl
andb $0x7, %cl
shlb %cl, %bl
movq (%r15), %rax
movq 0x8(%r15), %rcx
orb %bl, -0x1(%rax,%rcx)
incq (%r14)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: HuffmanTree_makeFromFrequencies(HuffmanTree*, unsigned int const*, unsigned long, unsigned int)
static unsigned HuffmanTree_makeFromFrequencies(HuffmanTree* tree, const unsigned* frequencies,
                                                size_t numcodes, unsigned maxbitlen)
{
  unsigned error = 0;
  tree->maxbitlen = maxbitlen;
  tree->numcodes = (unsigned)numcodes; /*number of symbols*/
  tree->lengths = (unsigned*)myrealloc(tree->lengths, numcodes * sizeof(unsigned));
  if(!tree->lengths) return 83; /*alloc fail*/
  /*initialize all lengths to 0*/
  memset(tree->lengths, 0, numcodes * sizeof(unsigned));

  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 %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl %ecx, 0x18(%rdi)
movl %r14d, 0x1c(%rdi)
movq 0x10(%rdi), %rdi
leaq (,%rdx,4), %r12
movq %r12, %rsi
callq 0x2320
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0xcc76
movq %rax, %r13
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x2100
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
movl %ebp, %ecx
callq 0x26a5
testl %eax, %eax
jne 0xcc7b
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xbf9c
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_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: color_profile_init(ColorProfile*, LodePNGColorMode*)
static void color_profile_init(ColorProfile* profile, LodePNGColorMode* mode)
{
  profile->sixteenbit = 0;
  profile->sixteenbit_done = mode->bitdepth == 16 ? 0 : 1;

  profile->colored = 0;
  profile->colored_done = lodepng_is_greyscale_type(mode) ? 1 : 0;

  profile->key = 0;
  profile->alpha = 0;
  profile->alpha_done = lodepng_can_have_alpha(mode) ? 0 : 1;

  profile->numcolors = 0;
  color_tree_init(&profile->tree, 1);
  profile->palette = (unsigned char*)mymalloc(1024);
  profile->maxnumcolors = 257;
  if(lodepng_get_bpp(mode) <= 8)
  {
    int bpp = lodepng_get_bpp(mode);
    profile->maxnumcolors = bpp == 1 ? 2 : (bpp == 2 ? 4 : (bpp == 4 ? 16 : 256));
  }
  profile->numcolors_done = 0;

  profile->greybits = 1;
  profile->greybits_done = lodepng_get_bpp(mode) == 1 ? 1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r15d, %r15d
movb %r15b, (%rdi)
movl 0x4(%rsi), %ebp
cmpl $0x10, %ebp
setne 0x1(%rdi)
movb %r15b, 0x2(%rdi)
movl (%rsi), %r14d
testl $0xfffffffb, %r14d      # imm = 0xFFFFFFFB
sete 0x3(%rdi)
movb %r15b, 0x4(%rdi)
movb %r15b, 0xc(%rdi)
movq %rsi, %rdi
callq 0x5a76
xorb $0x1, %al
movb %al, 0xd(%rbx)
movl $0x0, 0x10(%rbx)
movl $0x1000, %edi           # imm = 0x1000
callq 0x2270
movq %rax, 0x18(%rbx)
movq 0x18(%rbx), %rax
movq $0x0, (%rax,%r15)
movl $0xffffffff, 0x8(%rax,%r15) # imm = 0xFFFFFFFF
addq $0x10, %r15
cmpq $0x1000, %r15           # imm = 0x1000
jne 0xd640
movl $0xffffffff, 0x20(%rbx) # imm = 0xFFFFFFFF
movl $0x400, %edi            # imm = 0x400
callq 0x2270
movq %rax, 0x28(%rbx)
movl $0x101, 0x30(%rbx)      # imm = 0x101
xorl %ecx, %ecx
leaq 0x4f25(%rip), %rax      # 0x125ac
cmpl $0x6, %r14d
ja 0xd691
movl (%rax,%r14,4), %ecx
imull %ebp, %ecx
cmpl $0x8, %ecx
ja 0xd6d3
xorl %ecx, %ecx
cmpl $0x6, %r14d
ja 0xd6a5
movl (%rax,%r14,4), %ecx
imull %ebp, %ecx
cmpl $0x1, %ecx
je 0xd6b9
cmpl $0x2, %ecx
jne 0xd6c0
movl $0x4, %ecx
jmp 0xd6d0
movl $0x2, %ecx
jmp 0xd6d0
cmpl $0x4, %ecx
movl $0x10, %edx
movl $0x100, %ecx            # imm = 0x100
cmovel %edx, %ecx
movl %ecx, 0x30(%rbx)
movb $0x0, 0x34(%rbx)
movl $0x1, 0x38(%rbx)
xorl %ecx, %ecx
cmpl $0x6, %r14d
ja 0xd6ea
movl (%rax,%r14,4), %ecx
imull %ebp, %ecx
cmpl $0x1, %ecx
sete 0x3c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/lodepng.cpp
// Function: addPaddingBits(unsigned char*, unsigned char const*, unsigned long, unsigned long, unsigned int)
static void addPaddingBits(unsigned char* out, const unsigned char* in,
                           size_t olinebits, size_t ilinebits, unsigned h)
{
  /*The opposite of the removePaddingBits function
  olinebits must be >= ilinebits*/
  unsigned y;
  size_t diff = olinebits - ilinebits;
  size_t obp = 0, ibp = 0; /*bit pointers*/
  for(y = 0; y < h; y++)
  {
    size_t x;
    for(x = 0; x < ilinebits; x++)
    {
      unsigned char bit = readBitFromReversedStream(&ibp, in);
      setBitOfReversedStream(&obp, out, bit);
    }
    /*obp += diff; --> no, fill in some value in the padding bits too, to avoid
    "Use of uninitialised value of size ###" warning from valgrind*/
    for(x = 0; x < diff; x++) setBitOfReversedStream(&obp, out, 0);
  }
}

// Assembly:
testl %r8d, %r8d
je 0xd7bf
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rax
movq %rdx, %r9
subq %rcx, %r9
xorl %r10d, %r10d
xorl %r11d, %r11d
xorl %ebx, %ebx
testq %rax, %rax
je 0xd784
movq %rax, %r14
movq %r11, %r15
movq %r15, %rcx
shrq $0x3, %rcx
movl %r15d, %ebp
notb %bpl
movzbl (%rsi,%rcx), %r12d
movzbl %bpl, %r13d
andl $0x7, %r13d
movl %ebx, %ecx
notb %cl
andb $0x7, %cl
movb $0x1, %bpl
shlb %cl, %bpl
btl %r13d, %r12d
jae 0xd768
movq %rbx, %rcx
shrq $0x3, %rcx
orb %bpl, (%rdi,%rcx)
jmp 0xd776
notb %bpl
movq %rbx, %rcx
shrq $0x3, %rcx
andb %bpl, (%rdi,%rcx)
incq %rbx
incq %r15
decq %r14
jne 0xd72e
addq %rax, %r11
movq %r9, %r14
cmpq %rax, %rdx
je 0xd7a9
movl %ebx, %ecx
notb %cl
movb $-0x2, %bpl
rolb %cl, %bpl
movq %rbx, %rcx
shrq $0x3, %rcx
andb %bpl, (%rdi,%rcx)
incq %rbx
decq %r14
jne 0xd78c
incl %r10d
cmpl %r8d, %r10d
jne 0xd723
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/image.cpp
// Function: image::load_bmp(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool image::load_bmp(string filename)
  {
    this->delete_image();

    this->bmp_image = new bitmap_image(filename);

    if (!this->bmp_image->is_loaded())
      {
        this->delete_image();
        return false;
      }

    return true;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdi), %r14
testq %r14, %r14
je 0xe4e6
movq %r14, %rdi
callq 0xecc8
movl $0x40, %esi
movq %r14, %rdi
callq 0x21c0
movq $0x0, (%rbx)
movl $0x40, %edi
callq 0x21b0
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0xe932
movq %r14, (%rbx)
xorl %ebp, %ebp
cmpq $0x0, 0x20(%r14)
je 0xe52f
cmpl $0x0, 0x2c(%r14)
je 0xe52f
cmpl $0x0, 0x30(%r14)
je 0xe52f
cmpl $0x0, 0x34(%r14)
je 0xe52f
cmpl $0x0, 0x38(%r14)
setne %bpl
testb %bpl, %bpl
jne 0xe550
movq %r14, %rdi
callq 0xecc8
movl $0x40, %esi
movq %r14, %rdi
callq 0x21c0
movq $0x0, (%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x40, %esi
movq %r14, %rdi
callq 0x21c0
movq %rbx, %rdi
callq 0x2340
nop
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/image.cpp
// Function: image::load_png(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool image::load_png(string filename)
  {
    this->delete_image();

    unsigned char *pixel_data, r, g, b;
    unsigned int width, height, i, j, offset;

    if (lodepng_decode32_file(&pixel_data,&width,&height,filename.c_str()) != 0)
      return false;

    this->bmp_image = new bitmap_image(width,height);

    offset = 0;

    for (j = 0; j < height; j++)
      for (i = 0; i < width; i++)
        {
          r = pixel_data[offset];
          g = pixel_data[offset + 1];
          b = pixel_data[offset + 2];

          this->bmp_image->set_pixel(i,j,r,g,b);

          offset += 4;
        }

    return true;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %r15
testq %r15, %r15
je 0xe5a3
movq %r15, %rdi
callq 0xecc8
movl $0x40, %esi
movq %r15, %rdi
callq 0x21c0
movq $0x0, (%rbx)
movq (%r14), %rcx
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x8760
movl %eax, %ebp
testl %eax, %eax
jne 0xe669
movl $0x40, %edi
callq 0x21b0
movq %rax, %r14
movl 0xc(%rsp), %esi
movl 0x8(%rsp), %edx
movq %rax, %rdi
callq 0xe992
movq %r14, (%rbx)
cmpl $0x0, 0x8(%rsp)
je 0xe669
xorl %eax, %eax
xorl %ecx, %ecx
cmpl $0x0, 0xc(%rsp)
je 0xe661
xorl %edx, %edx
movq 0x10(%rsp), %rdi
movl %eax, %esi
movb (%rdi,%rsi), %sil
leal 0x1(%rax), %r8d
movb (%rdi,%r8), %r8b
leal 0x2(%rax), %r9d
movb (%rdi,%r9), %dil
movq (%rbx), %r9
movl 0x38(%r9), %r10d
imull %ecx, %r10d
movl 0x28(%r9), %r11d
imull %edx, %r11d
movq 0x20(%r9), %r14
leal (%r11,%r10), %r15d
movb %dil, (%r14,%r15)
movq 0x20(%r9), %rdi
leal 0x1(%r11,%r10), %r14d
movb %r8b, (%rdi,%r14)
movq 0x20(%r9), %rdi
leal (%r11,%r10), %r8d
addl $0x2, %r8d
movb %sil, (%rdi,%r8)
addl $0x4, %eax
incl %edx
cmpl 0xc(%rsp), %edx
jb 0xe5ff
incl %ecx
cmpl 0x8(%rsp), %ecx
jb 0xe5f6
testl %ebp, %ebp
sete %al
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x40, %esi
movq %r14, %rdi
callq 0x21c0
movq %rbx, %rdi
callq 0x2340
nop
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/image.cpp
// Function: image::load_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool image::load_file(string filename)
  {
    if (this->load_png(filename))
      return true;

    if (this->load_bmp(filename))
      return true;

    return false;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rsi), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0xef74
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe576
movl %eax, %r15d
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0xe6ea
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21c0
movb $0x1, %bpl
testb %r15b, %r15b
jne 0xe734
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %rsp, %r14
movq %r14, %rdi
callq 0xef74
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe4bc
movl %eax, %ebp
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0xe734
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
movl %ebp, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%rsp), %rdi
jmp 0xe754
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0xe765
movq (%r12), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2340
nop
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/image.cpp
// Function: image::save_png(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool image::save_png(string filename)
  {
    if (this->bmp_image == NULL)
      return false;

    unsigned char *pixel_data, r, g, b;
    unsigned int i, j, offset;
    bool result;

    pixel_data = (unsigned char *) malloc(this->bmp_image->width() * this->bmp_image->height() * 3);

    offset = 0;

    for (j = 0; j < this->bmp_image->width(); j++)
      for (i = 0; i < this->bmp_image->width(); i++)
        {
          this->bmp_image->get_pixel(i,j,r,g,b);

          pixel_data[offset] = r;
          pixel_data[offset + 1] = g;
          pixel_data[offset + 2] = b;

          offset += 3;
        }

    result = (lodepng_encode24_file(filename.c_str(),pixel_data,
      this->bmp_image->width(),this->bmp_image->height()) == 0);

    free(pixel_data);

    return result;
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq (%rdi), %r15
testq %r15, %r15
je 0xe82f
movq %rsi, %rbx
movl 0x30(%r15), %eax
imull 0x34(%r15), %eax
leal (%rax,%rax,2), %edi
callq 0x2270
movq %rax, %r14
movl 0x30(%r15), %edx
testl %edx, %edx
je 0xe811
xorl %eax, %eax
xorl %ecx, %ecx
cmpl $0x0, 0x30(%r15)
je 0xe807
xorl %edx, %edx
movl 0x38(%r15), %esi
imull %ecx, %esi
movl 0x28(%r15), %edi
imull %edx, %edi
movq 0x20(%r15), %r8
leal (%rdi,%rsi), %r9d
movb (%r8,%r9), %r9b
leal (%rdi,%rsi), %r10d
incl %r10d
movb (%r8,%r10), %r10b
leal 0x2(%rdi,%rsi), %esi
movb (%r8,%rsi), %sil
movl %eax, %edi
movb %sil, (%r14,%rdi)
leal 0x1(%rax), %esi
movb %r10b, (%r14,%rsi)
leal 0x2(%rax), %esi
movb %r9b, (%r14,%rsi)
addl $0x3, %eax
incl %edx
cmpl 0x30(%r15), %edx
jb 0xe7bb
incl %ecx
movl 0x30(%r15), %edx
cmpl %edx, %ecx
jb 0xe7b2
movq (%rbx), %rdi
movl 0x34(%r15), %ecx
movq %r14, %rsi
callq 0xb52a
testl %eax, %eax
sete %bl
movq %r14, %rdi
callq 0x2220
jmp 0xe831
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/image.cpp
// Function: image::get_pixel(unsigned int, unsigned int, unsigned char&, unsigned char&, unsigned char&)
void image::get_pixel(const unsigned int x, const unsigned int y,
  unsigned char &red, unsigned char &green, unsigned char &blue)
  {
    if (this->bmp_image != NULL && x < this->bmp_image->width() && y < this->bmp_image->height())
      {
        this->bmp_image->get_pixel(x,y,red,green,blue);
      }
    else
      {
        red = 255;
        green = 255;
        blue = 255;
      }
  }

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0xe8a2
cmpl %esi, 0x30(%rax)
jbe 0xe8a2
cmpl %edx, 0x34(%rax)
jbe 0xe8a2
imull 0x38(%rax), %edx
imull 0x28(%rax), %esi
movq 0x20(%rax), %rdi
leal (%rsi,%rdx), %r10d
movb (%rdi,%r10), %dil
movb %dil, (%r9)
movq 0x20(%rax), %rdi
leal 0x1(%rsi,%rdx), %r9d
movb (%rdi,%r9), %dil
movb %dil, (%r8)
movq 0x20(%rax), %rax
addl %esi, %edx
addl $0x2, %edx
movb (%rax,%rdx), %al
movb %al, (%rcx)
retq
movb $-0x1, %al
movb %al, (%rcx)
movb %al, (%r8)
movb %al, (%r9)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/image.cpp
// Function: image::set_pixel(unsigned int, unsigned int, char const&, char const&, char const&)
void image::set_pixel(const unsigned int x, const unsigned int y,
  const char &red, const char &green, const char &blue)
  {
    if (x >= this->bmp_image->width() || y >= this->bmp_image->height())
      return;

    if (this->bmp_image != NULL)
      this->bmp_image->set_pixel(x,y,red,green,blue);
  }

// Assembly:
movq (%rdi), %rax
cmpl %esi, 0x30(%rax)
jbe 0xe8f5
testq %rax, %rax
je 0xe8f5
cmpl %edx, 0x34(%rax)
jbe 0xe8f5
movb (%rcx), %cl
movb (%r8), %dil
imull 0x38(%rax), %edx
movb (%r9), %r8b
imull 0x28(%rax), %esi
movq 0x20(%rax), %r9
leal (%rsi,%rdx), %r10d
movb %r8b, (%r9,%r10)
movq 0x20(%rax), %r8
leal 0x1(%rsi,%rdx), %r9d
movb %dil, (%r8,%r9)
movq 0x20(%rax), %rax
addl %esi, %edx
addl $0x2, %edx
movb %cl, (%rax,%rdx)
retq
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/bitmap_image.hpp
// Function: bitmap_image::create_bitmap()
void create_bitmap()
   {
      length_ = width_ * height_ * bytes_per_pixel_;
      row_increment_ = width_ * bytes_per_pixel_;
      if (0 != data_)
      {
         delete[] data_;
      }
      data_ = new unsigned char[length_];
   }

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x28(%rdi), %eax
imull 0x30(%rdi), %eax
movl 0x34(%rdi), %ecx
imull %eax, %ecx
movl %ecx, 0x2c(%rdi)
movl %eax, 0x38(%rdi)
movq 0x20(%rdi), %rdi
testq %rdi, %rdi
je 0xef65
callq 0x2250
movl 0x2c(%rbx), %edi
callq 0x2040
movq %rax, 0x20(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/program.cpp
// Function: program::char_from_image_position(image*, coord_2d)
int program::char_from_image_position(image *img, coord_2d c)
  {
    unsigned int i, j, k, x, y;
    unsigned char r,g,b,r2,g2,b2;
    bool matches;

    for (k = 0; k < 256; k++)
      {
        x = (k % FONT_ROW_SYMBOLS) * FONT_WIDTH;   // character coordinates in the font mask
        y = (k / FONT_ROW_SYMBOLS) * FONT_HEIGHT;

        matches = true;

        for (j = 0; j < FONT_HEIGHT; j++)
          {
            for (i = 0; i < FONT_WIDTH; i++)
              {
                img->get_pixel(c.x + i,c.y + j,r,g,b);
                this->font_mask.get_pixel(x + i,y + j,r2,g2,b2);

                if ((is_black(r,g,b)) != (is_black(r2,g2,b2)))
                  matches = false;
              }
          }

        if (matches)
          return k;
      }

    return -1;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbp
movq %rdi, 0x38(%rsp)
movq %rdx, %rax
shrq $0x20, %rax
movq %rax, 0x20(%rsp)
leaq 0xf(%rsp), %r12
leaq 0xe(%rsp), %r13
leaq 0xd(%rsp), %r15
xorl %esi, %esi
movq %rdx, 0x30(%rsp)
movl %esi, %eax
andl $0x1f, %eax
leal (,%rax,8), %edi
subl %eax, %edi
movq %rdi, 0x40(%rsp)
movl %esi, 0x10(%rsp)
shrl $0x2, %esi
andl $0x38, %esi
movl %esi, 0x14(%rsp)
movb $0x1, %bl
xorl %esi, %esi
movq 0x20(%rsp), %rax
addl %esi, %eax
movl %eax, 0x1c(%rsp)
movq %rsi, 0x28(%rsp)
movl %esi, %eax
orl 0x14(%rsp), %eax
movl %eax, 0x18(%rsp)
xorl %r14d, %r14d
leal (%rdx,%r14), %esi
movq %rbp, %rdi
movl 0x1c(%rsp), %edx
movq %r12, %rcx
movq %r13, %r8
movq %r15, %r9
callq 0xe85a
movq 0x40(%rsp), %rax
leal (%rax,%r14), %esi
movq 0x38(%rsp), %rdi
movl 0x18(%rsp), %edx
leaq 0xc(%rsp), %rcx
leaq 0xb(%rsp), %r8
leaq 0xa(%rsp), %r9
callq 0xe85a
xorl %esi, %esi
movq 0x30(%rsp), %rdx
movb 0xe(%rsp), %al
orb 0xf(%rsp), %al
orb 0xd(%rsp), %al
sete %al
movb 0xb(%rsp), %dil
orb 0xc(%rsp), %dil
orb 0xa(%rsp), %dil
setne %dil
xorb %al, %dil
movzbl %bl, %ebx
cmovel %esi, %ebx
incl %r14d
cmpl $0x7, %r14d
jne 0xfe02
movq 0x28(%rsp), %rsi
incl %esi
cmpl $0x8, %esi
jne 0xfde5
testb $0x1, %bl
jne 0xfeaa
movl 0x10(%rsp), %esi
incl %esi
cmpl $0x100, %esi            # imm = 0x100
jne 0xfdc0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xfeae
movl 0x10(%rsp), %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/drummyfish[P]flowchart/src/program.cpp
// Function: program::string_from_image_position[abi:cxx11](image*, coord_2d, unsigned int, bool&)
string program::string_from_image_position(image *img, coord_2d c, unsigned int max_x, bool &success)
  {
    int character;
    string result;
    success = true;

    result = "";

    while (c.x <= max_x)
      {
        character = this->char_from_image_position(img,c);

        if (character < 0)    // error
          {
            success = false;
            result = "";
            return result;
          }

        result += (unsigned char) character;
        c.x += (FONT_WIDTH + 1);   // move to the next character
      }

    result = trim(result);

    if (result.length() == 0)
      success = false;

    return result;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r8d, %ebp
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, 0x8(%rsp)
movq %rax, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
movq %r9, 0x10(%rsp)
movb $0x1, (%r9)
leaq 0x362c(%rip), %rcx      # 0x1352f
xorl %esi, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x22f0
cmpl %ebp, %r15d
ja 0xff51
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %r15, %r14
andq %rax, %r14
movl %r15d, %edx
orq %r14, %rdx
movq %r13, %rdi
movq %r12, %rsi
callq 0xfd88
testl %eax, %eax
js 0xffd0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2170
addl $0x8, %r15d
cmpl %ebp, %r15d
jbe 0xff24
leaq 0x28(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0xef74
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x117fe
leaq 0x38(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2230
movq (%r15), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xffa8
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0xffbf
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21c0
cmpq $0x0, 0x8(%rbx)
jne 0xfff0
movq 0x10(%rsp), %rax
movb $0x0, (%rax)
jmp 0xfff0
movq 0x10(%rsp), %rax
movb $0x0, (%rax)
movq 0x8(%rbx), %rdx
leaq 0x354c(%rip), %rcx      # 0x1352f
movq %rbx, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x22f0
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x10025
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x10025
jmp 0x10022
jmp 0x10022
movq %rax, %r14
movq (%rbx), %rdi
cmpq 0x8(%rsp), %rdi
je 0x1003f
movq 0x8(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x21c0
movq %r14, %rdi
callq 0x2340
nop