// File: /workspace/github_c_makefile_star2_O1/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 0xbb00(%rip), %rsi      # 0x233e8
movl $0x5, %edx
movq %r15, %rdi
callq 0x5070
xorl %r12d, %r12d
testl %eax, %eax
je 0x179b8
leaq 0xc08e(%rip), %rsi      # 0x23995
movl $0x5, %edx
movq %r15, %rdi
callq 0x5070
testl %eax, %eax
je 0x179c0
leaq 0xc078(%rip), %rsi      # 0x2399b
movl $0x4, %edx
movq %r15, %rdi
callq 0x5070
testl %eax, %eax
je 0x179ce
leaq 0xbab8(%rip), %rsi      # 0x233f7
movq %r15, %rdi
callq 0x5160
testl %eax, %eax
je 0x179dc
leaq 0xbaa7(%rip), %rsi      # 0x233fd
movq %r15, %rdi
callq 0x5160
testl %eax, %eax
je 0x179ea
leaq 0xba81(%rip), %rsi      # 0x233ee
movq %r15, %rdi
callq 0x5160
testl %eax, %eax
je 0x179f8
leaq 0xba85(%rip), %rsi      # 0x23405
movq %r15, %rdi
callq 0x5160
testl %eax, %eax
je 0x17a00
leaq 0xac48(%rip), %r12      # 0x225db
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 0x17a06
movl $0x7, %r14d
jmp 0x17a06
movl $0xc, %r12d
movl $0x4, %r14d
jmp 0x17a06
movl $0x9, %r14d
movl $0x8, %r12d
jmp 0x17a06
movl $0x4, %r12d
movl $0x5, %r14d
jmp 0x17a06
movl $0x10, %r12d
movl $0xb, %r14d
jmp 0x17a06
movl $0x6, %r14d
jmp 0x179d4
movl $0x3, %r14d
movq 0x17e63(%rip), %rsi     # 0x2f870
movq %r15, %rdi
callq 0x5160
testl %eax, %eax
je 0x17a2f
movq 0x17e58(%rip), %rsi     # 0x2f878
movq %r15, %rdi
callq 0x5160
xorl %r13d, %r13d
testl %eax, %eax
jne 0x17a35
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
leaq 0x17da4(%rip), %rdi     # 0x2f7e0
movq %r15, %rsi
callq 0x169a2
movl 0x40(%rbx), %r10d
movl 0x1bed9(%rip), %r8d     # 0x33928
movl 0x48(%rbx), %r9d
movb 0x23(%rbx), %cl
movl $0x1, %r11d
shll %cl, %r11d
movsbl 0x17da9(%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 0x17e2a
addq $0x30, %rsp
cmpl $0x0, 0x1bea9(%rip)     # 0x33938
je 0x17aaf
movq %rax, %r14
movq 0x18(%rbx), %rdi
leaq 0xbde7(%rip), %rsi      # 0x23886
callq 0x5160
testl %eax, %eax
jne 0x17aaf
movq %r14, 0x1bea9(%rip)     # 0x33958
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq