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

  val = 0;

  delimiter = line[lexterm];
  if( is_alpha( line[lexstart] ))
  {
    sym = evalSymbol();
    if( M_UNDEFINED( sym->type ))
    {
      if( pass == 2 )
      {
        errorSymbol( &undefined_symbol, sym->name, lexstart );
      }
      nextLexeme();
      return( sym );
    }
    else if( M_PSEUDO( sym->type ))
    {
      if( sym->val == DECIMAL )
      {
        radix = 10;
      }
      else if( sym->val == OCTAL )
      {
        radix = 8;
      }
      else if( pass == 2 )
      {
        errorSymbol( &misplaced_symbol, sym->name, lexstart );
      }
      sym_eval.type = sym->type;
      sym_eval.val = 0;
      nextLexeme();
      return( &sym_eval );
    }
    else if( M_MACRO( sym->type ))
    {
      if( pass == 2 )
      {
        errorSymbol( &misplaced_symbol, sym->name, lexstart );
      }
      sym_eval.type = sym->type;
      sym_eval.val = 0;
      nextLexeme();
      return( &sym_eval );
    }
    else
    {
      nextLexeme();
      return( sym );
    }
  }
  else if( is_digit( line[lexstart] ))
  {
    from = lexstart;
    val = 0;
    while( from < lexterm )
    {
      if( is_digit( line[from] ))
      {
        digit = (WORD32) line[from++] - (WORD32) '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( lexstart + 2 < 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 + reloc;
      nextLexeme();
      break;

    case '[':                   /* Generate literal on page zero.             */
      nextLexBlank();           /* Skip bracket                               */
      val = getExprs() & 07777;
      if( line[lexstart] == ']' )
      {
        delimiter = line[lexterm];
        nextLexeme();           /* Skip end bracket                           */
      }
      else
      {
        /* errorMessage( "parens", lexstart );                                */
      }
      sym_eval.val = insertLiteral( &pz, field, val );
      return( &sym_eval );

    case '(':                   /* Generate literal on current page.          */
      nextLexBlank();           /* Skip paren                                 */
      val = getExprs() & 07777;

      if( line[lexstart] == ')' )
      {
        delimiter = line[lexterm];
        nextLexeme();           /* Skip end paren                             */
      }
      else
      {
        /* errorMessage( "parens", NULL );                                    */
      }
      if( testZeroPool( val ))
      {
        sym_eval.val = insertLiteral( &pz, field, val );
      }
      else
      {
        loc = insertLiteral( &cp, clc, val );
        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
movq 0x12416(%rip), %rax     # 0x17c18
leaq 0x12017(%rip), %rbp     # 0x17820
movb (%rax,%rbp), %al
movb %al, 0x1240e(%rip)      # 0x17c20
callq 0x21a0
movq %rax, %r14
movq (%rax), %rcx
movq 0x123e4(%rip), %rbx     # 0x17c08
movsbq (%rbx,%rbp), %rax
movzwl (%rcx,%rax,2), %ecx
btl $0xa, %ecx
jb 0x58b8
btl $0xb, %ecx
jb 0x58f7
movzbl %al, %eax
cmpl $0x2d, %eax
jle 0x5a0e
cmpl $0x2e, %eax
je 0x5ad5
cmpl $0x3d, %eax
je 0x5ae8
cmpl $0x5b, %eax
jne 0x5b87
callq 0x43c9
callq 0x441b
movq %rax, %rbx
andl $0xfff, %ebx            # imm = 0xFFF
movq 0x12386(%rip), %rax     # 0x17c08
cmpb $0x5d, (%rax,%rbp)
jne 0x589d
movq 0x12389(%rip), %rax     # 0x17c18
movb (%rax,%rbp), %al
movb %al, 0x12388(%rip)      # 0x17c20
callq 0x3ab5
movq 0x10714(%rip), %rsi     # 0x15fb8
leaq 0x11b3d(%rip), %rdi     # 0x173e8
movq %rbx, %rdx
callq 0x5790
jmp 0x5ac9
callq 0x4597
movq %rax, %rbx
movl (%rax), %eax
testb $0x1, %al
jne 0x59ac
cmpq $0x2, 0x845e(%rip)      # 0xdd30
jne 0x5b80
movq %rbx, %rsi
addq $0x4, %rsi
movq 0x12322(%rip), %rdx     # 0x17c08
leaq 0x6143(%rip), %rdi      # 0xba30
callq 0x42a8
jmp 0x5b80
movq 0x1231a(%rip), %rdx     # 0x17c18
xorl %r12d, %r12d
cmpq %rdx, %rbx
jge 0x599b
leaq 0x11(%rsp), %r15
leaq 0xa(%rsp), %r13
movq (%r14), %rcx
movsbq (%rbx,%rbp), %rax
testb $0x8, 0x1(%rcx,%rax,2)
jne 0x5941
movq 0x122de(%rip), %rbx     # 0x17c08
movq %r15, %rdi
movq %rbx, %rsi
callq 0x422d
leaq 0x6094(%rip), %rdi      # 0xb9d0
movq %r15, %rsi
jmp 0x5979
addq $-0x30, %rax
movq 0x11ec4(%rip), %rcx     # 0x17810
cmpq %rcx, %rax
jge 0x5960
incq %rbx
imulq %r12, %rcx
addq %rax, %rcx
movq %rcx, %r12
jmp 0x598b
movq 0x122a1(%rip), %rsi     # 0x17c08
movq %r13, %rdi
callq 0x422d
leaq 0x606a(%rip), %rdi      # 0xb9e0
movq %r13, %rsi
movq %rbx, %rdx
callq 0x42a8
movq 0x12290(%rip), %rbx     # 0x17c18
xorl %r12d, %r12d
movq 0x12286(%rip), %rdx     # 0x17c18
cmpq %rdx, %rbx
jl 0x5914
callq 0x3ab5
movq %r12, 0x61f9(%rip)      # 0xbba0
jmp 0x5bbe
notl %eax
testb $0x43, %al
jne 0x59d6
movq 0x10(%rbx), %rax
cmpq $0x19, %rax
je 0x5b5b
cmpq $0x4, %rax
jne 0x59e1
movq $0xa, 0x11e3f(%rip) # 0x17810
jmp 0x5b66
testl $0x101, %eax            # imm = 0x101
jne 0x5b80
cmpq $0x2, 0x8347(%rip)      # 0xdd30
jne 0x5b66
movq %rbx, %rsi
addq $0x4, %rsi
movq 0x1220b(%rip), %rdx     # 0x17c08
leaq 0x603c(%rip), %rdi      # 0xba40
callq 0x42a8
jmp 0x5b66
cmpl $0x22, %eax
je 0x5b2e
cmpl $0x28, %eax
jne 0x5b87
callq 0x43c9
callq 0x441b
movq %rax, %rbx
andl $0xfff, %ebx            # imm = 0xFFF
movq 0x121ce(%rip), %rax     # 0x17c08
cmpb $0x29, (%rax,%rbp)
jne 0x5a55
movq 0x121d1(%rip), %rax     # 0x17c18
movb (%rax,%rbp), %al
movb %al, 0x121d0(%rip)      # 0x17c20
callq 0x3ab5
movq 0x1055c(%rip), %rsi     # 0x15fb8
movl %esi, %ecx
shrl $0x4, %ecx
andl $0x7f8, %ecx            # imm = 0x7F8
leaq 0x10d62(%rip), %rax     # 0x167d0
movq (%rcx,%rax), %rax
leaq 0x10557(%rip), %rdx     # 0x15fd0
movq (%rcx,%rdx), %rcx
cmpq %rcx, %rax
jge 0x5a9c
leaq 0x1195f(%rip), %rdx     # 0x173e8
cmpq %rbx, 0x8(%rdx,%rax,8)
je 0x58a4
incq %rax
cmpq %rax, %rcx
jne 0x5a89
movq 0x1050d(%rip), %rsi     # 0x15fb0
leaq 0x11536(%rip), %rdi     # 0x16fe0
movq %rbx, %rdx
callq 0x5790
movq %rax, %rcx
movl 0x1050d(%rip), %eax     # 0x15fc8
addl 0x104ef(%rip), %eax     # 0x15fb0
andl $0x7f80, %eax           # imm = 0x7F80
addq %rcx, %rax
movq %rax, 0x60d0(%rip)      # 0xbba0
jmp 0x5bbe
movq 0x104ec(%rip), %r14     # 0x15fc8
addq 0x104cd(%rip), %r14     # 0x15fb0
jmp 0x5bb2
leaq 0x5f11(%rip), %rdi      # 0xba00
movq %rbx, %rsi
callq 0x5bd7
movq 0x12132(%rip), %rax     # 0x17c30
movzbl (%rax,%rbp), %ecx
testl %ecx, %ecx
je 0x5b17
cmpl $0xa, %ecx
je 0x5b17
incq %rax
movq %rax, 0x1211b(%rip)     # 0x17c30
jmp 0x5afe
movq %rax, 0x120ea(%rip)     # 0x17c08
movq %rax, 0x120f3(%rip)     # 0x17c18
movq %rax, 0x120fc(%rip)     # 0x17c28
jmp 0x5b96
leaq 0x2(%rbx), %rax
cmpq 0x124ff(%rip), %rax     # 0x18038
jge 0x5ba0
movsbq 0x1(%rbx,%rbp), %r14
orq $0x80, %r14
movb 0x2(%rbx,%rbp), %cl
movb %cl, 0x120ce(%rip)      # 0x17c20
movq %rax, 0x120d7(%rip)     # 0x17c30
jmp 0x5bb2
movq $0x8, 0x11caa(%rip) # 0x17810
movl (%rbx), %eax
movl %eax, 0x6022(%rip)      # 0xbb90
leaq 0x601b(%rip), %rbx      # 0xbb90
movq $0x0, 0x6020(%rip) # 0xbba0
callq 0x3ab5
jmp 0x5bc5
leaq 0x5e12(%rip), %rdi      # 0xb9a0
movq %rbx, %rsi
callq 0x5bd7
callq 0x43c9
xorl %r14d, %r14d
jmp 0x5bb7
leaq 0x5f49(%rip), %rdi      # 0xbaf0
movq %rbx, %rsi
callq 0x5bd7
xorl %r14d, %r14d
callq 0x3ab5
movq %r14, 0x5fe2(%rip)      # 0xbba0
leaq 0x5fcb(%rip), %rbx      # 0xbb90
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq