// File: /workspace/github_c_makefile_star2_O0/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 %rbx
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movl %esi, 0x5c(%rsp)
movl %edx, 0x58(%rsp)
movl 0x5c(%rsp), %edx
movl $0x1, %eax
movl $0x8, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, 0x4c(%rsp)
movl $0x0, 0x48(%rsp)
movl $0x0, 0x44(%rsp)
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rdi
leaq 0x10f31(%rip), %rsi     # 0x3623c
movl $0x5, %edx
callq 0x5050
cmpl $0x0, %eax
jne 0x25327
movl $0x7, 0x4c(%rsp)
jmp 0x25486
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rdi
leaq 0x114be(%rip), %rsi     # 0x367f5
movl $0x5, %edx
callq 0x5050
cmpl $0x0, %eax
jne 0x2535b
movl $0x4, 0x4c(%rsp)
movl $0xc, 0x44(%rsp)
jmp 0x25484
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rdi
leaq 0x11490(%rip), %rsi     # 0x367fb
movl $0x4, %edx
callq 0x5050
cmpl $0x0, %eax
jne 0x2538f
movl $0x9, 0x4c(%rsp)
movl $0x8, 0x44(%rsp)
jmp 0x25482
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rdi
leaq 0x10eac(%rip), %rsi     # 0x3624b
callq 0x5130
cmpl $0x0, %eax
jne 0x253be
movl $0x5, 0x4c(%rsp)
movl $0x4, 0x44(%rsp)
jmp 0x25480
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rdi
leaq 0x10e83(%rip), %rsi     # 0x36251
callq 0x5130
cmpl $0x0, %eax
jne 0x253ed
movl $0xb, 0x4c(%rsp)
movl $0x10, 0x44(%rsp)
jmp 0x2547e
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rdi
leaq 0x10e45(%rip), %rsi     # 0x36242
callq 0x5130
cmpl $0x0, %eax
jne 0x25419
movl $0x6, 0x4c(%rsp)
movl $0x8, 0x44(%rsp)
jmp 0x2547c
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rdi
leaq 0x10e30(%rip), %rsi     # 0x36259
callq 0x5130
cmpl $0x0, %eax
jne 0x2543d
movl $0x3, 0x4c(%rsp)
jmp 0x2547a
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x38(%rsp)
leaq 0x10189(%rip), %rdi     # 0x355db
callq 0x50c0
movq 0x38(%rsp), %rdi
movq %rax, %rdx
leaq 0x10175(%rip), %rsi     # 0x355db
callq 0x5050
cmpl $0x0, %eax
jne 0x25478
movl $0x4, 0x44(%rsp)
jmp 0x2547a
jmp 0x2547c
jmp 0x2547e
jmp 0x25480
jmp 0x25482
jmp 0x25484
jmp 0x25486
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x1ae9a(%rip), %rsi     # 0x40330
callq 0x5130
cmpl $0x0, %eax
je 0x254ba
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x1ae88(%rip), %rsi     # 0x40338
callq 0x5130
cmpl $0x0, %eax
jne 0x254c2
movl $0xffffffff, 0x48(%rsp) # imm = 0xFFFFFFFF
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x25b90
movl %eax, %edi
movl 0x4c(%rsp), %esi
movl 0x58(%rsp), %edx
movq 0x60(%rsp), %rax
movq 0x40(%rax), %rax
movl %eax, 0x34(%rsp)
movq 0x1f80a(%rip), %rax     # 0x44cf8
movl %eax, %r8d
movq 0x60(%rsp), %rax
movq 0x48(%rax), %rax
movl %eax, %r9d
movl 0x48(%rsp), %ebx
movq 0x60(%rsp), %rax
movzbl 0x23(%rax), %ecx
movl $0x1, %r11d
shll %cl, %r11d
movl 0x34(%rsp), %ecx
movl 0x44(%rsp), %r10d
movsbl 0x1adad(%rip), %eax     # 0x402d0
xorl %ebp, %ebp
movl $0x0, (%rsp)
movl %ebx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x25a40
movq %rax, 0x50(%rsp)
cmpl $0x0, 0x1f7b9(%rip)     # 0x44d08
je 0x25577
movq 0x60(%rsp), %rax
movq 0x18(%rax), %rdi
leaq 0x11185(%rip), %rsi     # 0x366e6
callq 0x5130
cmpl $0x0, %eax
jne 0x25577
movq 0x50(%rsp), %rax
movq %rax, 0x1f7b1(%rip)     # 0x44d28
addq $0x68, %rsp
popq %rbx
popq %rbp
retq
nop