// File: /workspace/github_c_makefile_star2_O2/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 0x691b(%rip), %rax      # 0xdf88
movl $0x6, (%rax)
pushq $0x6
popq %rax
leaq 0x6c55(%rip), %rbx      # 0xe2d2
leaq 0x6a24(%rip), %r13      # 0xe0a8
leaq 0x6a25(%rip), %r14      # 0xe0b0
cmpl $0x6, %eax
jg 0x7ae0
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x5232
cmpl $-0x1, %eax
je 0x7a38
leaq 0x6168(%rip), %rax      # 0xd820
movq (%rax), %rax
leaq 0x671e(%rip), %rcx      # 0xdde0
movq %rax, (%rcx)
xorl %ebp, %ebp
movb %bpl, (%rbx)
leaq 0x6c00(%rip), %rax      # 0xe2d1
movb %bpl, (%rax)
leaq 0x6bf5(%rip), %rax      # 0xe2d0
movb %bpl, (%rax)
leaq 0x6707(%rip), %rax      # 0xddec
andl $0x0, (%rax)
leaq 0x6be4(%rip), %rax      # 0xe2d3
movb $0x1, (%rax)
leaq 0x6703(%rip), %rax      # 0xddfc
movl $0x1, (%rax)
leaq 0x69ba(%rip), %rax      # 0xe0c0
movzbl (%rax), %ecx
cmpl $0x3b, %ecx
je 0x771a
movb $0x1, %al
testl %ecx, %ecx
jne 0x7728
movb $0x31, %cl
pushq $0x31
jmp 0x771c
pushq $0x1
popq %rbp
leaq 0x6502(%rip), %rax      # 0xdc26
movb %cl, (%rax)
xorl %eax, %eax
movq (%r13), %rcx
movb (%rcx), %cl
testb %cl, %cl
je 0x774d
cmpb $0x3b, %cl
sete %cl
leaq 0x6439(%rip), %rdx      # 0xdb78
cmpl $0x0, (%rdx)
setne %dl
andb %cl, %dl
testb %dl, %al
jne 0x7760
jmp 0x779c
leaq 0x6424(%rip), %rcx      # 0xdb78
cmpl $0x0, (%rcx)
sete %cl
xorb $0x1, %al
orb %cl, %al
jne 0x779c
leaq 0x6331(%rip), %rax      # 0xda98
movq (%rax), %r12
movq %r12, %rdi
pushq $0x3d
popq %rsi
callq 0x10d0
xorl %ebp, %ebp
testq %rax, %rax
jne 0x779c
movq %r12, %rdi
callq 0x74a1
pushq $0x1
popq %rbp
testl %eax, %eax
je 0x779c
leaq 0x6306(%rip), %rax      # 0xda98
movq (%rax), %rdi
movl %ebp, %esi
callq 0x7550
movq (%r13), %r12
movb $0x0, 0x1f(%r12)
leaq 0x63cb(%rip), %rax      # 0xdb78
movl (%rax), %r15d
leaq 0x6301(%rip), %r13      # 0xdab8
movq (%r13), %r13
leaq 0x64c6(%rip), %rax      # 0xdc88
movq %r13, (%rax)
testl %ebp, %ebp
jne 0x787e
testq %r13, %r13
je 0x787e
testl %r15d, %r15d
je 0x787e
leaq 0xc(%r13), %rsi
movq %r12, %rdi
callq 0x1130
testl %eax, %eax
jne 0x77b7
leaq 0x62a2(%rip), %rax      # 0xda98
movq (%rax), %rdi
cmpb $0x0, (%rdi)
je 0x7819
callq 0x74a1
testl %eax, %eax
je 0x7819
leaq 0x628a(%rip), %rax      # 0xda98
movq (%rax), %rdi
pushq $0x1
popq %rsi
callq 0x7550
movq (%r14), %rdi
callq 0x10b0
leaq 0x32(%rax), %rdi
callq 0x1180
movq %rax, %r12
testq %rax, %rax
jne 0x7848
leaq 0x23ad(%rip), %rdi      # 0x9be6
leaq 0x22d9(%rip), %rsi      # 0x9b19
pushq $0x4
popq %rdx
callq 0x1ddf
leaq 0x6439(%rip), %rax      # 0xdc88
movq (%rax), %rbp
addq $0xc, %rbp
cmpb $0x0, (%rbp)
leaq 0x1(%rbp), %rbp
jne 0x7856
leaq 0x2(%rbp), %rax
movq %rax, 0x20(%rsp)
cmpb $0x0, -0x1(%rax)
jne 0x7879
cmpb $0x0, -0x2(%rax)
je 0x7960
incq %rax
jmp 0x7864
testl %ebp, %ebp
leaq 0x6821(%rip), %r13      # 0xe0a8
jne 0x7916
leaq 0x6568(%rip), %rax      # 0xddfc
movl (%rax), %ebp
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x1eae
testl %eax, %eax
jne 0x790c
xorl %eax, %eax
callq 0x2ee8
testl %eax, %eax
jne 0x790c
leaq 0x653c(%rip), %rax      # 0xddfc
movl %ebp, (%rax)
leaq 0x61cf(%rip), %rax      # 0xda98
leaq 0x6140(%rip), %r15      # 0xda10
movq %r15, (%rax)
leaq 0x66b6(%rip), %rax      # 0xdf90
movq %rax, (%r13)
leaq 0x673b(%rip), %rax      # 0xe020
movq %rax, (%r14)
cmpb $0x0, (%r15)
je 0x7905
movq %r15, %rdi
callq 0x74a1
testl %eax, %eax
je 0x7905
movq %r15, %rdi
pushq $0x1
popq %rsi
callq 0x7550
xorl %eax, %eax
callq 0x5878
leaq 0x6265(%rip), %rax      # 0xdb78
movl (%rax), %r15d
testl %r15d, %r15d
jne 0x792d
leaq 0x626a(%rip), %rax      # 0xdb8c
movl (%rax), %eax
leaq 0x64d1(%rip), %rcx      # 0xddfc
andl %eax, (%rcx)
leaq 0x699c(%rip), %rax      # 0xe2d0
movsbl (%rax), %edi
leaq 0x6993(%rip), %rax      # 0xe2d1
movsbl (%rax), %esi
movsbl (%rbx), %ecx
leaq 0x6988(%rip), %rax      # 0xe2d3
movsbl (%rax), %r8d
leaq 0x687a(%rip), %rdx      # 0xe1d0
callq 0x72ed
jmp 0x7694
pushq $0x1
popq %rdi
callq 0x4e5f
movq (%r14), %rcx
pushq $0x1
popq %rax
cmpb $0x0, -0x1(%rcx,%rax)
jne 0x797b
cmpb $0x0, (%rcx,%rax)
je 0x7995
leaq (%rcx,%rax), %rdx
decq %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, (%r14)
movb (%rdx), %dl
movb %dl, -0x1(%r12,%rax)
incq %rax
jmp 0x796e
andw $0x0, -0x1(%r12,%rax)
leaq 0x6455(%rip), %rax      # 0xddf8
movl (%rax), %eax
leaq 0x6444(%rip), %rcx      # 0xddf0
orl (%rcx), %eax
leaq 0x643f(%rip), %rcx      # 0xddf4
orl (%rcx), %eax
je 0x79cb
leaq 0x6440(%rip), %rax      # 0xde00
movb $0x42, (%rax)
pushq $0x42
popq %rdi
callq 0x1e1c
leaq 0x642a(%rip), %rax      # 0xddfc
movl $0x1, (%rax)
leaq 0x6247(%rip), %rax      # 0xdc26
movb $0x4d, (%rax)
pushq $0x1
popq %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl %edi, %r8d
callq 0x72ed
leaq 0x6172(%rip), %rbx      # 0xdb6c
incl (%rbx)
leaq 0x6585(%rip), %r13      # 0xdf88
movl (%r13), %r15d
movq %rbp, %rdi
leaq 0x20(%rsp), %rsi
movq %r12, %rdx
callq 0x7649
movl %r15d, (%r13)
decl (%rbx)
movq %r12, %rdi
callq 0x1040
leaq 0x68a6(%rip), %rbx      # 0xe2d2
leaq 0x6675(%rip), %r13      # 0xe0a8
jmp 0x7694
leaq 0x612d(%rip), %rax      # 0xdb6c
cmpl $0x0, (%rax)
leaq 0x653f(%rip), %r15      # 0xdf88
jne 0x7ae0
leaq 0x5d92(%rip), %rax      # 0xd7e8
movq (%rax), %rdi
callq 0x10a0
movslq (%r15), %rcx
cmpq $0x5, %rcx
jg 0x7abd
leaq 0x6502(%rip), %rax      # 0xdf70
movslq (%rax,%rcx,4), %rsi
leaq 0x605b(%rip), %rax      # 0xdad4
movl %esi, (%rax)
addq 0x555e(%rip), %rsi      # 0xcfe0
leaq 0x5c47(%rip), %rbx      # 0xd6d0
movq %rbx, %rdi
callq 0x1080
leaq 0x5cc0(%rip), %rax      # 0xd758
movq (%rax), %rdi
leaq 0x2176(%rip), %rsi      # 0x9c18
leaq 0x15c2(%rip), %rdx      # 0x906b
movq %rbx, %rcx
leaq 0x681f(%rip), %rbx      # 0xe2d2
xorl %eax, %eax
callq 0x1140
movl (%r15), %ecx
leal 0x1(%rcx), %eax
movl %eax, (%r15)
movslq %ecx, %rcx
leaq 0x6343(%rip), %rdx      # 0xde10
movq (%rdx,%rcx,8), %rcx
leaq 0x5d10(%rip), %rdx      # 0xd7e8
movq %rcx, (%rdx)
jmp 0x768b
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop