// File: /workspace/github_c_makefile_star2_O1/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 0x1959b
cmpl $0x0, 0x244(%rbx)
je 0x195b4
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1591c
movq 0x10(%r14), %r12
leaq 0x16591(%rip), %rdi     # 0x2fb50
movq %r12, %rsi
callq 0x5160
testl %eax, %eax
je 0x1967b
leaq 0x906f(%rip), %rdi      # 0x22645
movq %r12, %rsi
callq 0x5160
testl %eax, %eax
je 0x1976e
leaq 0x1656d(%rip), %rdi     # 0x2fb5a
movq %r12, %rsi
callq 0x5160
testl %eax, %eax
je 0x197bb
leaq 0x16563(%rip), %rdi     # 0x2fb67
movq %r12, %rsi
callq 0x5160
testl %eax, %eax
je 0x197f1
leaq 0x16565(%rip), %rdi     # 0x2fb80
movq %r12, %rsi
callq 0x5160
testl %eax, %eax
je 0x19827
leaq 0x16560(%rip), %rdi     # 0x2fb92
movq %r12, %rsi
callq 0x5160
testl %eax, %eax
jne 0x1959b
leaq 0x16549(%rip), %rsi     # 0x2fb92
movq %rbx, %rdi
xorl %edx, %edx
movl $0x1, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x0
pushq $0x2
callq 0xae7f
addq $0x10, %rsp
movq %rax, %r14
movl $0x80000005, 0x48(%rax) # imm = 0x80000005
jmp 0x1985b
movzbl 0x50(%rbx), %eax
leaq 0x15afa(%rip), %r15     # 0x2f180
movq (%r15,%rax,8), %rax
movslq 0x9c(%rax), %rdx
leaq 0x164b8(%rip), %rsi     # 0x2fb50
movq %rbx, %rdi
movl $0x2, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x0
pushq $0x2
callq 0xae7f
addq $0x10, %rsp
movq %rax, %r14
movl $0x80000000, 0x48(%rax) # imm = 0x80000000
leaq 0x8f1b(%rip), %rsi      # 0x225e5
movq %rbx, %rdi
callq 0xaf21
testq %rax, %rax
jne 0x19719
movzbl 0x50(%rbx), %eax
movq (%r15,%rax,8), %rax
movslq 0x9c(%rax), %rdx
xorl %r12d, %r12d
leaq 0x8ef5(%rip), %rsi      # 0x225e5
movq %rbx, %rdi
movl $0x1, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq %r12
pushq $0x2
callq 0xae7f
addq $0x10, %rsp
movb $0x2, 0x40(%rax)
movl %r12d, 0x48(%rax)
leaq 0x8f25(%rip), %rsi      # 0x22645
movq %rbx, %rdi
callq 0xaf21
testq %rax, %rax
jne 0x1985b
movzbl 0x50(%rbx), %eax
movq (%r15,%rax,8), %rax
movslq 0x9c(%rax), %rdx
leaq 0x8efe(%rip), %rsi      # 0x22645
movq %rbx, %rdi
movl $0x1, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x0
pushq $0x2
callq 0xae7f
addq $0x10, %rsp
movb $0x2, 0x40(%rax)
jmp 0x197af
movzbl 0x50(%rbx), %eax
leaq 0x15a07(%rip), %rcx     # 0x2f180
movq (%rcx,%rax,8), %rax
movslq 0x9c(%rax), %rdx
leaq 0x8eba(%rip), %rsi      # 0x22645
movq %rbx, %rdi
movl $0x2, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x0
pushq $0x2
callq 0xae7f
addq $0x10, %rsp
movq %rax, %r14
movl $0x80000001, 0x48(%rax) # imm = 0x80000001
jmp 0x1985b
leaq 0x16398(%rip), %rsi     # 0x2fb5a
movq %rbx, %rdi
xorl %edx, %edx
movl $0x1, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x0
pushq $0x2
callq 0xae7f
addq $0x10, %rsp
movq %rax, %r14
movl $0x80000002, 0x48(%rax) # imm = 0x80000002
jmp 0x1985b
leaq 0x1636f(%rip), %rsi     # 0x2fb67
movq %rbx, %rdi
xorl %edx, %edx
movl $0x1, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x0
pushq $0x2
callq 0xae7f
addq $0x10, %rsp
movq %rax, %r14
movl $0x80000003, 0x48(%rax) # imm = 0x80000003
jmp 0x1985b
leaq 0x16352(%rip), %rsi     # 0x2fb80
movq %rbx, %rdi
xorl %edx, %edx
movl $0x2, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq $0x0
pushq $0x2
callq 0xae7f
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