// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_putdynreloc
static size_t elf32_putdynreloc(struct GlobalVars *gv,struct LinkedSection *ls,
                                struct Reloc *rel,void *dst,
                                uint8_t (*reloc_vlink2elf)(struct Reloc *),
                                bool rela,bool be)
{
  const char *fn = "elf32_putdynreloc()";
  struct Elf32_Rela *rp = (struct Elf32_Rela *)dst;
  uint32_t symidx;
  uint8_t rtype;

  if (rel->xrefname) {
    struct SymbolNode *sn;

    sn = elf32_findSymNode(&elf32dsymlist,rel->xrefname);
    if (sn == NULL)
      ierror("%s no symbol <%s> in dyn.table",fn,rel->xrefname);
    symidx = sn->index;
  }
  else
    ierror("%s no symbol base",fn);

  if (!(rtype = reloc_vlink2elf(rel))) {
    struct RelocInsert *ri;

    if (ri = rel->insert)
      error(32,fff[gv->dest_format]->tname,reloc_name[rel->rtype],
            (int)ri->bpos,(int)ri->bsiz,ri->mask,ls->name,rel->offset);
    else
      ierror("%s Reloc without insert-field",fn);
  }

  write32(be,rp->r_offset,(uint32_t)(ls->base + rel->offset));
  write32(be,rp->r_info,ELF32_R_INFO(symidx,(uint32_t)rtype));

  if (rela) {
    write32(be,rp->r_addend,(uint32_t)rel->addend);
    writesection(gv,ls->data+rel->offset,rel,0);
    return sizeof(struct Elf32_Rela);
  }
  writesection(gv,ls->data+rel->offset,rel,rel->addend);
  return sizeof(struct Elf32_Rel);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, 0x14(%rsp)
movq %r8, %rbp
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, 0x8(%rsp)
movq 0x10(%rdx), %r14
testq %r14, %r14
je 0x18ea2
movq 0x16905(%rip), %r13     # 0x2f768
movq %r14, %rdi
callq 0x6d94
xorl %edx, %edx
divq 0x168fc(%rip)           # 0x2f770
movq (%r13,%rdx,8), %r13
testq %r13, %r13
je 0x18fc1
movq 0x18(%r13), %rsi
movq %r14, %rdi
callq 0x5160
testl %eax, %eax
je 0x18e98
movq 0x10(%r13), %r13
jmp 0x18e79
movl 0x30(%r13), %r13d
shll $0x8, %r13d
jmp 0x18eba
leaq 0xabaf(%rip), %rdi      # 0x23a58
leaq 0xab75(%rip), %rsi      # 0x23a25
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x52b0
movl 0x50(%rsp), %r14d
movq %rbx, %rdi
callq *%rbp
movl %eax, %ebp
testb %al, %al
jne 0x18f34
movq 0x30(%rbx), %rax
testq %rax, %rax
je 0x18f1f
movq 0x8(%rsp), %rcx
movzbl 0x50(%rcx), %ecx
leaq 0x1629d(%rip), %rdx     # 0x2f180
movq (%rdx,%rcx,8), %rcx
movq (%rcx), %rsi
movzbl 0x38(%rbx), %ecx
leaq 0x163fb(%rip), %rdx     # 0x2f2f0
movq (%rdx,%rcx,8), %rdx
movzwl 0x8(%rax), %ecx
movzwl 0xa(%rax), %r8d
movq 0x10(%rax), %r9
movl $0x20, %edi
xorl %eax, %eax
pushq 0x20(%rbx)
pushq 0x18(%r15)
callq 0x6f14
addq $0x10, %rsp
jmp 0x18f34
leaq 0xab44(%rip), %rdi      # 0x23a6a
leaq 0xaaf8(%rip), %rsi      # 0x23a25
xorl %eax, %eax
callq 0x52b0
movl 0x20(%rbx), %edx
addl 0x40(%r15), %edx
movl %r14d, %edi
movq %r12, %rsi
callq 0x69a0
leaq 0x4(%r12), %rsi
movzbl %bpl, %eax
orl %eax, %r13d
movl %r14d, %edi
movl %r13d, %edx
callq 0x69a0
cmpl $0x0, 0x14(%rsp)
je 0x18f94
addq $0x8, %r12
movl 0x28(%rbx), %edx
movl %r14d, %edi
movq %r12, %rsi
callq 0x69a0
movq 0x78(%r15), %rsi
addq 0x20(%rbx), %rsi
movq 0x8(%rsp), %rdi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0xb4ed
movl $0xc, %eax
jmp 0x18fb2
movq 0x78(%r15), %rsi
addq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rcx
movq 0x8(%rsp), %rdi
movq %rbx, %rdx
callq 0xb4ed
movl $0x8, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rbx), %rdx
leaq 0xaa6d(%rip), %rdi      # 0x23a39
leaq 0xaa52(%rip), %rsi      # 0x23a25
xorl %eax, %eax
callq 0x52b0
nop