// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32.c
// Function: add_section_shdr
static void add_section_shdr(struct LinkedSection *ls,bool bss,uint32_t f)
{
  struct ShdrNode *shn;
  uint32_t type = bss ? SHT_NOBITS : SHT_PROGBITS;
  uint32_t info = 0;
  uint32_t entsize = 0;

  if (!strncmp(ls->name,note_name,strlen(note_name)))
    type = SHT_NOTE;
  else if (!strncmp(ls->name,".rela",5)) {
    type = SHT_RELA;
    entsize = sizeof(struct Elf32_Rela);
  }
  else if (!strncmp(ls->name,".rel",4)) {
    type = SHT_REL;
    entsize = sizeof(struct Elf32_Rel);
  }
  else if (!strcmp(ls->name,hash_name)) {
    type = SHT_HASH;
    entsize = sizeof(uint32_t);
  }
  else if (!strcmp(ls->name,dynsym_name)) {
    type = SHT_DYNSYM;
    entsize = sizeof(struct Elf32_Sym);
  }
  else if (!strcmp(ls->name,dyn_name)) {
    type = SHT_DYNAMIC;
    entsize = sizeof(struct Elf32_Dyn);
  }
  else if (!strcmp(ls->name,dynstr_name))
    type = SHT_STRTAB;
  else if (!strncmp(ls->name,got_name,strlen(got_name)))
    entsize = sizeof(uint32_t);

  if (!strcmp(ls->name,pltrel_name[0]) || !strcmp(ls->name,pltrel_name[1]))
    info = ~0;  /* request .plt index in info field for .rel(a).plt */

  shn = elf32_addshdr(elf32_addshdrstr(ls->name),type,f,ls->base,
                      elf32offset,ls->size,0,info,1<<(uint32_t)ls->alignment,
                      entsize,elf32_endianess);


  if (stabdebugidx && !strcmp(ls->name,".stab"))
    stabshdr = shn;  /* patch sh_link field for .stabstr later */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, 0x4(%rsp)
movq %rdi, %rbx
testl %esi, %esi
pushq $0x1
popq %r13
pushq $0x8
popq %rbp
movl %ebp, %r14d
cmovel %r13d, %r14d
movq 0x18(%rdi), %r15
leaq 0xaf96(%rip), %rsi      # 0x213e8
pushq $0x5
popq %rdx
movq %r15, %rdi
callq 0x5070
xorl %r12d, %r12d
testl %eax, %eax
je 0x16514
leaq 0xb526(%rip), %rsi      # 0x21995
pushq $0x5
popq %rdx
movq %r15, %rdi
callq 0x5070
testl %eax, %eax
je 0x16518
leaq 0xb512(%rip), %rsi      # 0x2199b
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x5070
testl %eax, %eax
je 0x16520
leaq 0xaf54(%rip), %rsi      # 0x213f7
movq %r15, %rdi
callq 0x5160
testl %eax, %eax
je 0x16529
leaq 0xaf47(%rip), %rsi      # 0x213fd
movq %r15, %rdi
callq 0x5160
testl %eax, %eax
je 0x16531
leaq 0xaf25(%rip), %rsi      # 0x213ee
movq %r15, %rdi
callq 0x5160
testl %eax, %eax
je 0x16539
leaq 0xaf29(%rip), %rsi      # 0x21405
movq %r15, %rdi
callq 0x5160
testl %eax, %eax
je 0x1653d
leaq 0xa0ec(%rip), %r12      # 0x205db
movq %r12, %rdi
callq 0x50e0
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x5070
xorl %r12d, %r12d
testl %eax, %eax
sete %r12b
shll $0x2, %r12d
jmp 0x16541
pushq $0x7
jmp 0x1653f
pushq $0xc
popq %r12
pushq $0x4
jmp 0x1653f
pushq $0x9
popq %r14
movl %ebp, %r12d
jmp 0x16541
pushq $0x4
popq %r12
pushq $0x5
jmp 0x1653f
pushq $0x10
popq %r12
pushq $0xb
jmp 0x1653f
pushq $0x6
jmp 0x16522
pushq $0x3
popq %r14
movq 0x19338(%rip), %rsi     # 0x2f880
movq %r15, %rdi
callq 0x5160
testl %eax, %eax
je 0x16569
movq 0x1932d(%rip), %rsi     # 0x2f888
movq %r15, %rdi
callq 0x5160
xorl %ebp, %ebp
testl %eax, %eax
jne 0x1656c
pushq $-0x1
popq %rbp
movq %r15, %rdi
callq 0x169fe
movl 0x40(%rbx), %r10d
movl 0x1d799(%rip), %r8d     # 0x33d18
movl 0x48(%rbx), %r9d
movb 0x23(%rbx), %cl
shll %cl, %r13d
movsbl 0x1928f(%rip), %r11d    # 0x2f820
subq $0x8, %rsp
movl %eax, %edi
movl %r14d, %esi
movl 0xc(%rsp), %edx
movl %r10d, %ecx
pushq %r11
pushq %r12
pushq %r13
pushq %rbp
pushq $0x0
callq 0x16931
addq $0x30, %rsp
cmpl $0x0, 0x1d76e(%rip)     # 0x33d28
je 0x165da
movq %rax, %r14
movq 0x18(%rbx), %rdi
leaq 0xb2bc(%rip), %rsi      # 0x21886
callq 0x5160
testl %eax, %eax
jne 0x165da
movq %r14, 0x1d76e(%rip)     # 0x33d48
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq