// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/targets.c
// Function: add_objunit
void add_objunit(struct GlobalVars *gv,struct ObjectUnit *ou,bool fixrelocs)
/* adds an ObjectUnit to the approriate list */
{
  if (ou) {
    uint8_t t = ou->lnkfile->type;

    if (t==ID_LIBARCH && gv->whole_archive)
      t = ID_OBJECT;  /* force linking of a whole archive */

    switch (t) {
      case ID_OBJECT:
      case ID_EXECUTABLE:
        ou->flags |= OUF_LINKED;  /* objects are always linked */
        addtail(&gv->selobjects,&ou->n);
        break;
      case ID_LIBARCH:
        addtail(&gv->libobjects,&ou->n);
        break;
      case ID_SHAREDOBJ:
        addtail(&gv->sharedobjects,&ou->n);
        break;
      default:
        ierror("add_objunit(): Link File type = %d",
               (int)ou->lnkfile->type);
    }

    if (fixrelocs) {  /* convert section index into address */
      struct Section *sec;
      struct Reloc *r;
      uint32_t idx;

      for (sec=(struct Section *)ou->sections.first;
           sec->n.next!=NULL; sec=(struct Section *)sec->n.next) {
        for (r=(struct Reloc *)sec->relocs.first;
             r->n.next!=NULL; r=(struct Reloc *)r->n.next) {
          idx = r->relocsect.id;
          if ((r->relocsect.ptr = find_sect_id(ou,idx)) == NULL) {
            /* section with this index doesn't exist */
            error(52,ou->lnkfile->pathname,sec->name,getobjname(ou),(int)idx);
          }
        }
      }
    }
  }
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movl %edx, 0x34(%rsp)
cmpq $0x0, 0x38(%rsp)
je 0x125ab
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movb 0x39(%rax), %al
movb %al, 0x33(%rsp)
movzbl 0x33(%rsp), %eax
cmpl $0x8, %eax
jne 0x12428
movq 0x40(%rsp), %rax
cmpl $0x0, 0x68(%rax)
je 0x12428
movb $0x1, 0x33(%rsp)
movzbl 0x33(%rsp), %eax
movl %eax, 0x18(%rsp)
decl %eax
subl $0x2, %eax
jb 0x12450
jmp 0x1243a
movl 0x18(%rsp), %eax
subl $0x4, %eax
je 0x12496
jmp 0x12445
movl 0x18(%rsp), %eax
subl $0x8, %eax
je 0x1247e
jmp 0x124ae
movq 0x38(%rsp), %rax
movzwl 0x80(%rax), %ecx
orl $0x1, %ecx
movw %cx, 0x80(%rax)
movq 0x40(%rsp), %rdi
addq $0x138, %rdi            # imm = 0x138
movq 0x38(%rsp), %rsi
callq 0x7470
jmp 0x124c9
movq 0x40(%rsp), %rdi
addq $0x150, %rdi            # imm = 0x150
movq 0x38(%rsp), %rsi
callq 0x7470
jmp 0x124c9
movq 0x40(%rsp), %rdi
addq $0x168, %rdi            # imm = 0x168
movq 0x38(%rsp), %rsi
callq 0x7470
jmp 0x124c9
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movzbl 0x39(%rax), %esi
leaq 0x233ff(%rip), %rdi     # 0x358c1
movb $0x0, %al
callq 0x8ae0
cmpl $0x0, 0x34(%rsp)
je 0x125a9
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
cmpq $0x0, (%rax)
je 0x125a7
movq 0x28(%rsp), %rax
movq 0x50(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
cmpq $0x0, (%rax)
je 0x12593
movq 0x20(%rsp), %rax
movl 0x18(%rax), %eax
movl %eax, 0x1c(%rsp)
movq 0x38(%rsp), %rdi
movl 0x1c(%rsp), %esi
callq 0x11fe0
movq 0x20(%rsp), %rcx
movq %rax, 0x18(%rcx)
cmpq $0x0, %rax
jne 0x1257f
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x38(%rsp), %rdi
callq 0x8f00
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rax, %rcx
movl 0x1c(%rsp), %r8d
movl $0x34, %edi
movb $0x0, %al
callq 0x8c00
jmp 0x12581
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20(%rsp)
jmp 0x124ff
jmp 0x12595
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x28(%rsp)
jmp 0x124e2
jmp 0x125a9
jmp 0x125ab
addq $0x48, %rsp
retq