LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_headersize
unsigned long elf32_headersize(struct GlobalVars *gv)
{
  int segcnt = 0;
  struct Phdr *p = gv->phdrlist;

  while (p) {
    if (p->flags & PHDR_USED)
      segcnt++;
    p = p->next;
  }
  return sizeof(struct Elf32_Ehdr) + segcnt * sizeof(struct Elf32_Phdr);
}

// Assembly:
addq $0x1f8, %rdi            # imm = 0x1F8
xorl %eax, %eax
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x155b7
btl $0x4, 0x24(%rdi)
adcl $0x0, %eax
jmp 0x155a5
cltq
shlq $0x5, %rax
addq $0x34, %rax
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_addstrlist
static uint32_t elf32_addstrlist(struct StrTabList *sl,const char *s)
/* add a new string to an ELF string table and return its index */
{
  struct StrTabNode **chain,*sn;

  if (sl->hashtab == NULL) {
    /* initialize an unused string list */
    initlist(&sl->l);
    sl->hashtab = alloczero(sl->htabsize * sizeof(struct StrTabNode *));
    elf32_addstrlist(sl,noname);
  }
  chain = &sl->hashtab[elf_hash(s) % sl->htabsize];

  /* search string in hash table */
  while (sn = *chain) {
    if (!strcmp(s,sn->str))
      return sn->index;  /* it's already in, return index */
    chain = &sn->hashchain;
  }

  /* new string table entry */
  *chain = sn = alloc(sizeof(struct StrTabNode));
  sn->hashchain = NULL;
  sn->str = s;
  sn->index = sl->nextindex;
  addtail(&sl->l,&sn->n);
  sl->nextindex += (uint32_t)strlen(s) + 1;

  return sn->index;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %r15
testq %r15, %r15
jne 0x15605
movq %rbx, %rdi
callq 0x63c8
movq 0x20(%rbx), %rdi
shlq $0x3, %rdi
callq 0x638a
movq %rax, 0x18(%rbx)
leaq 0xb057(%rip), %rsi      # 0x20650
movq %rbx, %rdi
callq 0x155c2
movq 0x18(%rbx), %r15
movq %r14, %rdi
callq 0x69ee
xorl %edx, %edx
divq 0x20(%rbx)
leaq (%r15,%rdx,8), %r12
movq (%r12), %r15
testq %r15, %r15
je 0x15639
movq 0x18(%r15), %rsi
movq %r14, %rdi
callq 0x5160
testl %eax, %eax
je 0x15677
addq $0x10, %r15
movq %r15, %r12
jmp 0x15617
pushq $0x28
popq %rdi
callq 0x6340
movq %rax, (%r12)
andq $0x0, 0x10(%rax)
movq %r14, 0x18(%rax)
movl 0x28(%rbx), %ecx
leaq 0x20(%rax), %r15
movl %ecx, 0x20(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6414
movq %r14, %rdi
callq 0x50e0
movl 0x28(%rbx), %ecx
addl %ecx, %eax
incl %eax
movl %eax, 0x28(%rbx)
jmp 0x1567b
addq $0x20, %r15
movl (%r15), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_getshndx
uint16_t elf32_getshndx(struct GlobalVars *gv,
                        struct Symbol *sym,uint8_t symtype)
{
  uint16_t shndx = SHN_UNDEF;

  switch (sym->type) {
    case SYM_INDIR:
      /* can't reproduce unsupported symbol type */
      error(33,fff[gv->dest_format]->tname,sym->name,sym_bind[sym->bind],
            sym_type[sym->type],sym_info[sym->info]);
    case SYM_UNDEF:
      shndx = SHN_UNDEF;
      break;
    case SYM_ABS:
      shndx = SHN_ABS;
      break;
    case SYM_RELOC:
      if (symtype > STT_FUNC)
        ierror("elf32_getshndx(): %s is relocatable, but not a "
               "function or object (type %d)",sym->name,(int)symtype);
      shndx = (uint16_t)sym->relsect->lnksec->index;
      break;
    case SYM_COMMON:
      shndx = SHN_COMMON;
      break;
    default:
      ierror("elf32_getshndx(): Illegal symbol type: %d",(int)sym->type);
      break;
  }
  return shndx;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
movzbl 0x40(%rsi), %esi
cmpq $0x4, %rsi
ja 0x15734
leaq 0xbd31(%rip), %rax      # 0x213d4
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
xorl %ebx, %ebx
jmp 0x15744
movzbl 0x50(%rdi), %eax
leaq 0x19ad2(%rip), %rcx     # 0x2f190
movq (%rcx,%rax,8), %rax
movq (%rax), %rsi
movq 0x20(%rbx), %rdx
movzbl 0x43(%rbx), %eax
leaq 0x19c0c(%rip), %rcx     # 0x2f2e0
movq (%rcx,%rax,8), %rcx
leaq 0x19ba1(%rip), %rax     # 0x2f280
movq 0x20(%rax), %r8
movzbl 0x42(%rbx), %eax
leaq 0x19bc2(%rip), %rdi     # 0x2f2b0
movq (%rdi,%rax,8), %r9
xorl %ebx, %ebx
pushq $0x21
popq %rdi
xorl %eax, %eax
callq 0x6c19
jmp 0x15744
cmpb $0x3, %dl
jb 0x1571a
movzbl %dl, %edx
movq 0x20(%rbx), %rsi
leaq 0xbfb2(%rip), %rdi      # 0x216c5
xorl %eax, %eax
callq 0x6b2c
movq 0x38(%rbx), %rax
movq 0x18(%rax), %rax
movzwl 0x10(%rax), %ebx
jmp 0x15744
movw $0xfff2, %bx            # imm = 0xFFF2
jmp 0x15744
movw $0xfff1, %bx            # imm = 0xFFF1
jmp 0x15744
leaq 0xbfd6(%rip), %rdi      # 0x21711
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x6b2c
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_header
void elf32_header(FILE *f,uint16_t type,uint16_t mach,uint32_t entry,
                  uint32_t phoff,uint32_t shoff,uint32_t flags,uint16_t phnum,
                  uint16_t shnum,uint16_t shstrndx,bool be)
/* write 32-bit ELF header */
{
  struct Elf32_Ehdr eh;

  memset(&eh,0,sizeof(struct Elf32_Ehdr));
  strncpy((char *)eh.e_ident,ELFid,4);
  eh.e_ident[EI_CLASS] = ELFCLASS32;
  eh.e_ident[EI_DATA] = be ? ELFDATA2MSB : ELFDATA2LSB;
  eh.e_ident[EI_VERSION] = ELF_VER;
  write16(be,eh.e_type,type);
  write16(be,eh.e_machine,mach);
  write32(be,eh.e_version,ELF_VER);
  write32(be,eh.e_entry,entry);
  write32(be,eh.e_phoff,phoff);
  write32(be,eh.e_shoff,shoff);
  write32(be,eh.e_flags,flags);
  write16(be,eh.e_ehsize,sizeof(struct Elf32_Ehdr));
  write16(be,eh.e_phentsize,phnum ? sizeof(struct Elf32_Phdr):0);
  write16(be,eh.e_phnum,phnum);
  write16(be,eh.e_shentsize,shnum ? sizeof(struct Elf32_Shdr):0);
  write16(be,eh.e_shnum,shnum);
  write16(be,eh.e_shstrndx,shstrndx);
  fwritex(f,&eh,sizeof(struct Elf32_Ehdr));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r9d, 0x10(%rsp)
movl %r8d, 0xc(%rsp)
movl %ecx, 0x8(%rsp)
movl %edx, %r13d
movl %esi, %ebp
movq %rdi, 0x50(%rsp)
movzwl 0x98(%rsp), %eax
movl %eax, 0x14(%rsp)
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
movzwl 0xa8(%rsp), %eax
movl %eax, 0x18(%rsp)
movzwl 0xa0(%rsp), %r12d
movl 0xb0(%rsp), %r15d
xorps %xmm0, %xmm0
leaq 0x1c(%rsp), %r14
movups %xmm0, 0x24(%r14)
movups %xmm0, 0x17(%r14)
movups %xmm0, 0x7(%r14)
leaq 0x1a0d4(%rip), %rsi     # 0x2f890
pushq $0x4
popq %rdx
movq %r14, %rdi
callq 0x5060
movb $0x1, %al
cmpl $0x1, %r15d
movb $0x2, %cl
sbbb $0x0, %cl
movb %al, 0x4(%r14)
movb %cl, 0x5(%r14)
movb %al, 0x6(%r14)
leaq 0x2c(%rsp), %rsi
movl %r15d, %edi
movl %ebp, %edx
callq 0x666c
leaq 0x2e(%rsp), %rsi
movl %r15d, %edi
movl %r13d, %edx
callq 0x666c
leaq 0x30(%rsp), %rsi
pushq $0x1
popq %rdx
movl %r15d, %edi
callq 0x6681
leaq 0x34(%rsp), %rsi
movl %r15d, %edi
movl 0x8(%rsp), %edx
callq 0x6681
leaq 0x38(%rsp), %rsi
movl %r15d, %edi
movl 0xc(%rsp), %edx
callq 0x6681
leaq 0x3c(%rsp), %rsi
movl %r15d, %edi
movl 0x10(%rsp), %edx
callq 0x6681
leaq 0x40(%rsp), %rsi
movl %r15d, %edi
movl 0x90(%rsp), %edx
callq 0x6681
leaq 0x44(%rsp), %rsi
pushq $0x34
popq %rdx
movl %r15d, %edi
callq 0x666c
leaq 0x46(%rsp), %rsi
shll $0x5, %ebx
movl %r15d, %edi
movl %ebx, %edx
callq 0x666c
leaq 0x48(%rsp), %rsi
movl %r15d, %edi
movl 0x14(%rsp), %edx
callq 0x666c
testl %r12d, %r12d
leaq 0x4a(%rsp), %rsi
pushq $0x28
popq %rdx
cmovel %r12d, %edx
movl %r15d, %edi
callq 0x666c
leaq 0x4c(%rsp), %rsi
movl %r15d, %edi
movl %r12d, %edx
callq 0x666c
leaq 0x4e(%rsp), %rsi
movl %r15d, %edi
movl 0x18(%rsp), %edx
callq 0x666c
pushq $0x34
popq %rdx
movq 0x50(%rsp), %rdi
movq %r14, %rsi
callq 0x6817
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_writephdrs
void elf32_writephdrs(struct GlobalVars *gv,FILE *f)
/* write 32-bit ELF Program Header (PHDR) */
{
  bool be = elf32_endianess == _BIG_ENDIAN_;
  long gapsize = file_hdr_gap;
  struct Elf32_Phdr phdr;
  struct Phdr *p;

  for (p=gv->phdrlist; p; p=p->next) {
    if (p->flags & PHDR_USED) {
      if (p->start!=ADDR_NONE && p->start_vma!=ADDR_NONE) {
        write32(be,phdr.p_type,p->type);
        write32(be,phdr.p_offset,p->offset);
        write32(be,phdr.p_vaddr,p->start_vma);
        write32(be,phdr.p_paddr,p->start);
        write32(be,phdr.p_filesz,p->file_end - p->start);
        write32(be,phdr.p_memsz,p->mem_end - p->start);
        write32(be,phdr.p_flags,p->flags & PHDR_PFMASK);
        write32(be,phdr.p_align,1L<<p->alignment);
        fwritex(f,&phdr,sizeof(struct Elf32_Phdr));
      }
      else
        gapsize += sizeof(struct Elf32_Phdr);
    }
  }
  fwritegap(f,gapsize);  /* gap at the end, for unused PHDRs */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorl %ebp, %ebp
cmpb $0x1, 0x19f25(%rip)     # 0x2f820
sete %bpl
movq 0x1e3ea(%rip), %rax     # 0x33cf0
movq %rax, (%rsp)
addq $0x1f8, %r14            # imm = 0x1F8
leaq 0x8(%rsp), %r13
pushq $0x1
popq %r12
pushq $0x20
popq %r15
movq (%r14), %r14
testq %r14, %r14
je 0x159f4
testb $0x10, 0x24(%r14)
je 0x1591e
cmpq $-0x1, 0x30(%r14)
je 0x159ea
cmpq $-0x1, 0x28(%r14)
je 0x159ea
movl 0x20(%r14), %edx
movl %ebp, %edi
movq %r13, %rsi
callq 0x6681
movl 0x48(%r14), %edx
movl %ebp, %edi
leaq 0xc(%rsp), %rsi
callq 0x6681
movl 0x28(%r14), %edx
movl %ebp, %edi
leaq 0x10(%rsp), %rsi
callq 0x6681
movl 0x30(%r14), %edx
movl %ebp, %edi
leaq 0x14(%rsp), %rsi
callq 0x6681
movl 0x38(%r14), %edx
subl 0x30(%r14), %edx
movl %ebp, %edi
leaq 0x18(%rsp), %rsi
callq 0x6681
movl 0x40(%r14), %edx
subl 0x30(%r14), %edx
movl %ebp, %edi
leaq 0x1c(%rsp), %rsi
callq 0x6681
movzwl 0x24(%r14), %edx
andl $0xf, %edx
movl %ebp, %edi
leaq 0x20(%rsp), %rsi
callq 0x6681
movb 0x26(%r14), %cl
movq %r12, %rdx
shlq %cl, %rdx
movl %ebp, %edi
leaq 0x24(%rsp), %rsi
callq 0x6681
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x6817
jmp 0x1591e
addq $0x20, (%rsp)
jmp 0x1591e
movq %rbx, %rdi
movq (%rsp), %rsi
callq 0x698d
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_addsymlist
void elf32_addsymlist(struct GlobalVars *gv,struct SymTabList *sl,
                      uint8_t bind,uint8_t type)
/* add all symbols with specified bind and type to the ELF symbol list */
{
  struct LinkedSection *ls = (struct LinkedSection *)gv->lnksec.first;
  struct LinkedSection *nextls;
  struct Symbol *nextsym,*sym;

  while (nextls = (struct LinkedSection *)ls->n.next) {
    sym = (struct Symbol *)ls->symbols.first;

    while (nextsym = (struct Symbol *)sym->n.next) {
      uint8_t symtype = elf32_getinfo(sym);
      uint8_t symbind = elf32_getbind(sym);

      if (symbind == bind && (!type || (symtype == type))) {
        if (!discard_symbol(gv,sym)) {
          remnode(&sym->n);
          elf32_addsym(sl,&elf32stringlist,sym->name,(uint32_t)sym->value,
                       sym->size,symbind,symtype,
                       elf32_getshndx(gv,sym,symtype));
        }
      }
      sym = nextsym;
    }
    ls = nextls;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %ebx
movl %edx, %r12d
movq %rsi, 0x20(%rsp)
movq %rdi, 0x10(%rsp)
movq 0x1c0(%rdi), %rax
movzbl %r12b, %ecx
movl %ecx, 0x4(%rsp)
movl %edx, 0x8(%rsp)
movq (%rax), %rcx
testq %rcx, %rcx
je 0x15d49
movq %rcx, 0x18(%rsp)
movq 0xb0(%rax), %r15
movq %r15, %r13
movq (%r15), %r15
testq %r15, %r15
je 0x15d3f
testb %bl, %bl
sete %bpl
movq %r13, %rdi
callq 0x14d27
movl %eax, %r14d
movq %r13, %rdi
callq 0x14d06
cmpb %bl, %r14b
sete %cl
cmpb %r12b, %al
jne 0x15c98
orb %cl, %bpl
je 0x15c98
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0xc408
testl %eax, %eax
jne 0x15c98
movq %r13, %rdi
callq 0x6444
movq 0x20(%r13), %r12
movl 0x30(%r13), %eax
movl %eax, 0xc(%rsp)
movl 0x44(%r13), %ebp
movzbl %r14b, %r14d
movq 0x10(%rsp), %rdi
movq %r13, %rsi
movl %r14d, %edx
callq 0x1568a
movzwl %ax, %eax
movq 0x20(%rsp), %rdi
leaq 0x19a74(%rip), %rsi     # 0x2f790
movq %r12, %rdx
movl 0x8(%rsp), %r12d
movl 0xc(%rsp), %ecx
movl %ebp, %r8d
movl 0x4(%rsp), %r9d
pushq %rax
pushq %r14
callq 0x14bb2
popq %rcx
popq %rdx
jmp 0x15c98
movq 0x18(%rsp), %rax
jmp 0x15c80
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_addshdr
static struct ShdrNode *elf32_addshdr(uint32_t name,uint32_t type,
                                      uint32_t flags,uint32_t addr,
                                      uint32_t offset,uint32_t size,
                                      uint32_t link,uint32_t info,
                                      uint32_t align,uint32_t entsize,bool be)
{
  struct ShdrNode *shn = elf32_newshdr();

  write32(be,shn->s.sh_name,name);
  write32(be,shn->s.sh_type,type);
  write32(be,shn->s.sh_flags,flags);
  write32(be,shn->s.sh_addr,addr);
  write32(be,shn->s.sh_offset,offset);
  write32(be,shn->s.sh_size,size);
  write32(be,shn->s.sh_link,link);
  write32(be,shn->s.sh_info,info);
  write32(be,shn->s.sh_addralign,align);
  write32(be,shn->s.sh_entsize,entsize);
  return shn;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, 0x4(%rsp)
movl %r8d, (%rsp)
movl %ecx, %r12d
movl %edx, %ebx
movl %esi, %r13d
movl %edi, %r15d
movl 0x60(%rsp), %ebp
callq 0x17097
movq %rax, %r14
leaq 0x10(%rax), %rsi
movl %ebp, %edi
movl %r15d, %edx
callq 0x6681
leaq 0x14(%r14), %rsi
movl %ebp, %edi
movl %r13d, %edx
callq 0x6681
leaq 0x18(%r14), %rsi
movl %ebp, %edi
movl %ebx, %edx
callq 0x6681
leaq 0x1c(%r14), %rsi
movl %ebp, %edi
movl %r12d, %edx
callq 0x6681
leaq 0x20(%r14), %rsi
movl %ebp, %edi
movl (%rsp), %edx
callq 0x6681
leaq 0x24(%r14), %rsi
movl %ebp, %edi
movl 0x4(%rsp), %edx
callq 0x6681
leaq 0x28(%r14), %rsi
movl %ebp, %edi
movl 0x40(%rsp), %edx
callq 0x6681
leaq 0x2c(%r14), %rsi
movl %ebp, %edi
movl 0x48(%rsp), %edx
callq 0x6681
leaq 0x30(%r14), %rsi
movl %ebp, %edi
movl 0x50(%rsp), %edx
callq 0x6681
leaq 0x34(%r14), %rsi
movl %ebp, %edi
movl 0x58(%rsp), %edx
callq 0x6681
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_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_makeshstrtab
void elf32_makeshstrtab(void)
/* creates .shstrtab */
{
  bool be = elf32_endianess == _BIG_ENDIAN_;

  elf32_addshdr(shstrtabidx,SHT_STRTAB,0,0,elf32offset,
                elf32shstrlist.nextindex,0,0,1,0,be);
  elf32offset += elf32shstrlist.nextindex;
  elf32offset += align(elf32offset,2);
}

// Assembly:
subq $0x28, %rsp
xorl %eax, %eax
cmpb $0x1, 0x18e06(%rip)     # 0x2f820
sete %al
movl 0x1d2fd(%rip), %edi     # 0x33d20
movl 0x1d2ee(%rip), %r8d     # 0x33d18
movl 0x18de7(%rip), %r9d     # 0x2f818
andl $0x0, 0x18(%rsp)
andl $0x0, 0x8(%rsp)
movl %eax, 0x20(%rsp)
andl $0x0, (%rsp)
movl $0x1, 0x10(%rsp)
pushq $0x3
popq %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x16931
movl 0x18dbb(%rip), %edi     # 0x2f818
addq 0x1d2b4(%rip), %rdi     # 0x33d18
movq %rdi, 0x1d2ad(%rip)     # 0x33d18
pushq $0x2
popq %rsi
callq 0x6a1e
addq %rax, 0x1d29e(%rip)     # 0x33d18
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_makestrtab
void elf32_makestrtab(void)
/* creates .strtab */
{
  bool be = elf32_endianess == _BIG_ENDIAN_;

  elf32_addshdr(strtabidx,SHT_STRTAB,0,0,elf32offset,
                elf32stringlist.nextindex,0,0,1,0,be);
  elf32offset += elf32stringlist.nextindex;
  elf32offset += align(elf32offset,2);
}

// Assembly:
subq $0x28, %rsp
xorl %eax, %eax
cmpb $0x1, 0x18d94(%rip)     # 0x2f820
sete %al
movl 0x1d28f(%rip), %edi     # 0x33d24
movl 0x1d27c(%rip), %r8d     # 0x33d18
movl 0x18d15(%rip), %r9d     # 0x2f7b8
andl $0x0, 0x18(%rsp)
andl $0x0, 0x8(%rsp)
movl %eax, 0x20(%rsp)
andl $0x0, (%rsp)
movl $0x1, 0x10(%rsp)
pushq $0x3
popq %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x16931
movl 0x18ce9(%rip), %edi     # 0x2f7b8
addq 0x1d242(%rip), %rdi     # 0x33d18
movq %rdi, 0x1d23b(%rip)     # 0x33d18
pushq $0x2
popq %rsi
callq 0x6a1e
addq %rax, 0x1d22c(%rip)     # 0x33d18
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_makestabstr
void elf32_makestabstr(void)
/* create .stabstr */
{
  if (stabdebugidx) {
    bool be = elf32_endianess == _BIG_ENDIAN_;
    uint32_t size = 0;
    struct StabCompUnit *cu;

    for (cu=(struct StabCompUnit *)elf32stabcompunits.first;
         cu->n.next!=NULL; cu=(struct StabCompUnit *)cu->n.next)
      size += cu->strtab.nextindex;

    if (stabshdr) {
      /* patch sh_link field of .stab */
      write32(be,stabshdr->s.sh_link,elf32shdridx);
    }
    elf32_addshdr(stabdebugidx,SHT_STRTAB,0,0,elf32offset,size,0,0,1,0,be);
    elf32offset += size;
  }
}

// Assembly:
movl 0x1d231(%rip), %edi     # 0x33d28
testl %edi, %edi
je 0x16b8e
pushq %rbp
pushq %rbx
subq $0x28, %rsp
movb 0x18d15(%rip), %al      # 0x2f820
xorl %ebx, %ebx
movq 0x1d21c(%rip), %rcx     # 0x33d30
movq (%rcx), %rdx
testq %rdx, %rdx
je 0x16b24
addl 0x60(%rcx), %ebx
movq %rdx, %rcx
jmp 0x16b14
xorl %ebp, %ebp
cmpb $0x1, %al
sete %bpl
movq 0x1d215(%rip), %rsi     # 0x33d48
testq %rsi, %rsi
je 0x16b4f
addq $0x28, %rsi
movl 0x1d1ce(%rip), %edx     # 0x33d10
movl %ebp, %edi
callq 0x6681
movl 0x1d1d9(%rip), %edi     # 0x33d28
movl 0x1d1c2(%rip), %r8d     # 0x33d18
andl $0x0, 0x18(%rsp)
andl $0x0, 0x8(%rsp)
movl %ebp, 0x20(%rsp)
andl $0x0, (%rsp)
movl $0x1, 0x10(%rsp)
pushq $0x3
popq %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movl %ebx, %r9d
callq 0x16931
movl %ebx, %eax
addq %rax, 0x1d190(%rip)     # 0x33d18
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_makesymtab
void elf32_makesymtab(uint32_t strtabindex)
/* creates .symtab */
{
  bool be = elf32_endianess == _BIG_ENDIAN_;

  elf32_addshdr(symtabidx,SHT_SYMTAB,0,0,elf32offset,
                elf32symlist.nextindex * sizeof(struct Elf32_Sym),
                strtabindex,elf32symlist.global_index,4,
                sizeof(struct Elf32_Sym),be);
  elf32offset += elf32symlist.nextindex * sizeof(struct Elf32_Sym);
}

// Assembly:
pushq %rax
movl %edi, %eax
xorl %r10d, %r10d
cmpb $0x1, 0x18c84(%rip)     # 0x2f820
sete %r10b
movl 0x1d1aa(%rip), %edi     # 0x33d50
movl 0x1d16b(%rip), %r8d     # 0x33d18
movl 0x18ba4(%rip), %r9d     # 0x2f758
shll $0x4, %r9d
movl 0x18b9d(%rip), %r11d    # 0x2f75c
subq $0x8, %rsp
pushq $0x2
popq %rsi
xorl %edx, %edx
xorl %ecx, %ecx
pushq %r10
pushq $0x10
pushq $0x4
pushq %r11
pushq %rax
callq 0x16931
addq $0x30, %rsp
movl 0x18b76(%rip), %eax     # 0x2f758
shlq $0x4, %rax
addq %rax, 0x1d12b(%rip)     # 0x33d18
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: write_nlist
static void write_nlist(bool be,struct nlist32 *n,long strx,
                        uint8_t type,int8_t othr,int16_t desc,uint32_t val)
{
  write32(be,&n->n_strx,strx);
  n->n_type = type;
  n->n_other = othr;
  write16(be,&n->n_desc,desc);
  write32(be,&n->n_value,val);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebx
movl %r8d, %ebp
movl %ecx, %r14d
movq %rsi, %r15
movl %edi, %r12d
movl 0x40(%rsp), %r13d
callq 0x6681
movb %r14b, 0x4(%r15)
movb %bpl, 0x5(%r15)
leaq 0x6(%r15), %rsi
movzwl %bx, %edx
movl %r12d, %edi
callq 0x666c
addq $0x8, %r15
movl %r12d, %edi
movq %r15, %rsi
movl %r13d, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6681
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_initoutput
void elf32_initoutput(struct GlobalVars *gv,
                      uint32_t init_file_offset,int8_t output_endianess)
/* initialize section header, program header, relocation, symbol, */
/* string and section header string lists */
{
  elf32_endianess = output_endianess;
  elf32offset = init_file_offset;
  file_hdr_gap = 0;

  if (gv->phdrlist == NULL) {
    /* we need to provide at least one dummy PHDR, even for reloc-objects */
    struct Phdr *p = alloczero(sizeof(struct Phdr));

    p->type = PT_LOAD;
    p->flags = PF_X|PF_W|PF_R|PHDR_USED;
    p->mem_end = p->file_end = 0xffffffff;
    p->offset = fff[gv->dest_format]->headersize(gv);
    gv->phdrlist = p;
  }

  initlist(&shdrlist);
  initlist(&phdrlist);
  initlist(&relalist);
  elf32shdridx = 0;

  symtabidx = elf32_addshdrstr(".symtab");
  strtabidx = elf32_addshdrstr(".strtab");
  shstrtabidx = elf32_addshdrstr(".shstrtab");
  elf32_newshdr();          /* first Shdr is always zero */
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movb %dl, 0x18856(%rip)      # 0x2f820
andq $0x0, 0x1cd1e(%rip)     # 0x33cf0
movl %esi, %eax
movq %rax, 0x1cd3d(%rip)     # 0x33d18
cmpq $0x0, 0x1f8(%rdi)
jne 0x1702d
movq %rdi, %rbx
pushq $0x58
popq %rdi
callq 0x638a
movq %rax, %r14
movl $0x1, 0x20(%rax)
movw $0x17, 0x24(%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x38(%r14)
movq %rax, 0x40(%r14)
movzbl 0x50(%rbx), %eax
leaq 0x18178(%rip), %rcx     # 0x2f190
movq (%rcx,%rax,8), %rax
movq %rbx, %rdi
callq *0x18(%rax)
movq %rax, 0x48(%r14)
movq %r14, 0x1f8(%rbx)
leaq 0x1ccc4(%rip), %rdi     # 0x33cf8
callq 0x63c8
leaq 0x1cd18(%rip), %rdi     # 0x33d58
callq 0x63c8
leaq 0x1cd24(%rip), %rdi     # 0x33d70
callq 0x63c8
andl $0x0, 0x1ccb8(%rip)     # 0x33d10
leaq 0xa7e7(%rip), %rdi      # 0x21846
callq 0x169fe
movl %eax, 0x1cce6(%rip)     # 0x33d50
leaq 0xa7dd(%rip), %rdi      # 0x2184e
callq 0x169fe
movl %eax, 0x1cca8(%rip)     # 0x33d24
leaq 0xa7d3(%rip), %rdi      # 0x21856
callq 0x169fe
movl %eax, 0x1cc92(%rip)     # 0x33d20
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x17097
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_newshdr
static struct ShdrNode *elf32_newshdr(void)
{
  struct ShdrNode *s = alloczero(sizeof(struct ShdrNode));

  addtail(&shdrlist,&s->n);
  ++elf32shdridx;
  return s;
}

// Assembly:
pushq %rbx
pushq $0x38
popq %rdi
callq 0x638a
movq %rax, %rbx
leaq 0x1cc4e(%rip), %rdi     # 0x33cf8
movq %rax, %rsi
callq 0x6414
incl 0x1cc58(%rip)           # 0x33d10
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_writesegments
void elf32_writesegments(struct GlobalVars *gv,FILE *f)
/* write all PT_LOAD segments, with alignment gaps, etc. */
{
  struct Phdr *p;
  struct LinkedSection *ls;

  for (p=gv->phdrlist; p; p=p->next) {
    if (p->type==PT_LOAD && (p->flags&PHDR_USED) &&
        p->start!=ADDR_NONE && p->start_vma!=ADDR_NONE) {
      /* write page-alignment gap */
      fwritegap(f,p->alignment_gap);

      /* write section contents */
      for (ls=(struct LinkedSection *)gv->lnksec.first;
           ls->n.next!=NULL; ls=(struct LinkedSection *)ls->n.next) {
        if (ls->copybase>=(unsigned long)p->start &&
            (ls->copybase+ls->size)<=(unsigned long)p->mem_end &&
            (ls->flags & SF_ALLOC)) {
          if (ls->filesize)
            fwritex(f,ls->data,ls->filesize);  /* section's contents */
          if (ls->gapsize)
            fwritegap(f,ls->gapsize);  /* inter-section alignment gap */
        }
      }
    }
  }

  /* unallocated sections at last */
  for (ls=(struct LinkedSection *)gv->lnksec.first;
       ls->n.next!=NULL; ls=(struct LinkedSection *)ls->n.next) {
    if (!(ls->flags & SF_ALLOC)) {
      if (!(ls->flags & SF_UNINITIALIZED))
        fwritex(f,ls->data,ls->size);
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1f8(%rdi), %r15
addq $0x1c0, %r14            # imm = 0x1C0
movq (%r15), %r15
testq %r15, %r15
je 0x1717b
cmpl $0x1, 0x20(%r15)
jne 0x170d9
testb $0x10, 0x24(%r15)
je 0x170d9
cmpq $-0x1, 0x30(%r15)
je 0x170d9
cmpq $-0x1, 0x28(%r15)
je 0x170d9
movq 0x50(%r15), %rsi
movq %rbx, %rdi
callq 0x698d
movq %r14, %r12
movq (%r12), %r12
cmpq $0x0, (%r12)
je 0x170d9
movq 0x38(%r12), %rax
cmpq 0x30(%r15), %rax
jb 0x17110
addq 0x48(%r12), %rax
cmpq 0x40(%r15), %rax
ja 0x17110
testb $0x1, 0x21(%r12)
je 0x17110
movq 0x50(%r12), %rdx
testq %rdx, %rdx
je 0x17150
movq 0x78(%r12), %rsi
movq %rbx, %rdi
callq 0x6817
movq 0x58(%r12), %rsi
testq %rsi, %rsi
je 0x17110
movq %rbx, %rdi
callq 0x698d
jmp 0x17110
testb $0x3, 0x21(%r14)
jne 0x1717b
movq 0x48(%r14), %rdx
movq 0x78(%r14), %rsi
movq %rbx, %rdi
callq 0x6817
movq (%r14), %r14
cmpq $0x0, (%r14)
jne 0x17164
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_writesections
void elf32_writesections(struct GlobalVars *gv,FILE *f)
/* write all linked sections */
{
  struct LinkedSection *ls;

  /* write all allocated sections */
  for (ls=(struct LinkedSection *)gv->lnksec.first;
       ls->n.next!=NULL; ls=(struct LinkedSection *)ls->n.next) {
    if (ls->flags & SF_ALLOC) {
      if (!(ls->flags & SF_UNINITIALIZED))
        fwritex(f,ls->data,ls->size);
    }
  }
  /* unallocated sections at last */
  for (ls=(struct LinkedSection *)gv->lnksec.first;
       ls->n.next!=NULL; ls=(struct LinkedSection *)ls->n.next) {
    if (!(ls->flags & SF_ALLOC)) {
      if (!(ls->flags & SF_UNINITIALIZED))
        fwritex(f,ls->data,ls->size);
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
addq $0x1c0, %r14            # imm = 0x1C0
movq %r14, %r15
movq (%r15), %r15
cmpq $0x0, (%r15)
je 0x171e1
movb 0x21(%r15), %al
andb $0x3, %al
cmpb $0x1, %al
jne 0x171a5
movq 0x48(%r15), %rdx
movq 0x78(%r15), %rsi
movq %rbx, %rdi
callq 0x6817
jmp 0x171a5
testb $0x3, 0x21(%r14)
jne 0x171e1
movq 0x48(%r14), %rdx
movq 0x78(%r14), %rsi
movq %rbx, %rdi
callq 0x6817
movq (%r14), %r14
cmpq $0x0, (%r14)
jne 0x171ca
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_writestabstr
void elf32_writestabstr(FILE *f)
{
  if (stabdebugidx) {
    struct StabCompUnit *cu;

    for (cu=(struct StabCompUnit *)elf32stabcompunits.first;
         cu->n.next!=NULL; cu=(struct StabCompUnit *)cu->n.next)
      elf32_writestrtab(f,&cu->strtab);
  }
}

// Assembly:
cmpl $0x0, 0x1caf6(%rip)     # 0x33d28
je 0x17260
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1caee(%rip), %r14     # 0x33d30
movq (%r14), %r14
cmpq $0x0, (%r14)
je 0x17259
leaq 0x38(%r14), %rsi
movq %rbx, %rdi
callq 0x171f0
jmp 0x17242
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_writerelocs
void elf32_writerelocs(struct GlobalVars *gv,FILE *f)
{
  struct RelaNode *rn;

  while (rn = (struct RelaNode *)remhead(&relalist))
    fwritex(f,&rn->r,
            gv->reloctab_format==RTAB_ADDEND ?
              sizeof(struct Elf32_Rela) : sizeof(struct Elf32_Rel));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1cac7(%rip), %r15     # 0x33d70
movq %r15, %rdi
callq 0x642a
testq %rax, %rax
je 0x172d9
addq $0x10, %rax
xorl %ecx, %ecx
cmpb $0x2, 0x6e(%r14)
sete %cl
leaq 0x8(,%rcx,4), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6817
jmp 0x172a9
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_findsym
static uint32_t elf32_findsym(struct SymTabList *sl,const char *name,
                              uint16_t shndx,bool be)
/* find an ELF symbol by its name and shndx */
/* return its symbol table index, index=0 means 'not found' */
{
  struct SymbolNode **chain = &sl->hashtab[elf_hash(name) % sl->htabsize];
  struct SymbolNode *sym;

  while (sym = *chain) {
    if (!strcmp(name,sym->name))
      if (read16(be,sym->s.st_shndx) == shndx)
        return sym->index;
    chain = &sym->hashchain;
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movq 0x17e66(%rip), %r12     # 0x2f748
callq 0x69ee
xorl %r15d, %r15d
xorl %edx, %edx
divq 0x17e5d(%rip)           # 0x2f750
leaq (%r12,%rdx,8), %r12
movq (%r12), %r12
testq %r12, %r12
je 0x1792d
movq 0x18(%r12), %rsi
movq %r14, %rdi
callq 0x5160
testl %eax, %eax
jne 0x17922
leaq 0x2e(%r12), %rsi
movl %ebx, %edi
callq 0x663d
cmpw %bp, %ax
je 0x17928
addq $0x10, %r12
jmp 0x178f7
movl 0x30(%r12), %r15d
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32ppcbe.c
// Function: ppc32be_identify
static int ppc32be_identify(char *name,uint8_t *p,unsigned long plen,bool lib)
/* identify ELF-PPC-32Bit-BigEndian */
{
  int id;

  /* first check for ancient PowerPC machine types */
  if ((id = elf32_identify(&fff_elf32ppcbe,name,(struct Elf32_Ehdr *)p,
                           plen,ELFCLASS32,ELFDATA2MSB,EM_CYGNUS_POWERPC,
                           ELF_VER)) != ID_UNKNOWN)
    return (id);

  /* EM_PPC_OLD is used in Motorola's libmoto.a, for example... */
  if ((id = elf32_identify(&fff_elf32ppcbe,name,(struct Elf32_Ehdr *)p,
                           plen,ELFCLASS32,ELFDATA2MSB,EM_PPC_OLD,
                           ELF_VER)) != ID_UNKNOWN)
    return (id);

  /* the normal case: EM_PPC */
  return (elf32_identify(&fff_elf32ppcbe,name,(struct Elf32_Ehdr *)p,plen,
                         ELFCLASS32,ELFDATA2MSB,EM_PPC,ELF_VER));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x17daf(%rip), %rdi     # 0x2f8a0
pushq $0x1
popq %r8
pushq $0x2
popq %r9
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
pushq $0x1
pushq $0x9025                 # imm = 0x9025
callq 0x12c80
addq $0x10, %rsp
testl %eax, %eax
jne 0x17b62
leaq 0x17d83(%rip), %rdi     # 0x2f8a0
pushq $0x1
popq %r8
pushq $0x2
popq %r9
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
pushq $0x1
pushq $0x11
callq 0x12c80
addq $0x10, %rsp
testl %eax, %eax
jne 0x17b62
leaq 0x17d5a(%rip), %rdi     # 0x2f8a0
pushq $0x1
popq %r8
pushq $0x2
popq %r9
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
pushq $0x1
pushq $0x14
callq 0x12c80
popq %rcx
popq %rdx
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32ppcbe.c
// Function: ppc32be_readconv
static void ppc32be_readconv(struct GlobalVars *gv,struct LinkFile *lf)
/* Read elfppc32be executable / object / shared obj. */
{
  if (lf->type == ID_LIBARCH) {
    struct ar_info ai;

    if (ar_init(&ai,(char *)lf->data,lf->length,lf->filename)) {
      while (ar_extract(&ai)) {
        lf->objname = allocstring(ai.name);
        elf32_check_ar_type(fff[lf->format],lf->pathname,
                            (struct Elf32_Ehdr *)ai.data,
                            ELFCLASS32,ELFDATA2MSB,ELF_VER,
                            3,EM_PPC,EM_PPC_OLD,EM_CYGNUS_POWERPC);
        elf32_parse(gv,lf,(struct Elf32_Ehdr *)ai.data,
                    ppc32_reloc_elf2vlink);
      }
    }
    else
      ierror("ppc32be_readconv(): archive %s corrupted since last access",
             lf->pathname);
  }
  else {
    lf->objname = lf->filename;
    elf32_parse(gv,lf,(struct Elf32_Ehdr *)lf->data,ppc32_reloc_elf2vlink);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x8, 0x39(%rsi)
jne 0x17c26
movq 0x18(%rbx), %rcx
movq 0x28(%rbx), %rsi
movq 0x30(%rbx), %rdx
movq %rsp, %rdi
callq 0xc6e0
testl %eax, %eax
je 0x17c55
movq %rsp, %r12
pushq $0x2
popq %rbp
pushq $0x1
popq %r13
leaq 0xa5c(%rip), %r15       # 0x18612
movq %r12, %rdi
callq 0xc745
testl %eax, %eax
je 0x17c67
leaq 0x20(%rsp), %rdi
callq 0x63a1
movq %rax, 0x20(%rbx)
movzbl 0x38(%rbx), %eax
leaq 0x175b1(%rip), %rcx     # 0x2f190
movq (%rcx,%rax,8), %rdi
movq 0x10(%rbx), %rsi
movq 0x128(%rsp), %rdx
movl %r13d, %ecx
movl %ebp, %r8d
movl %r13d, %r9d
xorl %eax, %eax
pushq $0x9025                 # imm = 0x9025
pushq $0x11
pushq $0x14
pushq $0x3
callq 0x12dec
addq $0x20, %rsp
movq 0x128(%rsp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rcx
callq 0x137fb
jmp 0x17bb6
movq 0x18(%rbx), %rax
movq 0x28(%rbx), %rdx
movq %rax, 0x20(%rbx)
leaq 0x9d9(%rip), %rcx       # 0x18612
movq %r14, %rdi
movq %rbx, %rsi
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x137fb
movq 0x10(%rbx), %rsi
leaq 0x9fbd(%rip), %rdi      # 0x21c1d
xorl %eax, %eax
callq 0x6b2c
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32ppcbe.c
// Function: amiga_targetlink
static int amiga_targetlink(struct GlobalVars *gv,struct LinkedSection *ls,
                            struct Section *s)
/* returns 1, if target requires the combination of the two sections, */
/* returns -1, if target doesn't want to combine them, */
/* returns 0, if target doesn't care - standard linking rules are used. */
{
  if (!gv->dest_object && !gv->use_ldscript) {
    if ((!strncmp(ls->name,sdata_name,6) && !strncmp(s->name,sbss_name,5)
         && *(ls->name+6) == *(s->name+5)) ||
        (!strncmp(ls->name,sbss_name,5) && !strncmp(s->name,sdata_name,6)
         && *(ls->name+5) == *(s->name+6)))
      /* .sdata/.sbss, .sdata2/.sbss2, etc. are always combined */
      return (1);
  }
  return (elf32_targetlink(gv,ls,s));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
cmpl $0x0, 0x54(%rdi)
jne 0x17eb8
cmpl $0x0, 0x244(%r15)
jne 0x17eb8
movq 0x18(%r14), %r12
leaq 0x8775(%rip), %rsi      # 0x205b1
pushq $0x6
popq %rdx
movq %r12, %rdi
callq 0x5070
testl %eax, %eax
jne 0x17e70
movq 0x20(%rbx), %r13
leaq 0x8762(%rip), %rsi      # 0x205b8
pushq $0x5
popq %rdx
movq %r13, %rdi
callq 0x5070
testl %eax, %eax
jne 0x17e70
movb 0x6(%r12), %al
cmpb 0x5(%r13), %al
je 0x17eab
leaq 0x8741(%rip), %rsi      # 0x205b8
pushq $0x5
popq %rdx
movq %r12, %rdi
callq 0x5070
testl %eax, %eax
jne 0x17eb8
movq 0x20(%rbx), %r13
leaq 0x8720(%rip), %rsi      # 0x205b1
pushq $0x6
popq %rdx
movq %r13, %rdi
callq 0x5070
testl %eax, %eax
jne 0x17eb8
movb 0x5(%r12), %al
cmpb 0x6(%r13), %al
jne 0x17eb8
pushq $0x1
popq %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x14614
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32ppcbe.c
// Function: amiga_setlnksym
static void amiga_setlnksym(struct GlobalVars *gv,struct Symbol *xdef)
{
  if ((xdef->flags & SYMF_LNKSYM) && (xdef->extra & SYMX_SPECIAL)) {
    struct LinkedSection *ls;

    switch (xdef->extra & ~SYMX_SPECIAL) {
      case LINKERDB:
      case R13INIT:
        ls = smalldata_section(gv);
        xdef->relsect = (struct Section *)ls->sections.first;
        break;
      case SDATASIZE:
        if (ls = find_lnksec(gv,sdata_name,0,0,0,0))
          xdef->value = (lword)ls->size;
        break;
      case SBSSSIZE:
        if (ls = find_lnksec(gv,sbss_name,0,0,0,0))
          xdef->value = (lword)ls->size;
        break;
      case DDRELOCS:
        xdef->relsect = ddrelocs_sec(gv,find_lnksec(gv,sdata_name,0,0,0,0));
        break;
      case TEXTSIZE:
        if (ls = find_lnksec(gv,text_name,0,0,0,0))
          xdef->value = (lword)ls->size;
        break;
    }
    xdef->flags &= ~SYMF_LNKSYM;  /* do not init again */
  }
  else
    elf32_setlnksym(gv,xdef);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
testb $0x1, 0x41(%rsi)
je 0x181b9
movl 0x48(%rbx), %eax
testl %eax, %eax
js 0x181c9
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x14720
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl $0x5, %eax
ja 0x182e0
leaq 0x98ee(%rip), %rcx      # 0x21acc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
callq 0xc25a
movq 0x60(%rax), %rax
movq %rax, 0x38(%rbx)
jmp 0x182e0
leaq 0x83b5(%rip), %rsi      # 0x205b8
jmp 0x18215
leaq 0x83a5(%rip), %rsi      # 0x205b1
jmp 0x18215
leaq 0x838b(%rip), %rsi      # 0x205a0
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xb7e9
testq %rax, %rax
je 0x182e0
movq 0x48(%rax), %rax
movq %rax, 0x30(%rbx)
jmp 0x182e0
leaq 0x836d(%rip), %rsi      # 0x205b1
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xb7e9
testq %rax, %rax
je 0x18265
movq 0x60(%rax), %rax
addq $0x10, %rax
jmp 0x1826c
leaq 0x138(%r14), %rax
movq (%rax), %r15
testq %r15, %r15
jne 0x18282
leaq 0x9a07(%rip), %rdi      # 0x21c82
xorl %eax, %eax
callq 0x6b2c
leaq 0x17d05(%rip), %rsi     # 0x2ff8e
movq %r15, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xba41
movq %rax, %r15
movabsq $0x2010102ffffffff, %rax # imm = 0x2010102FFFFFFFF
movq %rax, 0x28(%r15)
movq 0x20(%r15), %rsi
pushq $0x1
popq %rcx
pushq $0x2
popq %rdx
movq %r14, %rdi
movl %ecx, %r8d
movl %edx, %r9d
callq 0xbcdb
movq %rax, %r14
leaq 0x60(%rax), %rdi
movq %r15, %rsi
callq 0x6414
movq %r14, 0x18(%r15)
pushq $0x1
popq %rax
movq %rax, 0x48(%r14)
movq %rax, 0x48(%r15)
movq %r15, 0x38(%rbx)
andb $-0x2, 0x41(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32ppcbe.c
// Function: amiga_writeexec
static void amiga_writeexec(struct GlobalVars *gv,FILE *f)
/* creates a target-elf32powerup executable file, which in */
/* reality is a relocatable object too, but all symbol references have */
/* been resolved */
{
  struct LinkedSection *ls;

  if (gv->collect_ctors_type == CCDT_VBCC_ELF) {
    static const char ctname[] = ".vbcc_ctors";
    static const char dtname[] = ".vbcc_dtors";
    /* rename .ctors and .dtors,
       otherwise the PowerUp ELF loader will rearrange the pointers */
    if (ls = find_lnksec(gv,ctors_name,0,0,0,0))
      ls->name = ctname;
    if (ls = find_lnksec(gv,dtors_name,0,0,0,0))
      ls->name = dtname;
  }

  for (ls=(struct LinkedSection *)gv->lnksec.first; ls->n.next!=NULL;
       ls=(struct LinkedSection *)ls->n.next) {
    /* set filesize to memsize for all sections */
    if (!(ls->flags & SF_UNINITIALIZED))
      ls->filesize = ls->size;

    /* setup ddrelocs section, if present */
    if (!strcmp(ls->name,ddrelocs_name))
      make_ddrelocs(gv,ls);
  }

  elf32_writeobject(gv,f,EM_PPC,_BIG_ENDIAN_,ppc32_reloc_vlink2elf);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x3, 0x203(%rdi)
jne 0x18373
leaq 0x82a5(%rip), %rsi      # 0x205cd
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xb7e9
testq %rax, %rax
je 0x1834a
leaq 0x989a(%rip), %rcx      # 0x21be0
movq %rcx, 0x18(%rax)
leaq 0x8283(%rip), %rsi      # 0x205d4
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xb7e9
testq %rax, %rax
je 0x18373
leaq 0x987d(%rip), %rcx      # 0x21bec
movq %rcx, 0x18(%rax)
leaq 0x1c0(%r14), %r15
leaq 0x17c0d(%rip), %r12     # 0x2ff8e
movq (%r15), %r15
cmpq $0x0, (%r15)
je 0x183b6
testb $0x2, 0x21(%r15)
jne 0x18399
movq 0x48(%r15), %rax
movq %rax, 0x50(%r15)
movq 0x18(%r15), %rdi
movq %r12, %rsi
callq 0x5160
testl %eax, %eax
jne 0x18381
movq %r14, %rdi
movq %r15, %rsi
callq 0x18b38
jmp 0x18381
leaq 0x371(%rip), %r8        # 0x1872e
pushq $0x14
popq %rdx
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x172df
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32ppcbe.c
// Function: setupRI
static uint8_t setupRI(uint8_t rtype,struct ELF2vlink *convert,
                       struct RelocInsert *ri1,struct RelocInsert *ri2)
{
  ri1->bpos = convert[rtype].bpos;
  ri1->bsiz = convert[rtype].bsiz;
  if ((ri1->mask = convert[rtype].mask) == 0) {
    /* @ha mode - add a second RelocInsert */
    memset(ri2,0,sizeof(struct RelocInsert));
    ri1->next = ri2;
    ri1->mask = 0xffff0000;
    ri2->bsiz = 16;
    ri2->mask = 0x8000;
  }
  return (convert[rtype].rtype);
}

// Assembly:
shll $0x4, %edi
leaq (%rsi,%rdi), %rax
movl 0x2(%rsi,%rdi), %ecx
movl %ecx, 0x8(%rdx)
movq 0x8(%rsi,%rdi), %rcx
movq %rcx, 0x10(%rdx)
testq %rcx, %rcx
jne 0x186bb
xorps %xmm0, %xmm0
movups %xmm0, 0x1b6f4(%rip)    # 0x33d88
leaq 0x1b6ed(%rip), %rcx     # 0x33d88
movq %rcx, (%rdx)
movl $0xffff0000, %ecx       # imm = 0xFFFF0000
movq %rcx, 0x10(%rdx)
movw $0x10, 0x1b6e2(%rip)    # 0x33d92
movq $0x8000, 0x1b6dd(%rip) # imm = 0x8000
movb (%rax), %al
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32ppcbe.c
// Function: init_got
static void init_got(struct GlobalVars *gv)
/* initialize target-specific .got contents */
{
  struct LinkedSection *got,*dyn;

  if (got = find_lnksec(gv,got_name,0,0,0,0)) {
    write32be(got->data,0x4e800021);  		  /* 0: blrl */
    if (dyn = find_lnksec(gv,dyn_name,0,0,0,0))
      write32be(got->data+4,(uint32_t)dyn->base);   /* 4: .dynamic address */
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x7f0f(%rip), %rsi      # 0x205db
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xb7e9
testq %rax, %rax
je 0x18726
movq %rax, %rbx
movq 0x78(%rax), %rdi
movl $0x4e800021, %esi       # imm = 0x4E800021
callq 0x661b
leaq 0x8cf6(%rip), %rsi      # 0x213ee
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xb7e9
testq %rax, %rax
je 0x18726
movq 0x78(%rbx), %rdi
addq $0x4, %rdi
movl 0x40(%rax), %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x661b
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32ppcbe.c
// Function: make_ddrelocs
static void make_ddrelocs(struct GlobalVars *gv,struct LinkedSection *ddrel)
{
  struct LinkedSection *sdata;
  struct Section *sec;
  struct Reloc *rel;
  uint8_t *table;
  uint32_t *p;
  unsigned long size;
  uint32_t nrelocs = 0;

  if (sdata = find_lnksec(gv,sdata_name,0,0,0,0)) {
    for (rel=(struct Reloc *)sdata->relocs.first;
         rel->n.next!=NULL; rel=(struct Reloc *)rel->n.next) {
      if (rel->relocsect.lnk==sdata && rel->rtype==R_ABS)
        nrelocs++;
    }
  }

  size = (nrelocs+1) * sizeof(uint32_t);
  table = alloc(size);
  p = (uint32_t *)table;
  write32be(p++,nrelocs);

  if (sdata) {
    for (rel=(struct Reloc *)sdata->relocs.first;
         rel->n.next!=NULL; rel=(struct Reloc *)rel->n.next) {
      if (rel->relocsect.lnk==sdata && rel->rtype==R_ABS)
        write32be(p++,(uint32_t)rel->offset);
    }
  }

  ddrel->data = table;
  ddrel->size = ddrel->filesize = size;
  if (sec = (struct Section *)ddrel->sections.first) {
    sec->data = table;
    sec->size = size;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq 0x7a64(%rip), %rsi      # 0x205b1
xorl %r12d, %r12d
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xb7e9
movq %rax, %r14
testq %rax, %rax
je 0x18b90
movq 0x80(%r14), %rax
xorl %r12d, %r12d
movq %rax, %rcx
movq (%rax), %rax
testq %rax, %rax
je 0x18b90
cmpq %r14, 0x18(%rcx)
jne 0x18b71
xorl %edx, %edx
cmpb $0x1, 0x38(%rcx)
sete %dl
addl %edx, %r12d
jmp 0x18b71
leal 0x1(%r12), %r15d
shlq $0x2, %r15
movq %r15, %rdi
callq 0x6340
movq %rax, %r13
movq %rax, %rdi
movl %r12d, %esi
callq 0x661b
testq %r14, %r14
je 0x18be6
leaq 0x80(%r14), %rbp
movq %r13, %r12
addq $0x4, %r12
movq (%rbp), %rbp
cmpq $0x0, (%rbp)
je 0x18be6
cmpq %r14, 0x18(%rbp)
jne 0x18bc2
cmpb $0x1, 0x38(%rbp)
jne 0x18bc2
movl 0x20(%rbp), %esi
movq %r12, %rdi
callq 0x661b
jmp 0x18bbe
movq %r13, 0x78(%rbx)
movq %r15, 0x50(%rbx)
movq %r15, 0x48(%rbx)
movq 0x60(%rbx), %rax
testq %rax, %rax
je 0x18c03
movq %r13, 0x40(%rax)
movq %r15, 0x48(%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32m68k.c
// Function: m68k_readconv
static void m68k_readconv(struct GlobalVars *gv,struct LinkFile *lf)
/* Read ELF-68k executable / object / shared obj. */
{
  if (lf->type == ID_LIBARCH) {
    struct ar_info ai;

    if (ar_init(&ai,(char *)lf->data,lf->length,lf->filename)) {
      while (ar_extract(&ai)) {
        lf->objname = allocstring(ai.name);
        elf32_check_ar_type(fff[lf->format],lf->pathname,
                            (struct Elf32_Ehdr *)ai.data,
                            ELFCLASS32,ELFDATA2MSB,ELF_VER,1,EM_68K);
        elf32_parse(gv,lf,(struct Elf32_Ehdr *)ai.data,m68k_reloc_elf2vlink);
      }
    }
    else
      ierror("m68k_readconv(): archive %s corrupted since last access",
             lf->pathname);
  }
  else {
    lf->objname = lf->filename;
    elf32_parse(gv,lf,(struct Elf32_Ehdr *)lf->data,m68k_reloc_elf2vlink);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x8, 0x39(%rsi)
jne 0x18cef
movq 0x18(%rbx), %rcx
movq 0x28(%rbx), %rsi
movq 0x30(%rbx), %rdx
movq %rsp, %rdi
callq 0xc6e0
testl %eax, %eax
je 0x18d1e
movq %rsp, %r12
pushq $0x2
popq %rbp
pushq $0x1
popq %r13
leaq 0x10b(%rip), %r15       # 0x18d93
movq %r12, %rdi
callq 0xc745
testl %eax, %eax
je 0x18d30
leaq 0x20(%rsp), %rdi
callq 0x63a1
movq %rax, 0x20(%rbx)
movzbl 0x38(%rbx), %eax
leaq 0x164df(%rip), %rcx     # 0x2f190
movq (%rcx,%rax,8), %rdi
movq 0x10(%rbx), %rsi
movq 0x128(%rsp), %rdx
movl %r13d, %ecx
movl %ebp, %r8d
movl %r13d, %r9d
xorl %eax, %eax
pushq $0x4
pushq $0x1
callq 0x12dec
popq %rax
popq %rcx
movq 0x128(%rsp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rcx
callq 0x137fb
jmp 0x18c88
movq 0x18(%rbx), %rax
movq 0x28(%rbx), %rdx
movq %rax, 0x20(%rbx)
leaq 0x91(%rip), %rcx        # 0x18d93
movq %r14, %rdi
movq %rbx, %rsi
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x137fb
movq 0x10(%rbx), %rsi
leaq 0x8fd2(%rip), %rdi      # 0x21cfb
xorl %eax, %eax
callq 0x6b2c
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32i386.c
// Function: i386_readconv
static void i386_readconv(struct GlobalVars *gv,struct LinkFile *lf)
/* Read ELF-386 executable / object / shared obj. */
{
  if (lf->type == ID_LIBARCH) {
    struct ar_info ai;

    if (ar_init(&ai,(char *)lf->data,lf->length,lf->filename)) {
      while (ar_extract(&ai)) {
        lf->objname = allocstring(ai.name);
        elf32_check_ar_type(fff[lf->format],lf->pathname,
                            (struct Elf32_Ehdr *)ai.data,
                            ELFCLASS32,ELFDATA2LSB,ELF_VER,1,EM_386);
        elf32_parse(gv,lf,(struct Elf32_Ehdr *)ai.data,i386_reloc_elf2vlink);
      }
    }
    else
      ierror("i386_readconv(): archive %s corrupted since last access",
             lf->pathname);
  }
  else {
    lf->objname = lf->filename;
    elf32_parse(gv,lf,(struct Elf32_Ehdr *)lf->data,i386_reloc_elf2vlink);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x8, 0x39(%rsi)
jne 0x19075
movq 0x18(%rbx), %rcx
movq 0x28(%rbx), %rsi
movq 0x30(%rbx), %rdx
movq %rsp, %rdi
callq 0xc6e0
testl %eax, %eax
je 0x190a4
movq %rsp, %r12
leaq 0x16184(%rip), %r15     # 0x2f190
pushq $0x1
popq %rbp
leaq 0x3cd(%rip), %r13       # 0x193e3
movq %r12, %rdi
callq 0xc745
testl %eax, %eax
je 0x190b6
leaq 0x20(%rsp), %rdi
callq 0x63a1
movq %rax, 0x20(%rbx)
movzbl 0x38(%rbx), %eax
movq (%r15,%rax,8), %rdi
movq 0x10(%rbx), %rsi
movq 0x128(%rsp), %rdx
movl %ebp, %ecx
movl %ebp, %r8d
movl %ebp, %r9d
xorl %eax, %eax
pushq $0x3
pushq $0x1
callq 0x12dec
popq %rax
popq %rcx
movq 0x128(%rsp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rcx
callq 0x137fb
jmp 0x19016
movq 0x18(%rbx), %rax
movq 0x28(%rbx), %rdx
movq %rax, 0x20(%rbx)
leaq 0x35b(%rip), %rcx       # 0x193e3
movq %r14, %rdi
movq %rbx, %rsi
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x137fb
movq 0x10(%rbx), %rsi
leaq 0x8f64(%rip), %rdi      # 0x22013
xorl %eax, %eax
callq 0x6b2c
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq