// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/t_aout.c
// Function: aoutstd_writeexec
void aoutstd_writeexec(struct GlobalVars *gv,FILE *f)
/* creates a standard a.out paged executable file */
{
  uint32_t mid = fff[gv->dest_format]->id;
  int be = (int)fff[gv->dest_format]->endianess;
  struct LinkedSection *sections[3];

  if (be < 0)
    be = gv->endianess;
  aout_initwrite(gv,sections);
  if (sections[0] == NULL)  /* this requires a .text section! */
    error(97,fff[gv->dest_format]->tname,TEXTNAME);
  aout_addsymlist(gv,sections,BIND_GLOBAL,0,be);
  aout_addsymlist(gv,sections,BIND_WEAK,0,be);
  aout_addsymlist(gv,sections,BIND_LOCAL,0,be);
  aout_debugsyms(gv,be);
  calc_relocs(gv,sections[0]);
  calc_relocs(gv,sections[1]);

  aout_header(f,ZMAGIC,mid,isPIC(sections) ? EX_PIC : 0, /* @@@ DYNAMIC? */
              aout_getpagedsize(gv,sections,0),
              aout_getpagedsize(gv,sections,1),
              aout_getpagedsize(gv,sections,2),
              aoutsymlist.nextindex * sizeof(struct nlist32),
              (uint32_t)entry_address(gv),0,0,be);
  aout_pagedsection(gv,f,sections,0);
  aout_pagedsection(gv,f,sections,1);
  aout_writesymbols(f);
  aout_writestrings(f,be);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movq 0x80(%rsp), %rax
movzbl 0x50(%rax), %eax
movl %eax, %ecx
leaq 0x10ce5(%rip), %rax     # 0x3fa30
movq (%rax,%rcx,8), %rax
movl 0xa4(%rax), %eax
movl %eax, 0x74(%rsp)
movq 0x80(%rsp), %rax
movzbl 0x50(%rax), %eax
movl %eax, %ecx
leaq 0x10cc2(%rip), %rax     # 0x3fa30
movq (%rax,%rcx,8), %rax
movsbl 0xaa(%rax), %eax
movl %eax, 0x70(%rsp)
cmpl $0x0, 0x70(%rsp)
jge 0x2ed97
movq 0x80(%rsp), %rax
movsbl 0x202(%rax), %eax
movl %eax, 0x70(%rsp)
movq 0x80(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x2d100
cmpq $0x0, 0x50(%rsp)
jne 0x2ede0
movq 0x80(%rsp), %rax
movzbl 0x50(%rax), %eax
movl %eax, %ecx
leaq 0x10c6a(%rip), %rax     # 0x3fa30
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
movl $0x61, %edi
leaq 0x67c7(%rip), %rdx      # 0x355a0
movb $0x0, %al
callq 0x8c00
movq 0x80(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movl 0x70(%rsp), %r8d
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x2d190
movq 0x80(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movl 0x70(%rsp), %r8d
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x2d190
movq 0x80(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movl 0x70(%rsp), %r8d
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x2d190
movq 0x80(%rsp), %rdi
movl 0x70(%rsp), %esi
callq 0x2d600
movq 0x80(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x114f0
movq 0x80(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x114f0
movq 0x78(%rsp), %rax
movq %rax, 0x30(%rsp)
movl 0x74(%rsp), %eax
movl %eax, 0x3c(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x2ec00
movl %eax, %edx
xorl %eax, %eax
movl $0x10, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, 0x40(%rsp)
movq 0x80(%rsp), %rdi
leaq 0x50(%rsp), %rsi
xorl %edx, %edx
callq 0x2e0b0
movl %eax, 0x44(%rsp)
movq 0x80(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movl $0x1, %edx
callq 0x2e0b0
movl %eax, 0x48(%rsp)
movq 0x80(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movl $0x2, %edx
callq 0x2e0b0
movl %eax, %ebx
movl 0x1602b(%rip), %eax     # 0x44f18
imulq $0xc, %rax, %rax
movl %eax, 0x4c(%rsp)
movq 0x80(%rsp), %rdi
callq 0x13750
movq 0x30(%rsp), %rdi
movl 0x3c(%rsp), %edx
movl 0x40(%rsp), %ecx
movl 0x44(%rsp), %r8d
movl 0x48(%rsp), %r9d
movl 0x4c(%rsp), %r11d
movl %eax, %r10d
movl 0x70(%rsp), %eax
movl $0x10b, %esi            # imm = 0x10B
xorl %ebp, %ebp
movl %ebx, (%rsp)
movl %r11d, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
movl %eax, 0x28(%rsp)
callq 0x2df90
movq 0x80(%rsp), %rdi
movq 0x78(%rsp), %rsi
leaq 0x50(%rsp), %rdx
xorl %ecx, %ecx
callq 0x2e310
movq 0x80(%rsp), %rdi
movq 0x78(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movl $0x1, %ecx
callq 0x2e310
movq 0x78(%rsp), %rdi
callq 0x2e490
movq 0x78(%rsp), %rdi
movl 0x70(%rsp), %esi
callq 0x2e4d0
addq $0x88, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax)