// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/t_elf32ppcbe.c
// Function: amiga_lnksym
static struct Symbol *amiga_lnksym(struct GlobalVars *gv,
                                     struct Section *sec,
                                     struct Reloc *xref)
{
  struct Symbol *sym;

  if (!gv->dest_object && !gv->use_ldscript) {
    if (!strcmp(linkerdb,xref->xrefname)) {  /* _LinkerDB */
      sym = addlnksymbol(gv,linkerdb,(lword)fff[gv->dest_format]->baseoff,
                         SYM_RELOC,SYMF_LNKSYM,SYMI_OBJECT,SYMB_GLOBAL,0);
      sym->extra = SYMX_SPECIAL|LINKERDB;
      if (findlnksymbol(gv,sdabase_name) == NULL) {
        /* Reference to _LinkerDB creates _SDA_BASE_ */
        struct Symbol *sdabase = addlnksymbol(gv,sdabase_name,
                                              (lword)fff[gv->dest_format]->baseoff,
                                              SYM_ABS,SYMF_LNKSYM,
                                              SYMI_OBJECT,SYMB_GLOBAL,0);
        sdabase->type = SYM_RELOC;
        sdabase->extra = SDABASE;
      }
      if (findlnksymbol(gv,r13init_name) == NULL) {
        /* Reference to _LinkerDB creates __r13_init */
        struct Symbol *r13init = addlnksymbol(gv,r13init_name,
                                              (lword)fff[gv->dest_format]->baseoff,
                                              SYM_ABS,SYMF_LNKSYM,
                                              SYMI_OBJECT,SYMB_GLOBAL,0);
        r13init->type = SYM_RELOC;
        r13init->extra = SYMX_SPECIAL|R13INIT;
      }
      return (sym);  /* new linker symbol created */
    }

    else if (!strcmp(r13init_name,xref->xrefname)) {  /* __r13_init */
      sym = addlnksymbol(gv,r13init_name,(lword)fff[gv->dest_format]->baseoff,
                         SYM_RELOC,SYMF_LNKSYM,SYMI_OBJECT,SYMB_GLOBAL,0);
      sym->extra = SYMX_SPECIAL|R13INIT;
      return (sym);  /* new linker symbol created */
    }

    else if (!strcmp(sdatasize,xref->xrefname)) {  /* __sdata_size */
      sym = addlnksymbol(gv,sdatasize,0,
                         SYM_ABS,SYMF_LNKSYM,SYMI_OBJECT,SYMB_GLOBAL,0);
      sym->extra = SYMX_SPECIAL|SDATASIZE;
      return (sym);  /* new linker symbol created */
    }

    else if (!strcmp(sbsssize,xref->xrefname)) {  /* __sbss_size */
      sym = addlnksymbol(gv,sbsssize,0,
                         SYM_ABS,SYMF_LNKSYM,SYMI_OBJECT,SYMB_GLOBAL,0);
      sym->extra = SYMX_SPECIAL|SBSSSIZE;
      return (sym);  /* new linker symbol created */
    }

    else if (!strcmp(ddrelocs,xref->xrefname)) {  /* __datadata_relocs */
      sym = addlnksymbol(gv,ddrelocs,0,
                         SYM_RELOC,SYMF_LNKSYM,SYMI_OBJECT,SYMB_GLOBAL,0);
      sym->extra = SYMX_SPECIAL|DDRELOCS;
      return (sym);  /* new linker symbol created */
    }

    else if (!strcmp(textsize,xref->xrefname)) {  /* __text_size */
      sym = addlnksymbol(gv,textsize,0,
                         SYM_ABS,SYMF_LNKSYM,SYMI_OBJECT,SYMB_GLOBAL,0);
      sym->extra = SYMX_SPECIAL|TEXTSIZE;
      return (sym);  /* new linker symbol created */
    }
  }

