// File: /workspace/github_c_makefile_star2_O1/deplinenoise[P]vlink/t_aout.c
// Function: aoutstd_writeobject
void aoutstd_writeobject(struct GlobalVars *gv,FILE *f)
/* creates a standard a.out relocatable object file */
{
  uint32_t mid = fff[gv->dest_format]->id;
  int be = (int)fff[gv->dest_format]->endianess;
  struct LinkedSection *sections[3];
  uint32_t trsize,drsize;
  unsigned long a = MIN_ALIGNMENT;

  if (be < 0)
    be = gv->endianess;
  aout_initwrite(gv,sections);
  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);
  trsize = aout_addrelocs(gv,sections,0,&treloclist,aoutstd_getrinfo,be);
  drsize = aout_addrelocs(gv,sections,1,&dreloclist,aoutstd_getrinfo,be);

  aout_header(f,OMAGIC,mid,isPIC(sections) ? EX_PIC : 0,
              sections[0] ? sections[0]->size+align(sections[0]->size,a) : 0,
              sections[1] ? sections[1]->size+align(sections[0]->size,a) : 0,
              sections[2] ? sections[2]->size : 0,
              aoutsymlist.nextindex * sizeof(struct nlist32),
              0,trsize,drsize,be);
  aout_writesection(f,sections[0],(uint8_t)a);
  aout_writesection(f,sections[1],(uint8_t)a);
  aout_writerelocs(f,&treloclist);
  aout_writerelocs(f,&dreloclist);
  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, %rbx
movq %rdi, %r13
movzbl 0x50(%rdi), %eax
leaq 0x11e37(%rip), %rcx     # 0x2f180
movq (%rcx,%rax,8), %rax
movb 0xaa(%rax), %cl
testb %cl, %cl
jns 0x1d35e
movb 0x202(%r13), %cl
movl 0xa4(%rax), %eax
movl %eax, 0xc(%rsp)
movsbl %cl, %r14d
leaq 0x10(%rsp), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1c6bb
xorl %r15d, %r15d
movq %r13, %rdi
movq %rbp, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
movl %r14d, %r8d
callq 0x1c73d
movq %r13, %rdi
movq %rbp, %rsi
movl $0x2, %edx
xorl %ecx, %ecx
movl %r14d, %r8d
callq 0x1c73d
movq %r13, %rdi
movq %rbp, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movl %r14d, %r8d
callq 0x1c73d
movq %r13, %rdi
movl %r14d, %esi
callq 0x1c99d
leaq 0x16783(%rip), %rcx     # 0x33b50
leaq 0x14c(%rip), %r12       # 0x1d520
movq %r13, %rdi
movq %rbp, %rsi
xorl %edx, %edx
movq %r12, %r8
movl %r14d, %r9d
callq 0x1cb87
movq %rax, 0x30(%rsp)
leaq 0x16775(%rip), %rcx     # 0x33b68
movq %r13, %rdi
movq %rbp, %rsi
movl $0x1, %edx
movq %r12, %r8
movl %r14d, %r9d
callq 0x1cb87
movl %eax, %r13d
movq %rbp, %rdi
callq 0x1d6e1
movl %eax, %r12d
movq (%rbp), %rax
movl $0x0, %ebp
testq %rax, %rax
je 0x1d438
movq 0x48(%rax), %rbp
movl $0x2, %esi
movq %rbp, %rdi
callq 0x6e40
addl %eax, %ebp
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x1d46b
movl %r12d, %r15d
movq %r13, %r12
movl 0x48(%rax), %r13d
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rdi
movl $0x2, %esi
callq 0x6e40
addl %r13d, %eax
movq %r12, %r13
movl %r15d, %r12d
movq %rax, %r15
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x1d47a
movl 0x48(%rax), %eax
jmp 0x1d47c
xorl %eax, %eax
xorl %ecx, %ecx
testl %r12d, %r12d
setne %cl
shll $0x4, %ecx
movl 0x166bb(%rip), %edx     # 0x33b48
shll $0x2, %edx
leal (%rdx,%rdx,2), %r10d
movq %rbx, %rdi
movl $0x107, %esi            # imm = 0x107
movl 0xc(%rsp), %edx
movl %ebp, %r8d
movl %r15d, %r9d
pushq %r14
pushq %r13
pushq 0x40(%rsp)
pushq $0x0
pushq %r10
pushq %rax
callq 0x1cf74
addq $0x30, %rsp
movq 0x10(%rsp), %rsi
movq %rbx, %rdi
movl $0x2, %edx
callq 0x1d1f7
movq 0x18(%rsp), %rsi
movq %rbx, %rdi
movl $0x2, %edx
callq 0x1d1f7
leaq 0x16669(%rip), %rsi     # 0x33b50
movq %rbx, %rdi
callq 0x1d22a
leaq 0x16672(%rip), %rsi     # 0x33b68
movq %rbx, %rdi
callq 0x1d22a
movq %rbx, %rdi
callq 0x1d262
movq %rbx, %rdi
movl %r14d, %esi
callq 0x1d2aa
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq