// File: /workspace/github_c_makefile_star2_O3/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 %rbx
subq $0x18, %rsp
movslq 0xf72e(%rip), %r14      # 0x14130
leaq 0xf597(%rip), %r15      # 0x13fa0
movb (%r14,%r15), %al
movb %al, 0xf721(%rip)       # 0x14134
callq 0x2180
movq (%rax), %rdx
movslq 0xf6fe(%rip), %rbx      # 0x14120
movsbq (%rbx,%r15), %rcx
movzwl (%rdx,%rcx,2), %edx
btl $0xa, %edx
jb 0x4ad8
btl $0xb, %edx
jb 0x4b11
movzbl %cl, %eax
cmpl $0x2d, %eax
jg 0x4b80
cmpl $0x22, %eax
je 0x4c0c
cmpl $0x28, %eax
jne 0x4bde
callq 0x3f6c
callq 0x3fbc
movl %eax, %ebx
movslq 0xf6b0(%rip), %rax      # 0x14120
cmpb $0x29, (%rax,%r15)
jne 0x4a8d
movslq 0xf6b2(%rip), %rax      # 0x14130
movb (%rax,%r15), %al
movb %al, 0xf6ac(%rip)       # 0x14134
callq 0x3816
andl $0x3ffff, %ebx          # imm = 0x3FFFF
movslq 0x78ce(%rip), %rcx      # 0xc368
cmpq $0x1eff, %rcx           # imm = 0x1EFF
jg 0x4ac0
movl $0x1f00, %eax           # imm = 0x1F00
leaq 0x78c9(%rip), %rdx      # 0xc378
cmpl %ebx, (%rdx,%rax,4)
je 0x4d22
decq %rax
cmpq %rcx, %rax
jg 0x4aaf
leal -0x1(%rcx), %eax
movl %eax, 0x789f(%rip)      # 0xc368
leaq 0x78a8(%rip), %rdx      # 0xc378
movl %ebx, (%rdx,%rcx,4)
jmp 0x4d24
callq 0x40fb
movq %rax, %rbx
movl (%rax), %eax
testb $0x1, %al
jne 0x4b54
cmpl $0x2, 0x7603(%rip)      # 0xc0f0
jne 0x4cc2
movq %rbx, %rsi
addq $0x4, %rsi
movl 0xf620(%rip), %edx      # 0x14120
leaq 0x5359(%rip), %rdi      # 0x9e60
callq 0x3e58
jmp 0x4cc2
xorl %ebp, %ebp
cmpl %r14d, %ebx
jge 0x4d02
movq (%rax), %rax
xorl %ebp, %ebp
movl 0xf46d(%rip), %ecx      # 0x13f94
movsbq (%rbx,%r15), %rdx
testb $0x8, 0x1(%rax,%rdx,2)
je 0x4c55
addl $-0x30, %edx
cmpl %ecx, %edx
jge 0x4cc9
imull %ecx, %ebp
addl %edx, %ebp
incq %rbx
cmpl %r14d, %ebx
jl 0x4b27
jmp 0x4d02
movl %eax, %ecx
notl %ecx
testb $0x43, %cl
jne 0x4bc0
movl 0xc(%rbx), %eax
cmpl $0x9, %eax
je 0x4c7b
testl %eax, %eax
jne 0x4c87
movl $0xa, 0xf419(%rip)      # 0x13f94
jmp 0x4ca9
cmpl $0x2e, %eax
je 0x4c4a
cmpl $0x3d, %eax
jne 0x4bde
leaq 0x529b(%rip), %rdi      # 0x9e30
movl %ebx, %esi
callq 0x4d39
movslq 0xf589(%rip), %rax      # 0x1412c
addq %rax, %r15
movzbl (%r15), %ecx
testl %ecx, %ecx
je 0x4bee
cmpl $0xa, %ecx
je 0x4bee
incl %eax
movl %eax, 0xf571(%rip)      # 0x1412c
incq %r15
jmp 0x4ba6
testl $0x101, %ecx            # imm = 0x101
jne 0x4cc2
cmpl $0x2, 0x751d(%rip)      # 0xc0f0
je 0x4c90
jmp 0x4cab
leaq 0x51eb(%rip), %rdi      # 0x9dd0
movl %ebx, %esi
callq 0x4d39
jmp 0x4c00
movl %eax, 0xf52c(%rip)      # 0x14120
movl %eax, 0xf536(%rip)      # 0x14130
movl %eax, 0xf538(%rip)      # 0x14138
callq 0x3f6c
xorl %ebp, %ebp
jmp 0x4d07
movl 0xf51a(%rip), %eax      # 0x1412c
addl $0x2, %eax
cmpl 0xf509(%rip), %eax      # 0x14124
jge 0x4cf2
movsbl 0x1(%rbx,%r15), %ebp
orl $0x80, %ebp
movq %rbx, %rax
addq $0x2, %rax
movb 0x2(%rbx,%r15), %cl
movb %cl, 0xf4f5(%rip)       # 0x14134
movl %eax, 0xf4e7(%rip)      # 0x1412c
jmp 0x4d02
movl 0x7710(%rip), %ebp      # 0xc360
jmp 0x4d02
movl 0xf4c5(%rip), %ebx      # 0x14120
leaq 0x11(%rsp), %r15
movq %r15, %rdi
movl %ebx, %esi
movl %r14d, %edx
callq 0x3de8
leaq 0x518c(%rip), %rdi      # 0x9e00
movq %r15, %rsi
movl %ebx, %edx
jmp 0x4ceb
movl $0x8, 0xf30f(%rip)      # 0x13f94
jmp 0x4ca9
cmpl $0x2, 0x7462(%rip)      # 0xc0f0
jne 0x4ca9
movq %rbx, %rsi
addq $0x4, %rsi
movl 0xf483(%rip), %edx      # 0x14120
leaq 0x51cc(%rip), %rdi      # 0x9e70
callq 0x3e58
movl (%rbx), %eax
movl %eax, 0x52cf(%rip)      # 0x9f80
leaq 0x52c8(%rip), %rbx      # 0x9f80
movl $0x0, 0x52ca(%rip)      # 0x9f8c
callq 0x3816
jmp 0x4d14
movl 0xf451(%rip), %esi      # 0x14120
leaq 0xa(%rsp), %r15
movq %r15, %rdi
movl %r14d, %edx
callq 0x3de8
leaq 0x512a(%rip), %rdi      # 0x9e10
movq %r15, %rsi
movl %ebx, %edx
callq 0x3e58
jmp 0x4d00
leaq 0x51f7(%rip), %rdi      # 0x9ef0
movl %ebx, %esi
callq 0x4d39
xorl %ebp, %ebp
callq 0x3816
movl %ebp, 0x527f(%rip)      # 0x9f8c
leaq 0x526c(%rip), %rbx      # 0x9f80
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
decl %eax
movl $0x6000, %ecx           # imm = 0x6000
andl 0x7631(%rip), %ecx      # 0xc360
addl %eax, %ecx
movl %ecx, 0x5255(%rip)      # 0x9f8c
jmp 0x4d0d