// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_section
void elf32_section(struct GlobalVars *gv,struct Elf32_Ehdr *ehdr,
                   struct ObjectUnit *ou,struct Elf32_Shdr *shdr,
                   int shndx,char *shstrtab)
/* create a new section */
{
  bool be = (ehdr->e_ident[EI_DATA] == ELFDATA2MSB);
  struct LinkFile *lf = ou->lnkfile;
  char *sec_name = shstrtab + read32(be,shdr->sh_name);
  uint8_t *data = (uint8_t *)ehdr + read32(be,shdr->sh_offset);
  unsigned long size = (unsigned long)read32(be,shdr->sh_size);
  uint32_t f = read32(be,shdr->sh_flags);
  uint8_t type=ST_DATA,flags=0,prot=SP_READ;
  struct Section *s;

  if (gv->strip_symbols>=STRIP_DEBUG &&
      (!strncmp(sec_name,".debug",6) ||
       !strncmp(sec_name,".line",5) ||
       !strncmp(sec_name,".stab",5)))
    return;   /* ignore debugging sections when -S or -s is given */

  if (read32(be,shdr->sh_type) == SHT_NOBITS) {
    data = NULL;
    type = ST_UDATA;
    flags |= SF_UNINITIALIZED;
  }
  else {
    if (data+size > lf->data+lf->length)  /* illegal section offset */
      error(49,lf->pathname,sec_name,lf->objname);
  }

  if ((f & SHF_EXECINSTR) && data) {
    type = ST_CODE;
    prot |= SP_EXEC;
  }
  if (f & SHF_WRITE)
    prot |= SP_WRITE;
  if (f & SHF_ALLOC)
    flags |= SF_ALLOC;
  if (!strncmp(sec_name,".gnu.linkonce",13))
    flags |= SF_LINKONCE;

  s = add_section(ou,sec_name,data,size,type,flags,prot,
                  (uint8_t)shiftcnt(read32(be,shdr->sh_addralign)),FALSE);

  s->link = read32(be,shdr->sh_link);  /* save link for later use */
  s->id = shndx;  /* use section header index for identification */
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xb0(%rsp)
movq %rsi, 0xa8(%rsp)
movq %rdx, 0xa0(%rsp)
movq %rcx, 0x98(%rsp)
movl %r8d, 0x94(%rsp)
movq %r9, 0x88(%rsp)
movq 0xa8(%rsp), %rax
movzbl 0x5(%rax), %eax
cmpl $0x2, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x84(%rsp)
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x78(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x40(%rsp)
movl 0x84(%rsp), %edi
movq 0x98(%rsp), %rsi
callq 0x8060
movl %eax, %ecx
movq 0x40(%rsp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, 0x70(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0x48(%rsp)
movl 0x84(%rsp), %edi
movq 0x98(%rsp), %rsi
addq $0x10, %rsi
callq 0x8060
movl %eax, %ecx
movq 0x48(%rsp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, 0x68(%rsp)
movl 0x84(%rsp), %edi
movq 0x98(%rsp), %rsi
addq $0x14, %rsi
callq 0x8060
movl %eax, %eax
movq %rax, 0x60(%rsp)
movl 0x84(%rsp), %edi
movq 0x98(%rsp), %rsi
addq $0x8, %rsi
callq 0x8060
movl %eax, 0x5c(%rsp)
movb $0x2, 0x5b(%rsp)
movb $0x0, 0x5a(%rsp)
movb $0x1, 0x59(%rsp)
movq 0xb0(%rsp), %rax
movzbl 0x6c(%rax), %eax
cmpl $0x1, %eax
jl 0x1fd4f
movq 0x70(%rsp), %rdi
leaq 0x169d5(%rip), %rsi     # 0x366da
movl $0x6, %edx
callq 0x5050
cmpl $0x0, %eax
je 0x1fd4a
movq 0x70(%rsp), %rdi
leaq 0x16625(%rip), %rsi     # 0x36345
movl $0x5, %edx
callq 0x5050
cmpl $0x0, %eax
je 0x1fd4a
movq 0x70(%rsp), %rdi
leaq 0x169ab(%rip), %rsi     # 0x366e6
movl $0x5, %edx
callq 0x5050
cmpl $0x0, %eax
jne 0x1fd4f
jmp 0x1ff2f
movl 0x84(%rsp), %edi
movq 0x98(%rsp), %rsi
addq $0x4, %rsi
callq 0x8060
cmpl $0x8, %eax
jne 0x1fd88
movq $0x0, 0x68(%rsp)
movb $0x3, 0x5b(%rsp)
movzbl 0x5a(%rsp), %eax
orl $0x2, %eax
movb %al, 0x5a(%rsp)
jmp 0x1fdce
movq 0x68(%rsp), %rax
addq 0x60(%rsp), %rax
movq 0x78(%rsp), %rcx
movq 0x28(%rcx), %rcx
movq 0x78(%rsp), %rdx
addq 0x30(%rdx), %rcx
cmpq %rcx, %rax
jbe 0x1fdcc
movq 0x78(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x70(%rsp), %rdx
movq 0x78(%rsp), %rax
movq 0x20(%rax), %rcx
movl $0x31, %edi
movb $0x0, %al
callq 0x8c00
jmp 0x1fdce
movl 0x5c(%rsp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x1fdf3
cmpq $0x0, 0x68(%rsp)
je 0x1fdf3
movb $0x1, 0x5b(%rsp)
movzbl 0x59(%rsp), %eax
orl $0x4, %eax
movb %al, 0x59(%rsp)
movl 0x5c(%rsp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1fe0b
movzbl 0x59(%rsp), %eax
orl $0x2, %eax
movb %al, 0x59(%rsp)
movl 0x5c(%rsp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x1fe23
movzbl 0x5a(%rsp), %eax
orl $0x1, %eax
movb %al, 0x5a(%rsp)
movq 0x70(%rsp), %rdi
leaq 0x1651c(%rip), %rsi     # 0x3634b
movl $0xd, %edx
callq 0x5050
cmpl $0x0, %eax
jne 0x1fe4a
movzbl 0x5a(%rsp), %eax
orl $0x8, %eax
movb %al, 0x5a(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x30(%rsp)
movb 0x5b(%rsp), %al
movb %al, 0x3d(%rsp)
movb 0x5a(%rsp), %al
movb %al, 0x3e(%rsp)
movb 0x59(%rsp), %al
movb %al, 0x3f(%rsp)
movl 0x84(%rsp), %edi
movq 0x98(%rsp), %rsi
addq $0x20, %rsi
callq 0x8060
movl %eax, %edi
callq 0x8860
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
movb 0x3d(%rsp), %r8b
movb 0x3e(%rsp), %r9b
movb 0x3f(%rsp), %r10b
xorl %r11d, %r11d
movzbl %r8b, %r8d
movzbl %r9b, %r9d
movzbl %r10b, %r10d
movl %r10d, (%rsp)
movzbl %al, %eax
movl %eax, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
callq 0x12660
movq %rax, 0x50(%rsp)
movl 0x84(%rsp), %edi
movq 0x98(%rsp), %rsi
addq $0x18, %rsi
callq 0x8060
movl %eax, %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0x90(%rax)
movl 0x94(%rsp), %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0x28(%rax)
addq $0xb8, %rsp
retq
nopw (%rax,%rax)