// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/linker.c
// Function: add_undef_syms
static void add_undef_syms(struct GlobalVars *gv)
/* create dummy xreferences for symbols marked as undefined
   (-u option or EXTERN script directive) */
{
  struct SymNames *sn;

  if (sn = gv->undef_syms) {
    static uint8_t dat[sizeof(uint32_t)];  /* contents of dummy section */
    struct ObjectUnit *obj;
    struct Section *sec = NULL;
    struct Section *dummysec;
    struct Reloc *r;

    /* search first section in an object from the command line */
    for (obj=(struct ObjectUnit *)gv->selobjects.first;
         obj->n.next!=NULL; obj=(struct ObjectUnit *)obj->n.next) {
      if (!listempty(&obj->sections)) {
        sec = (struct Section *)obj->sections.first;
        break;
      }
    }
    if (sec == NULL)
      ierror("add_undef_syms(): no objects or no sections on command line");

    /* make artificial object for external references */
    obj = art_objunit(gv,"UNDEFSYMBOLS",dat,sizeof(uint32_t));
    obj->flags |= OUF_LINKED;
    dummysec = create_section(obj,sec->name,dat,sizeof(uint32_t));
    dummysec->type = sec->type;
    dummysec->protection = sec->protection;
    dummysec->flags = sec->flags;
    addtail(&obj->sections,&dummysec->n);
    addtail(&gv->selobjects,&obj->n);

    do {
      /* add a dummy xreference of type R_NONE to the dummy section */
      r = newreloc(gv,dummysec,sn->name,NULL,0,0,R_NONE,0);
      addreloc(dummysec,r,0,32,-1);
    }
    while (sn = sn->next);
  }
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq 0xb8(%rax), %rax
movq %rax, 0x38(%rsp)
cmpq $0x0, %rax
je 0x9d2e
movq $0x0, 0x28(%rsp)
movq 0x40(%rsp), %rax
movq 0x138(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
cmpq $0x0, (%rax)
je 0x9bf9
movq 0x30(%rsp), %rax
movq 0x20(%rax), %rax
cmpq $0x0, (%rax)
je 0x9be8
movq 0x30(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x28(%rsp)
jmp 0x9bf9
jmp 0x9bea
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0x9bbe
cmpq $0x0, 0x28(%rsp)
jne 0x9c0f
leaq 0x2b8c3(%rip), %rdi     # 0x354cb
movb $0x0, %al
callq 0x8ae0
movq 0x40(%rsp), %rdi
leaq 0x2b8ec(%rip), %rsi     # 0x35507
leaq 0x3adae(%rip), %rdx     # 0x449d0
movl $0x4, %ecx
callq 0x12350
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movzwl 0x80(%rax), %ecx
orl $0x1, %ecx
movw %cx, 0x80(%rax)
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rsi
leaq 0x3ad74(%rip), %rdx     # 0x449d0
movl $0x4, %ecx
callq 0x125b0
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rax
movb 0x2c(%rax), %cl
movq 0x20(%rsp), %rax
movb %cl, 0x2c(%rax)
movq 0x28(%rsp), %rax
movb 0x2e(%rax), %cl
movq 0x20(%rsp), %rax
movb %cl, 0x2e(%rax)
movq 0x28(%rsp), %rax
movb 0x2d(%rax), %cl
movq 0x20(%rsp), %rax
movb %cl, 0x2d(%rax)
movq 0x30(%rsp), %rdi
addq $0x20, %rdi
movq 0x20(%rsp), %rsi
callq 0x7470
movq 0x40(%rsp), %rdi
addq $0x138, %rdi            # imm = 0x138
movq 0x30(%rsp), %rsi
callq 0x7470
movq 0x40(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rdx
xorl %eax, %eax
movl %eax, %r9d
xorl %r8d, %r8d
movq %r9, %rcx
movl $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
callq 0x10850
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
xorl %edx, %edx
movl $0x20, %ecx
movq $-0x1, %r8
callq 0x109b0
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x38(%rsp)
cmpq $0x0, %rax
jne 0x9cc4
jmp 0x9d2e
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)