// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/expr.c
// Function: primary_expr
static struct Expr *primary_expr(void)
{
  lword val = 0;
  int type = ABS;
  struct Expr *new;

  if (*s == '(') {
    s++;
    skip();
    new = expression();
    if (*s != ')')
      error(66,scriptname,line,')');  /* ')' expected */
    else
      s++;
    skip();
    return new;
  }

  if (isdigit((unsigned char)*s)) {
    /* octal, decimal or hex constant */
    if (s[0]=='0' && (s[1]=='x' || s[1]=='X')) {
      s += 2;
      while (isxdigit((unsigned char)*s)) {
        if (*s>='0' && *s<='9')
          val = (val<<4) + *s++ - '0';
        else if (*s>='a' && *s<='f')
          val = (val<<4) + *s++ - 'a' + 10;
        else
          val = (val<<4) + *s++ - 'A' + 10;
      }
    }
    else {
      int base = (*s=='0') ? 8 : 10;

      while (*s>='0' && *s<('0'+base)) {
        val = base*val + *s++ - '0';
      }
    }

    if (toupper((unsigned char)*s) == 'K') {
      val <<= 10;
      s++;
    }
    else if (toupper((unsigned char)*s) == 'M') {
      val <<= 20;
      s++;
    }
  }

  else {
    char *word;

    if (word = getarg(1)) {
      if (word[0]=='.' && word[1]=='\0') {  /* current address symbol '.' */
        if (caddr != -1) {
          if (caddr != -2) {
            val = caddr;
            type = REL;
          }
        }
        else {
          /* Address symbol '.' invalid outside SECTIONS block */
          error(101,scriptname,line);
        }
      }
      else {  /* otherwise it's possibly a function- or symbol-name */
        struct Symbol *sym;

        if (sym = findsymbol(gv,NULL,word)) {
          if (caddr==-1 && sym->type!=SYM_ABS) {
            /* Reference to non-absolute symbol */
            error(102,scriptname,line,sym->name);
          }
          else if (caddr != -2) {
            if (sym->type == SYM_ABS) {
              val = sym->value;
            }
            else if (sym->type==SYM_RELOC && sym->relsect->lnksec!=NULL) {
              val = (lword)sym->relsect->va + sym->value;
              type = REL;
            }
            else {
              /* Symbol is not yet assigned */
              error(106,scriptname,line,sym->name);
            }
          }
        }
        else {
          struct ScriptFunc *sfptr;

          for (sfptr=ldFunctions; sfptr->name; sfptr++) {
            if (!strcmp(sfptr->name,word))
              break;
          }
          if (sfptr->name) {
            if (caddr == -2) {
              if (getchr() == '(')
                skipblock(1,'(',')');
              else
                back(1);
            }
            else if (caddr != -1)
              type = sfptr->funcptr(gv,caddr,&val) ? ABS : REL;
            else
              error(105,scriptname,line);  /* No function-calls allowed here */
          }
          else
            error(104,scriptname,line,word);  /* Unknown symbol or function */
        }
      }
    }
    else
      error(78,scriptname,line);   /* missing argument */
  }

  skip();
  new = new_expr();
  new->type = type;
  new->val = val;
  return new;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
andq $0x0, 0x8(%rsp)
movq 0x23cc3(%rip), %rbx     # 0x33a80
movzbl (%rbx), %r12d
cmpq $0x28, %r12
jne 0xfdfd
incq %rbx
movq %rbx, 0x23caf(%rip)     # 0x33a80
callq 0xf3c4
callq 0xf602
movq %rax, %rbx
movq 0x23c9b(%rip), %rax     # 0x33a80
cmpb $0x29, (%rax)
jne 0xfe8e
incq %rax
movq %rax, 0x23c88(%rip)     # 0x33a80
jmp 0xfea8
callq 0x52a0
movq (%rax), %rax
testb $0x8, 0x1(%rax,%r12,2)
jne 0xfeb2
pushq $0x1
popq %rdi
callq 0xf4bf
testq %rax, %rax
je 0xff4a
movq %rax, %rbx
cmpb $0x2e, (%rax)
jne 0xfe34
cmpb $0x0, 0x1(%rbx)
je 0x10033
movq 0x23e5d(%rip), %rdi     # 0x33c98
xorl %esi, %esi
movq %rbx, %rdx
callq 0xa220
testq %rax, %rax
je 0xff69
pushq $0x15
popq %rbp
movq 0x23e38(%rip), %rcx     # 0x33c90
cmpq $-0x2, %rcx
je 0x1000b
cmpq $-0x1, %rcx
jne 0x10066
cmpb $0x1, 0x40(%rax)
je 0x10074
movq 0x23e23(%rip), %rsi     # 0x33ca0
movl 0x23c05(%rip), %edx     # 0x33a88
movq 0x20(%rax), %rcx
pushq $0x66
jmp 0x10103
movq 0x23e0b(%rip), %rsi     # 0x33ca0
movl 0x23bed(%rip), %edx     # 0x33a88
pushq $0x42
popq %rdi
pushq $0x29
popq %rcx
xorl %eax, %eax
callq 0x6c19
callq 0xf3c4
jmp 0x10023
cmpb $0x30, %r12b
jne 0xff46
movzbl 0x1(%rbx), %ecx
orl $0x20, %ecx
cmpl $0x78, %ecx
jne 0xff97
addq $0x2, %rbx
movq %rbx, 0x23ba9(%rip)     # 0x33a80
xorl %r14d, %r14d
movzbl (%rbx), %r15d
testb $0x10, 0x1(%rax,%r15,2)
je 0xffd9
leal -0x30(%r15), %ecx
cmpb $0x9, %cl
ja 0xff0f
shlq $0x4, %r14
incq %rbx
movq %rbx, 0x23b7f(%rip)     # 0x33a80
addq %r15, %r14
addq $-0x30, %r14
movq %r14, 0x8(%rsp)
jmp 0xfeda
leal -0x61(%r15), %ecx
shlq $0x4, %r14
incq %rbx
movq %rbx, 0x23b5f(%rip)     # 0x33a80
cmpb $0x5, %cl
ja 0xff34
addq %r15, %r14
addq $-0x57, %r14
movq %r14, 0x8(%rsp)
jmp 0xfeda
movsbq %r15b, %rcx
addq %rcx, %r14
addq $-0x37, %r14
movq %r14, 0x8(%rsp)
jmp 0xfeda
pushq $0xa
jmp 0xff99
movq 0x23d4f(%rip), %rsi     # 0x33ca0
movl 0x23b31(%rip), %edx     # 0x33a88
pushq $0x4e
popq %rdi
xorl %eax, %eax
callq 0x6c19
pushq $0x15
popq %rbp
jmp 0x1000b
leaq 0x1f4c0(%rip), %r14     # 0x2f430
addq $0x8, %r14
movq -0x8(%r14), %rdi
testq %rdi, %rdi
je 0x1007f
movq %rbx, %rsi
callq 0x5160
testl %eax, %eax
je 0x1009e
addq $0x10, %r14
jmp 0xff74
pushq $0x8
popq %rax
movl %eax, %ecx
orl $0x30, %eax
incq %rbx
xorl %r14d, %r14d
movzbl %r12b, %r15d
cmpb $0x30, %r12b
jl 0xffd6
movsbl %r12b, %edx
cmpl %edx, %eax
jle 0xffd6
imulq %rcx, %r14
movq %rbx, 0x23abe(%rip)     # 0x33a80
addq %r15, %r14
addq $-0x30, %r14
movq %r14, 0x8(%rsp)
movb (%rbx), %r12b
incq %rbx
jmp 0xffa5
decq %rbx
callq 0x5030
movq (%rax), %rax
movl (%rax,%r15,4), %eax
pushq $0x15
popq %rbp
cmpl $0x4d, %eax
je 0xfff8
cmpl $0x4b, %eax
jne 0x1000b
shlq $0xa, %r14
jmp 0xfffc
shlq $0x14, %r14
movq %r14, 0x8(%rsp)
incq %rbx
movq %rbx, 0x23a75(%rip)     # 0x33a80
callq 0xf3c4
callq 0xf990
movq %rax, %rbx
movl %ebp, (%rax)
movq 0x8(%rsp), %rax
movq %rax, 0x18(%rbx)
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
pushq $0x15
popq %rbp
movq 0x23c53(%rip), %rax     # 0x33c90
cmpq $-0x2, %rax
je 0x1000b
cmpq $-0x1, %rax
jne 0x100e4
movq 0x23c4c(%rip), %rsi     # 0x33ca0
movl 0x23a2e(%rip), %edx     # 0x33a88
pushq $0x65
popq %rdi
xorl %eax, %eax
callq 0x6c19
jmp 0x1000b
movzbl 0x40(%rax), %ecx
cmpl $0x2, %ecx
je 0x100d1
cmpl $0x1, %ecx
jne 0x100f0
movq 0x30(%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x1000b
movq 0x23c1a(%rip), %rsi     # 0x33ca0
movl 0x239fc(%rip), %edx     # 0x33a88
pushq $0x68
popq %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x6c19
jmp 0xff61
movq 0x23beb(%rip), %rsi     # 0x33c90
cmpq $-0x1, %rsi
je 0x10110
cmpq $-0x2, %rsi
jne 0x10124
callq 0xf457
cmpb $0x28, %al
jne 0x10140
pushq $0x1
popq %rdi
pushq $0x28
popq %rsi
pushq $0x29
popq %rdx
callq 0xf476
jmp 0xff61
movq 0x38(%rax), %rcx
cmpq $0x0, 0x18(%rcx)
je 0x100f0
movq 0x30(%rax), %rax
addq 0x30(%rcx), %rax
movq %rax, 0x8(%rsp)
pushq $0x16
jmp 0xff63
movq 0x23ba9(%rip), %rsi     # 0x33ca0
movl 0x2398b(%rip), %edx     # 0x33a88
movq 0x20(%rax), %rcx
pushq $0x6a
popq %rdi
xorl %eax, %eax
callq 0x6c19
jmp 0x1000b
movq 0x23b89(%rip), %rsi     # 0x33ca0
movl 0x2396b(%rip), %edx     # 0x33a88
pushq $0x69
jmp 0xff59
movq 0x23b6d(%rip), %rdi     # 0x33c98
leaq 0x8(%rsp), %rdx
callq *(%r14)
xorl %ebp, %ebp
cmpl $0x1, %eax
adcl $0x15, %ebp
jmp 0x1000b
decq 0x23939(%rip)           # 0x33a80
jmp 0xff61