// File: /workspace/github_c_makefile_star2_O3/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, %ebp
movq %rdi, %rbx
testl %esi, %esi
movl $0x1, %eax
movl $0x8, %r14d
cmovel %eax, %r14d
movq 0x18(%rdi), %r15
leaq 0xbc64(%rip), %rsi      # 0x233c8
movl $0x5, %edx
movq %r15, %rdi
callq 0x5070
xorl %r12d, %r12d
testl %eax, %eax
je 0x17834
leaq 0xc1f2(%rip), %rsi      # 0x23975
movl $0x5, %edx
movq %r15, %rdi
callq 0x5070
testl %eax, %eax
je 0x1783c
leaq 0xc1dc(%rip), %rsi      # 0x2397b
movl $0x4, %edx
movq %r15, %rdi
callq 0x5070
testl %eax, %eax
je 0x1784a
leaq 0xbc1c(%rip), %rsi      # 0x233d7
movq %r15, %rdi
callq 0x5160
testl %eax, %eax
je 0x17858
leaq 0xbc0b(%rip), %rsi      # 0x233dd
movq %r15, %rdi
callq 0x5160
testl %eax, %eax
je 0x17866
leaq 0xbbe5(%rip), %rsi      # 0x233ce
movq %r15, %rdi
callq 0x5160
testl %eax, %eax
je 0x17874
leaq 0xbbe9(%rip), %rsi      # 0x233e5
movq %r15, %rdi
callq 0x5160
testl %eax, %eax
je 0x1787c
leaq 0xadbc(%rip), %r12      # 0x225cb
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 0x17882
movl $0x7, %r14d
jmp 0x17882
movl $0xc, %r12d
movl $0x4, %r14d
jmp 0x17882
movl $0x9, %r14d
movl $0x8, %r12d
jmp 0x17882
movl $0x4, %r12d
movl $0x5, %r14d
jmp 0x17882
movl $0x10, %r12d
movl $0xb, %r14d
jmp 0x17882
movl $0x6, %r14d
jmp 0x17850
movl $0x3, %r14d
movq 0x17fe7(%rip), %rsi     # 0x2f870
movq %r15, %rdi
callq 0x5160
testl %eax, %eax
je 0x178ab
movq 0x17fdc(%rip), %rsi     # 0x2f878
movq %r15, %rdi
callq 0x5160
xorl %r13d, %r13d
testl %eax, %eax
jne 0x178b1
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
leaq 0x17f28(%rip), %rdi     # 0x2f7e0
movq %r15, %rsi
callq 0x167f2
movl 0x40(%rbx), %r10d
movl 0x1c05d(%rip), %r8d     # 0x33928
movl 0x48(%rbx), %r9d
movb 0x23(%rbx), %cl
movl $0x1, %r11d
shll %cl, %r11d
movsbl 0x17f2d(%rip), %r15d    # 0x2f810
subq $0x8, %rsp
movl %eax, %edi
movl %r14d, %esi
movl %ebp, %edx
movl %r10d, %ecx
pushq %r15
pushq %r12
pushq %r11
pushq %r13
pushq $0x0
callq 0x17ca8
addq $0x30, %rsp
cmpl $0x0, 0x1c02d(%rip)     # 0x33938
je 0x1792b
movq %rax, %r14
movq 0x18(%rbx), %rdi
leaq 0xbf4b(%rip), %rsi      # 0x23866
callq 0x5160
testl %eax, %eax
jne 0x1792b
movq %r14, 0x1c02d(%rip)     # 0x33958
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq