// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/t_vobj.c
// Function: vobj_read
static void vobj_read(struct GlobalVars *gv,struct LinkFile *lf,uint8_t *data)
{
  struct ObjectUnit *u;
  int bpb,bpt,nsecs,nsyms,i;
  struct vobj_symbol *vsymbols = NULL;

  if (lf->type == ID_LIBARCH) {  /* check ar-member for correct format */
    vobj_check_ar_type(fff[lf->format],lf->pathname,data);
  }
  p = data + 5;  /* skip ID and endianess */
  bpb = (int)read_number();  /* bits per byte */
  if (bpb != 8) {
    /* bits per byte are not supported */
    error(113,lf->pathname,fff[lf->format]->tname,bpb);
  }
  bpt = (int)read_number();  /* bytes per taddr */
  if (bpt > sizeof(taddr)) {
    /* n bytes per target-address are not supported */
    error(114,lf->pathname,fff[lf->format]->tname,bpt);
  }
  skip_string();  /* skip cpu-string */

  u = create_objunit(gv,lf,lf->objname);
  nsecs = (int)read_number();  /* number of sections */
  nsyms = (int)read_number();  /* number of symbols */

  if (nsyms) {
    vsymbols = alloc(nsyms * sizeof(struct vobj_symbol));
    for (i=0; i<nsyms; i++)
      read_symbol(&vsymbols[i]);
  }

  for (i=1; i<=nsecs; i++)
    read_section(gv,u,(uint32_t)i,vsymbols,nsyms);

  /* add relocatable and absolute symbols, ignore unknown symbol-refs */
  for (i=0; i<nsyms; i++) {
    struct vobj_symbol *vs = &vsymbols[i];
    struct Section *s = NULL;
    uint8_t type,bind,info;

    if (vs->flags & WEAK)
      bind = SYMB_WEAK;
    else if (vs->flags & EXPORT)
      bind = SYMB_GLOBAL;
    else
      bind = SYMB_LOCAL;

    if (vs->flags & COMMON) {
      type = SYM_COMMON;
      s = common_section(gv,u);
    }
    else if (vs->type == EXPRESSION) {
      type = SYM_ABS;
      s = abs_section(u);
    }
    else if (vs->type == LABSYM) {
      type = SYM_RELOC;
      if (!(s = find_sect_id(u,vs->sec))) {
        /* a section with this index doesn't exist! */
        error(53,lf->pathname,vs->name,lf->objname,vs->sec);
      }
    }
    else if (vs->type == IMPORT) {
      type = 0;  /* ignore unknown symbols */
    }
    else {
      /* illegal symbol type */
      error(116,getobjname(u),fff[lf->format]->tname,
            vs->type,vs->name,lf->objname);
      type = 0;
    }

    switch (TYPE(vs)) {
      case TYPE_UNKNOWN: info = SYMI_NOTYPE; break;
      case TYPE_OBJECT: info = SYMI_OBJECT; break;
      case TYPE_FUNCTION: info = SYMI_FUNC; break;
      case TYPE_SECTION: type = 0; break;  /* ignore SECTION symbols */
      case TYPE_FILE: info = SYMI_FILE; break;
      default:
        error(54,lf->pathname,TYPE(vs),vs->name,lf->objname);
        type = 0;
        break;
    }

    if (type) {
      if (bind == SYMB_LOCAL)
        addlocsymbol(gv,s,vs->name,NULL,(lword)vs->val,type,0,info,vs->size);
      else
        addsymbol(gv,s,vs->name,NULL,(lword)vs->val,
                  type,0,info,bind,vs->size,TRUE);
    }
  }
  if (nsyms)
    free(vsymbols);

  add_objunit(gv,u,TRUE);  /* add object unit and fix relocations */
}

