// File: /workspace/github_c_makefile_star2_O1/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 0x4b37
movl (%rbx), %r13d
movl 0xc(%rbx), %r12d
leaq 0x7a11(%rip), %r15      # 0xc050
leaq 0x1a2a(%rip), %rbp      # 0x6070
leaq 0x60(%rsp), %r14
movslq 0x7a5e(%rip), %rsi      # 0xc0b0
movzbl (%rsi,%r15), %eax
cmpl $0x39, %eax
jg 0x4776
leal -0x20(%rax), %ecx
cmpl $0xf, %ecx
ja 0x4787
movslq (%rbp,%rcx,4), %rax
addq %rbp, %rax
jmpq *%rax
movl $0x1, %edi
callq 0x384a
movslq 0x7a29(%rip), %rax      # 0xc0b0
movzbl (%rax,%r15), %eax
cmpl $0xa, %eax
ja 0x4725
movl $0x601, %ecx            # imm = 0x601
btl %eax, %ecx
jae 0x4725
jmp 0x4793
movl $0x1, %r13d
movl $0x1, %edi
callq 0x384a
leaq 0x48(%rsp), %rdi
callq 0x4b37
movl 0x54(%rsp), %eax
movl $0x3ffff, %ecx          # imm = 0x3FFFF
xorl %ecx, %eax
addl %eax, %r12d
jmp 0x475a
movl $0x1, %r13d
movl $0x1, %edi
callq 0x384a
leaq 0x18(%rsp), %rdi
callq 0x4b37
andl 0x24(%rsp), %r12d
jmp 0x464b
movl $0x1, %r13d
movl $0x1, %edi
callq 0x384a
movq %rsp, %rdi
callq 0x4b37
orl 0xc(%rsp), %r12d
jmp 0x464b
movl $0x1, %edi
callq 0x384a
movq %r14, %rdi
callq 0x4b37
addl 0x6c(%rsp), %r12d
movl $0x1, %r13d
jmp 0x475a
movl $0x1, %r13d
movl $0x1, %edi
callq 0x384a
leaq 0x30(%rsp), %rdi
callq 0x4b37
imull 0x3c(%rsp), %r12d
cmpl $0x40000, %r12d         # imm = 0x40000
jl 0x464b
incl %r12d
andl $0x3ffff, %r12d         # imm = 0x3FFFF
jmp 0x464b
cmpl $0x3a, %eax
je 0x4793
cmpl $0x3d, %eax
je 0x47e9
cmpl $0x5d, %eax
je 0x4793
jmp 0x47ac
leal -0x9(%rax), %ecx
cmpl $0x2, %ecx
jb 0x4793
testl %eax, %eax
jne 0x47ac
movl %r12d, 0xc(%rbx)
movl %r13d, (%rbx)
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r12d, 0xc(%rbx)
movl %r13d, (%rbx)
leaq 0x52e6(%rip), %rdi      # 0x9aa0
callq 0x4ab6
movslq 0x78f2(%rip), %rax      # 0xc0b8
addq %rax, %r15
movl $0x601, %ecx            # imm = 0x601
movzbl (%r15), %edx
cmpl $0xa, %edx
ja 0x47dc
btl %edx, %ecx
jb 0x4826
incl %eax
movl %eax, 0x78d4(%rip)      # 0xc0b8
incq %r15
jmp 0x47ce
movl %r12d, 0xc(%rbx)
movl %r13d, (%rbx)
leaq 0x52f9(%rip), %rdi      # 0x9af0
callq 0x4ab6
movslq 0x78b5(%rip), %rax      # 0xc0b8
addq %rax, %r15
movl $0x601, %ecx            # imm = 0x601
movzbl (%r15), %edx
cmpl $0xa, %edx
ja 0x4819
btl %edx, %ecx
jb 0x4826
incl %eax
movl %eax, 0x7897(%rip)      # 0xc0b8
incq %r15
jmp 0x480b
movl %eax, 0x7884(%rip)      # 0xc0b0
movl %eax, 0x790a(%rip)      # 0xc13c
movl %eax, 0x790c(%rip)      # 0xc144
movl $0x0, 0xc(%rbx)
jmp 0x479a