// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro1/macro1.c
// Function: getExpr
SYM_T getExpr()
{
    SYM_T sym;

    sym = eval();

    /* Here we assume the current lexeme is the operator separating the */
    /* previous operator from the next, if any. */

    for (;;) {
	int space;
	/*
	 * falling out of switch breaks loop and returns from routine
	 * so if you want to keep going, you must "continue"!!
	 */
	space = FALSE;
	switch( line[lexstart] ) {
	case ' ':
	    space = TRUE;
	    /* fall */
	case '+':			/* add */
	    next(1);			/* skip operator */
	    if (space && ISEND(line[lexstart]))	/* tollerate a trailing space */
		return sym;
	    sym.val += eval().val;	/* XXX look at type? */
	    sym.type = DEFINED;
	    if( sym.val >= 01000000 )
		sym.val = ( sym.val + 1 ) & 0777777;
	    continue;

	case '-':			/* subtract */
	    next(1);			/* skip over the operator */
	    sym.val += eval().val ^ 0777777; /* XXX look at type? */
	    sym.type = DEFINED;
	    if( sym.val >= 01000000 )
		sym.val = ( sym.val + 1 ) & 0777777;
	    continue;

	case '*':			/* multiply */
	    next(1);			/* skip over the operator */
	    sym.val *= eval().val;
	    sym.type = DEFINED;
	    if( sym.val >= 01000000 )
		sym.val = ( sym.val + 1 ) & 0777777;
	    continue;

#if 0
	case '%':			/* divide !??? */
	    /*
	     * neither '%' nor the divide symbol appear in FIO-DEC,
	     * does any known program use such an operator?
	     * Easily confused for "MOD", which is how C uses '%'!
	     */
	    next(1);
	    sym.val /= eval().val;
	    sym.type = DEFINED;
	    continue;
#endif

	case '&':			/* and */
	    next(1);			/* skip over the operator */
	    sym.val &= eval().val;
	    sym.type = DEFINED;
	    continue;

	case '!':			/* or */
	    next(1);			/* skip over the operator */
	    sym.val |= eval().val;
	    sym.type = DEFINED;
	    continue;

	case '/':
	case ')':
	case ']':
	case ':':
	case ',':
	    break;

	case '=':
	    errorMessage( &illegal_equals, lexstart );
	    moveToEndOfLine();
	    sym.val = 0;
	    break;

	default:
	    if (!ISEND(line[lexstart])) {
		errorMessage( &illegal_expression, lexstart );
		moveToEndOfLine();
		sym.val = 0;
		break;
	    }
	} /* switch */
	break;				/* break loop!! */
    } /* "forever" */
    return( sym );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
callq 0x463b
movl (%rbx), %ebp
movl 0xc(%rbx), %r12d
leaq 0x7e6a(%rip), %r13      # 0xc050
leaq 0x1e83(%rip), %r15      # 0x6070
pushq $0x1
popq %r14
movslq 0x7eb8(%rip), %rsi      # 0xc0b0
movzbl (%rsi,%r13), %eax
leal -0x20(%rax), %ecx
cmpl $0xf, %ecx
ja 0x42e5
movslq (%r15,%rcx,4), %rax
addq %r15, %rax
jmpq *%rax
movl %r14d, %edi
callq 0x3575
movslq 0x7e8f(%rip), %rax      # 0xc0b0
movzbl (%rax,%r13), %eax
cmpl $0xa, %eax
ja 0x4278
movl $0x601, %ecx            # imm = 0x601
btl %eax, %ecx
jae 0x4278
jmp 0x4300
movl %r14d, %edi
callq 0x3575
movq %rsp, %rdi
callq 0x463b
orl 0xc(%rsp), %r12d
movl %r14d, %ebp
jmp 0x41f1
movl %r14d, %edi
callq 0x3575
leaq 0x18(%rsp), %rdi
callq 0x463b
andl 0x24(%rsp), %r12d
movl %r14d, %ebp
jmp 0x41f1
movl %r14d, %edi
callq 0x3575
leaq 0x60(%rsp), %rdi
callq 0x463b
addl 0x6c(%rsp), %r12d
jmp 0x42c3
movl %r14d, %edi
callq 0x3575
leaq 0x30(%rsp), %rdi
callq 0x463b
imull 0x3c(%rsp), %r12d
jmp 0x42c3
movl %r14d, %edi
callq 0x3575
leaq 0x48(%rsp), %rdi
callq 0x463b
movl 0x54(%rsp), %eax
movl $0x3ffff, %ecx          # imm = 0x3FFFF
xorl %ecx, %eax
addl %eax, %r12d
movl %r14d, %ebp
cmpl $0x40000, %r12d         # imm = 0x40000
jl 0x41f1
incl %r12d
andl $0x3ffff, %r12d         # imm = 0x3FFFF
movl %r14d, %ebp
jmp 0x41f1
leal -0x9(%rax), %ecx
cmpl $0x2, %ecx
jb 0x4300
testl %eax, %eax
je 0x4300
cmpl $0x3a, %eax
je 0x4300
cmpl $0x3d, %eax
je 0x4323
cmpl $0x5d, %eax
jne 0x4318
movl %r12d, 0xc(%rbx)
movl %ebp, (%rbx)
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebp, (%rbx)
leaq 0x577f(%rip), %rdi      # 0x9aa0
jmp 0x432c
movl %ebp, (%rbx)
leaq 0x57c4(%rip), %rdi      # 0x9af0
callq 0x45ba
callq 0x4689
andl $0x0, 0xc(%rbx)
jmp 0x4306