  return (elf32_lnksym(gv,sec,xref));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
cmpl $0x0, 0x54(%rdi)
jne 0x19453
cmpl $0x0, 0x244(%rbx)
je 0x1946c
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x15760
movq 0x10(%r14), %r12
leaq 0x166d9(%rip), %rdi     # 0x2fb50
movq %r12, %rsi
callq 0x5160
testl %eax, %eax
je 0x19533
leaq 0x91a7(%rip), %rdi      # 0x22635
movq %r12, %rsi
callq 0x5160
testl %eax, %eax
je 0x19626
leaq 0x166b5(%rip), %rdi     # 0x2fb5a
movq %r12, %rsi
callq 0x5160
testl %eax, %eax
je 0x19673
leaq 0x166ab(%rip), %rdi     # 0x2fb67
movq %r12, %rsi
callq 0x5160
testl %eax, %eax
je 0x196a9
leaq 0x166ad(%rip), %rdi     # 0x2fb80
movq %r12, %rsi
callq 0x5160
testl %eax, %eax
je 0x196df
leaq 0x166a8(%rip), %rdi     # 0x2fb92
movq %r12, %rsi
callq 0x5160
testl %eax, %eax
jne 0x19453
leaq 0x16691(%rip), %rsi     # 0x2fb92
movq %rbx, %rdi
xorl %edx, %edx
movl $0x1, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x0
pushq $0x2
callq 0xadaf
addq $0x10, %rsp
movq %rax, %r14
movl $0x80000005, 0x48(%rax) # imm = 0x80000005
jmp 0x19713
movzbl 0x50(%rbx), %eax
leaq 0x15c42(%rip), %r15     # 0x2f180
movq (%r15,%rax,8), %rax
movslq 0x9c(%rax), %rdx
leaq 0x16600(%rip), %rsi     # 0x2fb50
movq %rbx, %rdi
movl $0x2, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x0
pushq $0x2
callq 0xadaf
addq $0x10, %rsp
movq %rax, %r14
movl $0x80000000, 0x48(%rax) # imm = 0x80000000
leaq 0x9053(%rip), %rsi      # 0x225d5
movq %rbx, %rdi
callq 0xae55
testq %rax, %rax
jne 0x195d1
movzbl 0x50(%rbx), %eax
movq (%r15,%rax,8), %rax
movslq 0x9c(%rax), %rdx
xorl %r12d, %r12d
leaq 0x902d(%rip), %rsi      # 0x225d5
movq %rbx, %rdi
movl $0x1, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq %r12
pushq $0x2
callq 0xadaf
addq $0x10, %rsp
movb $0x2, 0x40(%rax)
movl %r12d, 0x48(%rax)
leaq 0x905d(%rip), %rsi      # 0x22635
movq %rbx, %rdi
callq 0xae55
testq %rax, %rax
jne 0x19713
movzbl 0x50(%rbx), %eax
movq (%r15,%rax,8), %rax
movslq 0x9c(%rax), %rdx
leaq 0x9036(%rip), %rsi      # 0x22635
movq %rbx, %rdi
movl $0x1, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x0
pushq $0x2
callq 0xadaf
addq $0x10, %rsp
movb $0x2, 0x40(%rax)
jmp 0x19667
movzbl 0x50(%rbx), %eax
leaq 0x15b4f(%rip), %rcx     # 0x2f180
movq (%rcx,%rax,8), %rax
movslq 0x9c(%rax), %rdx
leaq 0x8ff2(%rip), %rsi      # 0x22635
movq %rbx, %rdi
movl $0x2, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x0
pushq $0x2
callq 0xadaf
addq $0x10, %rsp
movq %rax, %r14
movl $0x80000001, 0x48(%rax) # imm = 0x80000001
jmp 0x19713
leaq 0x164e0(%rip), %rsi     # 0x2fb5a
movq %rbx, %rdi
xorl %edx, %edx
movl $0x1, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x0
pushq $0x2
callq 0xadaf
addq $0x10, %rsp
movq %rax, %r14
movl $0x80000002, 0x48(%rax) # imm = 0x80000002
jmp 0x19713
leaq 0x164b7(%rip), %rsi     # 0x2fb67
movq %rbx, %rdi
xorl %edx, %edx
movl $0x1, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x0
pushq $0x2
callq 0xadaf
addq $0x10, %rsp
movq %rax, %r14
movl $0x80000003, 0x48(%rax) # imm = 0x80000003
jmp 0x19713
leaq 0x1649a(%rip), %rsi     # 0x2fb80
movq %rbx, %rdi
xorl %edx, %edx
movl $0x2, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x0
pushq $0x2
callq 0xadaf
addq $0x10, %rsp
movq %rax, %r14
movl $0x80000004, 0x48(%rax) # imm = 0x80000004
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq