// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/direct2.c
// Function: dir2equ
int dir2equ() {
	/* handle the various forms of equates */

	long l;
	int i;
	char *sym = 0, *equal = 0, *exp = 0, localsym[34];

	if (!strchr(p1, '=') && !strchr(p2, '=') && *s3 != '=')
		return 0;                 /* not equate */
	if (!(equal = strchr(line, '='))) /* search for = */
		return 0;                 /* this isn't an equate */
	exp = strchr(line, ';');          /* check for comments */
	if (exp && exp < equal) return 0; /* there was ; before = */
	for (exp = equal + 1; isspace(*exp) && *exp; exp++)
		; /* point to expression */
	for (sym = equal - 1; isspace(*sym) && sym >= line; sym--)
		; /* find non-space */
	for (; !isspace(*sym) && sym >= line; sym--)
		; /* find space */
	sym++;    /* point to symbol */

	if (sym != line && !isspace(*line)) /* optional label on line */
		if (good_label(s1)) get_label(s1, 1);

	known = evaluate(exp, &l); /* evaluate expression */
	equ = TRUE;
	if (*sym == '*')
		if (sym[1] != '=' && !isspace(sym[1]))
			display_error(error = 'S');
		else if (known)
			loc_cntr = l;
		else
			display_error(error = 'U');
	else {
		if (isdigit(*sym)) {
			for (i = 0; isdigit(*sym); sym++)
				i = i * 10 + *sym - '0';
			makelocal(i, localsym);
			insert_symbol(localsym, l, 1, expdef, TRUE);
		} else {
			for (i = 0; i < 32; i++)
				if (isspace(sym[i]) || sym[i] == '=') {
					localsym[i] = 0;
					break;
				} else
					localsym[i] = toupper(sym[i]);
			insert_symbol(localsym, l, 1, expdef, FALSE);
		}
		ptr->value = l;
		ptr->known |= known;
		ptr->equate = TRUE;
	}
	data = 2;
	d[0] = l >> 8 & 255;
	d[1] = l & 255;
	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
leaq 0xa919(%rip), %rdi      # 0xda00
movl $0x3d, %esi
callq 0x10d0
testq %rax, %rax
jne 0x3121
leaq 0xae83(%rip), %rdi      # 0xdf80
movl $0x3d, %esi
callq 0x10d0
testq %rax, %rax
jne 0x3121
leaq 0xaf8d(%rip), %rax      # 0xe0a0
movq (%rax), %rax
xorl %ebx, %ebx
cmpb $0x3d, (%rax)
jne 0x3395
leaq 0xaf88(%rip), %rdi      # 0xe0b0
movl $0x3d, %esi
callq 0x10d0
xorl %ebx, %ebx
testq %rax, %rax
je 0x3395
movq %rax, %r12
leaq 0xaf69(%rip), %r15      # 0xe0b0
movq %r15, %rdi
movl $0x3b, %esi
callq 0x10d0
testq %rax, %rax
setne %cl
cmpq %r12, %rax
setb %al
testb %al, %cl
jne 0x3395
callq 0x1230
movq %rax, %rbx
movq (%rax), %rax
movq %r12, %r14
movsbq 0x1(%r14), %rcx
incq %r14
testq %rcx, %rcx
je 0x318f
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
jne 0x3176
decq %r12
leaq -0x1(%r12), %rcx
cmpq %r15, %r12
jb 0x31b0
movsbq (%r12), %rdx
movzwl (%rax,%rdx,2), %edx
movq %rcx, %r12
andl $0x2000, %edx           # imm = 0x2000
jne 0x3192
addq $0x4, %rcx
leaq -0x3(%rcx), %rdx
leaq -0x1(%rcx), %r12
cmpq %r15, %rdx
jb 0x31d5
movsbq -0x3(%rcx), %rcx
movzwl (%rax,%rcx,2), %edx
movq %r12, %rcx
andl $0x2000, %edx           # imm = 0x2000
je 0x31b4
leaq -0x1(%r12), %r13
cmpq 0x9e07(%rip), %r13      # 0xcfe8
je 0x320e
movsbq (%r15), %rcx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x320e
leaq 0xa893(%rip), %r15      # 0xda88
movq (%r15), %rdi
callq 0x7da0
testl %eax, %eax
je 0x320e
movq (%r15), %rdi
movl $0x1, %esi
callq 0x7e7b
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x4a37
leaq 0xb0a1(%rip), %r14      # 0xe2c3
movb %al, (%r14)
leaq 0xb096(%rip), %rcx      # 0xe2c2
movb $0x1, (%rcx)
movsbq -0x1(%r12), %rcx
cmpq $0x2a, %rcx
jne 0x3264
movsbq (%r12), %rcx
cmpq $0x3d, %rcx
je 0x32af
movq (%rbx), %rdx
testb $0x20, 0x1(%rdx,%rcx,2)
jne 0x32af
leaq 0xab99(%rip), %rax      # 0xddf0
movb $0x53, (%rax)
movl $0x53, %edi
jmp 0x331e
movq (%rbx), %rbx
testb $0x8, 0x1(%rbx,%rcx,2)
jne 0x32c7
xorl %r15d, %r15d
movsbq (%r13), %r12
cmpq $0x3d, %r12
je 0x3325
movzwl (%rbx,%r12,2), %eax
andl $0x2000, %eax           # imm = 0x2000
jne 0x3325
callq 0x1030
movq (%rax), %rax
movb (%rax,%r12,4), %al
movb %al, 0x10(%rsp,%r15)
incq %r15
incq %r13
cmpq $0x20, %r15
jne 0x3271
jmp 0x332b
testb %al, %al
je 0x330f
movq 0x8(%rsp), %rax
leaq 0xa551(%rip), %rcx      # 0xd810
movq %rax, (%rcx)
jmp 0x3373
xorl %edi, %edi
movsbl %cl, %eax
leal (%rdi,%rdi,4), %ecx
leal (%rax,%rcx,2), %edi
addl $-0x30, %edi
movsbq (%r12), %rcx
incq %r12
testb $0x8, 0x1(%rbx,%rcx,2)
jne 0x32c9
leaq 0x10(%rsp), %rbx
movq %rbx, %rsi
callq 0x8b21
movq 0x8(%rsp), %rsi
leaq 0xaadb(%rip), %rax      # 0xddd8
movl (%rax), %ecx
movq %rbx, %rdi
movl $0x1, %edx
movl $0x1, %r8d
jmp 0x3346
leaq 0xaada(%rip), %rax      # 0xddf0
movb $0x55, (%rax)
movl $0x55, %edi
callq 0x1ec8
jmp 0x3373
movb $0x0, 0x10(%rsp,%r15)
movq 0x8(%rsp), %rsi
leaq 0xaaa1(%rip), %rax      # 0xddd8
movl (%rax), %ecx
leaq 0x10(%rsp), %rdi
movl $0x1, %edx
xorl %r8d, %r8d
callq 0x8b70
movq 0x8(%rsp), %rax
leaq 0xa8e9(%rip), %rcx      # 0xdc40
movq (%rcx), %rcx
movq %rax, 0x18(%rcx)
movzbl (%r14), %eax
andl $0x1, %eax
shll $0x8, %eax
orw 0x20(%rcx), %ax
orl $0x20, %eax
movw %ax, 0x20(%rcx)
leaq 0xaf47(%rip), %rax      # 0xe2c1
movb $0x2, (%rax)
movzwl 0x8(%rsp), %eax
leaq 0xae37(%rip), %rcx      # 0xe1c0
rolw $0x8, %ax
movw %ax, (%rcx)
movl $0x1, %ebx
movl %ebx, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq