// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_dynreloc
static void elf32_dynreloc(struct ObjectUnit *ou,struct Reloc *r,int rela)
{
  const char *secname;
  struct Section **secp;
  uint8_t dynflag = SYMF_DYNIMPORT;

  switch (r->rtype) {
    case R_COPY:
      dynflag = SYMF_DYNEXPORT;
      /* fall through */
    case R_GLOBDAT:
    case R_LOADREL:
      secp = &dynrelocs;
      secname = dynrel_name[rela?1:0];
      r->flags |= RELF_DYN;
      break;
    case R_JMPSLOT:
      secp = &pltrelocs;
      secname = pltrel_name[rela?1:0];
      r->flags |= RELF_PLT;
      break;
    case R_ABS:
      return;
    default:
      ierror("elf32_dynreloc(): wrong rtype %s (%d)",
             reloc_name[r->rtype],(int)r->rtype);
      break;
  }

  /* make sure that dynamic relocation section exists */
  if (*secp == NULL)
    *secp = add_section(ou,secname,NULL,0,ST_DATA,SF_ALLOC,SP_READ,2,TRUE);

  /* increase size for new entry */
  (*secp)->size += rela ? 12 : 8;
  
  /* allocate referenced symbol in .dynsym and .dynstr */
  if (r->xrefname) {
    struct Symbol *sym = r->relocsect.symbol;

    if (!(sym->flags & SYMF_DYNLINK)) {
      /* add symbol to .dynsym symbol list, if not already present */
      sym->flags |= dynflag;
      elf32_adddynsym(sym);
    }
  }
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movl %edx, 0x44(%rsp)
movb $0x40, 0x2f(%rsp)
movq 0x48(%rsp), %rax
movzbl 0x38(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, 0x18(%rsp)
subl $0xe, %eax
ja 0x23006
movq 0x18(%rsp), %rax
leaq 0x1327e(%rip), %rcx     # 0x361ec
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $-0x80, 0x2f(%rsp)
leaq 0x21d45(%rip), %rax     # 0x44cc8
movq %rax, 0x30(%rsp)
movl 0x44(%rsp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movslq %eax, %rcx
leaq 0x1d37d(%rip), %rax     # 0x40320
movq (%rax,%rcx,8), %rax
movq %rax, 0x38(%rsp)
movq 0x48(%rsp), %rax
movzbl 0x39(%rax), %ecx
orl $0x80, %ecx
movb %cl, 0x39(%rax)
jmp 0x23033
leaq 0x21cf9(%rip), %rax     # 0x44cc0
movq %rax, 0x30(%rsp)
movl 0x44(%rsp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movslq %eax, %rcx
leaq 0x1d349(%rip), %rax     # 0x40330
movq (%rax,%rcx,8), %rax
movq %rax, 0x38(%rsp)
movq 0x48(%rsp), %rax
movzbl 0x39(%rax), %ecx
orl $0x40, %ecx
movb %cl, 0x39(%rax)
jmp 0x23033
jmp 0x230f5
movq 0x48(%rsp), %rax
movzbl 0x38(%rax), %eax
movl %eax, %ecx
leaq 0x1cb88(%rip), %rax     # 0x3fba0
movq (%rax,%rcx,8), %rsi
movq 0x48(%rsp), %rax
movzbl 0x38(%rax), %edx
leaq 0x1378b(%rip), %rdi     # 0x367b7
movb $0x0, %al
callq 0x8ae0
movq 0x30(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x23082
movq 0x50(%rsp), %rdi
movq 0x38(%rsp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movl $0x2, %r8d
movl $0x1, %r9d
movq %rcx, %rdx
movl $0x1, (%rsp)
movl $0x2, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
callq 0x12660
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, (%rax)
movl 0x44(%rsp), %edx
movl $0x8, %eax
movl $0xc, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movslq %eax, %rcx
movq 0x30(%rsp), %rax
movq (%rax), %rax
addq 0x48(%rax), %rcx
movq %rcx, 0x48(%rax)
movq 0x48(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x230f5
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movzbl 0x41(%rax), %eax
andl $0xc0, %eax
cmpl $0x0, %eax
jne 0x230f3
movzbl 0x2f(%rsp), %edx
movq 0x20(%rsp), %rax
movzbl 0x41(%rax), %ecx
orl %edx, %ecx
movb %cl, 0x41(%rax)
movq 0x20(%rsp), %rdi
callq 0x22610
jmp 0x230f5
addq $0x58, %rsp
retq
nopw (%rax,%rax)