// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0xa0(%rbp)
movq %rdi, -0xa8(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x5750
movq -0xa0(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, (%rdi)
movq -0x10(%rbp), %rax
movq %rax, 0x8(%rdi)
movq -0x8(%rbp), %rax
movq %rax, 0x10(%rdi)
movl $0x0, -0x1c(%rbp)
movslq 0x9042(%rip), %rax      # 0xe0b0
leaq 0x8fdb(%rip), %rcx      # 0xe050
movsbl (%rax,%rcx), %eax
addl $-0x20, %eax
movl %eax, %ecx
movq %rcx, -0xb0(%rbp)
subl $0x3d, %eax
ja 0x5278
movq -0xb0(%rbp), %rax
leaq 0x3040(%rip), %rcx      # 0x80dc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, -0x1c(%rbp)
movl $0x1, %edi
callq 0x3e10
cmpl $0x0, -0x1c(%rbp)
je 0x5106
movslq 0x8fed(%rip), %rcx      # 0xe0b0
leaq 0x8f86(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x5101
movslq 0x8fd6(%rip), %rcx      # 0xe0b0
leaq 0x8f6f(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
je 0x5101
movslq 0x8fbf(%rip), %rcx      # 0xe0b0
leaq 0x8f58(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0x9, %eax
jne 0x5106
jmp 0x52ea
leaq -0x34(%rbp), %rdi
callq 0x5750
movq -0xa0(%rbp), %rax
movl -0x28(%rbp), %ecx
addl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movl $0x1, (%rax)
cmpl $0x40000, 0xc(%rax)     # imm = 0x40000
jl 0x5144
movq -0xa0(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
andl $0x3ffff, %ecx          # imm = 0x3FFFF
movl %ecx, 0xc(%rax)
jmp 0x5060
movl $0x1, %edi
callq 0x3e10
leaq -0x4c(%rbp), %rdi
callq 0x5750
movq -0xa0(%rbp), %rax
movl -0x40(%rbp), %ecx
xorl $0x3ffff, %ecx          # imm = 0x3FFFF
addl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movl $0x1, (%rax)
cmpl $0x40000, 0xc(%rax)     # imm = 0x40000
jl 0x5197
movq -0xa0(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
andl $0x3ffff, %ecx          # imm = 0x3FFFF
movl %ecx, 0xc(%rax)
jmp 0x5060
movl $0x1, %edi
callq 0x3e10
leaq -0x64(%rbp), %rdi
callq 0x5750
movq -0xa0(%rbp), %rax
movl -0x58(%rbp), %ecx
imull 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movl $0x1, (%rax)
cmpl $0x40000, 0xc(%rax)     # imm = 0x40000
jl 0x51e5
movq -0xa0(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
andl $0x3ffff, %ecx          # imm = 0x3FFFF
movl %ecx, 0xc(%rax)
jmp 0x5060
movl $0x1, %edi
callq 0x3e10
leaq -0x7c(%rbp), %rdi
callq 0x5750
movq -0xa0(%rbp), %rax
movl -0x70(%rbp), %ecx
andl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movl $0x1, (%rax)
jmp 0x5060
movl $0x1, %edi
callq 0x3e10
leaq -0x94(%rbp), %rdi
callq 0x5750
movq -0xa0(%rbp), %rax
movl -0x88(%rbp), %ecx
orl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movl $0x1, (%rax)
jmp 0x5060
jmp 0x52e6
movl 0x8e59(%rip), %esi      # 0xe0b0
leaq 0x6892(%rip), %rdi      # 0xbaf0
callq 0x56c0
callq 0x5800
movq -0xa0(%rbp), %rax
movl $0x0, 0xc(%rax)
jmp 0x52e6
movslq 0x8e31(%rip), %rcx      # 0xe0b0
leaq 0x8dca(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x52e4
movslq 0x8e1a(%rip), %rcx      # 0xe0b0
leaq 0x8db3(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
je 0x52e4
movslq 0x8e03(%rip), %rcx      # 0xe0b0
leaq 0x8d9c(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0x9, %eax
je 0x52e4
movl 0x8ded(%rip), %esi      # 0xe0b0
leaq 0x67d6(%rip), %rdi      # 0xbaa0
callq 0x56c0
callq 0x5800
movq -0xa0(%rbp), %rax
movl $0x0, 0xc(%rax)
jmp 0x52e6
jmp 0x52e6
jmp 0x52e8
jmp 0x52ea
movq -0xa8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
nopw (%rax,%rax)