// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, 0x18(%rsp)
movq %rdi, %r14
movzbl 0x50(%rdi), %eax
leaq 0x11bd1(%rip), %r15     # 0x2f180
movq (%r15,%rax,8), %rax
movb 0xaa(%rax), %bpl
testb %bpl, %bpl
jns 0x1d5c6
movb 0x202(%r14), %bpl
movl 0xa4(%rax), %eax
movl %eax, 0x4(%rsp)
leaq 0x20(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1c516
cmpq $0x0, (%rbx)
jne 0x1d605
movzbl 0x50(%r14), %eax
movq (%r15,%rax,8), %rax
movq (%rax), %rsi
leaq 0x4f97(%rip), %rdx      # 0x22590
movl $0x61, %edi
xorl %eax, %eax
callq 0x6f14
movsbl %bpl, %r15d
leaq 0x20(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
movl %r15d, %r8d
callq 0x1c598
movq %r14, %rdi
movq %r12, %rsi
movl $0x2, %edx
xorl %ecx, %ecx
movl %r15d, %r8d
callq 0x1c598
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movl %r15d, %r8d
callq 0x1c598
movq %r14, %rdi
movl %r15d, %esi
callq 0x1c808
movq (%r12), %rsi
movq %r14, %rdi
callq 0xb6e6
movq 0x8(%r12), %rsi
movq %r14, %rdi
callq 0xb6e6
movq %r12, %rdi
callq 0x1d52f
xorl %r13d, %r13d
testl %eax, %eax
setne %r13b
shll $0x4, %r13d
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x1ce92
movl %eax, (%rsp)
movq %r14, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x1ce92
movl %eax, %ebp
movq %r14, %rdi
movq %r12, %rsi
movl $0x2, %edx
callq 0x1ce92
movq %rax, 0x10(%rsp)
movl 0x16488(%rip), %eax     # 0x33b48
shll $0x2, %eax
leal (%rax,%rax,2), %eax
movq %rax, 0x8(%rsp)
movq %r14, %rdi
callq 0xcbe5
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
movl $0x10b, %esi            # imm = 0x10B
movl 0x4(%rsp), %edx
movl %r13d, %ecx
movl (%rsp), %r8d
movl %ebp, %r9d
pushq %r15
xorl %r10d, %r10d
pushq %r10
pushq %r10
pushq %rax
pushq 0x28(%rsp)
pushq 0x38(%rsp)
callq 0x1cdb8
addq $0x30, %rsp
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x1cfc9
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movl $0x1, %ecx
callq 0x1cfc9
movq %rbx, %rdi
callq 0x1d0a6
movq %rbx, %rdi
movl %r15d, %esi
callq 0x1d0ee
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq