// File: /workspace/github_c_makefile_star2_O1/mist64[P]cbm6502asm/src/pass1.c
// Function: pass1
void pass1(char *macprmbgn, char **maclinptr, char *macargbgn) {
	int done, macro, savprint;

	incl_sp = MAXINCL;
	while (incl_sp <= MAXINCL) { /* consider nested includes */

		while (get_line(macprmbgn, maclinptr, macargbgn) !=
		       EOF) { /* read to end of file or macro */
			old_loc =
			        loc_cntr; /* save location couter for listing */
			macro = wrt = addr = data = equ = 0;
			print = known = 1; /* unless otherwise determined */

			if ((done = (*line == ';'))) /* don't process comments */
				spechar = *line;

			if (!*line) done = spechar = '1';

			if ((!*s2 || *s2 == ';') && condit && !done &&
			    !strchr(s1, '=')) {
				if (good_label(s1)) /* only label on line */
					get_label(s1, 1);
				done = 1;
			}

			s2[31] = 0;
			tmpmac = macro_head;
			while (tmpmac && !done &&
			       condit) { /* check if this is a macro expansion
				          */
				if (!strcmp(s2, tmpmac->name)) { /* is this a
					                            macro? */
					char *p;      /* temporary use to copy
					                 argument list */
					char *prmbgn; /* pointer to beginning of
					                 parameter list */
					char *defbgn; /* pointer to beginning of
					                 macro definition */
					char *argbgn; /* pointer to beginning of
					                 argument list */
					/* use heap for argument list - don't
					 * fill up stack */
					if (*s1)
						if (good_label(s1))
							get_label(s1, 1);
					p = argbgn =
					        (char *)malloc(strlen(s3) + 50);
					if (!p)
						error_msg(
						        "Memory allocation "
						        "failure during macro "
						        "expansion.",
						        "", 4);
					prmbgn = tmpmac->name;
					while (*prmbgn++)
						; /* point to start of parameter
						     list */
					defbgn = prmbgn + 2;
					while (*(defbgn - 1) || *(defbgn - 2))
						defbgn++; /* starts just after
						             the double null */
					parses3(1);       /* argument list */
					while (*s3 ||
					       *(s3 + 1)) /* copy arg list until
					                     double null */
						*p++ = *s3++;
					*p++ = 0;
					*p = 0;
					if (angleb | squote | dquote)
						display_error(
						        error = 'B'); /* unbalanced
						                         ",', or
						                         <> */
					print = macro = 1;
					spechar = 'M';
					outline((char)1, (char)0, (char *)0,
					        (char)0, (char)1);
					macrolevel++; /* increment macro depth
					               */
					int incl_sp_copy = incl_sp;
					pass1(prmbgn, &defbgn, argbgn);
					incl_sp = incl_sp_copy;
					macrolevel--; /* finished with macro */
					free(argbgn); /* free memory used for
					                 arguments */
					break; /* macro found - stop searching
					        */
				}
				tmpmac = tmpmac->nextmac; /* not this macro -
				                             try next if any */
			}
			if (macro) continue;
			if (!done) {
				savprint = print; /* save print flag - directive
				                     changes it */
				if (!direct1(macprmbgn, maclinptr,
				             macargbgn)) /* asm directive */
					if (!direct2()) {
						print = savprint; /* restore
						                     print flag
						                     if not
						                     directive
						                   */
						s1 = p1;
						s2 = p2;
						s3 = p3;
						if (*p1)
							if (good_label(p1))
								get_label(p1,
								          1);
						opcode(); /* better be an
						             instruction */
					}
			}

			if (!condit) print &= clist;
			outline(addr, data, d, equ, known);
		}
		if (macrolevel) return;
		fclose(file_src);
		if (incl_sp < MAXINCL) {
			strcpy(srcfile, &filename[fnptr = filnamptr[incl_sp]]);
			fprintf(file_tmp, "%32.32sF%s\n", STATLINE, srcfile);
		}
		file_src = incl_stack[incl_sp++];
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
leaq 0x5fa0(%rip), %rax      # 0xdf78
movl $0x6, (%rax)
movl $0x31, %ebx
leaq 0x60ae(%rip), %r15      # 0xe098
leaq 0x5b77(%rip), %r13      # 0xdb68
leaq 0x60a8(%rip), %r14      # 0xe0a0
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x55cc
cmpl $-0x1, %eax
je 0x83b3
leaq 0x6094(%rip), %rax      # 0xe0b0
movzbl (%rax), %eax
xorl %ebp, %ebp
cmpl $0x3b, %eax
sete %bpl
testl %eax, %eax
cmovel %ebx, %ebp
leaq 0x57dc(%rip), %rcx      # 0xd810
movq (%rcx), %rcx
leaq 0x5d92(%rip), %rdx      # 0xddd0
movq %rcx, (%rdx)
xorl %ecx, %ecx
leaq 0x6278(%rip), %rdx      # 0xe2c2
movb %cl, (%rdx)
leaq 0x626e(%rip), %rdx      # 0xe2c1
movb %cl, (%rdx)
leaq 0x6264(%rip), %rdx      # 0xe2c0
movb %cl, (%rdx)
leaq 0x5d77(%rip), %rcx      # 0xdddc
movl $0x0, (%rcx)
leaq 0x6251(%rip), %rcx      # 0xe2c3
movb $0x1, (%rcx)
leaq 0x5d70(%rip), %rcx      # 0xddec
movl $0x1, (%rcx)
cmpl $0x3b, %eax
je 0x808b
testl %eax, %eax
jne 0x809c
testb %al, %al
movzbl %al, %eax
cmovel %ebx, %eax
leaq 0x5b7c(%rip), %rcx      # 0xdc16
movb %al, (%rcx)
movq (%r15), %rax
movb (%rax), %al
testb %al, %al
je 0x80af
testl %ebp, %ebp
jne 0x8104
cmpb $0x3b, %al
je 0x80b3
jmp 0x8104
testl %ebp, %ebp
jne 0x8104
cmpl $0x0, (%r13)
je 0x8104
leaq 0x59c7(%rip), %rax      # 0xda88
movq (%rax), %r12
movq %r12, %rdi
movl $0x3d, %esi
callq 0x10d0
xorl %ebp, %ebp
testq %rax, %rax
jne 0x8104
movq %r12, %rdi
callq 0x7db8
testl %eax, %eax
je 0x80ff
leaq 0x599d(%rip), %rax      # 0xda88
movq (%rax), %rdi
movl $0x1, %ebp
movl $0x1, %esi
callq 0x7e93
jmp 0x8104
movl $0x1, %ebp
movq (%r15), %r12
movb $0x0, 0x1f(%r12)
movl (%r13), %r15d
leaq 0x5990(%rip), %r13      # 0xdaa8
movq (%r13), %r13
leaq 0x5b55(%rip), %rax      # 0xdc78
movq %r13, (%rax)
testl %ebp, %ebp
jne 0x81e6
testq %r13, %r13
je 0x81e6
testl %r15d, %r15d
je 0x81e6
leaq 0xc(%r13), %rsi
movq %r12, %rdi
callq 0x1130
testl %eax, %eax
jne 0x8118
leaq 0x5931(%rip), %rax      # 0xda88
movq (%rax), %rdi
cmpb $0x0, (%rdi)
je 0x817c
callq 0x7db8
testl %eax, %eax
je 0x817c
leaq 0x5919(%rip), %rax      # 0xda88
movq (%rax), %rdi
movl $0x1, %esi
callq 0x7e93
movq (%r14), %rdi
callq 0x10b0
leaq 0x32(%rax), %rdi
callq 0x1180
movq %rax, %rbp
testq %rax, %rax
jne 0x81ad
leaq 0x2a68(%rip), %rdi      # 0xac04
leaq 0x2994(%rip), %rsi      # 0xab37
movl $0x4, %edx
callq 0x1e94
leaq 0x5ac4(%rip), %rax      # 0xdc78
movq (%rax), %r12
addq $0xc, %r12
cmpb $0x0, (%r12)
leaq 0x1(%r12), %r12
jne 0x81bb
leaq 0x2(%r12), %rax
movq %rax, 0x20(%rsp)
cmpb $0x0, -0x1(%rax)
jne 0x81e1
cmpb $0x0, -0x2(%rax)
je 0x82cc
incq %rax
jmp 0x81cc
testl %ebp, %ebp
leaq 0x5ea9(%rip), %r15      # 0xe098
leaq 0x5972(%rip), %r13      # 0xdb68
leaq 0x5803(%rip), %r12      # 0xda00
jne 0x8279
leaq 0x5be6(%rip), %rax      # 0xddec
movl (%rax), %ebp
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x1f6e
testl %eax, %eax
jne 0x8279
xorl %eax, %eax
callq 0x3018
testl %eax, %eax
jne 0x8279
leaq 0x5bba(%rip), %rax      # 0xddec
movl %ebp, (%rax)
leaq 0x584d(%rip), %rax      # 0xda88
movq %r12, (%rax)
leaq 0x5d3b(%rip), %rax      # 0xdf80
movq %rax, (%r15)
leaq 0x5dc1(%rip), %rax      # 0xe010
movq %rax, (%r14)
cmpb $0x0, (%r12)
je 0x8272
movq %r12, %rdi
callq 0x7db8
testl %eax, %eax
je 0x8272
movq %r12, %rdi
movl $0x1, %esi
callq 0x7e93
xorl %eax, %eax
callq 0x5c58
cmpl $0x0, (%r13)
jne 0x8292
leaq 0x58f5(%rip), %rax      # 0xdb7c
movl (%rax), %eax
leaq 0x5b5c(%rip), %rcx      # 0xddec
andl %eax, (%rcx)
leaq 0x6027(%rip), %rax      # 0xe2c0
movsbl (%rax), %edi
leaq 0x601e(%rip), %rax      # 0xe2c1
movsbl (%rax), %esi
leaq 0x6015(%rip), %rax      # 0xe2c2
movsbl (%rax), %ecx
leaq 0x600c(%rip), %rax      # 0xe2c3
movsbl (%rax), %r8d
leaq 0x5efe(%rip), %rdx      # 0xe1c0
callq 0x7bf7
jmp 0x7ff8
movl $0x1, %edi
callq 0x5171
movq (%r14), %rcx
movl $0x1, %eax
cmpb $0x0, -0x1(%rcx,%rax)
jne 0x82eb
cmpb $0x0, (%rcx,%rax)
je 0x8304
leaq (%rcx,%rax), %rdx
decq %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, (%r14)
movb (%rdx), %dl
movb %dl, -0x1(%rbp,%rax)
incq %rax
jmp 0x82de
movw $0x0, -0x1(%rbp,%rax)
leaq 0x5ad6(%rip), %rax      # 0xdde8
movl (%rax), %eax
leaq 0x5ac5(%rip), %rcx      # 0xdde0
orl (%rcx), %eax
leaq 0x5ac0(%rip), %rcx      # 0xdde4
orl (%rcx), %eax
je 0x833c
leaq 0x5ac1(%rip), %rax      # 0xddf0
movb $0x42, (%rax)
movl $0x42, %edi
callq 0x1ed1
leaq 0x5aa9(%rip), %rax      # 0xddec
movl $0x1, (%rax)
leaq 0x58c6(%rip), %rax      # 0xdc16
movb $0x4d, (%rax)
movl $0x1, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x7bf7
leaq 0x57ec(%rip), %rbx      # 0xdb5c
incl (%rbx)
leaq 0x5bff(%rip), %r13      # 0xdf78
movl (%r13), %r15d
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
movq %rbp, %rdx
callq 0x7fb4
movl %r15d, (%r13)
decl (%rbx)
movq %rbp, %rdi
callq 0x1040
movl $0x31, %ebx
leaq 0x5cf1(%rip), %r15      # 0xe098
leaq 0x57ba(%rip), %r13      # 0xdb68
jmp 0x7ff8
leaq 0x57a2(%rip), %rax      # 0xdb5c
cmpl $0x0, (%rax)
jne 0x8461
leaq 0x540e(%rip), %rax      # 0xd7d8
movq (%rax), %rdi
callq 0x10a0
leaq 0x5b9f(%rip), %rax      # 0xdf78
movslq (%rax), %rax
cmpq $0x5, %rax
jg 0x8433
leaq 0x5b77(%rip), %rcx      # 0xdf60
movslq (%rcx,%rax,4), %rsi
leaq 0x56d0(%rip), %rax      # 0xdac4
movl %esi, (%rax)
addq 0x4bdb(%rip), %rsi      # 0xcfd8
leaq 0x52bc(%rip), %rbx      # 0xd6c0
movq %rbx, %rdi
callq 0x1080
leaq 0x5335(%rip), %rax      # 0xd748
movq (%rax), %rdi
leaq 0x2819(%rip), %rsi      # 0xac36
leaq 0x1c47(%rip), %rdx      # 0xa06b
movq %rbx, %rcx
movl $0x31, %ebx
xorl %eax, %eax
callq 0x1140
leaq 0x5b3e(%rip), %rdx      # 0xdf78
movslq (%rdx), %rax
leal 0x1(%rax), %ecx
movl %ecx, (%rdx)
leaq 0x59b7(%rip), %rcx      # 0xde00
movq (%rcx,%rax,8), %rcx
leaq 0x5384(%rip), %rdx      # 0xd7d8
movq %rcx, (%rdx)
cmpq $0x6, %rax
jl 0x7ff8
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq