// File: /workspace/github_c_makefile_star2_O1/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, %r11d
movq %rsi, %r10
movq %rdi, %r12
movb $0x1, %bpl
movl 0x50(%rsp), %r14d
cmpl $0x1, %r14d
movq %rdx, 0x10(%rsp)
je 0x15df2
cmpl $0x2, %r14d
jne 0x15e00
movl $0x5, %eax
leaq 0x1daf8(%rip), %r13     # 0x338e8
jmp 0x15e35
movl $0x4, %eax
leaq 0x1dae2(%rip), %r13     # 0x338e0
jmp 0x15e35
leaq 0xd730(%rip), %rdi      # 0x23537
leaq 0xd602(%rip), %rsi      # 0x23410
movl %r14d, %edx
xorl %eax, %eax
movq %r10, %r15
movl %r11d, %r13d
movl %r9d, %ebp
movl %ecx, %ebx
callq 0x52b0
movl %ebx, %ecx
movl %ebp, %r9d
xorl %ebp, %ebp
movl %r13d, %r11d
movq %r15, %r10
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq (%r13), %r15
testq %r15, %r15
jne 0x15efc
movl %eax, 0x4(%rsp)
cmpq $0x0, 0x1e0(%r12)
jne 0x15e86
leaq 0xd6f1(%rip), %rdi      # 0x23549
leaq 0xd5b1(%rip), %rsi      # 0x23410
xorl %eax, %eax
movq %r10, 0x8(%rsp)
movl %r11d, %r15d
movl %ebp, (%rsp)
movl %r9d, %ebp
movl %ecx, %ebx
callq 0x52b0
movl %ebx, %ecx
movl %ebp, %r9d
movl (%rsp), %ebp
movl %r15d, %r11d
movq 0x8(%rsp), %r10
movq 0x1e0(%r12), %rdi
movslq %r14d, %rax
leaq 0x18f08(%rip), %rdx     # 0x2eda0
movq (%rdx,%rax,8), %rsi
subq $0x8, %rsp
movzbl %r9b, %eax
movzbl %cl, %r8d
movzbl %r11b, %r9d
xorl %edx, %edx
movq %r10, %rcx
pushq $0x1
pushq $0x2
pushq %rax
callq 0xc1c8
addq $0x20, %rsp
movq %rax, %r15
movq 0x10(%rsp), %rax
movq %rax, 0x38(%r15)
movq %r15, (%r13)
testb %bpl, %bpl
je 0x15efc
movl 0x4(%rsp), %ebp
movl %ebp, %eax
leaq 0x1993f(%rip), %rcx     # 0x2f820
movq (%rcx,%rax,8), %rsi
movq %r12, %rdi
callq 0xaf21
testq %rax, %rax
jne 0x15efc
movq %r12, %rdi
movl %ebp, %esi
callq 0x15979
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq