LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_omf_record_load_iterated
int xlink_omf_record_load_iterated(xlink_omf_record *rec, unsigned char *data,
 int length) {
  unsigned char *block;
  unsigned int repeat_count;
  unsigned int block_count;
  unsigned int size;
  int i;
  block = data;
  repeat_count = xlink_omf_record_read_numeric(rec);
  block_count = xlink_omf_record_read_word(rec);
  if (block_count) {
    size = 0;
    for (i = 0; i < block_count; i++) {
      int block_size;
      block_size = xlink_omf_record_load_iterated(rec, block, length);
      block += block_size;
      length -= block_size;
      size += block_size;
    }
  }
  else {
    size = xlink_omf_record_read_byte(rec);
    XLINK_ERROR(size > length,
     ("LIDATA wrote past end of segment, size = %i but length = %i", size,
     length));
    memcpy(block, &rec->buf[rec->idx], size);
    block += size;
    rec->idx += size;
  }
  for (i = 1; i < repeat_count; i++) {
    memcpy(block, data, size);
    block += size;
  }
  return repeat_count*size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
testb $0x1, 0xc(%rdi)
movq (%rdi), %rsi
movslq 0x8(%rdi), %rax
jne 0x4b9c
movzwl (%rsi,%rax), %ecx
movq %rcx, (%rsp)
addl $0x2, %eax
jmp 0x4ba6
movl (%rsi,%rax), %ecx
movq %rcx, (%rsp)
addl $0x4, %eax
movslq %eax, %rcx
movzwl (%rsi,%rcx), %r13d
addq $0x2, %rcx
movl %ecx, 0x8(%r14)
testl %r13d, %r13d
je 0x4bdf
xorl %ebp, %ebp
movq %rbx, %r12
movq %r14, %rdi
movq %r12, %rsi
movl %r15d, %edx
callq 0x4b6e
cltq
addq %rax, %r12
subl %eax, %r15d
addl %eax, %ebp
decl %r13d
jne 0x4bc0
jmp 0x4c09
addl $0x3, %eax
movl %eax, 0x8(%r14)
movzbl (%rsi,%rcx), %ebp
cmpl %r15d, %ebp
ja 0x4c45
cltq
addq %rax, %rsi
movl %ebp, %r12d
movq %rbx, %rdi
movq %r12, %rdx
callq 0x2140
addq %rbx, %r12
addl %ebp, 0x8(%r14)
movq (%rsp), %r13
cmpl $0x2, %r13d
jb 0x4c30
movl %ebp, %r14d
leal -0x1(%r13), %r15d
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2140
addq %r14, %r12
decl %r15d
jne 0x4c1a
imull %r13d, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5e51(%rip), %rdi      # 0xaa9d
movl %ebp, %esi
movl %r15d, %edx
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_file_load_omf_record
static void xlink_file_load_omf_record(xlink_file *file,
 xlink_omf_record *rec) {
  unsigned char checksum;
  XLINK_ERROR(file->size < 3,
   ("Need 3 bytes for a record but only have %i", file->size));
  rec->buf = &file->buf[file->pos];
  rec->idx = 0;
  rec->type = xlink_omf_record_read_byte(rec);
  rec->size = xlink_omf_record_read_word(rec);
  XLINK_ERROR(file->size - 3 < rec->size,
   ("Record extends %i bytes past the end of file %s",
   rec->size - file->size + 3, file->name));
  file->pos += 3 + rec->size;
  file->size -= 3 + rec->size;
  checksum = rec->buf[3 + rec->size - 1];
  if (checksum != 0) {
    int i;
    for (i = 0; i < 3 + rec->size - 1; i++) {
      checksum += rec->buf[i];
    }
  }
  XLINK_ERROR(checksum != 0, ("Invalid checksum, expected 0 got %i", checksum));
}

// Assembly:
pushq %rax
movl 0x8(%rdi), %eax
cmpl $0x2, %eax
jbe 0x5e1c
movq %rsi, %rcx
movq 0x10(%rdi), %rsi
movl 0xc(%rdi), %r8d
leaq (%rsi,%r8), %rdx
movq %rdx, (%rcx)
movl $0x1, 0x8(%rcx)
movb (%rsi,%r8), %r9b
movb %r9b, 0xc(%rcx)
movzwl 0x1(%rsi,%r8), %esi
movl $0x3, 0x8(%rcx)
movw %si, 0xe(%rcx)
leal -0x3(%rax), %ecx
cmpl %esi, %ecx
jb 0x5e27
leal 0x3(%rsi), %ecx
addl %esi, %r8d
addl $0x3, %r8d
movl %r8d, 0xc(%rdi)
subl %ecx, %eax
movl %eax, 0x8(%rdi)
movl %esi, %eax
movb 0x2(%rdx,%rax), %al
testb %al, %al
je 0x5e1a
addq $0x2, %rsi
xorl %ecx, %ecx
addb (%rdx,%rcx), %al
incq %rcx
cmpq %rcx, %rsi
jne 0x5e0b
testb %al, %al
jne 0x5e3f
popq %rax
retq
leaq 0x59b1(%rip), %rdi      # 0xb7d4
movl %eax, %esi
jmp 0x5e49
subl %eax, %esi
addl $0x3, %esi
movq (%rdi), %rdx
leaq 0x59c9(%rip), %rdi      # 0xb7ff
xorl %eax, %eax
callq 0x22ef
jmp 0x5e50
movzbl %al, %esi
leaq 0x59e6(%rip), %rdi      # 0xb82f
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_file_load_omf_library
xlink_library *xlink_file_load_omf_library(xlink_file *file,
 unsigned int flags) {
  xlink_library *lib;
  int done;
  lib = xlink_malloc(sizeof(xlink_library));
  done = 0;
  while (file->size > 0 && !done) {
    switch (file->buf[file->pos]) {
      case OMF_LIBHDR : {
        xlink_omf_record rec;
        xlink_file_load_omf_record(file, &rec);
        lib->page_size = rec.size + 3;
        break;
      }
      case OMF_LIBEND : {
        done = 1;
        break;
      }
      case OMF_THEADR :
      case OMF_LHEADR : {
        int mask;
        int skip;
        xlink_module *mod;
        /* TODO: Find embedded module name in dictionary, set file->name here */
        mod = xlink_file_load_omf_module(file, flags);
        XLINK_LIST_ADD(library, module, lib, mod);
        /* Page size is always a power of two */
        mask = lib->page_size - 1;
        /* Compute the number of bytes to skip to reach the next page */
        skip = ((file->pos + mask) & ~mask) - file->pos;
        file->pos += skip;
        file->size -= skip;
        break;
      }
      default : {
        XLINK_ERROR(1, ("Unknown record type %02X", file->buf[file->pos]));
      }
    }
  }
  XLINK_ERROR(!done, ("Got EOF before reading LIBEND in %s", file->name));
  return lib;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movl $0x30, %edi
callq 0x8520
cmpl $0x0, 0x8(%rbx)
je 0x5f3a
movq %rax, %r14
movq %rsp, %r15
movq 0x10(%rbx), %rax
movl 0xc(%rbx), %ecx
movzbl (%rax,%rcx), %esi
cmpl $0xef, %esi
jg 0x5f10
cmpl $0x80, %esi
je 0x5eac
cmpl $0x82, %esi
jne 0x5f65
movq %rbx, %rdi
movl %ebp, %esi
callq 0x4c62
movq %rax, %r12
movl 0x28(%r14), %eax
incl %eax
movl %eax, 0x8(%r12)
movq %r14, 0x10(%r12)
movslq 0x28(%r14), %rax
leaq 0x1(%rax), %rcx
movl %ecx, 0x28(%r14)
movq 0x20(%r14), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x8540
movq %rax, 0x20(%r14)
movslq 0x28(%r14), %rcx
movq %r12, -0x8(%rax,%rcx,8)
movl 0x18(%r14), %ecx
movl 0xc(%rbx), %eax
leal (%rcx,%rax), %edx
decl %edx
negl %ecx
andl %edx, %ecx
subl %ecx, %eax
movl %ecx, 0xc(%rbx)
addl 0x8(%rbx), %eax
movl %eax, 0x8(%rbx)
jmp 0x5f32
cmpl $0xf0, %esi
jne 0x5f4d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5da6
movzwl 0xe(%rsp), %eax
addl $0x3, %eax
movl %eax, 0x18(%r14)
movl 0x8(%rbx), %eax
testl %eax, %eax
jne 0x5e85
movq (%rbx), %rsi
leaq 0x4e00(%rip), %rdi      # 0xad44
xorl %eax, %eax
callq 0x22ef
jmp 0x5f73
cmpl $0xf1, %esi
jne 0x5f65
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4dbf(%rip), %rdi      # 0xad2b
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: seg_comp
int seg_comp(const void *a, const void *b) {
  const xlink_segment *seg_a;
  const xlink_segment *seg_b;
  seg_a = *(xlink_segment **)a;
  seg_b = *(xlink_segment **)b;
  if (xlink_segment_get_class(seg_a) == xlink_segment_get_class(seg_b)) {
    if (seg_a->attrib.proc == seg_b->attrib.proc) {
      if (seg_a->module == seg_b->module) {
        return seg_a->index - seg_b->index;
      }
      return seg_a->module->index - seg_b->module->index;
    }
    return seg_a->attrib.proc - seg_b->attrib.proc;
  }
  return xlink_segment_get_class(seg_a) - xlink_segment_get_class(seg_b);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq (%rdi), %r15
movq (%rsi), %r14
movq 0x28(%r15), %rdi
addq $0x10, %rdi
leaq 0x4d9f(%rip), %rsi      # 0xad68
callq 0x2110
movl %eax, %ebx
xorl %ebp, %ebp
movl $0x0, %r12d
testl %eax, %eax
je 0x5fec
movl 0x30(%r15), %eax
andl $0x1, %eax
movl $0x2, %r12d
subl %eax, %r12d
movq 0x28(%r14), %rdi
addq $0x10, %rdi
leaq 0x4d6d(%rip), %rsi      # 0xad68
callq 0x2110
movl %eax, %ecx
testl %eax, %eax
je 0x6014
movl 0x30(%r14), %eax
andl $0x1, %eax
movl $0x2, %ebp
subl %eax, %ebp
cmpl %ebp, %r12d
jne 0x6042
movzbl 0x10(%r15), %eax
andl $0x1, %eax
movzbl 0x10(%r14), %ecx
andl $0x1, %ecx
cmpb %cl, %al
jne 0x606a
movq 0x8(%r15), %rax
movq 0x8(%r14), %rcx
cmpq %rcx, %rax
je 0x606e
movl 0x8(%rax), %eax
subl 0x8(%rcx), %eax
jmp 0x6074
xorl %eax, %eax
movl $0x0, %edx
testl %ebx, %ebx
je 0x605b
movl 0x30(%r15), %esi
andl $0x1, %esi
movl $0x2, %edx
subl %esi, %edx
testl %ecx, %ecx
je 0x6066
movl 0x30(%r14), %eax
orl $-0x2, %eax
addl %edx, %eax
jmp 0x6074
subl %ecx, %eax
jmp 0x6074
movl (%r15), %eax
subl (%r14), %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_binary_link_root_segment
void xlink_binary_link_root_segment(xlink_binary *bin, xlink_segment *root) {
  int i;
  xlink_binary_process_segment(bin, root);
  for (i = 1; i <= bin->nexterns; i++) {
    xlink_extern *ext;
    ext = xlink_binary_get_extern(bin, i);
    if (ext->is_local) {
      ext->public = xlink_module_find_public(ext->module, ext->name);
    }
    else {
      ext->public = xlink_binary_find_public(bin, ext->name);
    }
    if (ext->public->segment != NULL) {
      xlink_binary_process_segment(bin, ext->public->segment);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x3842
cmpl $0x0, 0x60(%rbx)
jle 0x60e7
xorl %ebp, %ebp
incl %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x37ec
movq %rax, %r14
cmpl $0x0, 0x114(%rax)
je 0x60bb
movq 0x8(%r14), %rdi
movq %r14, %rsi
addq $0x10, %rsi
callq 0x328e
jmp 0x60ca
movq %r14, %rsi
addq $0x10, %rsi
movq %rbx, %rdi
callq 0x3568
movq %rax, 0x118(%r14)
movq 0x18(%rax), %rsi
testq %rsi, %rsi
je 0x60e2
movq %rbx, %rdi
callq 0x3842
cmpl 0x60(%rbx), %ebp
jl 0x6091
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_sort_segments
void xlink_sort_segments(xlink_segment **segments, int nsegments, int *data_idx,
 int *bss_idx) {
  int i;
  qsort(segments, nsegments, sizeof(xlink_segment *), seg_comp);
  if (data_idx != NULL) {
    for (i = 0; i < nsegments; i++) {
      if (xlink_segment_get_class(segments[i]) == OMF_SEGMENT_DATA) break;
    }
    *data_idx = i;
  }
  if (bss_idx != NULL) {
    for (i = 0; i < nsegments; i++) {
      if (xlink_segment_get_class(segments[i]) == OMF_SEGMENT_BSS) break;
    }
    *bss_idx = i;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r15
movq %rdx, %r13
movl %esi, %ebp
movq %rdi, %r14
movslq %esi, %r12
leaq -0x163(%rip), %rcx      # 0x5fac
movl $0x8, %edx
movq %r12, %rsi
callq 0x2070
movl %r12d, %ebx
testq %r13, %r13
je 0x6178
movq %r13, 0x10(%rsp)
testl %ebp, %ebp
jle 0x616d
movq %r15, 0x8(%rsp)
xorl %r13d, %r13d
leaq 0x4c2c(%rip), %r12      # 0xad68
movq (%r14,%r13,8), %r15
movq 0x28(%r15), %rdi
addq $0x10, %rdi
movq %r12, %rsi
callq 0x2110
testl %eax, %eax
je 0x615b
testb $0x1, 0x30(%r15)
jne 0x6166
incq %r13
cmpq %r13, %rbx
jne 0x613c
movl %ebx, %r13d
movq 0x8(%rsp), %r15
jmp 0x6170
xorl %r13d, %r13d
movq 0x10(%rsp), %rax
movl %r13d, (%rax)
testq %r15, %r15
je 0x61c3
testl %ebp, %ebp
jle 0x61bd
movq %r15, %rbp
xorl %r12d, %r12d
leaq 0x4bda(%rip), %r15      # 0xad68
movq (%r14,%r12,8), %r13
movq 0x28(%r13), %rdi
addq $0x10, %rdi
movq %r15, %rsi
callq 0x2110
testl %eax, %eax
je 0x61ad
testb $0x1, 0x30(%r13)
je 0x61b8
incq %r12
cmpq %r12, %rbx
jne 0x618e
movl %ebx, %r12d
movq %rbp, %r15
jmp 0x61c0
xorl %r12d, %r12d
movl %r12d, (%r15)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_set_first_segment
void xlink_set_first_segment(xlink_segment **segments, xlink_segment *first) {
  int i;
  for (i = 0; segments[i] != first; i++);
  memmove(&segments[1], &segments[0], sizeof(*segments)*i);
  segments[0] = first;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq $-0x8, %rdx
movq %rdx, %rax
addq $0x8, %rdx
cmpq %rbx, 0x8(%r14,%rax)
jne 0x61e3
leaq 0x8(%r14), %rdi
movq %r14, %rsi
callq 0x21a0
movq %rbx, (%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_binary_layout_segments
void xlink_binary_layout_segments(xlink_binary *bin, int index, int offset) {
  int i;
  for (i = index + 1; i <= bin->nsegments; i++) {
    xlink_segment *seg;
    seg = xlink_binary_get_segment(bin, i);
    /* If this is a 32-bit program, move all 32-bit BSS above the first 64k */
    if (bin->is_32bit && seg->attrib.proc == OMF_SEGMENT_USE32 &&
     xlink_segment_get_class(seg) == OMF_SEGMENT_BSS && offset < 0x10000) {
      offset = 0x10000;
    }
    offset = ALIGN2(offset, xlink_segment_get_alignment(seg));
    seg->start = offset;
    offset += seg->length;
  }
  XLINK_ERROR(!bin->is_32bit && offset > 65536,
   ("Address space exceeds 65536 bytes, %i", offset));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rdi, %rbx
cmpl %esi, 0x50(%rdi)
jle 0x62b6
movl %esi, %ebp
leaq 0x4b3d(%rip), %r14      # 0xad68
incl %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3759
movq %rax, %r12
cmpl $0x0, 0x64(%rbx)
je 0x6275
testb $0x1, 0x10(%r12)
je 0x6275
movq 0x28(%r12), %rdi
addq $0x10, %rdi
movq %r14, %rsi
callq 0x2110
testl %eax, %eax
je 0x6275
testb $0x1, 0x30(%r12)
jne 0x6275
cmpl $0x10001, %r15d         # imm = 0x10001
movl $0x10000, %eax          # imm = 0x10000
cmovll %eax, %r15d
movq %r12, %rdi
callq 0x2747
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl %eax, %ecx
shll %cl, %r13d
notl %r13d
addl %r15d, %r13d
movq %r12, %rdi
callq 0x2747
movl %eax, %ecx
shrl %cl, %r13d
shll %cl, %r13d
movl %r13d, 0x7c(%r12)
addl 0x1c(%r12), %r13d
movl %r13d, %r15d
cmpl 0x50(%rbx), %ebp
jl 0x622b
jmp 0x62b9
movl %r15d, %r13d
cmpl $0x0, 0x64(%rbx)
jne 0x62c8
cmpl $0x10001, %r13d         # imm = 0x10001
jge 0x62d7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4a8f(%rip), %rdi      # 0xad6d
movl %r13d, %esi
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_binary_extract_class
int xlink_binary_extract_class(xlink_binary *bin, int index, int offset,
 xlink_segment_class class, xlink_list *bytes) {
  int i;
  for (i = index + 1; i <= bin->nsegments; i++) {
    xlink_segment *seg;
    seg = xlink_binary_get_segment(bin, i);
    if (xlink_segment_get_class(seg) != class) break;
    XLINK_ERROR(seg->info & SEG_HAS_DATA == 0,
     ("Error segment %s has no data", xlink_segment_get_name(seg)));
    if (offset != seg->start) {
      unsigned char buf[4096];
      memset(buf, 0, 4096);
      xlink_list_add_all(bytes, buf, seg->start - offset);
      offset = seg->start;
    }
    xlink_list_add_all(bytes, seg->data, seg->length);
    offset += seg->length;
  }
  return offset;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1018, %rsp           # imm = 0x1018
movl %edx, %ebp
cmpl %esi, 0x50(%rdi)
jle 0x63e2
movq %r8, %rbx
movl %ecx, %r14d
movl %esi, %r15d
movq %rdi, %r12
movq %rdi, 0x8(%rsp)
incl %r15d
movq %r12, %rdi
movl %r15d, %esi
callq 0x3759
movq %rax, %r13
movq 0x28(%rax), %rdi
addq $0x10, %rdi
leaq 0x4a00(%rip), %rsi      # 0xad68
callq 0x2110
movl $0x0, %ecx
testl %eax, %eax
je 0x6384
movl 0x30(%r13), %eax
andl $0x1, %eax
movl $0x2, %ecx
subl %eax, %ecx
cmpl %r14d, %ecx
jne 0x63e2
cmpl 0x7c(%r13), %ebp
je 0x63c3
movl $0x1000, %edx           # imm = 0x1000
movl %r14d, %r12d
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x20d0
movl 0x7c(%r13), %edx
subl %ebp, %edx
movq %rbx, %rdi
movq %r14, %rsi
movl %r12d, %r14d
movq 0x8(%rsp), %r12
callq 0x95b4
movl 0x7c(%r13), %ebp
movq 0x38(%r13), %rsi
movl 0x1c(%r13), %edx
movq %rbx, %rdi
callq 0x95b4
addl 0x1c(%r13), %ebp
cmpl 0x50(%r12), %r15d
jl 0x6348
movl %ebp, %eax
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_model_search
void xlink_model_search(xlink_list *models, xlink_list *bytes) {
  xlink_modeler mod;
  /* Build a context modeler for bytes */
  xlink_modeler_init(&mod, xlink_list_length(bytes));
  xlink_modeler_load_binary(&mod, bytes);
  /* Search for the best context to use for bytes */
  xlink_list_empty(models);
  xlink_modeler_search(&mod, models);
  XLINK_ERROR(xlink_list_length(models) == 0,
   ("Error no context models found for bytes"));
  xlink_modeler_clear(&mod);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x90, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x94be
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movl %eax, %esi
callq 0x8c0c
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8c89
movq %r14, %rdi
callq 0x94c2
movq %r15, %rdi
movq %r14, %rsi
callq 0x9156
movq %r14, %rdi
callq 0x94be
testl %eax, %eax
je 0x6460
leaq 0x8(%rsp), %rdi
callq 0x8c6a
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x492c(%rip), %rdi      # 0xad93
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_decoder_test_bytes
void xlink_decoder_test_bytes(xlink_decoder *dec, xlink_list *bytes) {
  int i;
  for (i = 0; i < xlink_list_length(bytes); i++) {
    unsigned char orig;
    unsigned char byte;
    orig = *xlink_list_get_byte(bytes, i);
    byte = xlink_decoder_read_byte(dec);
    XLINK_ERROR(byte != orig,
     ("Decoder mismatch %02x != %02x at pos = %i", byte, orig, i));
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x94be
testl %eax, %eax
jle 0x650c
xorl %ebp, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x9507
movzbl (%rax), %r15d
movq %r14, %rdi
callq 0x8494
cmpb %r15b, %al
jne 0x6517
incl %ebp
movq %rbx, %rdi
callq 0x94be
cmpl %eax, %ebp
jl 0x64e3
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movzbl %al, %esi
leaq 0x489a(%rip), %rdi      # 0xadbb
movl %r15d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_bitstream_from_context
void xlink_bitstream_from_context(xlink_bitstream *bs, xlink_context *ctx,
 xlink_list *bytes) {
  xlink_encoder enc;
  xlink_decoder dec;
  bs->bytes.length = 0;
  /* Reset the context */
  xlink_context_reset(ctx);
  /* Encode bytes with the context */
  xlink_encoder_init(&enc, ctx);
  xlink_encoder_write_bytes(&enc, bytes);
  /* Finalize the bitstream */
  xlink_encoder_finalize(&enc, bs);
  xlink_encoder_clear(&enc);
  /* Reset the context */
  xlink_context_reset(ctx);
  /* Initialize the decoder with the context and bitstream */
  xlink_decoder_init(&dec, ctx, bs);
  /* Test that decoded bytes match original input */
  xlink_decoder_test_bytes(&dec, bytes);
  xlink_decoder_clear(&dec);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movl $0x0, 0x10(%rdi)
movq %rsi, %rdi
callq 0x8a75
leaq 0x30(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x7ee6
movq %r12, %rdi
movq %rbx, %rsi
callq 0x7ff0
movq %r12, %rdi
movq %r14, %rsi
callq 0x8100
movq %r12, %rdi
callq 0x7fe7
movq %r15, %rdi
callq 0x8a75
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x8352
movq %r12, %rdi
movq %rbx, %rsi
callq 0x64c8
movq %r12, %rdi
callq 0x8493
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_binary_load_modules
void xlink_binary_load_modules(xlink_binary *bin) {
  int i;
  for (i = 0; i < sizeof(XLINK_STUB_MODULES)/sizeof(xlink_file); i++) {
    xlink_file file;
    file = XLINK_STUB_MODULES[i];
    if (strstr(file.name, "stub32") == NULL) {
      xlink_module *mod;
      mod = xlink_file_load_omf_module(&file, 0);
      XLINK_LIST_ADD(binary, module, bin, mod);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %r13d, %r13d
leaq 0x9115(%rip), %rbp      # 0xf850
leaq 0x46a3(%rip), %r14      # 0xade5
movq %rsp, %r15
movups (%r13,%rbp), %xmm0
movaps %xmm0, (%rsp)
movq 0x10(%r13,%rbp), %rax
movq %rax, 0x10(%rsp)
movq (%rsp), %rdi
movq %r14, %rsi
callq 0x2230
testq %rax, %rax
jne 0x67af
movq %r15, %rdi
xorl %esi, %esi
callq 0x4c62
movq %rax, %r12
movl 0x30(%rbx), %eax
incl %eax
movl %eax, 0x8(%r12)
movq %rbx, 0x10(%r12)
movslq 0x30(%rbx), %rax
leaq 0x1(%rax), %rcx
movl %ecx, 0x30(%rbx)
movq 0x28(%rbx), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x8540
movq %rax, 0x28(%rbx)
movslq 0x30(%rbx), %rcx
movq %r12, -0x8(%rax,%rcx,8)
addq $0x18, %r13
cmpq $0x270, %r13            # imm = 0x270
jne 0x6745
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_binary_load_stub
void xlink_binary_load_stub(xlink_binary *bin, const char *stub) {
  char buf[1024];
  xlink_module *mod;
  int i;
  sprintf(buf, "stubs/%s.o", stub);
  mod = NULL;
  for (i = 0; i < sizeof(XLINK_STUB_MODULES)/sizeof(xlink_file); i++) {
    xlink_file file;
    file = XLINK_STUB_MODULES[i];
    if (strcmp(file.name, buf) == 0) {
      mod = xlink_file_load_omf_module(&file, 0);
      XLINK_LIST_ADD(binary, module, bin, mod);
      break;
    }
  }
  XLINK_ERROR(mod == NULL, ("Stub %s not found", stub));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x420, %rsp            # imm = 0x420
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4604(%rip), %rsi      # 0xadec
xorl %r12d, %r12d
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x21e0
leaq 0x904c(%rip), %r13      # 0xf850
movups (%r12,%r13), %xmm0
movaps %xmm0, (%rsp)
movq 0x10(%r12,%r13), %rax
movq %rax, 0x10(%rsp)
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x2110
testl %eax, %eax
je 0x684f
addq $0x18, %r12
cmpq $0x270, %r12            # imm = 0x270
jne 0x6804
leaq 0x45bc(%rip), %rdi      # 0xadf7
movq %r14, %rsi
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
movq %rsp, %rdi
xorl %esi, %esi
callq 0x4c62
movq %rax, %r14
movl 0x30(%rbx), %eax
incl %eax
movl %eax, 0x8(%r14)
movq %rbx, 0x10(%r14)
movslq 0x30(%rbx), %rax
leaq 0x1(%rax), %rcx
movl %ecx, 0x30(%rbx)
movq 0x28(%rbx), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x8540
movq %rax, 0x28(%rbx)
movslq 0x30(%rbx), %rcx
movq %r14, -0x8(%rax,%rcx,8)
addq $0x420, %rsp            # imm = 0x420
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_binary_find_segment_by_public
xlink_segment *xlink_binary_find_segment_by_public(xlink_binary *bin,
 const char *public, xlink_segment_class class) {
  xlink_segment *seg;
  seg = xlink_binary_find_public(bin, public)->segment;
  XLINK_ERROR(xlink_segment_get_class(seg) != class,
   ("Public %s found in segment %s, but class %s not '%s'", public,
   xlink_segment_get_name(seg), xlink_segment_get_class_name(seg),
   XLINK_SEGMENT_CLASS_NAME[class]));
  return seg;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %rbx
callq 0x3568
movq 0x18(%rax), %r14
movq 0x28(%r14), %rdi
addq $0x10, %rdi
leaq 0x44a4(%rip), %rsi      # 0xad68
callq 0x2110
testl %eax, %eax
je 0x68dd
movl 0x30(%r14), %ecx
andl $0x1, %ecx
movl $0x2, %eax
subl %ecx, %eax
jmp 0x68df
xorl %eax, %eax
cmpl %ebp, %eax
jne 0x68eb
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
movq %r14, %rdi
callq 0x26f9
movq %r14, %rdi
callq 0x2721
movl %ebp, %eax
leaq 0x3864(%rip), %rcx      # 0xa168
movslq (%rcx,%rax,4), %r8
addq %rcx, %r8
leaq 0x44f7(%rip), %rdi      # 0xae09
leaq 0xc717(%rip), %rdx      # 0x13030
leaq 0xc810(%rip), %rcx      # 0x13130
movq %rbx, %rsi
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_binary_write_map
void xlink_binary_write_map(xlink_binary *bin) {
  FILE *out;
  out = fopen(bin->map, "w");
  xlink_binary_print_map(bin, out);
  fclose(out);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
leaq 0x4971(%rip), %rsi      # 0xb2b7
callq 0x21b0
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3959
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2090
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_binary_write_com
void xlink_binary_write_com(xlink_binary *bin, int nsegments) {
  FILE *out;
  int i;
  int offset;
  out = fopen(bin->output, "wb");
  XLINK_ERROR(out == NULL, ("Unable to open output file '%s'", bin->output));
  for (offset = 0x100, i = 1; i <= nsegments; i++) {
    xlink_segment *seg;
    seg = xlink_binary_get_segment(bin, i);
    if (seg->info & SEG_HAS_DATA) {
      if (offset != seg->start) {
        unsigned char buf[4096];
        memset(buf, 0, 4096);
        fwrite(buf, 1, seg->start - offset, out);
        offset = seg->start;
      }
      fwrite(seg->data, 1, seg->length, out);
      offset += seg->length;
    }
  }
  fclose(out);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1018, %rsp           # imm = 0x1018
movl %esi, %r14d
movq %rdi, %rbx
movq (%rdi), %rdi
leaq 0x44b5(%rip), %rsi      # 0xae3e
callq 0x21b0
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x6a47
testl %r14d, %r14d
jle 0x6a2c
negl %r14d
movl $0x100, %r12d           # imm = 0x100
movl $0x1, %r13d
movq %rbx, %rdi
movl %r13d, %esi
callq 0x3759
testb $0x1, 0x30(%rax)
je 0x6a19
movq %rax, %rbp
movl 0x7c(%rax), %r15d
subl %r12d, %r15d
je 0x69fe
movl $0x1000, %edx           # imm = 0x1000
leaq 0x10(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x20d0
movslq %r15d, %rdx
movl $0x1, %esi
movq %r12, %rdi
movq 0x8(%rsp), %rcx
callq 0x2200
movl 0x7c(%rbp), %r12d
movq 0x38(%rbp), %rdi
movslq 0x1c(%rbp), %rdx
movl $0x1, %esi
movq 0x8(%rsp), %rcx
callq 0x2200
addl 0x1c(%rbp), %r12d
leal (%r14,%r13), %eax
incl %eax
movl %r13d, %ecx
incl %ecx
movl %ecx, %r13d
cmpl $0x1, %eax
jne 0x69b4
movq 0x8(%rsp), %rdi
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2090
movq (%rbx), %rsi
leaq 0x43f0(%rip), %rdi      # 0xae41
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_segment_find_reloc
xlink_reloc *xlink_segment_find_reloc(xlink_segment *seg, const char *name) {
  xlink_reloc *ret;
  int i;
  ret = NULL;
  for (i = 1; i <= seg->nrelocs; i++) {
    xlink_reloc *rel;
    rel = xlink_segment_get_reloc(seg, i);
    if (rel->target == OMF_TARGET_EXT) {
      xlink_extern *ext;
      ext = xlink_module_get_extern(seg->module, rel->target_idx);
      if (strcmp(ext->name, name) == 0) {
        XLINK_ERROR(ret != NULL,
         ("Duplicate relocation definition found for name %s in %s", name,
         seg->module->filename));
        ret = rel;
        break;
      }
    }
  }
  XLINK_ERROR(ret == NULL, ("No relocation found for extern name %s", name));
  return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
cmpl $0x0, 0x78(%rdi)
jle 0x6aae
movq %rdi, %r14
xorl %ebp, %ebp
incl %ebp
movq %r14, %rdi
movl %ebp, %esi
callq 0x264e
cmpl $0x6, 0x28(%rax)
jne 0x6aa8
movq %rax, %r15
movq 0x8(%r14), %rdi
movl 0x30(%rax), %esi
callq 0x30ee
leaq 0x10(%rax), %rdi
movq %rbx, %rsi
callq 0x2110
testl %eax, %eax
je 0x6ac9
cmpl 0x78(%r14), %ebp
jl 0x6a77
leaq 0x43ac(%rip), %rdi      # 0xae61
movq %rbx, %rsi
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_binary_get_relative_byte
unsigned char xlink_binary_get_relative_byte(xlink_binary *bin,
 xlink_segment *prog, int relative) {
  int prog_idx;
  int i;
  unsigned char byte;
  XLINK_ERROR(relative >= 0,
   ("Relative byte index should be negative, %i", relative));
  for (prog_idx = bin->nsegments; prog_idx-- > 0; ) {
    if (bin->segments[prog_idx] == prog) {
      break;
    }
  }
  XLINK_ERROR(prog_idx < 0, ("PROG segment index not found"));
  for (i = prog_idx; relative < 0 && i-- > 0; ) {
    relative += bin->segments[i + 1]->start - bin->segments[i]->start;
  }
  XLINK_ERROR(i < 0, ("Relative byte %i bytes before program start", relative));
  byte = 0;
  if (relative <= bin->segments[i]->length) {
    byte = bin->segments[i]->data[relative];
  }
  return byte;
}

// Assembly:
pushq %rax
testl %edx, %edx
jns 0x6b52
movl 0x50(%rdi), %eax
movq %rax, %r8
decq %r8
testl %eax, %eax
jle 0x6b28
movq 0x48(%rdi), %rcx
decl %eax
leaq -0x1(%r8), %r9
cmpq %rsi, (%rcx,%r8,8)
movq %r9, %r8
jne 0x6ae5
testl %eax, %eax
jle 0x6b38
movl %eax, %esi
decl %eax
movq (%rcx,%rsi,8), %rdi
movq (%rcx,%rax,8), %rsi
addl 0x7c(%rdi), %edx
subl 0x7c(%rsi), %edx
js 0x6afc
cmpl 0x1c(%rsi), %edx
jle 0x6b1d
xorl %eax, %eax
jmp 0x6b26
movq 0x38(%rsi), %rax
movl %edx, %ecx
movb (%rax,%rcx), %al
popq %rcx
retq
leaq 0x4384(%rip), %rdi      # 0xaeb3
xorl %eax, %eax
callq 0x22ef
jmp 0x6b48
leaq 0x4391(%rip), %rdi      # 0xaed0
movl %edx, %esi
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
leaq 0x432f(%rip), %rdi      # 0xae88
jmp 0x6b3f
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/xlink.c
// Function: xlink_parity
int xlink_parity(unsigned char byte) {
  int bits;
  bits = 0;
  while (byte > 0) {
    bits += byte & 1;
    byte >>= 1;
  }
  return bits & 1;
}

// Assembly:
xorl %eax, %eax
testl %edi, %edi
je 0x6b74
movzbl %dil, %ecx
addl %ecx, %eax
movl %ecx, %edi
shrb %dil
cmpb $0x1, %cl
ja 0x6b61
andl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/ec.c
// Function: xlink_encoder_init
void xlink_encoder_init(xlink_encoder *enc, xlink_context *ctx) {
  enc->ctx = ctx;
  xlink_list_init(&enc->bytes, sizeof(unsigned char), 0);
  enc->bits = 0;
  enc->low = 0;
  enc->range = EC_BASE;
  enc->zero = 0;
  enc->ones = 0;
  /* Start by writing a 1 bit, this is necessary for decoder implementation */
  xlink_encoder_write_bit(enc, 1, 1, 1);
  /* Update the context with 1 bit */
  xlink_context_update_bit(enc->ctx, 0, 1);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq %rsi, (%rdi)
addq $0x8, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x948c
movaps 0x3e0c(%rip), %xmm0     # 0xbd10
movups %xmm0, 0x20(%rbx)
movl $0x0, 0x30(%rbx)
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x7f36
movq (%rbx), %rdi
xorl %esi, %esi
movl $0x1, %edx
popq %rbx
jmp 0x8b37
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/ec.c
// Function: xlink_encoder_write_bit
static void xlink_encoder_write_bit(xlink_encoder *enc, xlink_word c0,
 xlink_word c1, int bit) {
  xlink_word s;
  XLINK_ERROR(c0 == 0 || c1 == 0 || (c0 > EC_MASK - c1),
   ("Error invalid counts, c0 = %i and c1 = %i", c0, c1));
  s = ((xlink_dword)enc->range)*c1/(c0 + c1);
  enc->range = bit ? s : enc->range - s;
  if (!bit) {
    /* Handle carry */
    if (s > EC_MASK - enc->low) {
      xlink_encoder_emit(enc, 1);
    }
    enc->low += s;
  }
  /* Normalize */
  while (enc->range < EC_BASE) {
    if (enc->low & EC_BASE) {
      enc->ones++;
    }
    else {
      xlink_encoder_emit(enc, 0);
    }
    enc->low <<= 1;
    enc->range <<= 1;
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %eax
negl %eax
cmpl %edx, %eax
jbe 0x7fcf
testl %edx, %edx
je 0x7fcf
movq %rdi, %rbx
movl 0x28(%rdi), %edi
movl %edx, %eax
imulq %rdi, %rax
addl %edx, %esi
xorl %edx, %edx
divq %rsi
movq %rax, %r14
subl %r14d, %edi
testl %ecx, %ecx
cmovel %edi, %eax
movl %eax, 0x28(%rbx)
jne 0x7f97
movl 0x24(%rbx), %eax
movl %eax, %ecx
addl %r14d, %ecx
jae 0x7f8e
movq %rbx, %rdi
movl $0x1, %esi
callq 0x81d6
movl 0x24(%rbx), %eax
movl 0x28(%rbx), %edi
addl %r14d, %eax
movl %eax, 0x24(%rbx)
movl %edi, %r14d
testl %r14d, %r14d
js 0x7fc7
movl 0x24(%rbx), %eax
testl %eax, %eax
js 0x7fb6
movq %rbx, %rdi
xorl %esi, %esi
callq 0x81d6
movl 0x24(%rbx), %eax
movl 0x28(%rbx), %r14d
jmp 0x7fb9
incl 0x30(%rbx)
addl %eax, %eax
movl %eax, 0x24(%rbx)
addl %r14d, %r14d
movl %r14d, 0x28(%rbx)
jns 0x7f9f
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x3de5(%rip), %rdi      # 0xbdbb
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/ec.c
// Function: xlink_encoder_write_bytes
void xlink_encoder_write_bytes(xlink_encoder *enc, xlink_list *bytes) {
  int i, j;
  for (j = 0; j < xlink_list_length(bytes); j++) {
    unsigned char byte;
    unsigned char partial;
    byte = *xlink_list_get_byte(bytes, j);
    partial = 1;
    /* Build partially seen byte from high bit to low bit to match decoder. */
    for (i = 8; i-- > 0; ) {
      unsigned int counts[2];
      int bit;
      xlink_context_get_counts(enc->ctx, partial, counts);
      bit = !!(byte & (1 << i));
      xlink_encoder_write_bit(enc, counts[0], counts[1], bit);
      xlink_context_update_bit(enc->ctx, partial, bit);
      partial <<= 1;
      partial |= bit;
    }
    XLINK_ERROR(partial != byte,
     ("Mismatch between partial %02x and byte %02x", partial, byte));
    for (i = 8; i-- > 1; ) {
      enc->ctx->buf[i] = enc->ctx->buf[i - 1];
    }
    enc->ctx->buf[0] = byte;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x94be
testl %eax, %eax
jle 0x80d2
xorl %ebp, %ebp
leaq 0x8(%rsp), %r15
movq %rbx, 0x10(%rsp)
movq %rbx, %rdi
movl %ebp, 0x4(%rsp)
movl %ebp, %esi
callq 0x9507
movb (%rax), %al
movb %al, 0x3(%rsp)
movzbl %al, %r12d
movb $0x1, %r13b
movl $0x9, %ebp
movq (%r14), %rdi
movzbl %r13b, %ebx
movl %ebx, %esi
movq %r15, %rdx
callq 0x8a8e
leal -0x2(%rbp), %eax
movzbl %al, %eax
xorl %r13d, %r13d
btl %eax, %r12d
setb %r13b
movl 0x8(%rsp), %esi
movl 0xc(%rsp), %edx
movq %r14, %rdi
movl %r13d, %ecx
callq 0x7f36
movq (%r14), %rdi
movl %ebx, %esi
movl %r13d, %edx
callq 0x8b37
addb %bl, %bl
orb %bl, %r13b
decl %ebp
cmpl $0x1, %ebp
ja 0x8040
movb 0x3(%rsp), %sil
cmpb %sil, %r13b
jne 0x80e1
movl $0x9, %eax
movq 0x10(%rsp), %rbx
movl 0x4(%rsp), %ebp
movq (%r14), %rcx
movb -0x3(%rcx,%rax), %dl
movb %dl, -0x2(%rcx,%rax)
decq %rax
cmpq $0x2, %rax
ja 0x80a6
movq (%r14), %rax
movb %sil, (%rax)
incl %ebp
movq %rbx, %rdi
callq 0x94be
cmpl %eax, %ebp
jl 0x8020
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzbl %r13b, %esi
leaq 0x3c44(%rip), %rdi      # 0xbd30
movl %r12d, %edx
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/ec.c
// Function: xlink_encoder_finalize
void xlink_encoder_finalize(xlink_encoder *enc, xlink_bitstream *bs) {
  xlink_word m;
  int s;
  int i;
  m = EC_BASE - 1;
  /* Count how many bits must be output to ensure that the symbols encoded thus
      far will decode correctly regardless of the bits that follow. */
  for (s = 1; ((enc->low + m) | m) - enc->low >= enc->range; s++, m >>= 1);
  XLINK_ERROR(s > 2,
   ("At most two bits need to be written to finalize range coder"));
  if (m > EC_MASK - enc->low) {
    /* Handle carry */
    xlink_encoder_emit(enc, 1);
  }
  for (i = 0; i < s; i++) {
    if ((enc->low + m) & (EC_BASE >> i)) {
      enc->ones++;
    }
    else {
      xlink_encoder_emit(enc, 0);
    }
  }
  /* Flush any pending bits */
  xlink_encoder_emit(enc, 0);
  /* Copy finalized bits to bitstream */
  bs->bits = enc->bits;
  bs->bytes.length = 0;
  xlink_list_append(&bs->bytes, &enc->bytes);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x24(%rdi), %eax
movl 0x28(%rdi), %ecx
movl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
leal (%rax,%r15), %edx
orl %r15d, %edx
subl %eax, %edx
movl $0x1, %r12d
cmpl %ecx, %edx
jb 0x8152
movl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %r12d, %r12d
shrl %r15d
leal (%rax,%r15), %edx
orl %r15d, %edx
subl %eax, %edx
incl %r12d
cmpl %ecx, %edx
jae 0x8136
cmpl $0x2, %r12d
jae 0x81be
incl %r12d
addl %r15d, %eax
jae 0x8164
movq %r14, %rdi
movl $0x1, %esi
callq 0x81d6
xorl %ebp, %ebp
movl 0x24(%r14), %eax
addl %r15d, %eax
movl %ebp, %ecx
shll %cl, %eax
testl $0x80000000, %eax       # imm = 0x80000000
je 0x817e
incl 0x30(%r14)
jmp 0x8188
movq %r14, %rdi
xorl %esi, %esi
callq 0x81d6
incl %ebp
cmpl %ebp, %r12d
jne 0x8166
movq %r14, %rdi
xorl %esi, %esi
callq 0x81d6
movl 0x20(%r14), %eax
movl %eax, 0x18(%rbx)
movl $0x0, 0x10(%rbx)
addq $0x8, %r14
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x95f9
leaq 0x3b97(%rip), %rdi      # 0xbd5c
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/ec.c
// Function: xlink_encoder_emit
static void xlink_encoder_emit(xlink_encoder *enc, int bit) {
  XLINK_ERROR(bit == 1 && enc->zero == 0,
   ("Got a carry, but have not seen a zero to propogate it into yet"));
  if (bit == 0) {
    if (enc->zero) {
      xlink_encoder_store(enc, 0);
    }
    while (enc->ones > 0) {
      xlink_encoder_store(enc, 1);
      enc->ones--;
    }
    enc->zero = 1;
  }
  else {
    xlink_encoder_store(enc, 1);
    enc->zero = enc->ones > 0;
    while (enc->ones > 1) {
      xlink_encoder_store(enc, 0);
      enc->ones--;
    }
    enc->ones = 0;
  }
  enc->bytes.length = (enc->bits + 7)/8;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
je 0x828e
cmpl $0x1, %esi
jne 0x81f4
cmpl $0x0, 0x2c(%rbx)
je 0x833a
leaq 0x8(%rbx), %r14
movl 0x20(%rbx), %esi
andl $-0x8, %esi
incl %esi
movq %r14, %rdi
callq 0x94ca
movq 0x8(%rbx), %rax
movl 0x20(%rbx), %ecx
movl %ecx, %edx
sarl $0x3, %edx
movslq %edx, %rdx
andb $0x7, %cl
movl $0x1, %esi
shll %cl, %esi
orb %sil, (%rax,%rdx)
movl 0x20(%rbx), %esi
movl 0x30(%rbx), %eax
incl %esi
movl %esi, 0x20(%rbx)
xorl %ecx, %ecx
testl %eax, %eax
setg %cl
movl %ecx, 0x2c(%rbx)
cmpl $0x2, %eax
jl 0x8282
andl $-0x8, %esi
incl %esi
movq %r14, %rdi
callq 0x94ca
movq 0x8(%rbx), %rax
movl 0x20(%rbx), %ecx
movl %ecx, %edx
sarl $0x3, %edx
movslq %edx, %rdx
andb $0x7, %cl
movl $0x1, %esi
shll %cl, %esi
notb %sil
andb %sil, (%rax,%rdx)
movl 0x20(%rbx), %esi
movl 0x30(%rbx), %eax
incl %esi
movl %esi, 0x20(%rbx)
leal -0x1(%rax), %ecx
movl %ecx, 0x30(%rbx)
cmpl $0x2, %eax
jg 0x823f
movl $0x0, 0x30(%rbx)
jmp 0x8321
cmpl $0x0, 0x2c(%rbx)
je 0x82c8
leaq 0x8(%rbx), %rdi
movl 0x20(%rbx), %esi
andl $-0x8, %esi
incl %esi
callq 0x94ca
movq 0x8(%rbx), %rax
movl 0x20(%rbx), %ecx
movl %ecx, %edx
sarl $0x3, %edx
movslq %edx, %rdx
andb $0x7, %cl
movl $0x1, %esi
shll %cl, %esi
notb %sil
andb %sil, (%rax,%rdx)
incl 0x20(%rbx)
cmpl $0x0, 0x30(%rbx)
jle 0x8317
leaq 0x8(%rbx), %r14
movl 0x20(%rbx), %esi
andl $-0x8, %esi
incl %esi
movq %r14, %rdi
callq 0x94ca
movq 0x8(%rbx), %rax
movl 0x20(%rbx), %ecx
movl %ecx, %edx
sarl $0x3, %edx
andb $0x7, %cl
movl $0x1, %esi
shll %cl, %esi
movslq %edx, %rcx
orb %sil, (%rax,%rcx)
movl 0x20(%rbx), %esi
movl 0x30(%rbx), %eax
incl %esi
movl %esi, 0x20(%rbx)
leal -0x1(%rax), %ecx
movl %ecx, 0x30(%rbx)
cmpl $0x1, %eax
jg 0x82d5
jmp 0x831a
movl 0x20(%rbx), %esi
movl $0x1, 0x2c(%rbx)
leal 0x7(%rsi), %eax
addl $0xe, %esi
testl %eax, %eax
cmovnsl %eax, %esi
sarl $0x3, %esi
movl %esi, 0x18(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x3aa4(%rip), %rdi      # 0xbde5
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/ec.c
// Function: xlink_decoder_init
void xlink_decoder_init(xlink_decoder *dec, xlink_context *ctx,
 xlink_bitstream *bs) {
  dec->ctx = ctx;
  dec->bytes = &bs->bytes;
  dec->bits = bs->bits;
  dec->pos = 1;
  dec->low = 0;
  dec->range = 1;
  dec->value = 0;
  /* Discard first bit */
  XLINK_ERROR(xlink_decoder_read_bit(dec, 1, 1) == 0,
   ("Expected first decoded bit to be 1"));
  /* Update the context with 1 bit */
  xlink_context_update_bit(dec->ctx, 0, 1);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq %rsi, (%rdi)
movq %rdx, 0x8(%rdi)
movl 0x18(%rdx), %eax
movl %eax, 0x10(%rdi)
movaps 0x39b6(%rip), %xmm0     # 0xbd20
movups %xmm0, 0x14(%rdi)
movl $0x1, %esi
movl $0x1, %edx
callq 0x83a9
testl %eax, %eax
je 0x8391
movq (%rbx), %rdi
xorl %esi, %esi
movl $0x1, %edx
popq %rbx
jmp 0x8b37
leaq 0x3a00(%rip), %rdi      # 0xbd98
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/ec.c
// Function: xlink_decoder_read_bit
static int xlink_decoder_read_bit(xlink_decoder *dec, xlink_word c0,
 xlink_word c1) {
  int bit;
  xlink_word s;
  XLINK_ERROR(c0 == 0 || c1 == 0 || (c0 > EC_MASK - c1),
   ("Error invalid counts, c0 = %i and c1 = %i", c0, c1));
  /* Fill value with bits until EC_BASE <= range < 2*EC_BASE */
  while (dec->range < EC_BASE) {
    dec->low <<= 1;
    dec->range <<= 1;
    dec->value <<= 1;
    dec->value |=
     dec->pos >= dec->bits ? 0 : XLINK_GET_BIT(dec->bytes->data, dec->pos);
    dec->pos++;
  }
  s = ((xlink_dword)dec->range)*c1/(c0 + c1);
  XLINK_ERROR(s == 0 || s >= dec->range, ("Invalid scale value s = %02x", s));
  bit = dec->value < s;
  if (!bit) {
    dec->low += s;
    dec->range -= s;
    dec->value -= s;
  }
  else {
    dec->range = s;
  }
  return bit;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %eax
negl %eax
cmpl %edx, %eax
jbe 0x8469
testl %edx, %edx
je 0x8469
movl 0x1c(%rdi), %ecx
testl %ecx, %ecx
js 0x8428
movl 0x10(%rdi), %eax
movl 0x14(%rdi), %r8d
movl 0x18(%rdi), %r9d
movl 0x20(%rdi), %r10d
addl %r9d, %r9d
movl %r9d, 0x18(%rdi)
addl %ecx, %ecx
movl %ecx, 0x1c(%rdi)
addl %r10d, %r10d
movl %r10d, 0x20(%rdi)
xorl %r11d, %r11d
cmpl %eax, %r8d
jge 0x8416
movq 0x8(%rdi), %r11
movq (%r11), %r11
movl %r8d, %ebx
sarl $0x3, %ebx
movslq %ebx, %rbx
movzbl (%r11,%rbx), %ebx
movl %r8d, %ebp
andl $0x7, %ebp
xorl %r11d, %r11d
btl %ebp, %ebx
setb %r11b
orl %r11d, %r10d
movl %r10d, 0x20(%rdi)
incl %r8d
movl %r8d, 0x14(%rdi)
testl %ecx, %ecx
jns 0x83d6
movl %ecx, %r8d
movl %edx, %eax
imulq %r8, %rax
addl %edx, %esi
xorl %edx, %edx
divq %rsi
testl %eax, %eax
je 0x8479
subl %eax, %ecx
jbe 0x8479
movl 0x20(%rdi), %edx
movl %edx, %r8d
movl %eax, %esi
subl %eax, %r8d
jb 0x8456
addl %eax, 0x18(%rdi)
movl %r8d, 0x20(%rdi)
movl %ecx, %esi
xorl %ecx, %ecx
cmpl %eax, %edx
setb %cl
movl %esi, 0x1c(%rdi)
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x394b(%rip), %rdi      # 0xbdbb
xorl %eax, %eax
callq 0x22ef
jmp 0x8489
leaq 0x39a4(%rip), %rdi      # 0xbe24
movl %eax, %esi
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/ec.c
// Function: xlink_decoder_read_byte
unsigned char xlink_decoder_read_byte(xlink_decoder *dec) {
  unsigned char byte;
  int i;
  byte = 1;
  for (i = 8; i-- > 0; ) {
    unsigned int counts[2];
    int bit;
    xlink_context_get_counts(dec->ctx, byte, counts);
    bit = xlink_decoder_read_bit(dec, counts[0], counts[1]);
    xlink_context_update_bit(dec->ctx, byte, bit);
    byte <<= 1;
    byte |= bit;
  }
  for (i = 8; i-- > 1; ) {
    dec->ctx->buf[i] = dec->ctx->buf[i - 1];
  }
  dec->ctx->buf[0] = byte;
  return byte;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movb $0x1, %bpl
movl $0x9, %r12d
leaq 0x8(%rsp), %r14
movq (%rbx), %rdi
movzbl %bpl, %r15d
movl %r15d, %esi
movq %r14, %rdx
callq 0x8a8e
movl 0x8(%rsp), %esi
movl 0xc(%rsp), %edx
movq %rbx, %rdi
callq 0x83a9
movl %eax, %ebp
movq (%rbx), %rdi
movl %r15d, %esi
movl %eax, %edx
callq 0x8b37
addb %r15b, %r15b
orb %r15b, %bpl
decl %r12d
cmpl $0x1, %r12d
ja 0x84b1
movl $0x9, %eax
movq (%rbx), %rcx
movb -0x3(%rcx,%rax), %dl
movb %dl, -0x2(%rcx,%rax)
decq %rax
cmpq $0x2, %rax
ja 0x84f6
movq (%rbx), %rax
movb %bpl, (%rax)
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/internal.c
// Function: xlink_malloc
void *xlink_malloc(size_t size) {
  void *ptr;
  ptr = malloc(size);
  XLINK_ERROR(ptr == NULL, ("Insufficient memory for %i byte malloc", size));
  memset(ptr, 0, size);
  return ptr;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x1, %edi
movq %rbx, %rsi
callq 0x2100
testq %rax, %rax
je 0x8538
popq %rbx
retq
movq %rbx, %rdi
callq 0x23b4
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/io.c
// Function: xlink_file_init
void xlink_file_init(xlink_file *file, const char *name) {
  FILE *fp;
  int size;
  fp = fopen(name, "rb");
  XLINK_ERROR(fp == NULL, ("Could not open file %s", name));
  file->name = name;
  fseek(fp, 0, SEEK_END);
  file->size = ftell(fp);
  file->buf = xlink_malloc(file->size);
  fseek(fp, 0, SEEK_SET);
  size = fread((unsigned char *)file->buf, 1, file->size, fp);
  XLINK_ERROR(size != file->size,
   ("Problem reading file %s, got %i of %i bytes", name, size, file->size));
  fclose(fp);
  file->pos = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x392e(%rip), %rsi      # 0xbe98
movq %rbx, %rdi
callq 0x21b0
testq %rax, %rax
je 0x85e2
movq %rax, %r15
movq %rbx, (%r14)
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x2180
movq %r15, %rdi
callq 0x2130
movl %eax, 0x8(%r14)
movl %eax, %edi
callq 0x8520
movq %rax, 0x10(%r14)
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2180
movq 0x10(%r14), %rdi
movl 0x8(%r14), %edx
movl $0x1, %esi
movq %r15, %rcx
callq 0x2080
movl 0x8(%r14), %ecx
cmpl %eax, %ecx
jne 0x85f5
movq %r15, %rdi
callq 0x2090
movl $0x0, 0xc(%r14)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x38b2(%rip), %rdi      # 0xbe9b
movq %rbx, %rsi
xorl %eax, %eax
callq 0x22ef
jmp 0x8608
leaq 0x38b6(%rip), %rdi      # 0xbeb2
movq %rbx, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x22ef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
// File: /workspace/github_c_makefile_star2_O3/negge[P]xlink/src/paq.c
// Function: xlink_model_init
void xlink_model_init(xlink_model *model, unsigned char mask) {
  int i;
  model->mask = mask;
  /* For now just compute the weight as the number of bits set in mask */
  model->weight = 0;
  for (i = 0; i < 8; i++) {
    model->weight += !!(mask & (1 << i));
  }
}

// Assembly:
movb %sil, (%rdi)
movd %esi, %xmm0
pshufd $0x0, %xmm0, %xmm1      # xmm1 = xmm0[0,0,0,0]
pxor %xmm0, %xmm0
movdqa 0x38ac(%rip), %xmm2     # 0xbee0
movl $0x8, %eax
movaps 0x38b0(%rip), %xmm3     # 0xbef0
movdqa 0x38b8(%rip), %xmm4     # 0xbf00
pshuflw $0xfe, %xmm2, %xmm5     # xmm5 = xmm2[2,3,3,3,4,5,6,7]
movdqa %xmm1, %xmm6
psrld %xmm5, %xmm6
pshuflw $0x54, %xmm2, %xmm5     # xmm5 = xmm2[0,1,1,1,4,5,6,7]
movdqa %xmm1, %xmm7
psrld %xmm5, %xmm7
punpcklqdq %xmm6, %xmm7    # xmm7 = xmm7[0],xmm6[0]
pshufd $0xee, %xmm2, %xmm5     # xmm5 = xmm2[2,3,2,3]
pshuflw $0xfe, %xmm5, %xmm6     # xmm6 = xmm5[2,3,3,3,4,5,6,7]
movdqa %xmm1, %xmm8
psrld %xmm6, %xmm8
pshuflw $0x54, %xmm5, %xmm5     # xmm5 = xmm5[0,1,1,1,4,5,6,7]
movdqa %xmm1, %xmm6
psrld %xmm5, %xmm6
punpckhqdq %xmm8, %xmm6    # xmm6 = xmm6[1],xmm8[1]
shufps $0xcc, %xmm6, %xmm7     # xmm7 = xmm7[0,3],xmm6[0,3]
andps %xmm3, %xmm7
paddd %xmm7, %xmm0
paddd %xmm4, %xmm2
addl $-0x4, %eax
jne 0x8648
pshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
paddd %xmm0, %xmm1
pshufd $0x55, %xmm1, %xmm0     # xmm0 = xmm1[1,1,1,1]
paddd %xmm1, %xmm0
movd %xmm0, 0x4(%rdi)
retq