// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_dyntable
struct Section *elf32_dyntable(struct GlobalVars *gv,
                               unsigned long initial_size,
                               unsigned long initial_offset,
                               uint8_t sectype,uint8_t secflags,
                               uint8_t secprot,int type)
/* return got/plt section, create new when missing */
{
  static const char fn[] = "elf32_dyntable():";
  static const char *secname[] = { NULL, got_name, plt_name };
  struct Section *sec,**secp;
  struct ObjectUnit *ou;
  int symidx = -1;

  switch (type) {
    case GOT_ENTRY:
      secp = &gotsec;
      symidx = GLOBOFFSTAB;
      break;
    case PLT_ENTRY:
      secp = &pltsec;
      symidx = PROCLINKTAB;
      break;
    default:
      ierror("%s wrong type: %d",fn,type);
      break;
  }
  if (sec = *secp)
    return sec;

  if (gv->dynobj == NULL)
    ierror("%s no dynobj",fn);

  /* Section does not exist - create it.
     The offset field is used for the next table entry offset. */
  sec = add_section(gv->dynobj,(char *)secname[type],NULL,initial_size,
                    sectype,secflags,secprot,2,TRUE);
  sec->offset = initial_offset;
  *secp = sec;

  /* create _GLOBAL_OFFSET_TABLE_ or _PROCEDURE_LINKAGE_TABLE_ linker symbol */
  if (symidx >= 0) {
    if (!findlnksymbol(gv,elf32_symnames[symidx]))
      elf32_makelnksym(gv,symidx);
  }

  return sec;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %r13d
movq %rdx, 0x10(%rsp)
movq %rsi, %r10
movb $0x1, %bpl
movl 0x50(%rsp), %r14d
cmpl $0x1, %r14d
je 0x14a91
cmpl $0x2, %r14d
jne 0x14a9d
pushq $0x5
popq %rax
leaq 0x1f249(%rip), %r12     # 0x33cd8
jmp 0x14ad2
pushq $0x4
popq %rax
leaq 0x1f235(%rip), %r12     # 0x33cd0
jmp 0x14ad2
movq %rdi, %rbx
leaq 0xca90(%rip), %rdi      # 0x21537
leaq 0xc962(%rip), %rsi      # 0x21410
movl %r14d, %edx
xorl %eax, %eax
movq %r10, %r12
movl %r9d, %ebp
movl %ecx, %r15d
callq 0x6b2c
movl %r15d, %ecx
movl %ebp, %r9d
xorl %ebp, %ebp
movq %r12, %r10
movq %rbx, %rdi
pushq $-0x1
popq %rax
movq (%r12), %rbx
testq %rbx, %rbx
jne 0x14ba0
movl %eax, 0x4(%rsp)
movq %rdi, 0x8(%rsp)
movq 0x1e0(%rdi), %rdi
testq %rdi, %rdi
jne 0x14b2d
leaq 0xca4e(%rip), %rdi      # 0x21549
leaq 0xc90e(%rip), %rsi      # 0x21410
xorl %eax, %eax
movq %r10, %rbx
movl %ebp, (%rsp)
movl %r9d, %ebp
movl %ecx, %r15d
callq 0x6b2c
movl %r15d, %ecx
movl %ebp, %r9d
movl (%rsp), %ebp
movq %rbx, %r10
movq 0x8(%rsp), %rax
movq 0x1e0(%rax), %rdi
movslq %r14d, %rax
leaq 0x1a269(%rip), %rdx     # 0x2eda0
movq (%rdx,%rax,8), %rsi
subq $0x8, %rsp
movzbl %r9b, %eax
movzbl %cl, %r8d
movzbl %r13b, %r9d
xorl %edx, %edx
movq %r10, %rcx
pushq $0x1
pushq $0x2
pushq %rax
callq 0xbab3
addq $0x20, %rsp
movq %rax, %rbx
movq 0x10(%rsp), %rax
movq %rax, 0x38(%rbx)
movq %rbx, (%r12)
testb %bpl, %bpl
je 0x14ba0
movl 0x4(%rsp), %ebp
movl %ebp, %eax
leaq 0x1acb0(%rip), %rcx     # 0x2f830
movq (%rcx,%rax,8), %rsi
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xa922
testq %rax, %rax
jne 0x14ba0
movq %r14, %rdi
movl %ebp, %esi
callq 0x14676
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq