// File: /workspace/github_c_makefile_star2_O1/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_writeobject
void elf32_writeobject(struct GlobalVars *gv,FILE *f,uint16_t m,int8_t endian,
                       uint8_t (*reloc_vlink2elf)(struct Reloc *))
/* creates an ELF32 relocatable object file */
{
  uint32_t sh_off,shstrndx,stabndx;

  elf32_initoutput(gv,sizeof(struct Elf32_Ehdr),endian);
  elf32_makestabs(gv);
  elf32_stdsymtab(gv,STB_LOCAL,STT_FILE);

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

  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,ET_REL,m,0,0,sh_off,0,0,elf32shdridx,
               shstrndx,endian==_BIG_ENDIAN_);
  elf32_writesections(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);
  fwrite_align(f,2,ftell(f));
  elf32_writerelocs(gv,f);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r13
movl %ecx, %r12d
movl %edx, 0x4(%rsp)
movq %rsi, %rbx
movq %rdi, %r14
movl $0x34, %esi
movl %ecx, %edx
callq 0x184fc
movq %r14, %rdi
callq 0x180e2
leaq 0x16e97(%rip), %r15     # 0x2f720
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
movl $0x4, %ecx
callq 0x17082
movq %r14, %rdi
callq 0x175e7
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x17082
movl 0x16e90(%rip), %eax     # 0x2f748
movl %eax, 0x16e8e(%rip)     # 0x2f74c
movq %r14, %rdi
movq %r15, %rsi
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x17082
movq %r14, %rdi
movq %r15, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x17082
movq %r14, %rdi
movq %r13, %rsi
callq 0x17abe
callq 0x17fe5
movzwl 0x1b026(%rip), %r15d    # 0x33920
callq 0x17f11
movq 0x1b022(%rip), %rbp     # 0x33928
movl 0x1b013(%rip), %r13d    # 0x33920
leal 0x2(%r13), %eax
leaq (%rax,%rax,4), %rax
leaq (,%rax,8), %rax
addq %rbp, %rax
movq %rax, 0x1b001(%rip)     # 0x33928
leal 0x1(%r13), %edi
callq 0x18080
callq 0x17f7b
movzwl 0x1afe4(%rip), %eax     # 0x33920
xorl %r10d, %r10d
cmpb $0x1, %r12b
sete %r10b
subq $0x8, %rsp
movq %rbx, %rdi
movl $0x1, %esi
movl 0xc(%rsp), %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movl %ebp, %r9d
pushq %r10
pushq %r15
pushq %rax
xorl %eax, %eax
pushq %rax
pushq %rax
callq 0x16b2f
addq $0x30, %rsp
movq %r14, %rdi
movq %rbx, %rsi
callq 0x186e6
movq %rbx, %rdi
callq 0x1878a
leaq 0x16e55(%rip), %rsi     # 0x2f7e0
movq %rbx, %rdi
callq 0x1874c
movq %rbx, %rdi
callq 0x5190
movq %rbx, %rdi
movl $0x2, %esi
movl %eax, %edx
callq 0x6d55
movl 0x1af78(%rip), %edx     # 0x33928
movq %r14, %rdi
movq %rbx, %rsi
movl %r13d, %ecx
callq 0x16e0c
movq %rbx, %rdi
leaq 0x16d58(%rip), %rsi     # 0x2f720
callq 0x187c4
leaq 0x16dac(%rip), %rsi     # 0x2f780
movq %rbx, %rdi
callq 0x1874c
movq %rbx, %rdi
callq 0x5190
movq %rbx, %rdi
movl $0x2, %esi
movl %eax, %edx
callq 0x6d55
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x187fc