// File: /workspace/github_c_makefile_star2_O1/AK6DN[P]dec-utilities-for-pdp/palbart/palbart.c
// Function: eval
SYM_T *eval()
{
  WORD16  digit;
  int     from;
  WORD16  loc;
  SYM_T  *sym;
  WORD16  val;

  val = 0;

  delimiter = line[lexterm];
  if( isalpha( line[lexstart] ))
  {
    sym = evalSymbol();
    if( M_UNDEFINED( sym->type ) && pass == 2 )
    {
      errorSymbol( &undefined_symbol, sym->name, lexstart );
      nextLexeme();
      return( sym );
    }
    else
    {
      nextLexeme();
      return( sym );
    }
  }
  else if( isdigit( line[lexstart] ))
  {
    from = lexstart;
    val = 0;
    while( from < lexterm )
    {
      if( isdigit( line[from] ))
      {
        digit = (WORD16) line[from++] - (WORD16) '0';
        if( digit < radix )
        {
          val = val * radix + digit;
        }
        else
        {
          errorLexeme( &number_not_radix, from - 1 );
          val = 0;
          from = lexterm;
        }
      }
      else
      {
        errorLexeme( &not_a_number, lexstart );
        val = 0;
        from = lexterm;
      }
    }
    nextLexeme();
    sym_eval.val = val;
    return( &sym_eval );
  }
  else
  {
    switch( line[lexstart] )
    {
    case '"':                   /* Character literal                          */
      if( cc + 1 <= maxcc )
      {
        val = line[lexstart + 1] | 0200;
        delimiter = line[lexstart + 2];
        cc = lexstart + 2;
      }
      else
      {
        errorMessage( &no_literal_value, lexstart );
      }
      nextLexeme();
      break;

    case '.':                   /* Value of Current Location Counter          */
      val = (clc & 07777) + reloc;
      nextLexeme();
      break;

    case '[':                   /* Generate literal on page zero.             */
      if( !literals_ok && LITERAL_ERROR)
      {
        errorMessage( &literal_gen_off, lexstart );
      }
      nextLexBlank();           /* Skip bracket                               */
      val = getExprs() & 07777;

      if( line[lexstart] == ']' )
      {
        nextLexBlank();         /* Skip end bracket                           */
      }

      sym_eval.val = (literals_ok || !LITERAL_ERROR) ? insertLiteral( cp , val,
        GET_PAGE_INDEX(field)) : 0;
      return( &sym_eval );

    case '(':                   /* Generate literal on current page.          */
      if( !literals_ok && LITERAL_ERROR)
      {
        errorMessage( &literal_gen_off, lexstart );
      }

      nextLexBlank();           /* Skip paren                                 */
      val = getExprs() & 07777;

      if( line[lexstart] == ')' )
      {
        nextLexBlank();         /* Skip end paren                             */
      }

      loc = (literals_ok || !LITERAL_ERROR) ? insertLiteral( cp, val, GET_PAGE_INDEX(clc) ) : 0;
      sym_eval.val = loc + (( clc + reloc ) & 077600 );
      return( &sym_eval );

    default:
      switch( line[lexstart] )
      {
      case '=':
        errorMessage( &illegal_equals, lexstart );
        moveToEndOfLine();
        break;

      default:
        errorMessage( &illegal_character, lexstart );
        break;
      }
      val = 0;                  /* On error, set value to zero.               */
      nextLexBlank();           /* Go past illegal character.                 */
    }
  }
  sym_eval.val = val;
  return( &sym_eval );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movslq 0x8049(%rip), %rax      # 0xd81c
leaq 0x7fb6(%rip), %rbp      # 0xd790
movb (%rax,%rbp), %al
movb %al, 0x803d(%rip)       # 0xd820
callq 0x21c0
movq %rax, %r14
movq (%rax), %rdx
movl 0x8020(%rip), %ebx      # 0xd814
movslq %ebx, %rax
movsbq (%rax,%rbp), %rcx
movzwl (%rdx,%rcx,2), %edx
btl $0xa, %edx
jb 0x5883
btl $0xb, %edx
jb 0x58bc
movzbl %cl, %ecx
cmpl $0x2d, %ecx
jle 0x5964
cmpl $0x2e, %ecx
je 0x59d8
cmpl $0x3d, %ecx
je 0x59f1
cmpl $0x5b, %ecx
jne 0x5a69
callq 0x4498
callq 0x44e8
movl %eax, %ebx
andl $0xfff, %ebx            # imm = 0xFFF
movslq 0x7fc4(%rip), %rax      # 0xd814
cmpb $0x5d, (%rax,%rbp)
jne 0x585b
callq 0x4498
movzwl 0x7f00(%rip), %edx      # 0xd762
shrl $0x7, %edx
andl $0x1f, %edx
movzwl %bx, %esi
leaq 0x5dee(%rip), %rdi      # 0xb660
callq 0x572f
movw %ax, 0x5a76(%rip)       # 0xb2f4
jmp 0x5a9c
callq 0x45e2
movq %rax, %rbx
testb $0x1, (%rax)
jne 0x58b2
cmpl $0x2, 0x5b59(%rip)      # 0xb3f0
jne 0x58b2
movq %rbx, %rsi
addq $0x4, %rsi
movl 0x7f6e(%rip), %edx      # 0xd814
leaq 0x591b(%rip), %rdi      # 0xb1c8
callq 0x4382
callq 0x3b84
jmp 0x5aa3
movl 0x7f5a(%rip), %edx      # 0xd81c
xorl %r12d, %r12d
cmpl %edx, %ebx
jge 0x5952
leaq 0x11(%rsp), %r15
leaq 0xa(%rsp), %r13
movq (%r14), %rcx
movslq %ebx, %rax
movsbq (%rax,%rbp), %rax
testb $0x8, 0x1(%rcx,%rax,2)
jne 0x5905
movl 0x7f25(%rip), %ebx      # 0xd814
movq %r15, %rdi
movl %ebx, %esi
callq 0x430d
leaq 0x5868(%rip), %rdi      # 0xb168
movq %r15, %rsi
jmp 0x5938
addl $-0x30, %eax
movswl 0x7e73(%rip), %ecx      # 0xd782
cmpl %ecx, %eax
jge 0x5920
incl %ebx
imull %r12d, %ecx
addl %eax, %ecx
movl %ecx, %r12d
jmp 0x5948
movl 0x7eee(%rip), %esi      # 0xd814
movq %r13, %rdi
callq 0x430d
leaq 0x5843(%rip), %rdi      # 0xb178
movq %r13, %rsi
movl %ebx, %edx
callq 0x4382
xorl %r12d, %r12d
movl 0x7ed4(%rip), %ebx      # 0xd81c
movl 0x7ece(%rip), %edx      # 0xd81c
cmpl %edx, %ebx
jl 0x58d7
callq 0x3b84
movw %r12w, 0x5995(%rip)     # 0xb2f4
jmp 0x5a9c
cmpl $0x22, %ecx
je 0x5a37
cmpl $0x28, %ecx
jne 0x5a69
callq 0x4498
callq 0x44e8
movl %eax, %ebx
andl $0xfff, %ebx            # imm = 0xFFF
movslq 0x7e85(%rip), %rax      # 0xd814
cmpb $0x29, (%rax,%rbp)
jne 0x599a
callq 0x4498
movzwl 0x7dbf(%rip), %edx      # 0xd760
shrl $0x7, %edx
andl $0x1f, %edx
movzwl %bx, %esi
leaq 0x5caf(%rip), %rdi      # 0xb660
callq 0x572f
movzwl 0x7da9(%rip), %ecx      # 0xd766
addw 0x7d9c(%rip), %cx       # 0xd760
andl $0x7f80, %ecx           # imm = 0x7F80
addl %eax, %ecx
movw %cx, 0x5921(%rip)       # 0xb2f4
jmp 0x5a9c
movzwl 0x7d81(%rip), %ebx      # 0xd760
andl $0xfff, %ebx            # imm = 0xFFF
addw 0x7d7a(%rip), %bx       # 0xd766
jmp 0x5a90
leaq 0x57a0(%rip), %rdi      # 0xb198
movl %ebx, %esi
callq 0x5ab5
movslq 0x7e26(%rip), %rax      # 0xd82c
addq %rax, %rbp
movzbl (%rbp), %ecx
testl %ecx, %ecx
je 0x5a23
cmpl $0xa, %ecx
je 0x5a23
incl %eax
movl %eax, 0x7e0e(%rip)      # 0xd82c
incq %rbp
jmp 0x5a09
movl %eax, 0x7deb(%rip)      # 0xd814
movl %eax, 0x7ded(%rip)      # 0xd81c
movl %eax, 0x7def(%rip)      # 0xd824
jmp 0x5a77
movl 0x7def(%rip), %ecx      # 0xd82c
cmpl 0x7ded(%rip), %ecx      # 0xd830
jge 0x5a80
movsbl 0x1(%rax,%rbp), %ebx
orl $0x80, %ebx
movq %rax, %rcx
addq $0x2, %rcx
movb 0x2(%rax,%rbp), %al
movb %al, 0x7dbf(%rip)       # 0xd820
movl %ecx, 0x7dc5(%rip)      # 0xd82c
jmp 0x5a90
leaq 0x56c8(%rip), %rdi      # 0xb138
movl %ebx, %esi
callq 0x5ab5
callq 0x4498
xorl %ebx, %ebx
jmp 0x5a95
leaq 0x5811(%rip), %rdi      # 0xb298
movl %ebx, %esi
callq 0x5ab5
xorl %ebx, %ebx
callq 0x3b84
movw %bx, 0x5858(%rip)       # 0xb2f4
leaq 0x5845(%rip), %rbx      # 0xb2e8
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq