// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_writeexec
void elf32_writeexec(struct GlobalVars *gv,FILE *f,uint16_t m,int8_t endian,
                     uint8_t (*reloc_vlink2elf)(struct Reloc *))
/* creates an ELF32 executable file (page-aligned with absolute addresses) */
{
  uint32_t sh_off,shstrndx,stabndx,phnum;
  struct LinkedSection *ls;

  elf32_initoutput(gv,elf32_headersize(gv),endian);
  elf32_makestabs(gv);
  phnum = elf32_segmentcheck(gv);
  elf32_stdsymtab(gv,STB_LOCAL,STT_FILE);

  elf32_makeshdrs(gv);
  elf32_makedynamic(gv,reloc_vlink2elf);

  elf32_stdsymtab(gv,STB_LOCAL,0);
  elf32symlist.global_index = elf32symlist.nextindex;
  elf32_stdsymtab(gv,STB_WEAK,0);
  elf32_stdsymtab(gv,STB_GLOBAL,0);

  if (gv->keep_relocs)
    elf32_addrelocs(gv,reloc_vlink2elf);
  for (ls=(struct LinkedSection *)gv->lnksec.first;
       ls->n.next!=NULL; ls=(struct LinkedSection *)ls->n.next) {
    calc_relocs(gv,ls);
  }

  elf32_makestabstr();
  shstrndx = elf32shdridx;
  elf32_makeshstrtab();
  sh_off = elf32offset;
  stabndx = elf32shdridx;
  elf32offset += (elf32shdridx+2) * sizeof(struct Elf32_Shdr);
  elf32_makesymtab(elf32shdridx+1);
  elf32_makestrtab();

  elf32_header(f,gv->dest_sharedobj?ET_DYN:ET_EXEC,m,
               (uint32_t)entry_address(gv),sizeof(struct Elf32_Ehdr),sh_off,0,
               phnum,elf32shdridx,shstrndx,endian==_BIG_ENDIAN_);
  elf32_writephdrs(gv,f);
  elf32_writesegments(gv,f);
  elf32_writestabstr(f);
  elf32_writestrtab(f,&elf32shstrlist);
  fwrite_align(f,2,ftell(f));
  elf32_writeshdrs(gv,f,elf32offset,stabndx);
  elf32_writesymtab(f,&elf32symlist);
  elf32_writestrtab(f,&elf32stringlist);
  if (gv->keep_relocs) {
    fwrite_align(f,2,ftell(f));
    elf32_writerelocs(gv,f);
  }
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x88, %rsp
movb %cl, %al
movw %dx, %cx
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movw %cx, 0x76(%rsp)
movb %al, 0x75(%rsp)
movq %r8, 0x68(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x80(%rsp), %rdi
callq 0x239b0
movq 0x48(%rsp), %rdi
movl %eax, %esi
movsbl 0x75(%rsp), %edx
callq 0x264c0
movq 0x80(%rsp), %rdi
callq 0x25e80
movq 0x80(%rsp), %rdi
callq 0x24580
movl %eax, 0x58(%rsp)
movq 0x80(%rsp), %rdi
xorl %esi, %esi
movl $0x4, %edx
callq 0x243b0
movq 0x80(%rsp), %rdi
callq 0x24da0
movq 0x80(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0x26fd0
movq 0x80(%rsp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x243b0
movl 0x194cc(%rip), %eax     # 0x40208
movl %eax, 0x194ca(%rip)     # 0x4020c
movq 0x80(%rsp), %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x243b0
movq 0x80(%rsp), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x243b0
movq 0x80(%rsp), %rax
cmpl $0x0, 0x60(%rax)
je 0x26d8a
movq 0x80(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0x25580
movq 0x80(%rsp), %rax
movq 0x1c0(%rax), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
cmpq $0x0, (%rax)
je 0x26dca
movq 0x80(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x114f0
movq 0x50(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x50(%rsp)
jmp 0x26d9e
callq 0x25cf0
movl 0x1df1b(%rip), %eax     # 0x44cf0
movl %eax, 0x60(%rsp)
callq 0x25bb0
movq 0x1df13(%rip), %rax     # 0x44cf8
movl %eax, 0x64(%rsp)
movl 0x1df01(%rip), %eax     # 0x44cf0
movl %eax, 0x5c(%rsp)
movl 0x1def7(%rip), %eax     # 0x44cf0
addl $0x2, %eax
movl %eax, %eax
imulq $0x28, %rax, %rax
addq 0x1deef(%rip), %rax     # 0x44cf8
movq %rax, 0x1dee8(%rip)     # 0x44cf8
movl 0x1deda(%rip), %edi     # 0x44cf0
addl $0x1, %edi
callq 0x25de0
callq 0x25c50
movq 0x78(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x80(%rsp), %rax
movl 0x58(%rax), %edx
movl $0x2, %eax
movl $0x3, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movw %ax, 0x3c(%rsp)
movw 0x76(%rsp), %ax
movw %ax, 0x3e(%rsp)
movq 0x80(%rsp), %rdi
callq 0x13750
movq 0x30(%rsp), %rdi
movw 0x3c(%rsp), %si
movw 0x3e(%rsp), %dx
movl %eax, %ecx
movl 0x64(%rsp), %r9d
movl 0x58(%rsp), %eax
movw %ax, %bx
movl 0x1de69(%rip), %eax     # 0x44cf0
movw %ax, %r11w
movl 0x60(%rsp), %eax
movw %ax, %r10w
movsbl 0x75(%rsp), %eax
cmpl $0x1, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl $0x34, %r8d
xorl %ebp, %ebp
movzwl %si, %esi
movzwl %dx, %edx
movl $0x0, (%rsp)
movzwl %bx, %ebx
movl %ebx, 0x8(%rsp)
movzwl %r11w, %r11d
movl %r11d, 0x10(%rsp)
movzwl %r10w, %r10d
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x23cb0
movq 0x80(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0x23ed0
movq 0x80(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0x26630
movq 0x78(%rsp), %rdi
callq 0x26950
movq 0x78(%rsp), %rdi
leaq 0x1938c(%rip), %rsi     # 0x402a0
callq 0x268e0
movq 0x78(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x78(%rsp), %rdi
callq 0x5160
movq 0x40(%rsp), %rdi
movl %eax, %edx
movl $0x2, %esi
callq 0x8640
movq 0x80(%rsp), %rdi
movq 0x78(%rsp), %rsi
movq 0x1dda6(%rip), %rax     # 0x44cf8
movl %eax, %edx
movl 0x5c(%rsp), %ecx
callq 0x24090
movq 0x78(%rsp), %rdi
leaq 0x19277(%rip), %rsi     # 0x401e0
callq 0x269b0
movq 0x78(%rsp), %rdi
leaq 0x192c6(%rip), %rsi     # 0x40240
callq 0x268e0
movq 0x80(%rsp), %rax
cmpl $0x0, 0x60(%rax)
je 0x26fc4
movq 0x78(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x78(%rsp), %rdi
callq 0x5160
movq 0x28(%rsp), %rdi
movl %eax, %edx
movl $0x2, %esi
callq 0x8640
movq 0x80(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0x269f0
addq $0x88, %rsp
popq %rbx
popq %rbp
retq
nop