// File: /workspace/github_c_makefile_star2_O1/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
pushq %rax
cmpl $0x0, 0x54(%rdi)
je 0x11dda
xorl %r14d, %r14d
jmp 0x11ef2
movq %rdi, %rbx
movq 0x10(%rdx), %r15
leaq 0x1cf28(%rip), %rbp     # 0x2ed10
xorl %r14d, %r14d
xorl %r13d, %r13d
movq (%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x5160
testl %eax, %eax
je 0x11e13
decq %r13
addq $0x8, %rbp
cmpq $-0x12, %r13
jne 0x11dee
jmp 0x11ef2
movq %r13, %r15
negq %r15
movl %r15d, %ebp
andl $0x1e, %ebp
cmpl $0x6, %ebp
jne 0x11e50
cmpq $-0x6, %r13
leaq 0x10a46(%rip), %rax     # 0x22875
leaq 0x10a4e(%rip), %rsi     # 0x22884
cmoveq %rax, %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xaf21
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
movl $0x1, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x0
pushq $0x2
callq 0xae7f
addq $0x10, %rsp
movq %rax, %r14
cmpl $0x10, %ebp
je 0x11e8f
cmpl $0x8, %r15d
ja 0x11eee
movl $0x119, %eax            # imm = 0x119
btl %r15d, %eax
jae 0x11eee
movb $0x2, 0x40(%r14)
cmpl $0x8, %r15d
ja 0x11eee
movl $0x109, %eax            # imm = 0x109
btl %r15d, %eax
jae 0x11eee
leaq 0x10739(%rip), %rsi     # 0x225e5
movq %rbx, %rdi
callq 0xaf21
testq %rax, %rax
jne 0x11eee
leaq 0x10725(%rip), %rsi     # 0x225e5
movq %rbx, %rdi
xorl %edx, %edx
movl $0x1, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x0
pushq $0x2
callq 0xae7f
addq $0x10, %rsp
movb $0x2, 0x40(%rax)
movl $0x10, 0x48(%rax)
movl %r15d, 0x48(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq