// File: /workspace/github_c_makefile_star2_O1/simh[P]simtools/crossassemblers/macro7/macro7.c
// Function: eval
SYM_T *eval()
{
  WORD32  digit;
  WORD32  from;
  WORD32  loc;
  SYM_T  *sym;
  WORD32  val;

  val = 0;

  delimiter = line[lexterm];
  if( isalpha( 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( isdigit( line[lexstart] ))
  {
    from = lexstart;
    val = 0;
    while( from < lexterm )
    {
      if( isdigit( 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( cc + 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;
      nextLexeme();
      break;

    case '(':                   /* Generate literal on current page.          */
      nextLexBlank();           /* Skip paren                                 */
      val = getExprs() & 0777777;

      if( line[lexstart] == ')' )
      {
        delimiter = line[lexterm];
        nextLexeme();           /* Skip end paren                             */
      }
      else
      {
        /* errorMessage( "parens", NULL );                                    */
      }

      loc = insertLiteral( &cp, clc, val );
      sym_eval.val = loc + ( clc & 060000 );
      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 0xf6f5(%rip), %rax      # 0x14130
leaq 0xf55e(%rip), %rbp      # 0x13fa0
movb (%rax,%rbp), %al
movb %al, 0xf6e9(%rip)       # 0x14134
callq 0x2180
movq %rax, %r14
movq (%rax), %rdx
movl 0xf6c4(%rip), %ebx      # 0x14120
movslq %ebx, %rax
movsbq (%rax,%rbp), %rcx
movzwl (%rdx,%rcx,2), %edx
btl $0xa, %edx
jb 0x4af9
btl $0xb, %edx
jb 0x4b36
movzbl %cl, %ecx
cmpl $0x2d, %ecx
jg 0x4c04
cmpl $0x22, %ecx
je 0x4ca2
cmpl $0x28, %ecx
jne 0x4c77
callq 0x3f87
callq 0x3fd7
movl %eax, %ebx
movslq 0xf673(%rip), %rax      # 0x14120
cmpb $0x29, (%rax,%rbp)
jne 0x4ac8
movslq 0xf676(%rip), %rax      # 0x14130
movb (%rax,%rbp), %al
movb %al, 0xf671(%rip)       # 0x14134
callq 0x380e
andl $0x3ffff, %ebx          # imm = 0x3FFFF
movslq 0x7893(%rip), %rax      # 0xc368
cmpq $0x1eff, %rax           # imm = 0x1EFF
jg 0x4d61
cmpl %ebx, 0xf491(%rip)      # 0x13f78
jne 0x4d3d
movl $0x1eff, %ecx           # imm = 0x1EFF
xorl %edx, %edx
jmp 0x4d5d
callq 0x412d
movq %rax, %rbx
movl (%rax), %eax
testb $0x1, %al
jne 0x4bdf
cmpl $0x2, 0x75de(%rip)      # 0xc0f0
jne 0x4d02
movq %rbx, %rsi
addq $0x4, %rsi
movl 0xf5fb(%rip), %edx      # 0x14120
leaq 0x5334(%rip), %rdi      # 0x9e60
callq 0x3e73
jmp 0x4d02
movl 0xf5f4(%rip), %edx      # 0x14130
xorl %r12d, %r12d
cmpl %edx, %ebx
jge 0x4bce
xorl %r12d, %r12d
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 0x4b82
movl 0xf5b4(%rip), %ebx      # 0x14120
movq %r15, %rdi
movl %ebx, %esi
callq 0x3dfe
leaq 0x5283(%rip), %rdi      # 0x9e00
movq %r15, %rsi
jmp 0x4bb4
addl $-0x30, %eax
movl 0xf409(%rip), %ecx      # 0x13f94
cmpl %ecx, %eax
jge 0x4b9c
incl %ebx
imull %r12d, %ecx
addl %eax, %ecx
movl %ecx, %r12d
jmp 0x4bc4
movl 0xf57e(%rip), %esi      # 0x14120
movq %r13, %rdi
callq 0x3dfe
leaq 0x525f(%rip), %rdi      # 0x9e10
movq %r13, %rsi
movl %ebx, %edx
callq 0x3e73
xorl %r12d, %r12d
movl 0xf56c(%rip), %ebx      # 0x14130
movl 0xf566(%rip), %edx      # 0x14130
cmpl %edx, %ebx
jl 0x4b54
callq 0x380e
movl %r12d, 0x53b2(%rip)     # 0x9f8c
jmp 0x4d24
notl %eax
testb $0x43, %al
jne 0x4c44
movl 0xc(%rbx), %eax
cmpl $0x9, %eax
je 0x4cdf
testl %eax, %eax
jne 0x4c4f
movl $0xa, 0xf395(%rip)      # 0x13f94
jmp 0x4ce9
cmpl $0x2e, %ecx
je 0x4cd7
cmpl $0x3d, %ecx
jne 0x4c77
leaq 0x5217(%rip), %rdi      # 0x9e30
movl %ebx, %esi
callq 0x4d89
movslq 0xf505(%rip), %rax      # 0x1412c
addq %rax, %rbp
movzbl (%rbp), %ecx
testl %ecx, %ecx
je 0x4c87
cmpl $0xa, %ecx
je 0x4c87
incl %eax
movl %eax, 0xf4ed(%rip)      # 0x1412c
incq %rbp
jmp 0x4c2a
testl $0x101, %eax            # imm = 0x101
jne 0x4d02
cmpl $0x2, 0x749a(%rip)      # 0xc0f0
jne 0x4ce9
movq %rbx, %rsi
addq $0x4, %rsi
movl 0xf4b7(%rip), %edx      # 0x14120
leaq 0x5200(%rip), %rdi      # 0x9e70
callq 0x3e73
jmp 0x4ce9
leaq 0x5152(%rip), %rdi      # 0x9dd0
movl %ebx, %esi
callq 0x4d89
jmp 0x4c99
movl %eax, 0xf493(%rip)      # 0x14120
movl %eax, 0xf49d(%rip)      # 0x14130
movl %eax, 0xf49f(%rip)      # 0x14138
callq 0x3f87
xorl %ebx, %ebx
jmp 0x4d1e
movl 0xf484(%rip), %ecx      # 0x1412c
addl $0x2, %ecx
cmpl 0xf473(%rip), %ecx      # 0x14124
jge 0x4d09
movsbl 0x1(%rax,%rbp), %ebx
orl $0x80, %ebx
movq %rax, %rcx
addq $0x2, %rcx
movb 0x2(%rax,%rbp), %al
movb %al, 0xf465(%rip)       # 0x14134
movl %ecx, 0xf457(%rip)      # 0x1412c
jmp 0x4d19
movl 0x7683(%rip), %ebx      # 0xc360
jmp 0x4d19
movl $0x8, 0xf2ab(%rip)      # 0x13f94
movl (%rbx), %eax
movl %eax, 0x528f(%rip)      # 0x9f80
leaq 0x5288(%rip), %rbx      # 0x9f80
movl $0x0, 0x528a(%rip)      # 0x9f8c
callq 0x380e
jmp 0x4d2b
leaq 0x51e0(%rip), %rdi      # 0x9ef0
movl %ebx, %esi
callq 0x4d89
xorl %ebx, %ebx
callq 0x380e
movl %ebx, 0x5268(%rip)      # 0x9f8c
leaq 0x5255(%rip), %rbx      # 0x9f80
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1eff, %edi           # imm = 0x1EFF
leaq 0x762f(%rip), %rsi      # 0xc378
cmpq %rax, %rdi
setle %dl
jle 0x4d61
leaq -0x1(%rdi), %rcx
cmpl %ebx, (%rsi,%rdi,4)
movq %rcx, %rdi
jne 0x4d49
testb %dl, %dl
je 0x4d74
leal -0x1(%rax), %ecx
movl %ecx, 0x75fe(%rip)      # 0xc368
leaq 0x7607(%rip), %rdx      # 0xc378
movl %ebx, (%rdx,%rax,4)
movl $0x6000, %eax           # imm = 0x6000
andl 0x75e1(%rip), %eax      # 0xc360
addl %ecx, %eax
movl %eax, 0x5205(%rip)      # 0x9f8c
jmp 0x4d24