// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/t_amigahunk.c
// Function: ados_setlnksym
static void ados_setlnksym(struct GlobalVars *gv,struct Symbol *xdef)
/* Initialize ADOS linker symbol structure during resolve_xref() */
{
  if (xdef->flags & SYMF_LNKSYM) {
    struct LinkedSection *ls,*sdsec=NULL;

    if (xdef->extra == ELFS2) {
      if (!(sdsec = find_lnksec(gv,sdata2_name,ST_DATA,0,0,0)))
        if (!(sdsec = find_lnksec(gv,sbss2_name,ST_UDATA,0,0,0)))
          sdsec = smalldata_section(gv);
      xdef->relsect = (struct Section *)sdsec->sections.first;
    }
    else if (xdef->extra!=SASCT && xdef->extra!=SASDT) {
      sdsec = smalldata_section(gv);
      xdef->relsect = (struct Section *)sdsec->sections.first;
    }
    switch (xdef->extra) {
      case PHXDL:
      case SASBB:
      case DICDL:
        xdef->value = (lword)sdsec->filesize;
        break;
      case PHXBL:
      case SASBL:
      case DICBL:
        xdef->value = (lword)(sdsec->size - sdsec->filesize);
        break;
      case SASPT:
      case ELFSD:
      case ELFS2:
        xdef->value = (lword)fff[gv->dest_format]->baseoff;
        break;
      case GNUTL:
        if (ls = find_lnksec(gv,NULL,ST_CODE,0,0,0))
          xdef->value = (lword)ls->size;
        break;
      case GNUDL:
        if (ls = find_lnksec(gv,NULL,ST_DATA,0,0,0))
          xdef->value = (lword)ls->size;
        break;
      case GNUBL:
        if (ls = find_lnksec(gv,NULL,ST_UDATA,0,0,0))
          xdef->value = (lword)ls->size;
        break;        
    }
    xdef->flags &= ~SYMF_LNKSYM;  /* do not init again */
  }
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x18(%rsp), %rax
movzbl 0x41(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1c0b8
movq $0x0, 0x8(%rsp)
movq 0x18(%rsp), %rax
cmpl $0x11, 0x48(%rax)
jne 0x1bf30
movq 0x20(%rsp), %rdi
leaq 0x196fb(%rip), %rsi     # 0x355be
movl $0x2, %edx
xorl %r9d, %r9d
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x12110
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
jne 0x1bf1c
movq 0x20(%rsp), %rdi
leaq 0x196d9(%rip), %rsi     # 0x355c6
movl $0x3, %edx
xorl %r9d, %r9d
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x12110
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
jne 0x1bf1a
movq 0x20(%rsp), %rdi
callq 0x132b0
movq %rax, 0x8(%rsp)
jmp 0x1bf1c
movq 0x8(%rsp), %rax
movq 0x60(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x38(%rax)
jmp 0x1bf69
movq 0x18(%rsp), %rax
cmpl $0x6, 0x48(%rax)
je 0x1bf67
movq 0x18(%rsp), %rax
cmpl $0x7, 0x48(%rax)
je 0x1bf67
movq 0x20(%rsp), %rdi
callq 0x132b0
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq 0x60(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x38(%rax)
jmp 0x1bf69
movq 0x18(%rsp), %rax
movl 0x48(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, (%rsp)
subl $0x10, %eax
ja 0x1c0a9
movq (%rsp), %rax
leaq 0x19e43(%rip), %rcx     # 0x35dd0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x30(%rax)
jmp 0x1c0a9
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rcx
movq 0x8(%rsp), %rax
subq 0x50(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x30(%rax)
jmp 0x1c0a9
movq 0x20(%rsp), %rax
movzbl 0x50(%rax), %eax
movl %eax, %ecx
leaq 0x23a51(%rip), %rax     # 0x3fa30
movq (%rax,%rcx,8), %rax
movslq 0x9c(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x30(%rax)
jmp 0x1c0a9
movq 0x20(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
xorl %r9d, %r9d
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x12110
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x1c031
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x30(%rax)
jmp 0x1c0a9
movq 0x20(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
xorl %r9d, %r9d
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x12110
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x1c06c
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x30(%rax)
jmp 0x1c0a9
movq 0x20(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x3, %edx
xorl %r9d, %r9d
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x12110
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x1c0a7
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x30(%rax)
jmp 0x1c0a9
movq 0x18(%rsp), %rax
movzbl 0x41(%rax), %ecx
andl $-0x2, %ecx
movb %cl, 0x41(%rax)
addq $0x28, %rsp
retq
nopl (%rax)