// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_amigahunk.c
// Function: ados_lnksym
static struct Symbol *ados_lnksym(struct GlobalVars *gv,struct Section *sec,
                                  struct Reloc *xref)
/* Checks, if undefined symbol is an ADOS-linker symbol */
{
  struct Symbol *sym;
  int i;

  if (!gv->dest_object) {
    for (i=0; i<=LAST_LNKSYM; i++) {
      if (!strcmp(ados_symnames[i],xref->xrefname)) {
        if (i==SASCT || i==SASDT) {
          /* map to ___CTOR_LIST__ / ___DTOR_LIST__ */
          return (findlnksymbol(gv,(i == SASCT) ?
                                   "___CTOR_LIST__" : "___DTOR_LIST__"));
        }
        else {
          sym = addlnksymbol(gv,ados_symnames[i],0,SYM_ABS,
                             SYMF_LNKSYM,SYMI_OBJECT,SYMB_GLOBAL,0);
          if (i==PHXDB || i==SASPT || i==SASBB || i==DICDB ||
              i==ELFSD || i==ELFS2) {
            sym->type = SYM_RELOC;
          }
          if ((i==SASPT || i==PHXDB || i==DICDB) &&
              findlnksymbol(gv,sdabase_name)==NULL) {
            /* Reference to _LinkerDB, _DATA_BAS_ or __DATA_BAS
               creates _SDA_BASE_ */
            struct Symbol *sdabase = addlnksymbol(gv,sdabase_name,0,SYM_ABS,
                                                  SYMF_LNKSYM,SYMI_OBJECT,
                                                  SYMB_GLOBAL,0);
            sdabase->type = SYM_RELOC;
            sdabase->extra = ELFSD;
          }
          sym->extra = i;  /* for easy identification in ados_setlnksym */
          return (sym);  /* new linker symbol created */
        }
      }
    }
  }
  return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpl $0x0, 0x54(%rdi)
je 0x10ece
xorl %r14d, %r14d
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %rbx
movq 0x10(%rdx), %r15
leaq 0x1de34(%rip), %rbp     # 0x2ed10
xorl %r14d, %r14d
xorl %r13d, %r13d
cmpq $-0x12, %r13
je 0x10ebc
movq (%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x5160
testl %eax, %eax
je 0x10f04
decq %r13
addq $0x8, %rbp
jmp 0x10ee2
movq %r13, %r15
negq %r15
movl %r15d, %ebp
andl $0x1e, %ebp
cmpl $0x6, %ebp
jne 0x10f41
cmpq $-0x6, %r13
leaq 0xf955(%rip), %rax      # 0x20875
leaq 0xf95d(%rip), %rsi      # 0x20884
cmoveq %rax, %rsi
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa922
andl $0x0, 0x8(%rsp)
movl $0x2, (%rsp)
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
movl %ecx, %r8d
movl %ecx, %r9d
callq 0xa880
movq %rax, %r14
cmpl $0x10, %ebp
je 0x10f7c
cmpl $0x8, %r15d
ja 0x10fd7
movl $0x119, %eax            # imm = 0x119
btl %r15d, %eax
jae 0x10fd7
movb $0x2, 0x40(%r14)
cmpl $0x8, %r15d
ja 0x10fd7
movl $0x109, %eax            # imm = 0x109
btl %r15d, %eax
jae 0x10fd7
leaq 0xf64c(%rip), %rsi      # 0x205e5
movq %rbx, %rdi
callq 0xa922
testq %rax, %rax
jne 0x10fd7
andl $0x0, 0x8(%rsp)
movl $0x2, (%rsp)
leaq 0xf62c(%rip), %rsi      # 0x205e5
pushq $0x1
popq %rcx
movq %rbx, %rdi
xorl %edx, %edx
movl %ecx, %r8d
movl %ecx, %r9d
callq 0xa880
movb $0x2, 0x40(%rax)
movl $0x10, 0x48(%rax)
movl %r15d, 0x48(%r14)
jmp 0x10ebc