// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x78, %rsp
movl %r8d, 0x18(%rsp)
movl %ecx, %eax
movl 0x18(%rsp), %ecx
movl %eax, 0x1c(%rsp)
movq %rdx, %rax
movl 0x1c(%rsp), %edx
movq %rax, 0x20(%rsp)
movq %rsi, %rax
movq 0x20(%rsp), %rsi
movq %rax, 0x28(%rsp)
movq %rdi, %r8
movq 0x28(%rsp), %rdi
movb %r9b, %al
movl 0x80(%rsp), %r9d
movq %r8, 0x68(%rsp)
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movb %dl, 0x57(%rsp)
movb %cl, 0x56(%rsp)
movb %al, 0x55(%rsp)
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
movl 0x80(%rsp), %eax
movl %eax, 0x30(%rsp)
subl $0x1, %eax
je 0x227bf
jmp 0x227b4
movl 0x30(%rsp), %eax
subl $0x2, %eax
je 0x227d5
jmp 0x227eb
leaq 0x224ea(%rip), %rax     # 0x44cb0
movq %rax, 0x40(%rsp)
movl $0x4, 0x34(%rsp)
jmp 0x22807
leaq 0x224dc(%rip), %rax     # 0x44cb8
movq %rax, 0x40(%rsp)
movl $0x5, 0x34(%rsp)
jmp 0x22807
movl 0x80(%rsp), %edx
leaq 0x13b9e(%rip), %rdi     # 0x36397
leaq 0x13a70(%rip), %rsi     # 0x36270
movb $0x0, %al
callq 0x8ae0
movq 0x40(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x48(%rsp)
cmpq $0x0, %rax
je 0x22829
movq 0x48(%rsp), %rax
movq %rax, 0x70(%rsp)
jmp 0x22902
movq 0x68(%rsp), %rax
cmpq $0x0, 0x1e0(%rax)
jne 0x2284d
leaq 0x13b6a(%rip), %rdi     # 0x363a9
leaq 0x13a2a(%rip), %rsi     # 0x36270
movb $0x0, %al
callq 0x8ae0
movq 0x68(%rsp), %rax
movq 0x1e0(%rax), %rdi
movslq 0x80(%rsp), %rcx
leaq 0x1daf8(%rip), %rax     # 0x40360
movq (%rax,%rcx,8), %rsi
movq 0x60(%rsp), %rcx
movb 0x57(%rsp), %r8b
movb 0x56(%rsp), %al
xorl %edx, %edx
movzbl %r8b, %r8d
movzbl %al, %r9d
movzbl 0x55(%rsp), %eax
movl %eax, (%rsp)
movl $0x2, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
callq 0x12660
movq %rax, 0x48(%rsp)
movq 0x58(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x38(%rax)
movq 0x48(%rsp), %rcx
movq 0x40(%rsp), %rax
movq %rcx, (%rax)
cmpl $0x0, 0x34(%rsp)
jl 0x228f8
movq 0x68(%rsp), %rdi
movslq 0x34(%rsp), %rcx
leaq 0x1da07(%rip), %rax     # 0x402e0
movq (%rax,%rcx,8), %rsi
callq 0x10350
cmpq $0x0, %rax
jne 0x228f6
movq 0x68(%rsp), %rdi
movl 0x34(%rsp), %esi
callq 0x22040
jmp 0x228f8
movq 0x48(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
addq $0x78, %rsp
retq
nopl (%rax)