// File: /workspace/github_c_makefile_star2_O1/deplinenoise[P]vlink/ldscript.c
// Function: symbol_assignment
static void symbol_assignment(struct GlobalVars *gv,
                              char *symname,uint8_t symflags)
{
  char *fn = "symbol_assignment(): ";
  struct LinkedSection *cls = current_ls;
  struct MemoryDescr *md = cls ? cls->relocmem : vdefmem;
  struct Symbol *sym;
  lword expr_val;

  if (!strcmp(symname,".")) {
    if (level >= 1) {
      if (!preparse) {
        if (!(symflags & SYMF_PROVIDED)) {
          parse_expr(md->current,&expr_val);
          change_address(md,expr_val);
        }
        else {
          /* Address symbol '.' cannot be provided */
          error(108,scriptname,getlineno());
        }
      }
    }
    else {
      /* Address symbol '.' invalid outside SECTIONS block */
      error(101,scriptname,getlineno());
    }
  }

  else {
    /* real symbol assignment */

    if (level < 1) {
      if (preparse) {   /* level 0 (outside SECTION) is only parsed once! */
        if (parse_expr(-1,&expr_val)) {
          scriptsymbol(gv,symname,expr_val,SYM_ABS,symflags);
        }
        else {
          /* Only absolute expr. may be assigned outside SECTIONS block */
          error(110,scriptname,getlineno());
        }
      }
    }

    else {
      if (preparse) {
        scriptsymbol(gv,symname,0,SYM_ABS,symflags);
      }
      else {
        if (sym = findsymbol(gv,NULL,symname)) {
          int abs = parse_expr(md->current,&expr_val);

          if (level < 2)
            abs = 1;
          sym->type = abs ? SYM_ABS : SYM_RELOC;
          if (!abs) {
            if (current_ls) {
              /* assign section and remove from scriptsymbol list,
                 will be moved into section's symbol list in linker_copy() */
              if (listempty(&current_ls->sections)) {
                sym->relsect = get_dummy_sec(current_ls->name);
                /* a section with symbols must be allocated? @@@ */
                current_ls->flags |= SF_ALLOC;
              }
              else
                sym->relsect = (struct Section *)current_ls->sections.first;
              remnode(&sym->n);
            }
            else
              ierror("%sNo current LinkedSection set, while "
                     "defining %s",fn,symname);
          }
          sym->value = abs ? expr_val : (expr_val - current_ls->base);
        }
        else
          ierror("%s%s disappeared",fn,symname);
      }
    }
  }

  skip_expr(symflags&SYMF_PROVIDED);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movq 0x2528e(%rip), %rax     # 0x33608
leaq 0x30(%rax), %rcx
testq %rax, %rax
leaq 0x252b0(%rip), %rax     # 0x33638
cmovneq %rcx, %rax
movq (%rax), %r12
leaq 0x12c86(%rip), %rsi     # 0x2101c
movq %r14, %rdi
callq 0x5160
movl 0x25278(%rip), %ecx     # 0x3361c
testl %eax, %eax
je 0xe3c7
movb 0x252b2(%rip), %al      # 0x33660
testl %ecx, %ecx
jle 0xe405
testb $0x1, %al
je 0xe43b
movzbl %bl, %ecx
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
jmp 0xe431
testl %ecx, %ecx
jle 0xe49c
cmpb $0x0, 0x2528a(%rip)     # 0x33660
jne 0xe551
testb $0x8, %bl
jne 0xe4d2
movq 0x20(%r12), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x101d8
movq (%r14), %rsi
movq %r12, %rdi
callq 0xec97
jmp 0xe551
testb $0x1, %al
je 0xe551
movq %rsp, %rsi
movq $-0x1, %rdi
callq 0x101d8
testl %eax, %eax
je 0xe4e5
movq (%rsp), %rdx
movzbl %bl, %ecx
movq %r15, %rdi
movq %r14, %rsi
callq 0xfcdf
jmp 0xe551
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0xa82c
testq %rax, %rax
je 0xe4af
movq %rax, %r15
movq 0x20(%r12), %rdi
movq %rsp, %rsi
callq 0x101d8
cmpl $0x2, 0x251b8(%rip)     # 0x3361c
setge %cl
testl %eax, %eax
sete %al
andb %cl, %al
leal 0x1(%rax), %ecx
movb %cl, 0x40(%r15)
testb %al, %al
je 0xe4cc
movq 0x25188(%rip), %rax     # 0x33608
testq %rax, %rax
je 0xe504
movq 0x60(%rax), %rcx
cmpq $0x0, (%rcx)
je 0xe51e
movq %rcx, 0x38(%r15)
jmp 0xe536
movq 0x2517d(%rip), %r14     # 0x33620
callq 0x10563
movl $0x65, %edi
jmp 0xe4f6
leaq 0x147c7(%rip), %rdi     # 0x22c7d
leaq 0x14778(%rip), %rsi     # 0x22c35
movq %r14, %rdx
xorl %eax, %eax
callq 0x52b0
jmp 0xe551
movq (%rsp), %rax
jmp 0xe54d
movq 0x25147(%rip), %r14     # 0x33620
callq 0x10563
movl $0x6c, %edi
jmp 0xe4f6
movq 0x25134(%rip), %r14     # 0x33620
callq 0x10563
movl $0x6e, %edi
movq %r14, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x6f84
jmp 0xe551
leaq 0x14740(%rip), %rdi     # 0x22c4b
leaq 0x14723(%rip), %rsi     # 0x22c35
movq %r14, %rdx
xorl %eax, %eax
callq 0x52b0
jmp 0xe53e
movq 0x18(%rax), %rdi
callq 0xfe01
movq %rax, 0x38(%r15)
movq 0x250d6(%rip), %rax     # 0x33608
orb $0x1, 0x21(%rax)
movq %r15, %rdi
callq 0x6789
movq (%rsp), %rax
movq 0x250bf(%rip), %rcx     # 0x33608
subq 0x40(%rcx), %rax
movq %rax, 0x30(%r15)
andb $0x8, %bl
movzbl %bl, %edi
callq 0xdb2e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq