// File: /workspace/github_c_makefile_star2_O3/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
movq $0x0, 0x8(%rsp)
movq 0x22d53(%rip), %r12     # 0x33690
movzbl (%r12), %ebx
cmpq $0x28, %rbx
jne 0x1097e
incq %r12
movq %r12, 0x22d3e(%rip)     # 0x33690
callq 0xfe58
callq 0x100a7
movq %rax, %rbx
movq 0x22d2a(%rip), %rax     # 0x33690
cmpb $0x29, (%rax)
jne 0x10a15
incq %rax
movq %rax, 0x22d17(%rip)     # 0x33690
jmp 0x10a33
callq 0x5290
movq (%rax), %rax
testb $0x8, 0x1(%rax,%rbx,2)
jne 0x10a3d
movl $0x1, %edi
callq 0xff64
testq %rax, %rax
je 0x10a82
movq %rax, %rbx
cmpb $0x2e, (%rax)
jne 0x109b6
cmpb $0x0, 0x1(%rbx)
je 0x10c1c
movq 0x22eeb(%rip), %rdi     # 0x338a8
xorl %esi, %esi
movq %rbx, %rdx
callq 0xa728
testq %rax, %rax
je 0x10a9d
movl $0x15, %ebp
movq 0x22ec4(%rip), %rcx     # 0x338a0
cmpq $-0x2, %rcx
je 0x10be8
cmpq $-0x1, %rcx
jne 0x10c53
cmpb $0x1, 0x40(%rax)
je 0x10c65
movq 0x22eaf(%rip), %rsi     # 0x338b0
movl 0x22c91(%rip), %edx     # 0x33698
movq 0x20(%rax), %rcx
movl $0x66, %edi
jmp 0x10d08
movq 0x22e94(%rip), %rsi     # 0x338b0
movl 0x22c76(%rip), %edx     # 0x33698
movl $0x42, %edi
movl $0x29, %ecx
xorl %eax, %eax
callq 0x6f14
callq 0xfe58
jmp 0x10c0c
movl $0xa, %ecx
cmpb $0x30, %bl
jne 0x10af7
movzbl 0x1(%r12), %ecx
orl $0x20, %ecx
cmpl $0x78, %ecx
jne 0x10af2
leaq 0x2(%r12), %r14
movq %r14, 0x22c27(%rip)     # 0x33690
movzbl 0x2(%r12), %ebx
testb $0x10, 0x1(%rax,%rbx,2)
jne 0x10b53
xorl %r15d, %r15d
jmp 0x10bb5
movq 0x22e27(%rip), %rsi     # 0x338b0
movl 0x22c09(%rip), %edx     # 0x33698
movl $0x4e, %edi
xorl %eax, %eax
callq 0x6f14
jmp 0x10ae8
leaq 0x1e97c(%rip), %r14     # 0x2f420
movq (%r14), %rdi
testq %rdi, %rdi
je 0x10acc
addq $0x10, %r14
movq %rbx, %rsi
callq 0x5160
testl %eax, %eax
je 0x10c73
movq (%r14), %rdi
addq $0x10, %r14
testq %rdi, %rdi
jne 0x10ab0
movq 0x22ddd(%rip), %rsi     # 0x338b0
movl 0x22bbf(%rip), %edx     # 0x33698
movl $0x68, %edi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x6f14
movl $0x15, %ebp
jmp 0x10be8
movl $0x8, %ecx
movsbl %bl, %edx
movl %ecx, %eax
orl $0x30, %eax
cmpb $0x30, %bl
setge %sil
cmpl %edx, %eax
setg %dl
andb %sil, %dl
cmpb $0x1, %dl
jne 0x10b4b
movl %ecx, %ecx
xorl %r15d, %r15d
movq %r12, %r14
imulq %rcx, %r15
movzbl %bl, %edx
addq %rdx, %r15
addq $-0x30, %r15
movq %r15, 0x8(%rsp)
movsbl 0x1(%r14), %ebx
incq %r14
cmpl $0x30, %ebx
jl 0x10b3f
cmpl %ebx, %eax
jg 0x10b1b
movzbl %bl, %ebx
movq %r14, 0x22b47(%rip)     # 0x33690
jmp 0x10bb5
xorl %r15d, %r15d
movq %r12, %r14
jmp 0x10bb5
xorl %r15d, %r15d
leal -0x30(%rbx), %ecx
cmpb $0x9, %cl
ja 0x10b78
shlq $0x4, %r15
incq %r14
movq %r14, 0x22b24(%rip)     # 0x33690
movzbl %bl, %ecx
addq %rcx, %r15
addq $-0x30, %r15
jmp 0x10ba5
leal -0x61(%rbx), %ecx
shlq $0x4, %r15
incq %r14
movq %r14, 0x22b07(%rip)     # 0x33690
cmpb $0x5, %cl
ja 0x10b9a
movzbl %bl, %ecx
addq %rcx, %r15
addq $-0x57, %r15
jmp 0x10ba5
movsbq %bl, %rcx
addq %rcx, %r15
addq $-0x37, %r15
movq %r15, 0x8(%rsp)
movzbl (%r14), %ebx
testb $0x10, 0x1(%rax,%rbx,2)
jne 0x10b56
callq 0x5030
movq (%rax), %rax
movl (%rax,%rbx,4), %eax
movl $0x15, %ebp
cmpl $0x4d, %eax
je 0x10bd5
cmpl $0x4b, %eax
jne 0x10be8
shlq $0xa, %r15
jmp 0x10bd9
shlq $0x14, %r15
movq %r15, 0x8(%rsp)
incq %r14
movq %r14, 0x22aa8(%rip)     # 0x33690
callq 0xfe58
movl $0x20, %edi
callq 0x6638
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
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
movl $0x15, %ebp
movq 0x22c78(%rip), %rax     # 0x338a0
cmpq $-0x2, %rax
je 0x10be8
cmpq $-0x1, %rax
jne 0x10ce3
movq 0x22c71(%rip), %rsi     # 0x338b0
movl 0x22a53(%rip), %edx     # 0x33698
movl $0x65, %edi
xorl %eax, %eax
callq 0x6f14
jmp 0x10be8
movzbl 0x40(%rax), %ecx
cmpl $0x2, %ecx
je 0x10cd0
cmpl $0x1, %ecx
jne 0x10cf2
movq 0x30(%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x10be8
movq 0x22c26(%rip), %rsi     # 0x338a0
cmpq $-0x1, %rsi
je 0x10d14
cmpq $-0x2, %rsi
jne 0x10d2b
callq 0xfe58
movq 0x229f6(%rip), %rax     # 0x33690
movb (%rax), %cl
testb %cl, %cl
je 0x10d48
incq %rax
movq %rax, 0x229e2(%rip)     # 0x33690
cmpb $0x28, %cl
jne 0x10d48
movl $0x1, %edi
movl $0x28, %esi
movl $0x29, %edx
callq 0xff0c
jmp 0x10ae8
movq 0x38(%rax), %rcx
cmpq $0x0, 0x18(%rcx)
je 0x10cf2
movq 0x30(%rax), %rax
addq 0x30(%rcx), %rax
movq %rax, 0x8(%rsp)
movl $0x16, %ebp
jmp 0x10be8
movq 0x22bb7(%rip), %rsi     # 0x338b0
movl 0x22999(%rip), %edx     # 0x33698
movq 0x20(%rax), %rcx
movl $0x6a, %edi
xorl %eax, %eax
callq 0x6f14
jmp 0x10be8
movq 0x22b95(%rip), %rsi     # 0x338b0
movl 0x22977(%rip), %edx     # 0x33698
movl $0x69, %edi
jmp 0x10a94
movq 0x22b76(%rip), %rdi     # 0x338a8
leaq 0x8(%rsp), %rdx
callq *-0x8(%r14)
xorl %ebp, %ebp
cmpl $0x1, %eax
adcl $0x15, %ebp
jmp 0x10be8
decq %rax
movq %rax, 0x2293e(%rip)     # 0x33690
jmp 0x10ae8
nop