// File: /workspace/github_c_makefile_star2_O0/simh[P]simtools/crossassemblers/macro1/macro1.c
// Function: eval2
SYM_T eval2()
{
  WORD32  digit;
  WORD32  from;
  SYM_T  *sym;
  WORD32  val;
  SYM_T   sym_eval;

  sym_eval.type = DEFINED;
  sym_eval.name[0] = '\0';
  sym_eval.val = sym_eval.xref_index = sym_eval.xref_count = 0;

  val = 0;

  if( isLexSymbol()) {
    sym = evalSymbol();
    if(!M_DEFINED( sym->type )) {
      if( pass == 2 )
        errorSymbol( &undefined_symbol, sym->name, lexstart );
      next(1);
      return( *sym );
    }
    else if( M_PSEUDO(sym->type) || M_EPSEUDO(sym->type)) {
      switch (sym->val) {
      case DECIMAL:
        radix = 10;
	sym_eval.type = PSEUDO;
	sym_eval.val = 0;		/* has zero as a value! */
	break;
      case OCTAL:
        radix = 8;
	sym_eval.type = PSEUDO;
	sym_eval.val = 0;		/* has zero as a value */
	break;
      case FLEX:
	next(1);			/* skip keyword */
	sym_eval.val = flex();
	break;
      case CHAR:
	next(1);			/* skip keyword */
	sym_eval.val = getChar();
	break;
      default:
        errorSymbol( &value_required, sym->name, lexstart );
        sym_eval.type = sym->type;
	sym_eval.val = 0;
	break;
      }
      next(1);
      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;
      next(1);
      return( sym_eval );
    }
    else
    {
      next(1);
      return( *sym );
    }
  } /* symbol */
  else if( isdigit( line[lexstart] )) {
    from = lexstart;
    val = 0;
    while( from < lexterm ) {
	if( isdigit( line[from] )) {
	    digit = line[from++] - '0';
	    if( digit >= radix ) {
		errorLexeme( &number_not_radix, from - 1 );
		val = 0;
		break;
	    }
	    val = val * radix + digit;
	}
	else {
	    errorLexeme( &not_a_number, lexstart );
	    val = 0;
	    break;
	}
    }
    next(1);
    sym_eval.val = val;
    return( sym_eval );
  } /* digit */
  else {
    switch( line[lexstart] ) {
    case '.':				/* Value of Current Location Counter */
	val = clc;
	next(1);
	break;
    case '(':				/* Generate literal */
	next(1);			/* Skip paren */
	val = getExprs();		/* recurse */
	if( line[lexstart] == ')' )
	    next(1);			/* Skip end paren */
	sym_eval.val = literal(val);
	return sym_eval;
    case '[':				/* parens!! */
	next(1);
	sym_eval.val = getExprs();	/* mutual recursion */
	if( line[lexstart] == ']' )
	    next(1);			/* Skip close bracket */
	else
	    errorMessage( &illegal_character, lexstart );
	return sym_eval;
    default:
	switch( line[lexstart] ) {
	case '=':
	    errorMessage( &illegal_equals, lexstart );
	    moveToEndOfLine();
	    break;
	default:
	    errorMessage( &illegal_character, lexstart );
	    break;
	} /* error switch */
	val = 0;				/* On error, set value to zero. */
	next(1);				/* Go past illegal character. */
    } /* switch on first char */
  } /* not symbol or number */
  sym_eval.val = val;
  return( sym_eval );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x40(%rbp)
movq %rdi, -0x38(%rbp)
movl $0x1, -0x2c(%rbp)
movb $0x0, -0x28(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x14(%rbp)
callq 0x68b0
cmpb $0x0, %al
je 0x5f40
callq 0x4d70
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
je 0x5dab
cmpl $0x2, 0x601e(%rip)      # 0xbd80
jne 0x5d7e
movq -0x10(%rbp), %rsi
addq $0x4, %rsi
movl 0x833e(%rip), %edx      # 0xe0b0
leaq 0x5da7(%rip), %rdi      # 0xbb20
callq 0x4c10
movl $0x1, %edi
callq 0x3e10
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
jmp 0x61e4
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x43, %eax
cmpl $0x43, %eax
je 0x5dcf
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x83, %eax
cmpl $0x83, %eax
jne 0x5ea4
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
movq %rax, -0x48(%rbp)
subq $0x7, %rax
ja 0x5e50
movq -0x48(%rbp), %rax
leaq 0x23e9(%rip), %rcx      # 0x81d4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0xa, 0x8342(%rip)      # 0xe140
movl $0x43, -0x2c(%rbp)
movl $0x0, -0x20(%rbp)
jmp 0x5e7a
movl $0x8, 0x8328(%rip)      # 0xe140
movl $0x43, -0x2c(%rbp)
movl $0x0, -0x20(%rbp)
jmp 0x5e7a
movl $0x1, %edi
callq 0x3e10
callq 0x5a20
movl %eax, -0x20(%rbp)
jmp 0x5e7a
movl $0x1, %edi
callq 0x3e10
callq 0x5b70
movl %eax, -0x20(%rbp)
jmp 0x5e7a
movq -0x10(%rbp), %rsi
addq $0x4, %rsi
movl 0x8252(%rip), %edx      # 0xe0b0
leaq 0x5ceb(%rip), %rdi      # 0xbb50
callq 0x4c10
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x1, %edi
callq 0x3e10
movq -0x40(%rbp), %rax
movq -0x2c(%rbp), %rcx
movq %rcx, (%rax)
movq -0x24(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x1c(%rbp), %rcx
movq %rcx, 0x10(%rax)
jmp 0x61e4
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x101, %eax            # imm = 0x101
cmpl $0x101, %eax            # imm = 0x101
jne 0x5f13
cmpl $0x2, 0x5ec3(%rip)      # 0xbd80
jne 0x5ed9
movq -0x10(%rbp), %rsi
addq $0x4, %rsi
movl 0x81e3(%rip), %edx      # 0xe0b0
leaq 0x5c5c(%rip), %rdi      # 0xbb30
callq 0x4c10
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x1, %edi
callq 0x3e10
movq -0x40(%rbp), %rax
movq -0x2c(%rbp), %rcx
movq %rcx, (%rax)
movq -0x24(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x1c(%rbp), %rcx
movq %rcx, 0x10(%rax)
jmp 0x61e4
movl $0x1, %edi
callq 0x3e10
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
jmp 0x61e4
callq 0x21b0
movq (%rax), %rax
movslq 0x8161(%rip), %rdx      # 0xe0b0
leaq 0x80fa(%rip), %rcx      # 0xe050
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x605d
movl 0x813b(%rip), %eax      # 0xe0b0
movl %eax, -0x8(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x8(%rbp), %eax
cmpl 0x81b4(%rip), %eax      # 0xe13c
jge 0x602d
callq 0x21b0
movq (%rax), %rax
movslq -0x8(%rbp), %rdx
leaq 0x80af(%rip), %rcx      # 0xe050
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x600d
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x8085(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
subl $0x30, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
cmpl 0x8162(%rip), %eax      # 0xe140
jl 0x5ffb
movl -0x8(%rbp), %esi
subl $0x1, %esi
leaq 0x5ae3(%rip), %rdi      # 0xbad0
callq 0x4d20
movl $0x0, -0x14(%rbp)
jmp 0x602d
movl -0x14(%rbp), %eax
imull 0x813b(%rip), %eax      # 0xe140
addl -0x4(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x6028
movl 0x809d(%rip), %esi      # 0xe0b0
leaq 0x5aa6(%rip), %rdi      # 0xbac0
callq 0x4d20
movl $0x0, -0x14(%rbp)
jmp 0x602d
jmp 0x5f7f
movl $0x1, %edi
callq 0x3e10
movq -0x40(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, -0x20(%rbp)
movq -0x2c(%rbp), %rcx
movq %rcx, (%rax)
movq -0x24(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x1c(%rbp), %rcx
movq %rcx, 0x10(%rax)
jmp 0x61e4
movslq 0x804c(%rip), %rax      # 0xe0b0
leaq 0x7fe5(%rip), %rcx      # 0xe050
movsbl (%rax,%rcx), %eax
movl %eax, -0x4c(%rbp)
subl $0x28, %eax
je 0x60a8
jmp 0x6079
movl -0x4c(%rbp), %eax
subl $0x2e, %eax
je 0x6090
jmp 0x6083
movl -0x4c(%rbp), %eax
subl $0x5b, %eax
je 0x6108
jmp 0x616c
movl 0x801e(%rip), %eax      # 0xe0b4
movl %eax, -0x14(%rbp)
movl $0x1, %edi
callq 0x3e10
jmp 0x61bf
movl $0x1, %edi
callq 0x3e10
callq 0x3ff0
movl %eax, -0x14(%rbp)
movslq 0x7fef(%rip), %rcx      # 0xe0b0
leaq 0x7f88(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0x29, %eax
jne 0x60db
movl $0x1, %edi
callq 0x3e10
movl -0x14(%rbp), %edi
callq 0x61f0
movl %eax, %ecx
movq -0x40(%rbp), %rax
movl %ecx, -0x20(%rbp)
movq -0x2c(%rbp), %rcx
movq %rcx, (%rax)
movq -0x24(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x1c(%rbp), %rcx
movq %rcx, 0x10(%rax)
jmp 0x61e4
movl $0x1, %edi
callq 0x3e10
callq 0x3ff0
movl %eax, -0x20(%rbp)
movslq 0x7f8f(%rip), %rcx      # 0xe0b0
leaq 0x7f28(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0x5d, %eax
jne 0x613d
movl $0x1, %edi
callq 0x3e10
jmp 0x614f
movl 0x7f6d(%rip), %esi      # 0xe0b0
leaq 0x5946(%rip), %rdi      # 0xba90
callq 0x56c0
movq -0x40(%rbp), %rax
movq -0x2c(%rbp), %rcx
movq %rcx, (%rax)
movq -0x24(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x1c(%rbp), %rcx
movq %rcx, 0x10(%rax)
jmp 0x61e4
movslq 0x7f3d(%rip), %rax      # 0xe0b0
leaq 0x7ed6(%rip), %rcx      # 0xe050
movb (%rax,%rcx), %al
subb $0x3d, %al
jne 0x619c
jmp 0x6183
movl 0x7f27(%rip), %esi      # 0xe0b0
leaq 0x5960(%rip), %rdi      # 0xbaf0
callq 0x56c0
callq 0x5800
jmp 0x61ae
movl 0x7f0e(%rip), %esi      # 0xe0b0
leaq 0x58e7(%rip), %rdi      # 0xba90
callq 0x56c0
movl $0x0, -0x14(%rbp)
movl $0x1, %edi
callq 0x3e10
jmp 0x61c1
jmp 0x61c3
movq -0x40(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, -0x20(%rbp)
movq -0x2c(%rbp), %rcx
movq %rcx, (%rax)
movq -0x24(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x1c(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nop