// File: /workspace/github_c_makefile_star2_O0/aap[P]rx-0/misc/wwas.c
// Function: expr
word
expr(int mustdef)
{
	word w, v;
	Token t;
	int op;
	int stype;

	/* operators:
	 * + add
	 * - sub
	 * ! or
	 * & and
	 * space combine */

	op = 0;
	w = 0;
	// not quite sure about expression delimiter here...
	while(t = token(), t.type != TokEol &&
	      t.type != ')' && t.type != ']' && t.type != ','){
		switch(t.type){
		case TokWord:
			w = combine(op, w, t.w);
			op = ' ';
			break;

		case TokSymbol:
			stype = t.sym->type & 7;
			v = 0;
			if(stype == SymValue)
				v = t.sym->val;
			else if(stype != None || pass2)
				err(1, "error: bad symbol in expression");
			if(mustdef && stype == None)
				err(1, "error: undefined symbol");
			w = combine(op, w, v);
			op = ' ';
			break;

		case '(':
			v = expr(0);
			v = putlit(v);
			w = combine(op, w, v);
			op = ' ';
			t = token();
			if(t.type != ')' && t.type != TokEol)
				err(1, "err: literal not closed");
			if(t.type != ')')
				peekt = t;
			break;

		case '+':
		case '-':
		case '!':
		case '&':
			op = t.type;
			break;
		}
	}
	peekt = t;
	return w;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movl $0x0, -0x1c(%rbp)
movw $0x0, -0x6(%rbp)
callq 0x1b20
movl %eax, -0x30(%rbp)
movq %rdx, -0x28(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x10(%rbp)
xorl %eax, %eax
cmpl $0x80, -0x18(%rbp)
movb %al, -0x41(%rbp)
je 0x20f2
xorl %eax, %eax
cmpl $0x29, -0x18(%rbp)
movb %al, -0x41(%rbp)
je 0x20f2
xorl %eax, %eax
cmpl $0x5d, -0x18(%rbp)
movb %al, -0x41(%rbp)
je 0x20f2
cmpl $0x2c, -0x18(%rbp)
setne %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x20fe
jmp 0x22b0
movl -0x18(%rbp), %eax
movl %eax, -0x48(%rbp)
subl $0x21, %eax
je 0x22a5
jmp 0x210f
movl -0x48(%rbp), %eax
subl $0x26, %eax
je 0x22a5
jmp 0x211d
movl -0x48(%rbp), %eax
subl $0x28, %eax
je 0x2213
jmp 0x212b
movl -0x48(%rbp), %eax
subl $0x2b, %eax
je 0x22a5
jmp 0x2139
movl -0x48(%rbp), %eax
subl $0x2d, %eax
je 0x22a5
jmp 0x2147
movl -0x48(%rbp), %eax
subl $0x81, %eax
je 0x2186
jmp 0x2153
movl -0x48(%rbp), %eax
subl $0x82, %eax
jne 0x22ab
jmp 0x2163
movl -0x1c(%rbp), %edi
movw -0x6(%rbp), %ax
movzwl %ax, %esi
movzwl -0x10(%rbp), %edx
callq 0x1f80
movw %ax, -0x6(%rbp)
movl $0x20, -0x1c(%rbp)
jmp 0x22ab
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
andl $0x7, %eax
movl %eax, -0x20(%rbp)
movw $0x0, -0x8(%rbp)
cmpl $0x1, -0x20(%rbp)
jne 0x21ad
movq -0x10(%rbp), %rax
movw 0x10(%rax), %ax
movw %ax, -0x8(%rbp)
jmp 0x21d1
cmpl $0x0, -0x20(%rbp)
jne 0x21bc
cmpl $0x0, 0x1a90a(%rip)     # 0x1cac4
je 0x21cf
movl $0x1, %edi
leaq 0x111b(%rip), %rsi      # 0x32e3
movb $0x0, %al
callq 0x1270
jmp 0x21d1
cmpl $0x0, -0x4(%rbp)
je 0x21f0
cmpl $0x0, -0x20(%rbp)
jne 0x21f0
movl $0x1, %edi
leaq 0x111a(%rip), %rsi      # 0x3303
movb $0x0, %al
callq 0x1270
movl -0x1c(%rbp), %edi
movw -0x6(%rbp), %ax
movzwl %ax, %esi
movzwl -0x8(%rbp), %edx
callq 0x1f80
movw %ax, -0x6(%rbp)
movl $0x20, -0x1c(%rbp)
jmp 0x22ab
xorl %edi, %edi
callq 0x2090
movw %ax, -0x8(%rbp)
movzwl -0x8(%rbp), %edi
callq 0x1ec0
movw %ax, -0x8(%rbp)
movl -0x1c(%rbp), %edi
movw -0x6(%rbp), %ax
movzwl %ax, %esi
movzwl -0x8(%rbp), %edx
callq 0x1f80
movw %ax, -0x6(%rbp)
movl $0x20, -0x1c(%rbp)
callq 0x1b20
movl %eax, -0x40(%rbp)
movq %rdx, -0x38(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x10(%rbp)
cmpl $0x29, -0x18(%rbp)
je 0x2287
cmpl $0x80, -0x18(%rbp)
je 0x2287
movl $0x1, %edi
leaq 0x109b(%rip), %rsi      # 0x331b
movb $0x0, %al
callq 0x1270
cmpl $0x29, -0x18(%rbp)
je 0x22a3
movq -0x18(%rbp), %rax
movq %rax, 0x1a840(%rip)     # 0x1cad8
movq -0x10(%rbp), %rax
movq %rax, 0x1a83d(%rip)     # 0x1cae0
jmp 0x22ab
movl -0x18(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x20a8
movq -0x18(%rbp), %rax
movq %rax, 0x1a81d(%rip)     # 0x1cad8
movq -0x10(%rbp), %rax
movq %rax, 0x1a81a(%rip)     # 0x1cae0
movw -0x6(%rbp), %ax
addq $0x50, %rsp
popq %rbp
retq