// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/targets.c
// Function: write_constructors
static void write_constructors(struct GlobalVars *gv,struct ObjectUnit *ou,
                               struct Symbol *labelsym,int cnt,
                               lword offset,const char *secname)
{
  uint8_t *data = ou->lnkfile->data + offset;
  unsigned long asize = (unsigned long)fff[gv->dest_format]->addr_bits / 8;
  struct Section *sec;
  struct PriPointer *pp;

  /* create a new section, if required */
  for (sec=(struct Section *)ou->sections.first;
       sec->n.next!=NULL; sec=(struct Section *)sec->n.next) {
    if (!strcmp(secname,sec->name))
      break;
  }
  if (sec->n.next == NULL) {
    sec = add_xtor_section(gv,ou,secname,ou->lnkfile->data+offset,2*asize);
    offset = 0;
  }
  else
    sec->size += 2*asize;

  /* assign constructor/destructor label symbol to start of list */
  unlink_lnksymbol(gv,labelsym);
  labelsym->relsect = sec;
  labelsym->type = SYM_RELOC;
  labelsym->value = offset;
  labelsym->size = 2 * asize;
  add_objsymbol(ou,labelsym);
  addglobsym(gv,labelsym);  /* make it globally visible */
  data += writetaddr(gv,data,(lword)cnt);
  offset += asize;

  /* write con-/destructor pointers */
  for (pp=(struct PriPointer *)gv->pripointers.first;
       pp->n.next!=NULL; pp=(struct PriPointer *)pp->n.next) {
    if (!strcmp(pp->listname,labelsym->name)) {
      struct Reloc *r;

      data += writetaddr(gv,data,pp->addend);
      if (pp->xrefname) {
        r = newreloc(gv,sec,pp->xrefname,NULL,0,(unsigned long)offset,
                     R_ABS,pp->addend);
        addreloc(sec,r,0,asize<<3,-1);
      }
      sec->size += asize;
      labelsym->size += asize;
      offset += asize;
    }
  }
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movl %ecx, 0x4c(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x38(%rsp)
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rax), %rax
addq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x60(%rsp), %rax
movzbl 0x50(%rax), %eax
movl %eax, %ecx
leaq 0x2c9f6(%rip), %rax     # 0x3fa30
movq (%rax,%rcx,8), %rax
movsbq 0xab(%rax), %rax
shrq $0x3, %rax
movq %rax, 0x28(%rsp)
movq 0x58(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
cmpq $0x0, (%rax)
je 0x13093
movq 0x38(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rsi
callq 0x5130
cmpl $0x0, %eax
jne 0x13082
jmp 0x13093
jmp 0x13084
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20(%rsp)
jmp 0x1305d
movq 0x20(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x130dc
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rax), %rcx
addq 0x40(%rsp), %rcx
movq 0x28(%rsp), %r8
shlq %r8
callq 0x13c10
movq %rax, 0x20(%rsp)
movq $0x0, 0x40(%rsp)
jmp 0x130f1
movq 0x28(%rsp), %rcx
shlq %rcx
movq 0x20(%rsp), %rax
addq 0x48(%rax), %rcx
movq %rcx, 0x48(%rax)
movq 0x60(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x13c70
movq 0x20(%rsp), %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x38(%rax)
movq 0x50(%rsp), %rax
movb $0x2, 0x40(%rax)
movq 0x40(%rsp), %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x30(%rax)
movq 0x28(%rsp), %rax
shlq %rax
movl %eax, %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0x44(%rax)
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x13a60
movq 0x60(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0xf750
movq 0x60(%rsp), %rdi
movq 0x30(%rsp), %rsi
movslq 0x4c(%rsp), %rdx
callq 0x81b0
movl %eax, %ecx
movq 0x30(%rsp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x30(%rsp)
movq 0x28(%rsp), %rax
addq 0x40(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x60(%rsp), %rax
movq 0x1a8(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
cmpq $0x0, (%rax)
je 0x132a8
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x50(%rsp), %rax
movq 0x20(%rax), %rsi
callq 0x5130
cmpl $0x0, %eax
jne 0x13294
movq 0x60(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x18(%rsp), %rax
movq 0x30(%rax), %rdx
callq 0x81b0
movl %eax, %ecx
movq 0x30(%rsp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x30(%rsp)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x28(%rax)
je 0x13260
movq 0x60(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rax
movq 0x28(%rax), %rdx
movq 0x40(%rsp), %r9
movq 0x18(%rsp), %rax
movq 0x30(%rax), %rax
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x1, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x10850
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x28(%rsp), %rax
shlq $0x3, %rax
xorl %edx, %edx
movq $-0x1, %r8
movzwl %ax, %ecx
callq 0x109b0
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %rax
addq 0x48(%rax), %rcx
movq %rcx, 0x48(%rax)
movq 0x28(%rsp), %rdx
movq 0x50(%rsp), %rax
movl 0x44(%rax), %ecx
addq %rdx, %rcx
movl %ecx, 0x44(%rax)
movq 0x28(%rsp), %rax
addq 0x40(%rsp), %rax
movq %rax, 0x40(%rsp)
jmp 0x13296
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
jmp 0x1319b
addq $0x68, %rsp
retq
nopl (%rax)