// File: /workspace/github_c_makefile_star2_O1/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 0xa9a5(%rip), %rdi      # 0xda00
movl $0x3d, %esi
callq 0x10d0
testq %rax, %rax
jne 0x3095
leaq 0xaf0f(%rip), %rdi      # 0xdf80
movl $0x3d, %esi
callq 0x10d0
testq %rax, %rax
jne 0x3095
leaq 0xb019(%rip), %rax      # 0xe0a0
movq (%rax), %rax
xorl %ebx, %ebx
cmpb $0x3d, (%rax)
jne 0x331b
leaq 0xb014(%rip), %rdi      # 0xe0b0
movl $0x3d, %esi
callq 0x10d0
xorl %ebx, %ebx
testq %rax, %rax
je 0x331b
movq %rax, %r12
leaq 0xaff5(%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 0x331b
callq 0x1230
movq %rax, %rbx
movq (%rax), %rax
movq %r12, %r14
movsbq 0x1(%r14), %rcx
incq %r14
testq %rcx, %rcx
je 0x3103
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
jne 0x30ea
decq %r12
leaq -0x1(%r12), %rcx
cmpq %r15, %r12
jb 0x3124
movsbq (%r12), %rdx
movzwl (%rax,%rdx,2), %edx
movq %rcx, %r12
andl $0x2000, %edx           # imm = 0x2000
jne 0x3106
addq $0x3, %rcx
leaq -0x2(%rcx), %rdx
leaq -0x1(%rcx), %r12
cmpq %r15, %rdx
jb 0x3149
movsbq -0x2(%rcx), %rcx
movzwl (%rax,%rcx,2), %edx
movq %r12, %rcx
andl $0x2000, %edx           # imm = 0x2000
je 0x3128
cmpq 0x9e90(%rip), %r12      # 0xcfe0
je 0x317d
movsbq (%r15), %rcx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x317d
leaq 0xa924(%rip), %r15      # 0xda88
movq (%r15), %rdi
callq 0x7db8
testl %eax, %eax
je 0x317d
movq (%r15), %rdi
movl $0x1, %esi
callq 0x7e93
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x49bd
leaq 0xb132(%rip), %r14      # 0xe2c3
movb %al, (%r14)
leaq 0xb127(%rip), %rcx      # 0xe2c2
movb $0x1, (%rcx)
movsbq (%r12), %rcx
cmpq $0x2a, %rcx
jne 0x31d3
movsbq 0x1(%r12), %rcx
cmpq $0x3d, %rcx
je 0x3224
movq (%rbx), %rdx
testb $0x20, 0x1(%rdx,%rcx,2)
jne 0x3224
leaq 0xac2a(%rip), %rax      # 0xddf0
movb $0x53, (%rax)
movl $0x53, %edi
jmp 0x32a4
movq (%rbx), %rax
testb $0x8, 0x1(%rax,%rcx,2)
jne 0x323c
xorl %r15d, %r15d
movsbq (%r12), %r13
cmpq $0x3d, %r13
je 0x32ab
movq (%rbx), %rax
movzwl (%rax,%r13,2), %eax
andl $0x2000, %eax           # imm = 0x2000
jne 0x32ab
callq 0x1030
movq (%rax), %rax
movb (%rax,%r13,4), %al
movb %al, 0x10(%rsp,%r15)
incq %r15
incq %r12
cmpq $0x20, %r15
jne 0x31e0
jmp 0x32b1
testb %al, %al
je 0x3295
movq 0x8(%rsp), %rax
leaq 0xa5dc(%rip), %rcx      # 0xd810
movq %rax, (%rcx)
jmp 0x32f9
movsbq (%r12), %rcx
xorl %edi, %edi
testb $0x8, 0x1(%rax,%rcx,2)
je 0x326a
incq %r12
xorl %edi, %edi
movsbl %cl, %ecx
leal (%rdi,%rdi,4), %edx
leal (%rcx,%rdx,2), %edi
addl $-0x30, %edi
movsbq (%r12), %rcx
incq %r12
testb $0x8, 0x1(%rax,%rcx,2)
jne 0x324f
leaq 0x10(%rsp), %rbx
movq %rbx, %rsi
callq 0x8b0f
movq 0x8(%rsp), %rsi
leaq 0xab55(%rip), %rax      # 0xddd8
movl (%rax), %ecx
movq %rbx, %rdi
movl $0x1, %edx
movl $0x1, %r8d
jmp 0x32cc
leaq 0xab54(%rip), %rax      # 0xddf0
movb $0x55, (%rax)
movl $0x55, %edi
callq 0x1ed1
jmp 0x32f9
movb $0x0, 0x10(%rsp,%r15)
movq 0x8(%rsp), %rsi
leaq 0xab1b(%rip), %rax      # 0xddd8
movl (%rax), %ecx
leaq 0x10(%rsp), %rdi
movl $0x1, %edx
xorl %r8d, %r8d
callq 0x8b5e
movq 0x8(%rsp), %rax
leaq 0xa963(%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 0xafc1(%rip), %rax      # 0xe2c1
movb $0x2, (%rax)
movzwl 0x8(%rsp), %eax
leaq 0xaeb1(%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