LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/support.c
// Function: memset16
void memset16(struct GlobalVars *gv,void *start,uint16_t fill,long n)
{
  if (n > 0) {
    uint8_t f[2];
    uint8_t *p;
    int i;

    write16(fff[gv->dest_format]->endianess==_BIG_ENDIAN_,f,fill);
    for (p=start,i=((unsigned long)start)&1; n; n--,i^=1)
      *p++ = f[i];
  }
}

// Assembly:
testq %rcx, %rcx
jle 0x6ea4
movzbl 0x50(%rdi), %eax
leaq 0x2831d(%rip), %rdi     # 0x2f180
movq (%rdi,%rax,8), %rax
movzwl %dx, %edx
movl %edx, %edi
shrl $0x8, %edi
cmpb $0x1, 0xaa(%rax)
movl %edi, %eax
cmovel %edx, %eax
cmovnel %edx, %edi
movb %dil, -0x2(%rsp)
movb %al, -0x1(%rsp)
movl %esi, %eax
andl $0x1, %eax
xorl %edx, %edx
movl %eax, %edi
movb -0x2(%rsp,%rdi), %dil
movb %dil, (%rsi,%rdx)
xorl $0x1, %eax
incq %rdx
cmpq %rdx, %rcx
jne 0x6e8e
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/support.c
// Function: add_symnames
void add_symnames(struct SymNames **snlist,const char *name)
/* add a new name to a SymNames list */
{
  struct SymNames *new = alloc(sizeof(struct SymNames));
  struct SymNames *sn;

  new->next = NULL;
  new->name = name;
  if (sn = *snlist) {
    while (sn->next)
      sn = sn->next;
    sn->next = new;
  }
  else
    *snlist = new;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
movl $0x10, %edi
callq 0x51c0
movq %rax, %r14
testq %rax, %rax
jne 0x6eee
movl $0x1, %edi
xorl %eax, %eax
callq 0x6f14
movq $0x0, (%r14)
movq %r15, 0x8(%r14)
movq (%rbx), %rax
testq %rax, %rax
je 0x6f09
movq %rax, %rbx
movq (%rax), %rax
jmp 0x6efc
movq %r14, (%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/linker.c
// Function: getobjname
const char *getobjname(struct ObjectUnit *obj)
/* if library: return "file name(object name)" */
/* else: return "file name" */
{
  const char *fn = obj->lnkfile->filename;

  if (obj->lnkfile->type == ID_LIBARCH) {
    const char *on = obj->objname;
    if (strlen(fn)+strlen(on)+2 < FNAMEBUFSIZE) {
      sprintf(namebuf,"%s(%s)",fn,on);
      return (namebuf);
    }
  }
  return (fn);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x10(%rdi), %rax
movq 0x18(%rax), %rbx
cmpb $0x8, 0x39(%rax)
jne 0x7160
movq 0x18(%rdi), %r14
movq %rbx, %rdi
callq 0x50e0
movq %rax, %r15
movq %r14, %rdi
callq 0x50e0
addq %r15, %rax
addq $-0x3fe, %rax           # imm = 0xFC02
cmpq $-0x400, %rax           # imm = 0xFC00
jb 0x7160
leaq 0x2bcaa(%rip), %r15     # 0x32df0
leaq 0x1af83(%rip), %rsi     # 0x220d0
movq %r15, %rdi
movq %rbx, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x5250
movq %r15, %rbx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/linker.c
// Function: print_function_name
void print_function_name(struct Section *sec,unsigned long offs)
/* Try to determine the function to which the section offset */
/* belongs, by comparing with SYMI_FUNC-type symbol definitions. */
/* If this was successful and the current function is different */
/* from the last one printed, make an output to stderr. */
{
  static const char *infoname[] = { "", "object ", "function " };
  static struct Symbol *last_func=NULL;
  struct Symbol *sym,*func=NULL;
  int i;

  for (i=0; i<OBJSYMHTABSIZE; i++) {  /* scan all hash chains */
    for (sym=sec->obj->objsyms[i]; sym; sym=sym->obj_chain) {
      if (sym->relsect == sec) {
        if (sym->info <= SYMI_FUNC) {
          if (sym->type == SYM_RELOC) {
            if ((unsigned long)sym->value <= offs) {
              if (sym->size) {  /* size of function specified? */
                if ((unsigned long)(sym->value+sym->size) > offs) {
                  func = sym;
                  i = OBJSYMHTABSIZE;
                  break;  /* function found! */
                }
              }
              else {  /* no size - find nearest... */
                if (func) {
                  if (sym->value > func->value) {
                    if (func->bind<SYMB_GLOBAL || sym->bind>=SYMB_GLOBAL)
                      func = sym;
                  }
                }
                else
                  func = sym;
              }
            }
          }
        }
      }
    }
  }

  /* print function name */
  if (func && func!=last_func) {
    last_func = func;
    fprintf(stderr,"%s: In %s\"%s\":\n",getobjname(sec->obj),
            infoname[func->info],func->name);
  }
}

// Assembly:
pushq %rax
movq %rsi, %rax
movq 0x10(%rdi), %rsi
movq 0x48(%rsi), %rdx
xorl %r8d, %r8d
xorl %r10d, %r10d
movl %r8d, %ecx
movq (%rdx,%rcx,8), %r9
testq %r9, %r9
je 0x71ef
cmpq %rdi, 0x38(%r9)
jne 0x71a4
cmpb $0x2, 0x42(%r9)
ja 0x71a4
cmpb $0x2, 0x40(%r9)
jne 0x71a4
movq 0x30(%r9), %r11
cmpq %rax, %r11
jbe 0x71b5
movq %r10, %rcx
movq 0x18(%r9), %r9
movq %rcx, %r10
testq %r9, %r9
jne 0x7187
jmp 0x71f2
movl 0x44(%r9), %ecx
testq %rcx, %rcx
je 0x71cb
addq %rcx, %r11
movq %r10, %rcx
cmpq %rax, %r11
jbe 0x71a7
jmp 0x7208
movq %r9, %rcx
testq %r10, %r10
je 0x71a7
cmpq 0x30(%r10), %r11
jle 0x71a4
cmpb $0x2, 0x43(%r10)
jb 0x71ea
cmpb $0x2, 0x43(%r9)
movq %r10, %rcx
jb 0x71a7
movq %r9, %rcx
jmp 0x71a7
movq %r10, %rcx
leal 0x1(%r8), %r9d
movq %rcx, %r10
cmpl $0x1f, %r8d
movl %r9d, %r8d
jb 0x717b
jmp 0x720b
movq %r9, %rcx
testq %rcx, %rcx
je 0x7219
cmpq 0x2bfd9(%rip), %rcx     # 0x331f0
jne 0x721b
popq %rax
retq
movq %rcx, %rdi
callq 0x53cb
jmp 0x7219
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/linker.c
// Function: print_symbol
void print_symbol(FILE *f,struct Symbol *sym)
/* print symbol name, type, value, etc. */
{
  if (sym->type == SYM_COMMON)
    fprintf(f,"  %s: %s%s%s, alignment %d, size %d\n",sym->name,
            sym_bind[sym->bind],sym_type[sym->type],sym_info[sym->info],
            (int)sym->value,(int)sym->size);
  else if (sym->type == SYM_INDIR)
    fprintf(f,"  %s: %s%s%s, referencing %s\n",sym->name,
            sym_bind[sym->bind],sym_type[sym->type],sym_info[sym->info],
            sym->indir_name);
  else
#if 0
    fprintf(f,"  %s: %s%s%s, value 0x%llx, size %d\n",sym->name,
            sym_bind[sym->bind],sym_type[sym->type],sym_info[sym->info],
            (uint64_t)sym->value,(int)sym->size);
#else
    fprintf(f,"  %s: %s%s%s, value 0x%x, size %d\n",sym->name,
            sym_bind[sym->bind],sym_type[sym->type],sym_info[sym->info],
            (uint32_t)sym->value,(int)sym->size);
#endif
}

// Assembly:
pushq %rax
movq %rsi, %r10
movzbl 0x40(%rsi), %eax
movq 0x20(%rsi), %rdx
movzbl 0x43(%rsi), %ecx
leaq 0x28094(%rip), %rsi     # 0x2f2d0
movq (%rsi,%rcx,8), %rcx
cmpl $0x4, %eax
je 0x7276
cmpl $0x3, %eax
jne 0x72a4
leaq 0x2801f(%rip), %rax     # 0x2f270
movq 0x18(%rax), %r8
movzbl 0x42(%r10), %eax
leaq 0x2803f(%rip), %rsi     # 0x2f2a0
movq (%rsi,%rax,8), %r9
movl 0x30(%r10), %r11d
movl 0x44(%r10), %r10d
leaq 0x1ae85(%rip), %rsi     # 0x220f9
jmp 0x72ce
leaq 0x27ff3(%rip), %rax     # 0x2f270
movq 0x20(%rax), %r8
movzbl 0x42(%r10), %eax
leaq 0x28013(%rip), %rsi     # 0x2f2a0
movq (%rsi,%rax,8), %r9
subq $0x8, %rsp
leaq 0x1ae82(%rip), %rsi     # 0x2211e
xorl %eax, %eax
pushq 0x28(%r10)
jmp 0x72d4
leaq 0x27fc5(%rip), %rsi     # 0x2f270
movq (%rsi,%rax,8), %r8
movzbl 0x42(%r10), %eax
leaq 0x27fe5(%rip), %rsi     # 0x2f2a0
movq (%rsi,%rax,8), %r9
movl 0x30(%r10), %r11d
movl 0x44(%r10), %r10d
leaq 0x1ae6e(%rip), %rsi     # 0x2213c
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x5180
addq $0x10, %rsp
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/linker.c
// Function: trace_sym_access
bool trace_sym_access(struct GlobalVars *gv,const char *name)
/* check if the symbol with this name should be traced */
{
  struct SymNames *sn;

  if (gv->trace_syms) {
    sn = gv->trace_syms[elf_hash(name)%TRSYMHTABSIZE];
    while (sn) {
      if (!strcmp(name,sn->name))
        return (TRUE);  /* symbol found! */
      sn = sn->next;
    }
  }
  return (FALSE);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0xa8(%rdi), %r15
xorl %ebx, %ebx
testq %r15, %r15
je 0x7321
movq %rsi, %r14
movq %rsi, %rdi
callq 0x6d94
andl $0x3f, %eax
leaq (%r15,%rax,8), %r15
movq (%r15), %r15
testq %r15, %r15
je 0x7321
movq 0x8(%r15), %rsi
movq %r14, %rdi
callq 0x5160
testl %eax, %eax
jne 0x7304
movl $0x1, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/linker.c
// Function: linker_init
void linker_init(struct GlobalVars *gv)
{
  initlist(&gv->linkfiles);
  initlist(&gv->selobjects);
  initlist(&gv->libobjects);
  initlist(&gv->sharedobjects);
  gv->symbols = alloc_hashtable(SYMHTABSIZE);
  initlist(&gv->pripointers);
  initlist(&gv->scriptsymbols);
  gv->got_base_name = gotbase_name;
  gv->plt_base_name = pltbase_name;

  if (gv->reloctab_format != RTAB_UNDEF) {
    if (!(fff[gv->dest_format]->rtab_mask & gv->reloctab_format)) {
      error(122,fff[gv->dest_format]->tname);
      gv->reloctab_format = fff[gv->dest_format]->rtab_format;
    }
  }
  else
    gv->reloctab_format = fff[gv->dest_format]->rtab_format;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x120, %rdi            # imm = 0x120
callq 0x66da
leaq 0x138(%rbx), %rdi
callq 0x66da
leaq 0x150(%rbx), %rdi
callq 0x66da
leaq 0x168(%rbx), %rdi
callq 0x66da
movl $0x10000, %edi          # imm = 0x10000
callq 0x66bb
movq %rax, 0x180(%rbx)
leaq 0x1a8(%rbx), %rdi
callq 0x66da
leaq 0x190(%rbx), %rdi
callq 0x66da
leaq 0x1b260(%rip), %rax     # 0x225f0
movq %rax, 0x230(%rbx)
leaq 0x1b272(%rip), %rax     # 0x22610
movq %rax, 0x238(%rbx)
movb 0x6e(%rbx), %cl
movzbl 0x50(%rbx), %eax
leaq 0x27dcd(%rip), %r14     # 0x2f180
movq (%r14,%rax,8), %rax
testb %cl, %cl
je 0x73da
testb %cl, 0xa9(%rax)
jne 0x73e3
movq (%rax), %rsi
movl $0x7a, %edi
xorl %eax, %eax
callq 0x6f14
movzbl 0x50(%rbx), %eax
movq (%r14,%rax,8), %rax
movb 0xa8(%rax), %al
movb %al, 0x6e(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/linker.c
// Function: dyn_ext_entry
static struct Symbol *dyn_ext_entry(struct GlobalVars *gv,
                                    struct Symbol *xdef,struct Reloc *xref,
                                    int entrytype)
/* make a dyn_entry for an external reference */
{
  if (xdef->relsect->obj->lnkfile->type!=ID_SHAREDOBJ
      && entrytype==PLT_ENTRY) {
    /* resolve PLT relocation to a local function directly */
    switch (xref->rtype) {
      case R_PLT:
        xref->rtype = R_ABS;
        break;
      case R_PLTPC:
        xref->rtype = R_PC;
        break;
    }
  }
  else {
    DynArg a;
    struct Symbol *sym;

    a.sym = xdef;
    sym = dyn_entry(gv,a,entrytype);
    if (sym)
      return sym;
  }
  return xdef;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
cmpl $0x2, %ecx
jne 0x7e12
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
cmpb $0x4, 0x39(%rax)
je 0x7e12
movzbl 0x38(%rdx), %eax
cmpl $0x7, %eax
je 0x7e23
cmpl $0x8, %eax
jne 0x7e28
movb $0x2, %al
jmp 0x7e25
movq %rbx, %rsi
movl %ecx, %edx
callq 0xa604
testq %rax, %rax
jne 0x7e2b
jmp 0x7e28
movb $0x1, %al
movb %al, 0x38(%rdx)
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/linker.c
// Function: addrelref
static void addrelref(struct RelRef **rrptr,struct Section *sec)
/* if not already exists, add a new relative reference to another sect. */
{
  struct RelRef *rr;

  if (rr = *rrptr) {
    while (rr->next) {
      if (rr->refsec == sec)
        return;  /* reference already exists */
      rr = rr->next;
    }
  }
  else
    rr = (struct RelRef *)rrptr;

  rr->next = alloczero(sizeof(struct RelRef));
  rr->next->refsec = sec;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rax
testq %rax, %rax
je 0x8129
movq (%rax), %rcx
testq %rcx, %rcx
je 0x8126
cmpq %rbx, 0x8(%rax)
movq %rcx, %rax
jne 0x8113
jmp 0x813a
movq %rax, %r14
movl $0x10, %edi
callq 0x6686
movq %rax, (%r14)
movq %rbx, 0x8(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/linker.c
// Function: dyn_reloc_entry
static void dyn_reloc_entry(struct GlobalVars *gv,struct Reloc *reloc,
                            int entrytype)
/* make a dyn_entry for a local GOT/PLT reference, fix reloc for entry */
{
  if (reloc->relocsect.ptr->obj->lnkfile->type!=ID_SHAREDOBJ
      && entrytype==PLT_LOCAL) {
    /* resolve PLT relocation to a local function directly */
    switch (reloc->rtype) {
      case R_PLT:
        reloc->rtype = R_ABS;
        break;
      case R_PLTPC:
        reloc->rtype = R_PC;
        break;
    }
  }
  else {
    DynArg a;
    struct Symbol *xdef;

    a.rel = reloc;
    if (xdef = dyn_entry(gv,a,entrytype)) {
      reloc->relocsect.ptr = xdef->relsect;
      reloc->addend = xdef->value;
    }
    else
      ierror("dyn_reloc_entry(): new xdef is NULL");
  }
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
cmpl $0x5, %edx
jne 0x8171
movq 0x18(%rbx), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
cmpb $0x4, 0x39(%rax)
je 0x8171
movzbl 0x38(%rbx), %eax
cmpl $0x8, %eax
je 0x819f
cmpl $0x7, %eax
jne 0x81a3
movb $0x1, 0x38(%rbx)
jmp 0x81a3
movq %rbx, %rsi
callq 0xa604
testq %rax, %rax
je 0x8190
movq 0x38(%rax), %rcx
movq %rcx, 0x18(%rbx)
movq 0x30(%rax), %rax
movq %rax, 0x28(%rbx)
jmp 0x81a3
leaq 0x1a38d(%rip), %rdi     # 0x22524
xorl %eax, %eax
popq %rbx
jmp 0x52b0
movb $0x2, 0x38(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/linker.c
// Function: linker_dynprep
void linker_dynprep(struct GlobalVars *gv)
/* Preparations for dynamic linking */
{
  /* hide unreferenced symbols from a shared library */
  hide_shlib_symbols(gv);

  /* export all global symbols when creating a shared library */
  if (gv->dest_sharedobj || gv->dyn_exp_all) {
    int i;

    for (i=0; i<SYMHTABSIZE; i++) {
      struct Symbol *sym;
      struct Symbol **chain = &gv->symbols[i];

      while (sym = *chain) {
        if (sym->bind>=SYMB_GLOBAL && !(sym->flags & SYMF_SHLIB) &&
            sym->relsect!=NULL && (sym->relsect->obj->flags & OUF_LINKED))
          dyn_export(gv,sym);
        chain = &sym->glob_chain;
      }
    }
  }

  /* let the target create and populate dynamic sections when needed */
  if (gv->dynamic && fff[gv->dest_format]->dyncreate)
    fff[gv->dest_format]->dyncreate(gv);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0xaa86
cmpl $0x0, 0x58(%rbx)
jne 0x81be
cmpl $0x0, 0x5c(%rbx)
je 0x8225
xorl %r15d, %r15d
movq 0x180(%rbx), %rax
movq (%rax,%r15,8), %r14
testq %r14, %r14
je 0x8219
cmpb $0x2, 0x43(%r14)
jb 0x8213
movb 0x41(%r14), %al
testb $0x10, %al
jne 0x8213
movq 0x38(%r14), %rcx
testq %rcx, %rcx
je 0x8213
cmpb $0x3f, %al
ja 0x8213
movq 0x10(%rcx), %rcx
movzwl 0x80(%rcx), %ecx
andl $0x1, %ecx
je 0x8213
orb $-0x80, %al
movb %al, 0x41(%r14)
movq %rbx, %rdi
movq %r14, %rsi
movl $0x7, %edx
callq 0xa604
movq 0x10(%r14), %r14
jmp 0x81cc
incq %r15
cmpq $0x10000, %r15          # imm = 0x10000
jne 0x81c1
cmpl $0x0, 0x240(%rbx)
je 0x8250
movzbl 0x50(%rbx), %eax
leaq 0x26f47(%rip), %rcx     # 0x2f180
movq (%rcx,%rax,8), %rax
movq 0x68(%rax), %rax
testq %rax, %rax
je 0x8250
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmpq *%rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/linker.c
// Function: allocate_common
static unsigned long allocate_common(struct GlobalVars *gv,
                                     struct Section *sec,unsigned long addr)
/* allocate all common symbols to section 'sec' at 'addr',
   returns number of total bytes allocated */
{
  unsigned long abytes,alloc=0;
  struct Symbol *sym;
  int i;

  for (i=0; i<SYMHTABSIZE; i++) {
    for (sym=gv->symbols[i]; sym; sym=sym->glob_chain) {
      /* common symbol from this section name? */
      if (sym->relsect==sec && sym->type==SYM_COMMON) {

        /* allocate and transform into SYM_RELOC */
        abytes = comalign(addr+alloc,sym->value);
        sym->value = (lword)((addr+alloc) - sec->va) + abytes;
        sym->type = SYM_RELOC;
        alloc += abytes + sym->size;

        if (gv->map_file)
          fprintf(gv->map_file,"Allocating common %s: %x at %llx hex\n",
                  sym->name,(int)sym->size,(lword)sec->va+sym->value);
      }
    }
  }

  sec->size += alloc;
  return alloc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, (%rsp)
movq %rsi, %rbx
movq %rdi, %r15
xorl %r13d, %r13d
xorl %r12d, %r12d
movq 0x180(%r15), %rax
movq (%rax,%r13,8), %r14
testq %r14, %r14
je 0x8d0f
cmpq %rbx, 0x38(%r14)
jne 0x8d09
cmpb $0x3, 0x40(%r14)
jne 0x8d09
movq (%rsp), %rax
leaq (%r12,%rax), %rbp
movq 0x30(%r14), %rsi
movq %rbp, %rdi
callq 0x6dee
addq %rax, %rbp
movq %rbp, %rcx
subq 0x30(%rbx), %rcx
movq %rcx, 0x30(%r14)
movb $0x2, 0x40(%r14)
movl 0x44(%r14), %ecx
addq %rcx, %r12
addq %rax, %r12
movq 0x90(%r15), %rdi
testq %rdi, %rdi
je 0x8d09
movq 0x20(%r14), %rdx
leaq 0x19849(%rip), %rsi     # 0x22548
movq %rbp, %r8
xorl %eax, %eax
callq 0x5180
movq 0x10(%r14), %r14
jmp 0x8ca5
incq %r13
cmpq $0x10000, %r13          # imm = 0x10000
jne 0x8c9a
addq %r12, 0x48(%rbx)
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/linker.c
// Function: searchlib
static char *searchlib(struct GlobalVars *gv,char *libname,int so_ver)
{
  struct LibPath *lpn = (struct LibPath *)gv->libpaths.first;
  struct LibPath *nextlpn;
  char *p,*path,*flavour_dir;
  int i,count;
  size_t len;

  if (p = scan_directory(".",libname,so_ver))
    return (p);

  while (nextlpn = (struct LibPath *)lpn->n.next) {
    for (count=gv->flavours.n_flavours; count>=0; count--) {
      flavour_dir = gv->flavours.flavour_dir;
      for (flavour_dir[0]='\0',i=0; i<count; i++) {
        if (!path_append(flavour_dir,flavour_dir,gv->flavours.flavours[i],
                         gv->flavours.flavours_len + 1))
          ierror("searchlib(): flavour \"%s\" doesn't fit into path buffer",
                 gv->flavours.flavours[i]);
      }
      len = strlen(lpn->path) + strlen(flavour_dir) + 3;
      if (len < FNAMEBUFSIZE) {
        path = path_append(namebuf2,lpn->path,flavour_dir,FNAMEBUFSIZE);
        if (p = scan_directory(path,libname,so_ver))
          return (p);
      }
    }
    lpn = nextlpn;
  }
  return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %r12
leaq 0x16d30(%rip), %rdi     # 0x21011
callq 0xa410
testq %rax, %rax
je 0xa2fa
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r12), %rcx
testq %rcx, %rcx
je 0xa409
movq %r14, 0x10(%rsp)
movl %ebx, 0x4(%rsp)
leaq 0x1815c(%rip), %rbp     # 0x22473
movq %r12, 0x18(%rsp)
movq %rcx, 0x8(%rsp)
movslq 0x30(%r15), %r14
testq %r14, %r14
js 0xa3ed
movq %r14, %rax
movq 0x40(%r15), %r12
movb $0x0, (%r12)
subq $0x1, %rax
movq %rax, 0x20(%rsp)
jb 0xa380
xorl %ebx, %ebx
movq 0x38(%r15), %rax
movq (%rax,%rbx,8), %rdx
movslq 0x34(%r15), %rcx
incq %rcx
movq %r12, %rdi
movq %r12, %rsi
callq 0xa658
testq %rax, %rax
jne 0xa378
movq 0x38(%r15), %rax
movq (%rax,%rbx,8), %rsi
movq %rbp, %rdi
xorl %eax, %eax
callq 0x52b0
incq %rbx
cmpq %rbx, %r14
jne 0xa347
movq 0x18(%rsp), %rax
movq 0x10(%rax), %r13
movq %r13, %rdi
callq 0x50e0
movq %rax, %rbx
movq %r12, %rdi
callq 0x50e0
addq %rbx, %rax
addq $0x3, %rax
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0xa3dc
movl $0x400, %ecx            # imm = 0x400
leaq 0x28e49(%rip), %rdi     # 0x33200
movq %r13, %rsi
movq %r12, %rdx
callq 0xa658
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movl 0x4(%rsp), %edx
callq 0xa410
testq %rax, %rax
jne 0xa2eb
testq %r14, %r14
movq 0x20(%rsp), %rax
movq %rax, %r14
jne 0xa331
movq 0x8(%rsp), %r12
movq (%r12), %rcx
testq %rcx, %rcx
movl $0x0, %eax
jne 0xa317
jmp 0xa2eb
xorl %eax, %eax
jmp 0xa2eb
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/linker.c
// Function: make_dynobj
static void make_dynobj(struct GlobalVars *gv)
{
  if (gv->dynobj == NULL) {
    gv->dynobj = art_objunit(gv,"DYNAMIC",NULL,0);
    gv->dynobj->flags |= OUF_LINKED;
    addhead(&gv->selobjects,&gv->dynobj->n);
  }
}

// Assembly:
cmpq $0x0, 0x1e0(%rdi)
je 0xa5cf
retq
pushq %rbx
movq %rdi, %rbx
leaq 0x17f42(%rip), %rsi     # 0x2251c
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xbf37
movq %rax, 0x1e0(%rbx)
orb $0x1, 0x80(%rax)
addq $0x138, %rbx            # imm = 0x138
movq %rbx, %rdi
movq %rax, %rsi
popq %rbx
jmp 0x6713
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/linker.c
// Function: dyn_entry
static struct Symbol *dyn_entry(struct GlobalVars *gv,DynArg arg,int entrytype)
{
  make_dynobj(gv);

  if (fff[gv->dest_format]->dynentry)
    return fff[gv->dest_format]->dynentry(gv,arg,entrytype);
  
  /* dynamic symbol reference not supported by target */
  error(126,fff[gv->dest_format]->tname);
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
callq 0xa5c4
movzbl 0x50(%r15), %eax
leaq 0x24b5e(%rip), %rcx     # 0x2f180
movq (%rcx,%rax,8), %rcx
movq 0x60(%rcx), %rax
testq %rax, %rax
je 0xa63e
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
popq %rbx
popq %r14
popq %r15
jmpq *%rax
movq (%rcx), %rsi
movl $0x7e, %edi
xorl %eax, %eax
callq 0x6f14
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/dir.c
// Function: path_append
char *path_append(char *buf,const char *path,const char *add,size_t bufsize)
/* append a file- or path-name to an existing path */
{
  size_t len = strlen(path);

  if ((len+strlen(add)+1) < bufsize) {
    if (buf != path)
      strcpy(buf,path);
    if (len>0 && buf[len-1]!='/')
      buf[len++] = '/';
    strcpy(&buf[len],add);
    return (buf);
  }
  return (NULL);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x50e0
movq %rax, %r15
movq %r14, %rdi
callq 0x50e0
addq %r15, %rax
incq %rax
cmpq %r13, %rax
jae 0xa6b2
cmpq %r12, %rbx
je 0xa69b
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5080
testq %r15, %r15
je 0xa6b6
cmpb $0x2f, -0x1(%rbx,%r15)
je 0xa6b9
movb $0x2f, (%rbx,%r15)
incq %r15
jmp 0xa6b9
xorl %ebx, %ebx
jmp 0xa6c7
xorl %r15d, %r15d
addq %rbx, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x5080
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/dir.c
// Function: chk_file
bool chk_file(const char *path)
/* Check if file is present */
{
  FILE *f;

#ifdef AMIGAOS
  if (!strncmp(path,"./",2))
    path += 2;
#endif
  if (f = fopen(path,"rb"))
    fclose(f);
  return (f != NULL);
}

// Assembly:
pushq %rbx
leaq 0x15b8d(%rip), %rsi     # 0x20295
callq 0x5220
movq %rax, %rbx
testq %rax, %rax
je 0xa71d
movq %rbx, %rdi
callq 0x50c0
xorl %eax, %eax
testq %rbx, %rbx
setne %al
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: findsymbol
struct Symbol *findsymbol(struct GlobalVars *gv,struct Section *sec,
                          const char *name)
/* Return pointer to Symbol, otherwise return NULL.
   Make sure to prefer symbols from sec's ObjectUnit. */
{
  if (fff[gv->dest_format]->fndsymbol) {
    return fff[gv->dest_format]->fndsymbol(gv,sec,name);
  }
  else {
    struct Symbol *sym = gv->symbols[elf_hash(name)%SYMHTABSIZE];
    struct Symbol *found = NULL;

    while (sym) {
      if (!strcmp(name,sym->name)) {
        if (found && sec) {
          /* ignore, when not from the refering ObjectUnit */
          if (sym->relsect->obj == sec->obj)
            found = sym;
        }
        else
          found = sym;
      }
      sym = sym->glob_chain;
    }
    if (found!=NULL && found->type==SYM_INDIR)
      return findsymbol(gv,sec,found->indir_name);
    return found;
  }
  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movzbl 0x50(%rdi), %eax
leaq 0x24a39(%rip), %r12     # 0x2f180
movq (%r12,%rax,8), %rax
movq 0x40(%rax), %rax
testq %rax, %rax
jne 0xa7c7
movq 0x180(%r14), %r13
movq %r15, %rdi
callq 0x6d94
movzwl %ax, %eax
movq (%r13,%rax,8), %r13
testq %r13, %r13
je 0xa7e0
xorl %eax, %eax
movq %rax, %rbp
movq 0x20(%r13), %rsi
movq %r15, %rdi
callq 0x5160
testl %eax, %eax
jne 0xa7a5
movq %r13, %rax
testq %rbx, %rbx
je 0xa7a8
movq %r13, %rax
testq %rbp, %rbp
je 0xa7a8
movq 0x38(%r13), %rax
movq 0x10(%rax), %rax
cmpq 0x10(%rbx), %rax
cmoveq %r13, %rbp
movq %rbp, %rax
movq 0x10(%r13), %r13
testq %r13, %r13
jne 0xa772
testq %rax, %rax
je 0xa7e0
cmpb $0x4, 0x40(%rax)
jne 0xa7e2
movq 0x28(%rax), %r15
movzbl 0x50(%r14), %eax
jmp 0xa747
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: hide_shlib_symbols
void hide_shlib_symbols(struct GlobalVars *gv)
/* scan for all unreferenced SYMF_SHLIB symbols in the global symbol list
   and remove them - they have to be invisible for the file we create */
{
  int i;

  for (i=0; i<SYMHTABSIZE; i++) {
    struct Symbol *sym;
    struct Symbol **chain = &gv->symbols[i];

    while (sym = *chain) {
      if ((sym->flags & SYMF_SHLIB) && !(sym->flags & SYMF_REFERENCED)) {
        /* remove from global symbol list */
        *chain = sym->glob_chain;
        sym->glob_chain = NULL;
      }
      else
        chain = &sym->glob_chain;
    }        
  }
}

// Assembly:
xorl %eax, %eax
movq 0x180(%rdi), %rdx
movq (%rdx,%rax,8), %rcx
testq %rcx, %rcx
je 0xaac8
leaq (%rdx,%rax,8), %rdx
movb 0x41(%rcx), %sil
andb $0x12, %sil
addq $0x10, %rcx
cmpb $0x10, %sil
jne 0xaabd
movq (%rcx), %rsi
movq %rsi, (%rdx)
movq $0x0, (%rcx)
jmp 0xaac0
movq %rcx, %rdx
movq (%rdx), %rcx
testq %rcx, %rcx
jne 0xaa9c
incq %rax
cmpq $0x10000, %rax          # imm = 0x10000
jne 0xaa88
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: findlocsymbol
struct Symbol *findlocsymbol(struct GlobalVars *gv,struct ObjectUnit *ou,
                             const char *name)
/* find a symbol which is local to the provided ObjectUnit */
{
  struct Symbol *sym;
  struct Symbol **chain = &ou->objsyms[elf_hash(name)%OBJSYMHTABSIZE];

  while (sym = *chain) {
    if (!strcmp(sym->name,name))
      return sym;
    chain = &sym->obj_chain;
  }
  return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq 0x48(%rsi), %r14
movq %rdx, %rdi
callq 0x6d94
andl $0x1f, %eax
movq (%r14,%rax,8), %r14
testq %r14, %r14
je 0xaccb
movq 0x20(%r14), %rdi
movq %rbx, %rsi
callq 0x5160
testl %eax, %eax
je 0xacce
movq 0x18(%r14), %r14
jmp 0xacb0
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: addlocsymbol
void addlocsymbol(struct GlobalVars *gv,struct Section *s,char *name,
                  char *iname,lword val,uint8_t type,uint8_t flags,
                  uint8_t info,uint32_t size)
/* Define a new local symbol. Local symbols are allowed to be */
/* multiply defined. */
{
  struct Symbol *sym;
  struct Symbol **chain = &s->obj->objsyms[elf_hash(name)%OBJSYMHTABSIZE];

  while (sym = *chain)
    chain = &sym->obj_chain;
  *chain = sym = alloczero(sizeof(struct Symbol));
  sym->name = name;
  sym->indir_name = iname;
  sym->value = val;
  sym->relsect = s;
  sym->type = type;
  sym->flags = flags;
  sym->info = info;
  sym->bind = SYMB_LOCAL;
  sym->size = size;
  if (check_protection(gv,name))
    sym->flags |= SYMF_PROTECTED;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, 0x4(%rsp)
movq %r8, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
movb 0x50(%rsp), %r15b
movq 0x10(%rsi), %rax
movq 0x48(%rax), %r13
movq %rdx, %rdi
callq 0x6d94
andl $0x1f, %eax
leaq (,%rax,8), %rax
addq %r13, %rax
movq %rax, %r13
movq (%rax), %rcx
leaq 0x18(%rcx), %rax
testq %rcx, %rcx
jne 0xad22
movl $0x50, %edi
callq 0x6686
movq %rax, %rbp
movq %rax, (%r13)
movq %rbx, 0x20(%rax)
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rbp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rbp)
movq %r12, 0x38(%rbp)
movl 0x4(%rsp), %eax
movb %al, 0x40(%rbp)
movb %r15b, 0x41(%rbp)
movb 0x58(%rsp), %al
movb %al, 0x42(%rbp)
movb $0x1, 0x43(%rbp)
movl 0x60(%rsp), %eax
movl %eax, 0x44(%rbp)
addq $0xb0, %r14
movq (%r14), %r14
testq %r14, %r14
je 0xada0
movq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0x5160
testl %eax, %eax
jne 0xad80
orb $0x4, %r15b
movb %r15b, 0x41(%rbp)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: addlnksymbol
struct Symbol *addlnksymbol(struct GlobalVars *gv,const char *name,lword val,
                            uint8_t type,uint8_t flags,uint8_t info,
                            uint8_t bind,uint32_t size)
/* Define a new, target-specific, linker symbol. */
{
  struct Symbol *sym;
  struct Symbol **chain;

  if (gv->lnksyms == NULL)
    gv->lnksyms = alloc_hashtable(LNKSYMHTABSIZE);
  chain = &gv->lnksyms[elf_hash(name)%LNKSYMHTABSIZE];

  while (sym = *chain)
    chain = &sym->obj_chain;
  *chain = sym = alloczero(sizeof(struct Symbol));
  sym->name = name;
  sym->value = val;
  sym->type = type;
  sym->flags = flags;
  sym->info = info;
  sym->bind = bind;
  sym->size = size;
  return sym;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, 0x4(%rsp)
movl %r8d, %ebp
movl %ecx, %r14d
movq %rdx, %r15
movq %rsi, %r12
movq 0x188(%rdi), %r13
testq %r13, %r13
jne 0xadee
movq %rdi, %rbx
movl $0x10, %edi
callq 0x66bb
movq %rax, %r13
movq %rax, 0x188(%rbx)
movb 0x40(%rsp), %bl
movq %r12, %rdi
callq 0x6d94
andl $0xf, %eax
leaq (,%rax,8), %rax
addq %r13, %rax
movq %rax, %r13
movq (%rax), %rcx
leaq 0x18(%rcx), %rax
testq %rcx, %rcx
jne 0xae08
movl $0x50, %edi
callq 0x6686
movq %rax, (%r13)
movq %r12, 0x20(%rax)
movq %r15, 0x30(%rax)
movb %r14b, 0x40(%rax)
movb %bpl, 0x41(%rax)
movl 0x4(%rsp), %ecx
movb %cl, 0x42(%rax)
movb %bl, 0x43(%rax)
movl 0x48(%rsp), %ecx
movl %ecx, 0x44(%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: findlnksymbol
struct Symbol *findlnksymbol(struct GlobalVars *gv,const char *name)
/* return pointer to Symbol, if present */
{
  struct Symbol *sym;

  if (gv->lnksyms) {
    sym = gv->lnksyms[elf_hash(name)%LNKSYMHTABSIZE];
    while (sym) {
      if (!strcmp(name,sym->name))
        return sym;  /* symbol found! */
      sym = sym->obj_chain;
    }
  }
  return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x188(%rdi), %r14
testq %r14, %r14
je 0xae92
movq %rsi, %rbx
movq %rsi, %rdi
callq 0x6d94
andl $0xf, %eax
movq (%r14,%rax,8), %r14
testq %r14, %r14
je 0xae92
movq 0x20(%r14), %rsi
movq %rbx, %rdi
callq 0x5160
testl %eax, %eax
je 0xae95
movq 0x18(%r14), %r14
jmp 0xae77
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: fixlnksymbols
void fixlnksymbols(struct GlobalVars *gv,struct LinkedSection *def_ls)
{
  struct Symbol *sym,*next;
  int i;

  if (gv->lnksyms) {
    for (i=0; i<LNKSYMHTABSIZE; i++) {
      for (sym=gv->lnksyms[i]; sym; sym=next) {
        next = sym->obj_chain;

        if (sym->flags & SYMF_LNKSYM) {
          if (fff[gv->dest_format]->setlnksym) {
            /* do target-specific symbol modificatios (relsect, value, etc.) */
            fff[gv->dest_format]->setlnksym(gv,sym);

            if (sym->relsect==NULL && def_ls!=NULL) {
              /* @@@ attach absolute symbols to the provided default section */
              if (!listempty(&def_ls->sections))
                sym->relsect = (struct Section *)def_ls->sections.first;
            }
            if (sym->type == SYM_RELOC)
              sym->value += sym->relsect->va;
#if 0 /* @@@ not needed? */
            add_objsymbol(sym->relsect->obj,sym);
#endif
            if (sym->bind >= SYMB_GLOBAL)
              addglobsym(gv,sym);  /* make it globally visible */
            /* add to final output section */
            addtail(&sym->relsect->lnksec->symbols,&sym->n);
            if (gv->map_file)
              print_symbol(gv->map_file,sym);
          }
        }
      }
      gv->lnksyms[i] = NULL;  /* clear chain, it's unusable now! */
    }
  }
}

// Assembly:
cmpq $0x0, 0x188(%rdi)
je 0xafaa
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
xorl %r12d, %r12d
leaq 0x242b7(%rip), %r13     # 0x2f180
movq 0x188(%r14), %rax
movq (%rax,%r12,8), %rbp
testq %rbp, %rbp
je 0xaf87
movq %rbp, %r15
movq 0x18(%rbp), %rbp
testb $0x1, 0x41(%r15)
je 0xaf77
movzbl 0x50(%r14), %eax
movq (%r13,%rax,8), %rax
movq 0x50(%rax), %rax
testq %rax, %rax
je 0xaf77
movq %r14, %rdi
movq %r15, %rsi
callq *%rax
movq 0x38(%r15), %rax
testq %rbx, %rbx
je 0xaf2a
testq %rax, %rax
jne 0xaf2a
movq 0x60(%rbx), %rax
cmpq $0x0, (%rax)
je 0xaf28
movq %rax, 0x38(%r15)
jmp 0xaf2a
xorl %eax, %eax
cmpb $0x2, 0x40(%r15)
jne 0xaf39
movq 0x30(%rax), %rcx
addq %rcx, 0x30(%r15)
cmpb $0x2, 0x43(%r15)
jb 0xaf4f
movq %r14, %rdi
movq %r15, %rsi
callq 0xa82b
movq 0x38(%r15), %rax
movq 0x18(%rax), %rdi
movl $0xb0, %eax
addq %rax, %rdi
movq %r15, %rsi
callq 0x6729
movq 0x90(%r14), %rdi
testq %rdi, %rdi
je 0xaf77
movq %r15, %rsi
callq 0x7225
testq %rbp, %rbp
jne 0xaedd
movq 0x188(%r14), %rax
movq $0x0, (%rax,%r12,8)
incq %r12
cmpq $0x10, %r12
jne 0xaec9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: find_any_symbol
struct Symbol *find_any_symbol(struct GlobalVars *gv,struct Section *sec,
                               const char *name)
/* return pointer to a global symbol or linker symbol */
{
  struct Symbol *sym = findsymbol(gv,sec,name);

  if (sym == NULL)
    sym = findlnksymbol(gv,name);

  return sym;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
callq 0xa728
testq %rax, %rax
je 0xafc7
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xae55
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: newreloc
struct Reloc *newreloc(struct GlobalVars *gv,struct Section *sec,
                       const char *xrefname,struct Section *rs,uint32_t id,
                       unsigned long offset,uint8_t rtype,lword addend)
/* allocate and init new relocation structure */
{
  struct Reloc *r = alloczero(sizeof(struct Reloc));

  if (r->xrefname = xrefname) {
    if (sec->obj) {
      uint16_t flags = sec->obj->lnkfile->flags;

      if (flags & IFF_DELUNDERSCORE) {
        if (*xrefname == '_')
          r->xrefname = ++xrefname;
      }
      else if (flags & IFF_ADDUNDERSCORE) {
        char *new_name = alloc(strlen(xrefname) + 2);

        *new_name = '_';
        strcpy(new_name+1,xrefname);
        r->xrefname = new_name;
      }
    }
  }
  if (rs)
    r->relocsect.ptr = rs;
  else
    r->relocsect.id = id;
  r->offset = offset;
  r->addend = addend;
  r->rtype = rtype;
  return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movl %r8d, %ebp
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movl $0x40, %edi
callq 0x6686
movq %rax, %r14
movq %r12, 0x10(%rax)
testq %r12, %r12
je 0xb1bb
movq 0x10(%r13), %rax
testq %rax, %rax
je 0xb1bb
movq 0x10(%rax), %rax
movzwl 0x3a(%rax), %eax
testb $0x1, %al
jne 0xb1ad
testb $0x2, %al
je 0xb1bb
movq %r12, %rdi
callq 0x50e0
leaq 0x2(%rax), %rdi
callq 0x6638
movq %rax, %r13
movb $0x5f, (%rax)
leaq 0x1(%rax), %rdi
movq %r12, %rsi
callq 0x5080
movq %r13, %r12
jmp 0xb1b7
cmpb $0x5f, (%r12)
jne 0xb1bb
incq %r12
movq %r12, 0x10(%r14)
movq 0x48(%rsp), %rcx
movb 0x40(%rsp), %al
testq %r15, %r15
je 0xb1cf
movq %r15, 0x18(%r14)
jmp 0xb1d3
movl %ebp, 0x18(%r14)
movq %rbx, 0x20(%r14)
movq %rcx, 0x28(%r14)
movb %al, 0x38(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: addreloc
void addreloc(struct Section *sec,struct Reloc *r,
              uint16_t pos,uint16_t siz,lword mask)
/* Add a relocation description of the current type to this relocation,
   which will be inserted into the sections reloc list, if not
   already done. */
{
  struct RelocInsert *new = alloc(sizeof(struct RelocInsert));
  struct RelocInsert *ri = r->insert;

  new->next = NULL;
  new->bpos = pos;
  new->bsiz = siz;
  new->mask = mask;
  if (ri) {
    while (ri->next)
      ri = ri->next;
    ri->next = new;
  }
  else
    r->insert = new;

  if (r->n.next==NULL && sec!=NULL) {
    if (r->xrefname)
      addtail(&sec->xrefs,&r->n);  /* add to current section's XRef list */
    else
      addtail(&sec->relocs,&r->n);  /* add to current section's Reloc list */
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r8, %r15
movl %ecx, %ebp
movl %edx, %r12d
movq %rsi, %rbx
movq %rdi, %r14
movl $0x18, %edi
callq 0x6638
movq 0x30(%rbx), %rcx
movq $0x0, (%rax)
movw %r12w, 0x8(%rax)
movw %bp, 0xa(%rax)
movq %r15, 0x10(%rax)
testq %rcx, %rcx
je 0xb23b
movq %rcx, %rdx
movq (%rcx), %rcx
testq %rcx, %rcx
jne 0xb22e
jmp 0xb23f
leaq 0x30(%rbx), %rdx
movq %rax, (%rdx)
testq %r14, %r14
je 0xb271
cmpq $0x0, (%rbx)
jne 0xb271
leaq 0x68(%r14), %rax
addq $0x50, %r14
cmpq $0x0, 0x10(%rbx)
cmovneq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6729
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: addstabs
void addstabs(struct ObjectUnit *ou,struct Section *sec,char *name,
              uint8_t type,int8_t other,int16_t desc,uint32_t value)
/* add an stab entry for debugging */
{
  struct StabDebug *stab = alloc(sizeof(struct StabDebug));

  stab->relsect = sec;
  stab->name.ptr = name;
  if (name) {
    if (*name == '\0')
      stab->name.ptr = NULL;
  }
  stab->n_type = type;
  stab->n_othr = other;
  stab->n_desc = desc;
  stab->n_value = value;
  addtail(&ou->stabs,&stab->n);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, 0x4(%rsp)
movl %r8d, %ebp
movl %ecx, %r15d
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r14
movl 0x40(%rsp), %ebx
movl $0x28, %edi
callq 0x6638
movq %r13, 0x10(%rax)
movq %r12, 0x18(%rax)
testq %r12, %r12
je 0xb313
cmpb $0x0, (%r12)
jne 0xb313
movq $0x0, 0x18(%rax)
movb %r15b, 0x20(%rax)
movb %bpl, 0x21(%rax)
movl 0x4(%rsp), %ecx
movw %cx, 0x22(%rax)
movl %ebx, 0x24(%rax)
addq $0x50, %r14
movq %r14, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6729
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: fixstabs
void fixstabs(struct ObjectUnit *ou)
/* fix offsets of relocatable stab entries */
{
  struct StabDebug *stab;

  for (stab=(struct StabDebug *)ou->stabs.first;
       stab->n.next!=NULL; stab=(struct StabDebug *)stab->n.next) {
    if (stab->relsect) {
      stab->n_value += (uint32_t)stab->relsect->va;
    }
  }
}

// Assembly:
movq 0x50(%rdi), %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0xb369
movq %rcx, %rdx
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0xb361
movl 0x30(%rcx), %ecx
addl %ecx, 0x24(%rax)
movq (%rdx), %rcx
movq %rdx, %rax
jmp 0xb34a
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: addtargetext
struct TargetExt *addtargetext(struct Section *s,uint8_t id,uint8_t subid,
                               uint16_t flags,uint32_t size)
/* Add a new TargetExt structure of given type to a section. The contents */
/* of this structure is target-specific. */
{
  struct TargetExt *te,*newte = alloc(size);

  newte->next = NULL;
  newte->id = id;
  newte->sub_id = subid;
  newte->flags = flags;
  if (te = s->special) {
    while (te->next)
      te = te->next;
    te->next = newte;
  }
  else
    s->special = newte;
  return newte;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebp
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %rbx
movl %r8d, %edi
callq 0x6638
movq $0x0, (%rax)
movb %r15b, 0x8(%rax)
movb %r14b, 0x9(%rax)
movw %bp, 0xa(%rax)
movq 0x88(%rbx), %rcx
testq %rcx, %rcx
je 0xb3b0
movq %rcx, %rbx
movq (%rcx), %rcx
testq %rcx, %rcx
jne 0xb3a3
jmp 0xb3b7
addq $0x88, %rbx
movq %rax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: checktargetext
bool checktargetext(struct LinkedSection *ls,uint8_t id,uint8_t subid)
/* Checks if one of the sections in LinkedSection has a TargetExt */
/* block with the given id. If subid = 0 it will be ignored. */
{
  struct Section *sec = (struct Section *)ls->sections.first;
  struct Section *nextsec;
  struct TargetExt *te;

  while (nextsec = (struct Section *)sec->n.next) {
    if (te = sec->special) {
      do {
        if (te->id==id && (te->sub_id==subid || subid==0))
          return TRUE;
      }
      while (te = te->next);
    }
    sec = nextsec;
  }
  return FALSE;
}

// Assembly:
movq 0x60(%rdi), %rcx
movq (%rcx), %rax
testq %rax, %rax
je 0xb3f9
movq 0x88(%rcx), %rdi
movq %rax, %rcx
testq %rdi, %rdi
je 0xb3c9
cmpb %sil, 0x8(%rdi)
jne 0xb3f4
movl $0x1, %eax
testb %dl, %dl
je 0xb3fb
cmpb %dl, 0x9(%rdi)
je 0xb3fb
movq (%rdi), %rdi
jmp 0xb3db
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: readsection
lword readsection(struct GlobalVars *gv,uint8_t rtype,uint8_t *p,
                  uint16_t bpos,uint16_t bsiz,lword mask)
/* Read data from section at 'p', using bit-offset 'bpos' and a field-size
   of 'bsiz' bits. The result is denormalized using the supplied mask.
   Complex RelocInsert scenarios are not supported, but this doesn't
   matter as those relocations have their addend information available
   anyway (ELF: .rela section) and don't need to read it from a section. */
{
  lword v = 0;
  int n;

  p += bpos >> 3;
  bpos &= 7;

  if (n = (bpos + bsiz + 7) >> 3) {
    if (gv->endianess == _LITTLE_ENDIAN_) {
      p += n;
      while (n--) {
        v <<= 8;
        v |= (lword)*(--p);
      }
      v >>= bpos;  /* normalize extracted bit-field */
    }
    else {  /* _BIG_ENDIAN_ or undefined */
      while (n--) {
        v <<= 8;
        v |= (lword)*p++;
      }
      v >>= (8 - ((bpos + bsiz) & 7)) & 7; /* normalize extracted bit-field */
    }
    v &= makemask(bsiz);

    /* mask and denormalize the read value using 'mask' */
    n = lshiftcnt(mask);
    mask >>= n;
    v &= mask;
    if (rtype==R_SD || rtype==R_SD2 || rtype==R_SD21)
      v <<= n;
    else
      v = sign_extend(v,(int)bsiz) << n;  /* sign-extend */
  }

  return v;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r14d
movl %ecx, %r8d
andl $0x7, %ecx
movl %ecx, %eax
addl %r14d, %eax
je 0xb459
movq %r9, %rbx
movl %esi, %ebp
shrl $0x3, %r8d
leal (%rcx,%r14), %esi
addl $0x7, %esi
cmpb $0x0, 0x202(%rdi)
je 0xb45d
addq %r8, %rdx
shrl $0x3, %esi
xorl %ecx, %ecx
xorl %r12d, %r12d
movq %r12, %rdi
shlq $0x8, %rdi
movzbl (%rdx,%rcx), %r12d
orq %rdi, %r12
incq %rcx
cmpl %ecx, %esi
jne 0xb43b
negb %al
andb $0x7, %al
movl %eax, %ecx
jmp 0xb484
xorl %ebx, %ebx
jmp 0xb4db
shrl $0x3, %esi
movl %esi, %eax
addq %rax, %r8
leaq (%rdx,%r8), %rax
decq %rax
xorl %r12d, %r12d
movq %r12, %rdx
shlq $0x8, %rdx
movzbl (%rax), %r12d
orq %rdx, %r12
decq %rax
decl %esi
jne 0xb46f
sarq %cl, %r12
movq $-0x1, %r13
movl %r14d, %ecx
shlq %cl, %r13
notq %r13
movq %rbx, %rdi
callq 0x6e27
movl %eax, %ecx
sarq %cl, %rbx
movl %eax, %r15d
andq %r13, %rbx
andq %r12, %rbx
cmpb $0x21, %bpl
ja 0xb4c7
movzbl %bpl, %eax
movabsq $0x300000400, %rcx      # imm = 0x300000400
btq %rax, %rcx
jb 0xb4d5
movq %rbx, %rdi
movl %r14d, %esi
callq 0x6ea5
movq %rax, %rbx
movl %r15d, %ecx
shlq %cl, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: sort_relocs
void sort_relocs(struct list *rlist)
/* sorts a section's relocation list by their section offsets */
{
  struct Reloc *rel,**rel_ptr_array,**p;
  int cnt = 0;

  /* count relocs and make a pointer array */
  for (rel=(struct Reloc *)rlist->first; rel->n.next!=NULL;
       rel=(struct Reloc *)rel->n.next)
    cnt++;
  if (cnt > 1) {
    rel_ptr_array = alloc(cnt * sizeof(void *));
    for (rel=(struct Reloc *)rlist->first,p=rel_ptr_array;
         rel->n.next!=NULL; rel=(struct Reloc *)rel->n.next)
      *p++ = rel;

    /* sort pointer array */
    qsort(rel_ptr_array,cnt,sizeof(void *),reloc_offset_cmp);

    /* rebuild reloc list from sorted pointer array, then free it */
    initlist(rlist);
    for (p=rel_ptr_array; cnt; cnt--) {
      rel = *p++;
      addtail(rlist,&rel->n);
    }
    free(rel_ptr_array);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
movl $0x1, %r12d
movq $-0x8, %rdi
movq (%rax), %rax
decq %r12
addq $0x8, %rdi
testq %rax, %rax
jne 0xb861
movl %r12d, %eax
negl %eax
cmpl $0x2, %eax
jb 0xb8ed
movq %r12, %r15
negq %r15
callq 0x6638
movq %rax, %r14
movq (%rbx), %rax
cmpq $0x0, (%rax)
je 0xb8a4
movq %r14, %rcx
movq %rax, (%rcx)
addq $0x8, %rcx
movq (%rax), %rax
cmpq $0x0, (%rax)
jne 0xb894
leaq 0x4e(%rip), %rcx        # 0xb8f9
movl $0x8, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x50a0
movq %rbx, %rdi
callq 0x66da
movq %r14, %r15
movq (%r15), %rsi
addq $0x8, %r15
movq %rbx, %rdi
callq 0x6729
incl %r12d
jne 0xb8c6
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x5040
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/targets.c
// Function: add_priptrs
void add_priptrs(struct GlobalVars *gv,struct ObjectUnit *ou)
/* Inserts all PriPointer nodes of an object into the global list. */
/* The node's position depends on 1. section name, 2. list name, */
/* 3. priority. */
{
  struct PriPointer *newpp,*nextpp,*pp;

  while (newpp = (struct PriPointer *)remhead(&ou->pripointers)) {
    pp = (struct PriPointer *)gv->pripointers.first;

    while (nextpp = (struct PriPointer *)pp->n.next) {
      int c;

      if ((c = strcmp(newpp->secname,pp->secname)) > 0)
        break;
      if (!c) {
        if ((c = strcmp(newpp->listname,pp->listname)) > 0)
          break;
        if (!c && newpp->priority < pp->priority)
          break;
      }
      pp = nextpp;
    }

    if (pp->n.pred)
      insertbefore(&newpp->n,&pp->n);
    else
      addhead(&gv->pripointers,&newpp->n);  /* first node in list */
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x68, %rbx
movq %rbx, %rdi
callq 0x673f
testq %rax, %rax
je 0xb9d2
movq %rax, %r15
addq $0x1a8, %r14            # imm = 0x1A8
movq (%r14), %rbp
movq (%rbp), %rax
testq %rax, %rax
je 0xb99b
movq 0x10(%r15), %r13
movq %rbp, %r12
movq %rax, %rbp
movq 0x10(%r12), %rsi
movq %r13, %rdi
callq 0x5160
testl %eax, %eax
jg 0xb99e
jne 0xb98d
movq 0x18(%r15), %rdi
movq 0x18(%r12), %rsi
callq 0x5160
testl %eax, %eax
jg 0xb99e
jne 0xb98d
movl 0x20(%r15), %eax
cmpl 0x20(%r12), %eax
jl 0xb99e
movq (%rbp), %rax
movq %rbp, %r12
testq %rax, %rax
jne 0xb955
jmp 0xb99e
movq %rbp, %r12
cmpq $0x0, 0x8(%r12)
je 0xb9b3
movq %r15, %rdi
movq %r12, %rsi
callq 0x66ee
jmp 0xb9be
movq %r14, %rdi
movq %r15, %rsi
callq 0x6713
movq %rbx, %rdi
callq 0x673f
movq %rax, %r15
testq %rax, %rax
jne 0xb945
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq