// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/targets.c
// Function: addglobsym
bool addglobsym(struct GlobalVars *gv,struct Symbol *newsym)
/* insert symbol into global symbol hash table */
{
  struct Symbol **chain = &gv->symbols[elf_hash(newsym->name)%SYMHTABSIZE];
  struct Symbol *sym;
  struct ObjectUnit *newou = newsym->relsect ? newsym->relsect->obj : NULL;

  while (sym = *chain) {
    if (!strcmp(newsym->name,sym->name)) {

      if (newsym->type==SYM_ABS && sym->type==SYM_ABS &&
          newsym->value == sym->value)
        return FALSE;  /* absolute symbols with same value are ignored */

      if (newsym->relsect == NULL || sym->relsect == NULL) {
        /* redefined linker script symbol */
        if (newou!=NULL && newou->lnkfile->type<ID_LIBBASE) {
          static const char *objname = "ldscript";

          error(19,newou ? newou->lnkfile->pathname : objname,
                newsym->name, newou ? getobjname(newou) : objname,
                sym->relsect ? getobjname(sym->relsect->obj) : objname);
        }
        /* redefinitions in libraries are silently ignored */
        return FALSE;
      }

      if (sym->bind == SYMB_GLOBAL) {
        /* symbol already defined with global binding */

        if (newsym->bind == SYMB_GLOBAL) {
          if (newou->lnkfile->type < ID_LIBBASE) {
            if (newsym->type==SYM_COMMON && sym->type==SYM_COMMON) {
              if ((newsym->size>sym->size && newsym->value>=sym->value) ||
                  (newsym->size>=sym->size && newsym->value>sym->value)) {
                /* replace by common symbol with bigger size or alignment */
                newsym->glob_chain = sym->glob_chain;
                remove_obj_symbol(sym);  /* delete old symbol in object unit */
                break;
              }
            }
            else {
              /* Global symbol "x" is already defined in... */
              error(19,newou->lnkfile->pathname,newsym->name,
                    getobjname(newou),getobjname(sym->relsect->obj));
            }
            return FALSE;  /* ignore this symbol */
          }
          /* else: add global library symbol with same name to the chain -
             some targets may want to choose between them! */
        }
        else
          return FALSE;  /* don't replace global by nonglobal symbols */
      }

      else {
        if (newsym->bind == SYMB_WEAK)
          return FALSE;  /* don't replace weak by weak */

        /* replace weak symbol by a global one */
        newsym->glob_chain = sym->glob_chain;
        remove_obj_symbol(sym);  /* delete old symbol in object unit */
        break;
      }
    }

    chain = &sym->glob_chain;
  }

  *chain = newsym;
  if (newou) {
    if (trace_sym_access(gv,newsym->name))
      fprintf(stderr,"Symbol %s defined in section %s in %s\n",
              newsym->name,newsym->relsect->name,getobjname(newou));
  }
  return TRUE;
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0x98(%rsp)
movq %rsi, 0x90(%rsp)
movq 0x98(%rsp), %rax
movq 0x180(%rax), %rax
movq %rax, 0x70(%rsp)
movq 0x90(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x8760
movq %rax, %rcx
movq 0x70(%rsp), %rax
andq $0xffff, %rcx           # imm = 0xFFFF
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x88(%rsp)
movq 0x90(%rsp), %rax
cmpq $0x0, 0x38(%rax)
je 0xf7d0
movq 0x90(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0x68(%rsp)
jmp 0xf7d9
xorl %eax, %eax
movq %rax, 0x68(%rsp)
jmp 0xf7d9
movq 0x68(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x88(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x80(%rsp)
cmpq $0x0, %rax
je 0xfb75
movq 0x90(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x80(%rsp), %rax
movq 0x20(%rax), %rsi
callq 0x5130
cmpl $0x0, %eax
jne 0xfb5c
movq 0x90(%rsp), %rax
movzbl 0x40(%rax), %eax
cmpl $0x1, %eax
jne 0xf872
movq 0x80(%rsp), %rax
movzbl 0x40(%rax), %eax
cmpl $0x1, %eax
jne 0xf872
movq 0x90(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x80(%rsp), %rcx
cmpq 0x30(%rcx), %rax
jne 0xf872
movl $0x0, 0xa4(%rsp)
jmp 0xfc1a
movq 0x90(%rsp), %rax
cmpq $0x0, 0x38(%rax)
je 0xf894
movq 0x80(%rsp), %rax
cmpq $0x0, 0x38(%rax)
jne 0xf98f
cmpq $0x0, 0x78(%rsp)
je 0xf97f
movq 0x78(%rsp), %rax
movq 0x10(%rax), %rax
movzbl 0x39(%rax), %eax
cmpl $0x4, %eax
jge 0xf97f
cmpq $0x0, 0x78(%rsp)
je 0xf8d2
movq 0x78(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0x60(%rsp)
jmp 0xf8de
movq 0x303ef(%rip), %rax     # 0x3fcc8
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x90(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x58(%rsp)
cmpq $0x0, 0x78(%rsp)
je 0xf912
movq 0x78(%rsp), %rdi
callq 0x8f00
movq %rax, 0x48(%rsp)
jmp 0xf91e
movq 0x303af(%rip), %rax     # 0x3fcc8
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x80(%rsp), %rax
cmpq $0x0, 0x38(%rax)
je 0xf953
movq 0x80(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rdi
callq 0x8f00
movq %rax, 0x38(%rsp)
jmp 0xf95f
movq 0x3036e(%rip), %rax     # 0x3fcc8
movq %rax, 0x38(%rsp)
movq 0x40(%rsp), %rcx
movq 0x58(%rsp), %rdx
movq 0x50(%rsp), %rsi
movq 0x38(%rsp), %r8
movl $0x13, %edi
movb $0x0, %al
callq 0x8c00
movl $0x0, 0xa4(%rsp)
jmp 0xfc1a
movq 0x80(%rsp), %rax
movzbl 0x43(%rax), %eax
cmpl $0x2, %eax
jne 0xfb12
movq 0x90(%rsp), %rax
movzbl 0x43(%rax), %eax
cmpl $0x2, %eax
jne 0xfb00
movq 0x78(%rsp), %rax
movq 0x10(%rax), %rax
movzbl 0x39(%rax), %eax
cmpl $0x4, %eax
jge 0xfafe
movq 0x90(%rsp), %rax
movzbl 0x40(%rax), %eax
cmpl $0x3, %eax
jne 0xfa89
movq 0x80(%rsp), %rax
movzbl 0x40(%rax), %eax
cmpl $0x3, %eax
jne 0xfa89
movq 0x90(%rsp), %rax
movl 0x44(%rax), %eax
movq 0x80(%rsp), %rcx
cmpl 0x44(%rcx), %eax
jbe 0xfa2b
movq 0x90(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x80(%rsp), %rcx
cmpq 0x30(%rcx), %rax
jge 0xfa5d
movq 0x90(%rsp), %rax
movl 0x44(%rax), %eax
movq 0x80(%rsp), %rcx
cmpl 0x44(%rcx), %eax
jb 0xfa87
movq 0x90(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x80(%rsp), %rcx
cmpq 0x30(%rcx), %rax
jle 0xfa87
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x90(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x80(%rsp), %rdi
callq 0xfc30
jmp 0xfb75
jmp 0xfaee
movq 0x78(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x90(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x78(%rsp), %rdi
callq 0x8f00
movq %rax, 0x30(%rsp)
movq 0x80(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rdi
callq 0x8f00
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
movq %rax, %r8
movl $0x13, %edi
movb $0x0, %al
callq 0x8c00
movl $0x0, 0xa4(%rsp)
jmp 0xfc1a
jmp 0xfb10
movl $0x0, 0xa4(%rsp)
jmp 0xfc1a
jmp 0xfb5a
movq 0x90(%rsp), %rax
movzbl 0x43(%rax), %eax
cmpl $0x3, %eax
jne 0xfb33
movl $0x0, 0xa4(%rsp)
jmp 0xfc1a
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x90(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x80(%rsp), %rdi
callq 0xfc30
jmp 0xfb75
jmp 0xfb5c
movq 0x80(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x88(%rsp)
jmp 0xf7e3
movq 0x90(%rsp), %rcx
movq 0x88(%rsp), %rax
movq %rcx, (%rax)
cmpq $0x0, 0x78(%rsp)
je 0xfc0f
movq 0x98(%rsp), %rdi
movq 0x90(%rsp), %rax
movq 0x20(%rax), %rsi
callq 0x9330
cmpl $0x0, %eax
je 0xfc0d
movq 0x2f443(%rip), %rax     # 0x3eff8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x90(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x90(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x78(%rsp), %rdi
callq 0x8f00
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rcx
movq %rax, %r8
leaq 0x25b27(%rip), %rsi     # 0x3572d
movb $0x0, %al
callq 0x5150
jmp 0xfc0f
movl $0x1, 0xa4(%rsp)
movl 0xa4(%rsp), %eax
addq $0xa8, %rsp
retq
nopl (%rax)