// File: /workspace/github_c_makefile_star2_O3/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 0x2539c(%rip), %rax     # 0x33608
leaq 0x30(%rax), %rcx
testq %rax, %rax
leaq 0x253be(%rip), %rax     # 0x33638
cmovneq %rcx, %rax
movq %rdi, %r15
movq (%rax), %r12
cmpb $0x2e, (%rsi)
jne 0xe294
cmpb $0x0, 0x1(%r14)
je 0xe36f
cmpl $0x0, 0x25381(%rip)     # 0x3361c
movb 0x253bf(%rip), %al      # 0x33660
jle 0xe2b4
testb $0x1, %al
je 0xe2ea
movzbl %bl, %ecx
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
jmp 0xe2e0
testb $0x1, %al
je 0xe43e
movq %rsp, %rsi
movq $-0x1, %rdi
callq 0x1004a
testl %eax, %eax
je 0xe3e1
movq (%rsp), %rdx
movzbl %bl, %ecx
movq %r15, %rdi
movq %r14, %rsi
callq 0xfb63
jmp 0xe43e
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0xa728
testq %rax, %rax
je 0xe3ae
movq %rax, %r15
movq 0x20(%r12), %rdi
movq %rsp, %rsi
callq 0x1004a
cmpl $0x2, 0x25305(%rip)     # 0x3361c
setge %cl
testl %eax, %eax
sete %al
andb %cl, %al
leal 0x1(%rax), %ecx
movb %cl, 0x40(%r15)
testb %al, %al
je 0xe3c8
movq 0x252d1(%rip), %rcx     # 0x33608
testq %rcx, %rcx
je 0xe3f4
movq 0x60(%rcx), %rax
cmpq $0x0, (%rax)
jne 0xe35e
movq 0x18(%rcx), %rdi
callq 0xfc85
movq 0x252ae(%rip), %rcx     # 0x33608
orb $0x1, 0x21(%rcx)
movq %rax, 0x38(%r15)
movq %r15, %rdi
callq 0x6759
jmp 0xe40c
cmpl $0x0, 0x252a6(%rip)     # 0x3361c
jle 0xe3ce
cmpb $0x0, 0x252e1(%rip)     # 0x33660
jne 0xe43e
testb $0x8, %bl
jne 0xe421
movq 0x20(%r12), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x1004a
movq (%r14), %rsi
movq %r12, %rdi
callq 0xeb62
jmp 0xe43e
leaq 0x148a9(%rip), %rdi     # 0x22c5e
leaq 0x1485a(%rip), %rsi     # 0x22c16
movq %r14, %rdx
xorl %eax, %eax
callq 0x52b0
jmp 0xe43e
movq (%rsp), %rax
jmp 0xe41b
movq 0x2524b(%rip), %r14     # 0x33620
callq 0x103d5
movl $0x65, %edi
jmp 0xe432
movq 0x25238(%rip), %r14     # 0x33620
callq 0x103d5
movl $0x6e, %edi
jmp 0xe432
leaq 0x14831(%rip), %rdi     # 0x22c2c
leaq 0x14814(%rip), %rsi     # 0x22c16
movq %r14, %rdx
xorl %eax, %eax
callq 0x52b0
movq (%rsp), %rax
movq 0x251f1(%rip), %rcx     # 0x33608
subq 0x40(%rcx), %rax
movq %rax, 0x30(%r15)
jmp 0xe43e
movq 0x251f8(%rip), %r14     # 0x33620
callq 0x103d5
movl $0x6c, %edi
movq %r14, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x6f14
andb $0x8, %bl
movzbl %bl, %edi
callq 0xd9ff
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq