// File: /workspace/github_c_makefile_star2_O3/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 0x4b93
movl (%rbx), %r13d
movl 0xc(%rbx), %r12d
leaq 0x799b(%rip), %r15      # 0xc050
leaq 0x19b4(%rip), %rbp      # 0x6070
leaq 0x60(%rsp), %r14
movslq 0x79e8(%rip), %rsi      # 0xc0b0
movzbl (%rsi,%r15), %eax
cmpl $0x39, %eax
jg 0x47ec
leal -0x20(%rax), %ecx
cmpl $0xf, %ecx
ja 0x47fd
movslq (%rbp,%rcx,4), %rax
addq %rbp, %rax
jmpq *%rax
movl $0x1, %edi
callq 0x3911
movslq 0x79b3(%rip), %rax      # 0xc0b0
movzbl (%rax,%r15), %eax
cmpl $0xa, %eax
ja 0x479b
movl $0x601, %ecx            # imm = 0x601
btl %eax, %ecx
jae 0x479b
jmp 0x4809
movl $0x1, %r13d
movl $0x1, %edi
callq 0x3911
leaq 0x48(%rsp), %rdi
callq 0x4b93
movl 0x54(%rsp), %eax
movl $0x3ffff, %ecx          # imm = 0x3FFFF
xorl %ecx, %eax
addl %eax, %r12d
jmp 0x47d0
movl $0x1, %r13d
movl $0x1, %edi
callq 0x3911
leaq 0x18(%rsp), %rdi
callq 0x4b93
andl 0x24(%rsp), %r12d
jmp 0x46c1
movl $0x1, %r13d
movl $0x1, %edi
callq 0x3911
movq %rsp, %rdi
callq 0x4b93
orl 0xc(%rsp), %r12d
jmp 0x46c1
movl $0x1, %edi
callq 0x3911
movq %r14, %rdi
callq 0x4b93
addl 0x6c(%rsp), %r12d
movl $0x1, %r13d
jmp 0x47d0
movl $0x1, %r13d
movl $0x1, %edi
callq 0x3911
leaq 0x30(%rsp), %rdi
callq 0x4b93
imull 0x3c(%rsp), %r12d
cmpl $0x40000, %r12d         # imm = 0x40000
jl 0x46c1
incl %r12d
andl $0x3ffff, %r12d         # imm = 0x3FFFF
jmp 0x46c1
cmpl $0x3a, %eax
je 0x4809
cmpl $0x3d, %eax
je 0x485b
cmpl $0x5d, %eax
je 0x4809
jmp 0x4822
leal -0x9(%rax), %ecx
cmpl $0x2, %ecx
jb 0x4809
testl %eax, %eax
jne 0x4822
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 %r13d, (%rbx)
leaq 0x5274(%rip), %rdi      # 0x9aa0
callq 0x4b12
movslq 0x7880(%rip), %rax      # 0xc0b8
addq %rax, %r15
movl $0x601, %ecx            # imm = 0x601
movzbl (%r15), %edx
cmpl $0xa, %edx
ja 0x484e
btl %edx, %ecx
jb 0x4894
incl %eax
movl %eax, 0x7862(%rip)      # 0xc0b8
incq %r15
jmp 0x4840
movl %r13d, (%rbx)
leaq 0x528b(%rip), %rdi      # 0x9af0
callq 0x4b12
movslq 0x7847(%rip), %rax      # 0xc0b8
addq %rax, %r15
movl $0x601, %ecx            # imm = 0x601
movzbl (%r15), %edx
cmpl $0xa, %edx
ja 0x4887
btl %edx, %ecx
jb 0x4894
incl %eax
movl %eax, 0x7829(%rip)      # 0xc0b8
incq %r15
jmp 0x4879
movl %eax, 0x7816(%rip)      # 0xc0b0
movl %eax, 0x789c(%rip)      # 0xc13c
movl %eax, 0x789e(%rip)      # 0xc144
movl $0x0, 0xc(%rbx)
jmp 0x4810