// File: /workspace/github_c_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %rbx
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
cmpb $0x8, 0x39(%rsi)
jne 0x1ee5b
movq 0x10(%rsp), %rdx
movzbl 0x38(%rdx), %eax
leaq 0x10367(%rip), %rcx     # 0x2f180
movq (%rcx,%rax,8), %rax
movq 0x10(%rdx), %rsi
cmpb $0x56, (%rbx)
jne 0x1ee4c
cmpb $0x4f, 0x1(%rbx)
jne 0x1ee4c
cmpb $0x42, 0x2(%rbx)
jne 0x1ee4c
cmpb $0x4a, 0x3(%rbx)
jne 0x1ee4c
xorl %ecx, %ecx
cmpb $0x1, 0xaa(%rax)
movzbl 0x4(%rbx), %edx
adcl $0x1, %ecx
cmpl %edx, %ecx
je 0x1ee5b
movq (%rax), %rdx
movl $0x29, %edi
xorl %eax, %eax
callq 0x6f84
addq $0x5, %rbx
movq %rbx, 0x14e5a(%rip)     # 0x33cc0
callq 0x1f6a4
cmpl $0x8, %eax
je 0x1ee99
movq 0x10(%rsp), %rcx
movq 0x10(%rcx), %rsi
movzbl 0x38(%rcx), %ecx
leaq 0x102fc(%rip), %rdx     # 0x2f180
movq (%rdx,%rcx,8), %rcx
movq (%rcx), %rdx
movl $0x71, %edi
movl %eax, %ecx
xorl %eax, %eax
callq 0x6f84
callq 0x1f6a4
cmpl $0x9, %eax
jb 0x1eecc
movq 0x10(%rsp), %rcx
movq 0x10(%rcx), %rsi
movzbl 0x38(%rcx), %ecx
leaq 0x102c9(%rip), %rdx     # 0x2f180
movq (%rdx,%rcx,8), %rcx
movq (%rcx), %rdx
movl $0x72, %edi
movl %eax, %ecx
xorl %eax, %eax
callq 0x6f84
movq 0x14ded(%rip), %rax     # 0x33cc0
cmpb $0x0, (%rax)
je 0x1eee9
cmpb $0x0, 0x1(%rax)
leaq 0x1(%rax), %rax
jne 0x1eed8
movq %rax, 0x14dd7(%rip)     # 0x33cc0
incq %rax
movq %rax, 0x14dcd(%rip)     # 0x33cc0
movq 0x10(%rsp), %rsi
movq 0x20(%rsi), %rdx
movq 0x18(%rsp), %rdi
callq 0xbf5e
movq %rax, 0x8(%rsp)
callq 0x1f6a4
movq %rax, 0x80(%rsp)
callq 0x1f6a4
movq %rax, %rbp
testl %ebp, %ebp
je 0x1efb8
movslq %ebp, %rdi
shlq $0x5, %rdi
callq 0x6668
movq %rax, %rcx
testl %ebp, %ebp
jle 0x1efba
movl %ebp, %ebx
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
xorl %r14d, %r14d
movq %r14, %r15
shlq $0x5, %r15
movq 0x14d6c(%rip), %rax     # 0x33cc0
movq %rax, (%rcx,%r15)
cmpb $0x0, (%rax)
je 0x1ef6e
cmpb $0x0, 0x1(%rax)
leaq 0x1(%rax), %rax
jne 0x1ef5d
movq %rax, 0x14d52(%rip)     # 0x33cc0
addq %rcx, %r15
incq %rax
movq %rax, 0x14d45(%rip)     # 0x33cc0
movq %rcx, %r12
callq 0x1f6a4
movl %eax, 0x8(%r15)
callq 0x1f6a4
movl %eax, 0xc(%r15)
callq 0x1f6a4
movl %eax, 0x10(%r15)
callq 0x1f6a4
movq %rax, 0x18(%r15)
callq 0x1f6a4
movq %r12, %rcx
movl %eax, 0x14(%r15)
incq %r14
cmpq %rbx, %r14
jne 0x1ef46
jmp 0x1efba
xorl %ecx, %ecx
movq %rcx, 0x48(%rsp)
cmpl $0x0, 0x80(%rsp)
movq %rbp, 0x60(%rsp)
jle 0x1f481
movl $0x1, %eax
movq %rax, 0x58(%rsp)
movq 0x14cdd(%rip), %rax     # 0x33cc0
cmpb $0x0, (%rax)
movq %rax, %r14
je 0x1f000
movq %rax, %r14
cmpb $0x0, 0x1(%r14)
leaq 0x1(%r14), %r14
jne 0x1efee
movq %r14, 0x14cc0(%rip)     # 0x33cc0
movq %rax, 0x30(%rsp)
leaq 0x1(%r14), %r15
movq %r15, 0x14cb0(%rip)     # 0x33cc0
movb 0x1(%r14), %r12b
testb %r12b, %r12b
je 0x1f085
callq 0x5280
movq (%rax), %rax
leaq 0x2(%r14), %rcx
movb $0x1, %r13b
movb $0x2, %bpl
xorl %ebx, %ebx
movl %r12d, %edx
movzbl %dl, %edx
movl (%rax,%rdx,4), %edx
cmpl $0x74, %edx
jg 0x1f04f
cmpl $0x61, %edx
je 0x1f064
cmpl $0x63, %edx
je 0x1f071
cmpl $0x64, %edx
jne 0x1f07a
movb $0x2, %bpl
jmp 0x1f07a
cmpl $0x75, %edx
je 0x1f069
cmpl $0x78, %edx
je 0x1f076
cmpl $0x77, %edx
jne 0x1f07a
orb $0x2, %r13b
jmp 0x1f07a
orb $0x1, %bl
jmp 0x1f07a
orb $0x2, %bl
movb $0x3, %bpl
jmp 0x1f07a
movb $0x1, %bpl
jmp 0x1f07a
orb $0x4, %r13b
movb (%rcx), %dl
incq %rcx
testb %dl, %dl
jne 0x1f030
jmp 0x1f08d
movb $0x2, %bpl
movb $0x1, %r13b
xorl %ebx, %ebx
testb %r12b, %r12b
je 0x1f0aa
cmpb $0x0, 0x1(%r15)
leaq 0x1(%r15), %r15
jne 0x1f092
movq %r15, 0x14c1c(%rip)     # 0x33cc0
decq %r15
movq %r15, %r14
addq $0x2, %r14
movq %r14, 0x14c0b(%rip)     # 0x33cc0
callq 0x1f6a4
callq 0x1f6a4
movq %rax, %rdi
callq 0x6e9c
movl %eax, 0x20(%rsp)
callq 0x1f6a4
movq %rax, %r15
callq 0x1f6a4
movq %rax, %r14
callq 0x1f6a4
movq %rax, %r12
cmpb $0x3, %bpl
jne 0x1f0ed
xorl %edx, %edx
jmp 0x1f11f
cmpq %r12, %r15
jle 0x1f118
movq %r15, %rdi
callq 0x66b6
movq %rax, 0x70(%rsp)
movq 0x14bba(%rip), %rsi     # 0x33cc0
movq %rax, %rdi
movq %r12, %rdx
callq 0x51a0
movq 0x70(%rsp), %rdx
jmp 0x1f11f
movq 0x14ba1(%rip), %rdx     # 0x33cc0
movq 0x30(%rsp), %rsi
movl 0x20(%rsp), %eax
addq %r12, 0x14b91(%rip)     # 0x33cc0
subq $0x8, %rsp
movzbl %al, %eax
movzbl %r13b, %r10d
movzbl %bpl, %r8d
movzbl %bl, %r9d
movq 0x10(%rsp), %rdi
movq %rdx, 0x78(%rsp)
movq %r15, %rcx
pushq $0x0
pushq %rax
pushq %r10
callq 0xc1c8
addq $0x20, %rsp
movq %rax, %rcx
movq 0x58(%rsp), %rax
movq %rcx, 0x90(%rsp)
movl %eax, 0x28(%rcx)
testl %r14d, %r14d
movq 0x60(%rsp), %rbp
jle 0x1f467
incl %r14d
movl $0xffffffff, 0x54(%rsp) # imm = 0xFFFFFFFF
movq $-0x1, 0x88(%rsp)
movw $0xffff, 0x6(%rsp)      # imm = 0xFFFF
movq 0x58(%rsp), %rax
movl %eax, 0x2c(%rsp)
movq $0x0, 0x78(%rsp)
callq 0x1f6a4
movq %rax, %rbx
callq 0x1f6a4
movq %rax, %r13
callq 0x1f6a4
movq %rax, 0x30(%rsp)
callq 0x1f6a4
movq %rax, %r12
callq 0x1f6a4
movq %rax, 0x68(%rsp)
callq 0x1f6a4
movq %rax, 0x98(%rsp)
callq 0x1f6a4
movq %rbx, %rdi
leal -0x1(%rax), %ebx
movzbl %dil, %r15d
leal -0x11(%r15), %ecx
cmpl $-0x10, %ecx
setb %cl
testq %r13, %r13
sets %dl
movq %r12, 0x20(%rsp)
movzwl %r12w, %esi
cmpl $0x41, %esi
setae %sil
orb %dl, %sil
orb %cl, %sil
testl %eax, %eax
setle %cl
cmpl %ebp, %eax
setg %r12b
orb %cl, %r12b
orb %r12b, %sil
je 0x1f2d0
testl %r15d, %r15d
je 0x1f45a
movq 0x8(%rsp), %rdi
callq 0x7174
movl %ebx, %ecx
leaq 0x69ed(%rip), %r10      # 0x25c3c
testb %r12b, %r12b
jne 0x1f264
movq %rcx, %rdx
shlq $0x5, %rdx
movq 0x48(%rsp), %rsi
movq (%rsi,%rdx), %r10
movq 0x8(%rsp), %rdx
movq 0x10(%rdx), %rdx
movzbl 0x38(%rdx), %edx
leaq 0xff08(%rip), %rsi      # 0x2f180
movq (%rsi,%rdx,8), %rdx
movq (%rdx), %rdx
xorl %r11d, %r11d
testb %r12b, %r12b
jne 0x1f295
shlq $0x5, %rcx
movq 0x48(%rsp), %rsi
movl 0x8(%rsi,%rcx), %r11d
movl $0xffff, %ecx           # imm = 0xFFFF
movq 0x30(%rsp), %r9
andl %ecx, %r9d
movq 0x20(%rsp), %rbx
andl %ecx, %ebx
movl $0x73, %edi
movq %rax, %rsi
movl %r15d, %ecx
movq %r13, %r8
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x78(%rsp)
pushq %rbx
callq 0x6f84
addq $0x20, %rsp
jmp 0x1f45a
movslq %ebx, %rax
shlq $0x5, %rax
movq 0x48(%rsp), %rcx
leaq (%rcx,%rax), %r12
movl 0x8(%rcx,%rax), %eax
cmpl $0x2, %eax
je 0x1f2fe
cmpl $0x1, %eax
jne 0x1f321
movl 0x10(%r12), %eax
movl %eax, 0x2c(%rsp)
xorl %edx, %edx
xorl %r15d, %r15d
jmp 0x1f317
movq (%r12), %rdx
movb 0xc(%r12), %r15b
shrb $0x6, %r15b
andb $0x1, %r15b
movl $0x0, 0x2c(%rsp)
movq 0x68(%rsp), %r12
jmp 0x1f3a3
movq 0x8(%rsp), %rbp
movq %rdi, 0xa0(%rsp)
movq %rbp, %rdi
callq 0x7174
movq 0x10(%rbp), %rcx
movq 0x60(%rsp), %rbp
movzbl 0x38(%rcx), %ecx
leaq 0xfe36(%rip), %rdx      # 0x2f180
movq (%rdx,%rcx,8), %rcx
movq (%rcx), %rdx
movq 0x30(%rsp), %rcx
movl %ecx, %r9d
movl $0xffff, %ecx           # imm = 0xFFFF
andl %ecx, %r9d
movq 0x20(%rsp), %r10
andl %ecx, %r10d
movl 0x8(%r12), %r11d
movl $0x73, %edi
movq %rax, %rsi
movl %r15d, %ecx
movq %r13, %r8
xorl %eax, %eax
pushq %r11
pushq (%r12)
movq 0x78(%rsp), %r12
pushq %r12
pushq %r10
callq 0x6f84
xorl %edx, %edx
movq 0xc0(%rsp), %rdi
addq $0x20, %rsp
xorl %r15d, %r15d
cmpl 0x54(%rsp), %ebx
sete %al
cmpq 0x88(%rsp), %r13
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x1f3d0
movq 0x30(%rsp), %rax
cmpw %ax, 0x6(%rsp)
jne 0x1f3d0
cmpq $0x0, 0x78(%rsp)
jne 0x1f41b
movzbl %dil, %eax
movq 0x18(%rsp), %rdi
movq 0x90(%rsp), %rsi
xorl %ecx, %ecx
movl 0x2c(%rsp), %r8d
movq %r13, %r9
pushq 0x98(%rsp)
pushq %rax
callq 0xb202
addq $0x10, %rsp
movq %rax, 0x78(%rsp)
orb %r15b, 0x39(%rax)
movl %ebx, 0x54(%rsp)
movq %r13, 0x88(%rsp)
movq 0x30(%rsp), %rax
movw %ax, 0x6(%rsp)
movzwl 0x30(%rsp), %edx
movzwl 0x20(%rsp), %ecx
movq 0x90(%rsp), %rdi
movq 0x78(%rsp), %rbx
movq %rbx, %rsi
movq %r12, %r8
callq 0xb2b7
movl %r13d, %esi
addq 0x70(%rsp), %rsi
movq 0x18(%rsp), %rdi
movq %rbx, %rdx
movq 0x98(%rsp), %rcx
callq 0xb5b0
decl %r14d
cmpl $0x1, %r14d
jg 0x1f1ae
movq 0x58(%rsp), %rcx
leal 0x1(%rcx), %eax
cmpl 0x80(%rsp), %ecx
movq %rax, 0x58(%rsp)
jne 0x1efdc
testl %ebp, %ebp
jle 0x1f66e
movq 0x60(%rsp), %r14
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movq 0x48(%rsp), %r13
movd 0xc(%r13), %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
pand 0x6723(%rip), %xmm0     # 0x25bd0
pcmpeqd 0x2c1b(%rip), %xmm0     # 0x220d0
movdqa %xmm0, 0x30(%rsp)
movmskps %xmm0, %eax
movl %eax, %ecx
andb $0x4, %cl
shrb $0x2, %cl
movb $0x2, %dl
subb %cl, %dl
movzbl %dl, %ebp
testb $0x8, %al
movl $0x3, %ecx
cmovel %ecx, %ebp
testb $0x1, %al
je 0x1f500
movl 0x8(%r13), %eax
cmpl $0x1, %eax
je 0x1f51b
cmpl $0x2, %eax
je 0x1f517
cmpl $0x3, %eax
jne 0x1f53a
movq 0x8(%rsp), %rdi
callq 0xc30c
movq %rax, %rbx
movb $0x1, %r12b
jmp 0x1f57b
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0xc242
movq %rax, %rbx
movb $0x3, %r12b
jmp 0x1f57b
xorl %ebx, %ebx
jmp 0x1f578
movl 0x10(%r13), %esi
movq 0x8(%rsp), %rdi
callq 0xbe4a
movb $0x2, %r12b
testq %rax, %rax
je 0x1f646
movq %rax, %rbx
jmp 0x1f57b
movq 0x8(%rsp), %rdi
callq 0x7174
movq 0x10(%rsp), %rsi
movzbl 0x38(%rsi), %ecx
leaq 0xfc2c(%rip), %rdx      # 0x2f180
movq (%rdx,%rcx,8), %rcx
movq (%rcx), %rdx
movl 0x8(%r13), %ecx
movq (%r13), %r8
movq 0x20(%rsi), %r9
xorl %ebx, %ebx
movl $0x74, %edi
movq %rax, %rsi
xorl %eax, %eax
callq 0x6f84
xorl %r12d, %r12d
movl 0xc(%r13), %edx
andl $0x7, %edx
cmpl $0x4, %edx
ja 0x1f5b0
leaq 0x6652(%rip), %rcx      # 0x25be0
movslq (%rcx,%rdx,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %r15d, %r15d
jmp 0x1f5d0
movb $0x4, %r15b
jmp 0x1f5d0
movb $0x2, %r15b
jmp 0x1f5d0
xorl %r12d, %r12d
jmp 0x1f5d0
movb $0x1, %r15b
jmp 0x1f5d0
movq (%r13), %rcx
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x20(%rax), %r8
xorl %r12d, %r12d
movl $0x36, %edi
xorl %eax, %eax
callq 0x6f84
testb %r12b, %r12b
je 0x1f637
movq (%r13), %rdx
movq 0x18(%r13), %r8
movdqa 0x30(%rsp), %xmm0
pextrw $0x2, %xmm0, %ecx
movl 0x14(%r13), %r10d
movzbl %r15b, %eax
movzbl %r12b, %r9d
subq $0x8, %rsp
testb $0x1, %cl
je 0x1f617
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
pushq %r10
pushq %rax
pushq $0x0
callq 0xadae
addq $0x20, %rsp
jmp 0x1f637
movzbl %bpl, %r11d
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
pushq $0x1
pushq %r10
pushq %r11
pushq %rax
pushq $0x0
callq 0xaba4
addq $0x30, %rsp
addq $0x20, %r13
decq %r14
jne 0x1f49a
jmp 0x1f66e
movq (%r13), %rdx
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x20(%rax), %rcx
movl 0x10(%r13), %r8d
movl $0x35, %edi
xorl %eax, %eax
callq 0x6f84
xorl %ebx, %ebx
jmp 0x1f57b
cmpl $0x0, 0x60(%rsp)
je 0x1f67f
movq 0x48(%rsp), %rdi
callq 0x5040
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
movl $0x1, %edx
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc040