// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_addsym
uint32_t elf32_addsym(struct SymTabList *sl,struct StrTabList *strl,
                      const char *name,uint32_t value,uint32_t size,
                      uint8_t bind,uint8_t type,uint16_t shndx)
/* add a new ELF symbol, return its symbol table index */
{
  bool be = elf32_endianess == _BIG_ENDIAN_;
  struct SymbolNode **chain,*sym;

  if (sl->hashtab == NULL) {
    /* initialize an unused symbol list */
    initlist(&sl->l);
    sl->hashtab = alloczero(sl->htabsize * sizeof(struct SymbolNode *));
    elf32_addsym(sl,strl,noname,0,0,0,0,SHN_UNDEF);
  }

  if (name == NULL)  /* do nothing, return first index */
    return 0;

  chain = &sl->hashtab[elf_hash(name) % sl->htabsize];

  while (sym = *chain)
    chain = &sym->hashchain;
  /* new symbol table entry */
  *chain = sym = alloczero(sizeof(struct SymbolNode));
  sym->name = name;
  sym->index = sl->nextindex++;
  addtail(&sl->l,&sym->n);
  write32(be,sym->s.st_name,elf32_addstrlist(strl,name));
  write32(be,sym->s.st_value,value);
  write32(be,sym->s.st_size,size);
  *sym->s.st_info = ELF32_ST_INFO(bind,type);
  write16(be,sym->s.st_shndx,shndx);
  return sym->index;
}

// Assembly:
subq $0x68, %rsp
movb %r9b, %al
movw 0x78(%rsp), %r9w
movb 0x70(%rsp), %r9b
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
movl %ecx, 0x44(%rsp)
movl %r8d, 0x40(%rsp)
movb %al, 0x3f(%rsp)
movsbl 0x1d98b(%rip), %eax     # 0x402d0
cmpl $0x1, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x38(%rsp)
movq 0x58(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x229b6
movq 0x58(%rsp), %rdi
callq 0x7330
movq 0x58(%rsp), %rax
movq 0x20(%rax), %rdi
shlq $0x3, %rdi
callq 0x7290
movq %rax, %rcx
movq 0x58(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rsi
leaq 0x12cb7(%rip), %rdx     # 0x35650
xorl %r9d, %r9d
movl %r9d, %ecx
movl %r9d, %r8d
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
callq 0x22910
cmpq $0x0, 0x48(%rsp)
jne 0x229cb
movl $0x0, 0x64(%rsp)
jmp 0x22b1d
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x48(%rsp), %rdi
callq 0x8760
movq 0x58(%rsp), %rcx
xorl %edx, %edx
divq 0x20(%rcx)
movq 0x20(%rsp), %rax
shlq $0x3, %rdx
addq %rdx, %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, %rax
je 0x22a22
movq 0x28(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x30(%rsp)
jmp 0x229ff
movl $0x38, %edi
callq 0x7290
movq %rax, %rcx
movq %rcx, 0x28(%rsp)
movq 0x30(%rsp), %rax
movq %rcx, (%rax)
movq 0x48(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x58(%rsp), %rax
movl 0x28(%rax), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x28(%rax)
movq 0x28(%rsp), %rax
movl %ecx, 0x30(%rax)
movq 0x58(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x7470
movl 0x38(%rsp), %eax
movl %eax, 0x14(%rsp)
movq 0x28(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x18(%rsp)
movq 0x50(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x23a10
movl 0x14(%rsp), %edi
movq 0x18(%rsp), %rsi
movl %eax, %edx
callq 0x8130
movl 0x38(%rsp), %edi
movq 0x28(%rsp), %rsi
addq $0x20, %rsi
addq $0x4, %rsi
movl 0x44(%rsp), %edx
callq 0x8130
movl 0x38(%rsp), %edi
movq 0x28(%rsp), %rsi
addq $0x20, %rsi
addq $0x8, %rsi
movl 0x40(%rsp), %edx
callq 0x8130
movzbl 0x3f(%rsp), %eax
shll $0x4, %eax
movzbl 0x70(%rsp), %ecx
andl $0xf, %ecx
addl %ecx, %eax
movb %al, %cl
movq 0x28(%rsp), %rax
movb %cl, 0x2c(%rax)
movl 0x38(%rsp), %edi
movq 0x28(%rsp), %rsi
addq $0x20, %rsi
addq $0xe, %rsi
movzwl 0x78(%rsp), %edx
callq 0x80e0
movq 0x28(%rsp), %rax
movl 0x30(%rax), %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)