// Assembly:
pushq %rbx
subq $0x90, %rsp
movq %rdi, 0x88(%rsp)
movq %rsi, 0x80(%rsp)
movq %rdx, 0x78(%rsp)
movq $0x0, 0x50(%rsp)
movq 0x80(%rsp), %rax
movzbl 0x39(%rax), %eax
cmpl $0x8, %eax
jne 0x319b6
movq 0x80(%rsp), %rax
movzbl 0x38(%rax), %eax
movl %eax, %ecx
leaq 0xe094(%rip), %rax      # 0x3fa30
movq (%rax,%rcx,8), %rdi
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x78(%rsp), %rdx
callq 0x31e60
movq 0x78(%rsp), %rax
addq $0x5, %rax
movq %rax, 0x136ca(%rip)     # 0x45090
callq 0x31ef0
movl %eax, 0x6c(%rsp)
cmpl $0x8, 0x6c(%rsp)
je 0x31a0e
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x80(%rsp), %rax
movzbl 0x38(%rax), %eax
movl %eax, %ecx
leaq 0xe039(%rip), %rax      # 0x3fa30
movq (%rax,%rcx,8), %rax
movq (%rax), %rdx
movl 0x6c(%rsp), %ecx
movl $0x71, %edi
movb $0x0, %al
callq 0x8c00
callq 0x31ef0
movl %eax, 0x68(%rsp)
movslq 0x68(%rsp), %rax
cmpq $0x8, %rax
jbe 0x31a5a
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x80(%rsp), %rax
movzbl 0x38(%rax), %eax
movl %eax, %ecx
leaq 0xdfed(%rip), %rax      # 0x3fa30
movq (%rax,%rcx,8), %rax
movq (%rax), %rdx
movl 0x68(%rsp), %ecx
movl $0x72, %edi
movb $0x0, %al
callq 0x8c00
callq 0x31fe0
movq 0x88(%rsp), %rdi
movq 0x80(%rsp), %rsi
movq 0x80(%rsp), %rax
movq 0x20(%rax), %rdx
callq 0x12270
movq %rax, 0x70(%rsp)
callq 0x31ef0
movl %eax, 0x64(%rsp)
callq 0x31ef0
movl %eax, 0x60(%rsp)
cmpl $0x0, 0x60(%rsp)
je 0x31ae8
movslq 0x60(%rsp), %rdi
shlq $0x5, %rdi
callq 0x71f0
movq %rax, 0x50(%rsp)
movl $0x0, 0x5c(%rsp)
movl 0x5c(%rsp), %eax
cmpl 0x60(%rsp), %eax
jge 0x31ae6
movq 0x50(%rsp), %rdi
movslq 0x5c(%rsp), %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0x32020
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x31ab9
jmp 0x31ae8
movl $0x1, 0x5c(%rsp)
movl 0x5c(%rsp), %eax
cmpl 0x64(%rsp), %eax
jg 0x31b27
movq 0x88(%rsp), %rdi
movq 0x70(%rsp), %rsi
movl 0x5c(%rsp), %edx
movq 0x50(%rsp), %rcx
movl 0x60(%rsp), %r8d
callq 0x32090
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x31af0
movl $0x0, 0x5c(%rsp)
movl 0x5c(%rsp), %eax
cmpl 0x60(%rsp), %eax
jge 0x31e27
movq 0x50(%rsp), %rax
movslq 0x5c(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, 0x48(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x48(%rsp), %rax
movl 0xc(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x31b73
movb $0x3, 0x3e(%rsp)
jmp 0x31b91
movq 0x48(%rsp), %rax
movl 0xc(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x31b8a
movb $0x2, 0x3e(%rsp)
jmp 0x31b8f
movb $0x1, 0x3e(%rsp)
jmp 0x31b91
movq 0x48(%rsp), %rax
movl 0xc(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x31bc2
movb $0x3, 0x3f(%rsp)
movq 0x88(%rsp), %rdi
movq 0x70(%rsp), %rsi
callq 0x12780
movq %rax, 0x40(%rsp)
jmp 0x31cb8
movq 0x48(%rsp), %rax
cmpl $0x3, 0x8(%rax)
jne 0x31be6
movb $0x1, 0x3f(%rsp)
movq 0x70(%rsp), %rdi
callq 0x128a0
movq %rax, 0x40(%rsp)
jmp 0x31cb6
movq 0x48(%rsp), %rax
cmpl $0x1, 0x8(%rax)
jne 0x31c4a
movb $0x2, 0x3f(%rsp)
movq 0x70(%rsp), %rdi
movq 0x48(%rsp), %rax
movl 0x10(%rax), %esi
callq 0x11fe0
movq %rax, 0x40(%rsp)
cmpq $0x0, %rax
jne 0x31c48
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x48(%rsp), %rax
movq (%rax), %rdx
movq 0x80(%rsp), %rax
movq 0x20(%rax), %rcx
movq 0x48(%rsp), %rax
movl 0x10(%rax), %r8d
movl $0x35, %edi
movb $0x0, %al
callq 0x8c00
jmp 0x31cb4
movq 0x48(%rsp), %rax
cmpl $0x2, 0x8(%rax)
jne 0x31c5c
movb $0x0, 0x3f(%rsp)
jmp 0x31cb2
movq 0x70(%rsp), %rdi
callq 0x8f00
movq %rax, %rsi
movq 0x80(%rsp), %rax
movzbl 0x38(%rax), %eax
movl %eax, %ecx
leaq 0xddb2(%rip), %rax      # 0x3fa30
movq (%rax,%rcx,8), %rax
movq (%rax), %rdx
movq 0x48(%rsp), %rax
movl 0x8(%rax), %ecx
movq 0x48(%rsp), %rax
movq (%rax), %r8
movq 0x80(%rsp), %rax
movq 0x20(%rax), %r9
movl $0x74, %edi
movb $0x0, %al
callq 0x8c00
movb $0x0, 0x3f(%rsp)
jmp 0x31cb4
jmp 0x31cb6
jmp 0x31cb8
movq 0x48(%rsp), %rax
movl 0xc(%rax), %eax
andl $0x7, %eax
movl %eax, %ecx
movq %rcx, 0x30(%rsp)
subl $0x4, %eax
ja 0x31d07
movq 0x30(%rsp), %rax
leaq 0x6551(%rip), %rcx      # 0x3822c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x0, 0x3d(%rsp)
jmp 0x31d43
movb $0x1, 0x3d(%rsp)
jmp 0x31d43
movb $0x2, 0x3d(%rsp)
jmp 0x31d43
movb $0x0, 0x3f(%rsp)
jmp 0x31d43
movb $0x4, 0x3d(%rsp)
jmp 0x31d43
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x48(%rsp), %rax
movl 0xc(%rax), %edx
andl $0x7, %edx
movq 0x48(%rsp), %rax
movq (%rax), %rcx
movq 0x80(%rsp), %rax
movq 0x20(%rax), %r8
movl $0x36, %edi
movb $0x0, %al
callq 0x8c00
movb $0x0, 0x3f(%rsp)
cmpb $0x0, 0x3f(%rsp)
je 0x31e15
movzbl 0x3e(%rsp), %eax
cmpl $0x1, %eax
jne 0x31dac
movq 0x88(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rax
movq (%rax), %rdx
movq 0x48(%rsp), %rax
movq 0x18(%rax), %r8
movb 0x3f(%rsp), %r9b
movb 0x3d(%rsp), %r10b
movq 0x48(%rsp), %rax
movl 0x14(%rax), %eax
xorl %ecx, %ecx
xorl %r11d, %r11d
movzbl %r9b, %r9d
movl $0x0, (%rsp)
movzbl %r10b, %r10d
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
callq 0x100b0
jmp 0x31e13
movq 0x88(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rax
movq (%rax), %rdx
movq 0x48(%rsp), %rax
movq 0x18(%rax), %r8
movb 0x3f(%rsp), %r9b
movb 0x3d(%rsp), %r11b
movb 0x3e(%rsp), %r10b
movq 0x48(%rsp), %rax
movl 0x14(%rax), %eax
xorl %ecx, %ecx
xorl %ebx, %ebx
movzbl %r9b, %r9d
movl $0x0, (%rsp)
movzbl %r11b, %r11d
movl %r11d, 0x8(%rsp)
movzbl %r10b, %r10d
movl %r10d, 0x10(%rsp)
movl %eax, 0x18(%rsp)
movl $0x1, 0x20(%rsp)
callq 0xfd00
jmp 0x31e15
jmp 0x31e17
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x31b2f
cmpl $0x0, 0x60(%rsp)
je 0x31e38
movq 0x50(%rsp), %rdi
callq 0x5030
movq 0x88(%rsp), %rdi
movq 0x70(%rsp), %rsi
movl $0x1, %edx
callq 0x123e0
addq $0x90, %rsp
popq %rbx
retq
nopl (%rax,%rax)