// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_writesegments
void elf32_writesegments(struct GlobalVars *gv,FILE *f)
/* write all PT_LOAD segments, with alignment gaps, etc. */
{
  struct Phdr *p;
  struct LinkedSection *ls;

  for (p=gv->phdrlist; p; p=p->next) {
    if (p->type==PT_LOAD && (p->flags&PHDR_USED) &&
        p->start!=ADDR_NONE && p->start_vma!=ADDR_NONE) {
      /* write page-alignment gap */
      fwritegap(f,p->alignment_gap);

      /* write section contents */
      for (ls=(struct LinkedSection *)gv->lnksec.first;
           ls->n.next!=NULL; ls=(struct LinkedSection *)ls->n.next) {
        if (ls->copybase>=(unsigned long)p->start &&
            (ls->copybase+ls->size)<=(unsigned long)p->mem_end &&
            (ls->flags & SF_ALLOC)) {
          if (ls->filesize)
            fwritex(f,ls->data,ls->filesize);  /* section's contents */
          if (ls->gapsize)
            fwritegap(f,ls->gapsize);  /* inter-section alignment gap */
        }
      }
    }
  }

  /* unallocated sections at last */
  for (ls=(struct LinkedSection *)gv->lnksec.first;
       ls->n.next!=NULL; ls=(struct LinkedSection *)ls->n.next) {
    if (!(ls->flags & SF_ALLOC)) {
      if (!(ls->flags & SF_UNINITIALIZED))
        fwritex(f,ls->data,ls->size);
    }
  }
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq 0x1f8(%rax), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x26787
movq 0x10(%rsp), %rax
cmpl $0x1, 0x20(%rax)
jne 0x26773
movq 0x10(%rsp), %rax
movzwl 0x24(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x26773
movq 0x10(%rsp), %rax
cmpq $-0x1, 0x30(%rax)
je 0x26773
movq 0x10(%rsp), %rax
cmpq $-0x1, 0x28(%rax)
je 0x26773
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rax
movq 0x50(%rax), %rsi
callq 0x86c0
movq 0x20(%rsp), %rax
movq 0x1c0(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
cmpq $0x0, (%rax)
je 0x26771
movq 0x8(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rsp), %rcx
cmpq 0x30(%rcx), %rax
jb 0x2675d
movq 0x8(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x8(%rsp), %rcx
addq 0x48(%rcx), %rax
movq 0x10(%rsp), %rcx
cmpq 0x40(%rcx), %rax
ja 0x2675d
movq 0x8(%rsp), %rax
movzbl 0x21(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2675d
movq 0x8(%rsp), %rax
cmpq $0x0, 0x50(%rax)
je 0x2673c
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rax
movq 0x78(%rax), %rsi
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rdx
callq 0x8470
movq 0x8(%rsp), %rax
cmpq $0x0, 0x58(%rax)
je 0x2675b
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rax
movq 0x58(%rax), %rsi
callq 0x86c0
jmp 0x2675d
jmp 0x2675f
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x266c3
jmp 0x26773
jmp 0x26775
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x2664f
movq 0x20(%rsp), %rax
movq 0x1c0(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
cmpq $0x0, (%rax)
je 0x267f4
movq 0x8(%rsp), %rax
movzbl 0x21(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x267e3
movq 0x8(%rsp), %rax
movzbl 0x21(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x267e1
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rax
movq 0x78(%rax), %rsi
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rdx
callq 0x8470
jmp 0x267e3
jmp 0x267e5
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x26798
addq $0x28, %rsp
retq
nopl (%rax)