// File: /workspace/github_c_makefile_star2_O3/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 0x15c33
cmpl $0x2, %r14d
jne 0x15c41
movl $0x5, %eax
leaq 0x1dcb7(%rip), %r12     # 0x338e8
jmp 0x15c78
movl $0x4, %eax
leaq 0x1dca1(%rip), %r12     # 0x338e0
jmp 0x15c78
movq %rdi, %rbx
leaq 0xd8cc(%rip), %rdi      # 0x23517
leaq 0xd79e(%rip), %rsi      # 0x233f0
movl %r14d, %edx
xorl %eax, %eax
movq %r10, %r12
movl %r9d, %ebp
movl %ecx, %r15d
callq 0x52b0
movl %r15d, %ecx
movl %ebp, %r9d
xorl %ebp, %ebp
movq %r12, %r10
movq %rbx, %rdi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq (%r12), %rbx
testq %rbx, %rbx
jne 0x15d46
movl %eax, 0x4(%rsp)
movq %rdi, 0x8(%rsp)
movq 0x1e0(%rdi), %rdi
testq %rdi, %rdi
jne 0x15cd3
leaq 0xd888(%rip), %rdi      # 0x23529
leaq 0xd748(%rip), %rsi      # 0x233f0
xorl %eax, %eax
movq %r10, %rbx
movl %ebp, (%rsp)
movl %r9d, %ebp
movl %ecx, %r15d
callq 0x52b0
movl %r15d, %ecx
movl %ebp, %r9d
movl (%rsp), %ebp
movq %rbx, %r10
movq 0x8(%rsp), %rax
movq 0x1e0(%rax), %rdi
movslq %r14d, %rax
leaq 0x190c3(%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 0xc11b
addq $0x20, %rsp
movq %rax, %rbx
movq 0x10(%rsp), %rax
movq %rax, 0x38(%rbx)
movq %rbx, (%r12)
testb %bpl, %bpl
je 0x15d46
movl 0x4(%rsp), %ebp
movl %ebp, %eax
leaq 0x19afa(%rip), %rcx     # 0x2f820
movq (%rcx,%rax,8), %rsi
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xae55
testq %rax, %rax
jne 0x15d46
movq %r14, %rdi
movl %ebp, %esi
callq 0x157bd
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq