// File: /workspace/github_c_makefile_star2_O1/mist64[P]cbm6502asm/src/pass2.c
// Function: pass2
void pass2() {
	char linestat[FIRSTCHAR + 1], spec, c;
	int i;
	long filepos, fileeof;

	fileeof = ftell(file_tmp);
	fseek(file_tmp, 0L, 0);
	while ((filepos = ftell(file_tmp)) < fileeof) {
		for (c = i = 0; i < 5; i++)
			c = linestat[i] = error_field[i] = fgetc(file_tmp);
		for (; i < FIRSTCHAR; i++) c = linestat[i] = fgetc(file_tmp);
		linestat[FIRSTCHAR] = 0;
		spec = fgetc(file_tmp);
		for (c = i = 0; i < 2 * LINELENG && c != '\n'; i++)
			c = line[i] = fgetc(file_tmp);
		line[--i] = 0;
		if (spec != ' ' && spec != 'M') continue;
		addr = data = equ = 0;
		print = known = 1;
		sscanf(&linestat[21], "%8d", &linenum);
		forcelong = !isspace(linestat[17]);
		maclev = linestat[29];
		old_loc = loc_cntr;
		parselin();
		if ((spechar = spec) == 'M') {
			addr = TRUE;
			*s2 = *s3 = 0;
		}
		if (*s2 || strchr(s1, '=')) {
			if (!direct2()) {
				s1 = p1;
				s2 = p2;
				s3 = p3;
				if (*s1)
					if (good_label(s1)) get_label(s1, 1);
				opcode();
			}
		} else if (*s1)
			if (good_label(s1)) get_label(s1, 1);
		fseek(file_tmp, filepos, 0);
		outline(addr, data, d, equ, known);
		fseek(file_tmp, ftell(file_tmp), 0);
	}
	fseek(file_tmp, fileeof, 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
leaq 0x52c3(%rip), %r15      # 0xd748
movq (%r15), %rdi
callq 0x1150
movq %rax, %rbx
movq (%r15), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x11a0
movq (%r15), %rdi
callq 0x1150
movq %rbx, (%rsp)
cmpq %rbx, %rax
jge 0x8762
leaq 0x57b8(%rip), %r13      # 0xdc70
leaq 0x5bf1(%rip), %rbx      # 0xe0b0
movq %rax, 0x8(%rsp)
xorl %r14d, %r14d
movq (%r15), %rdi
callq 0x1100
movb %al, (%r13,%r14)
movb %al, 0x10(%rsp,%r14)
incq %r14
cmpq $0x5, %r14
jne 0x84c7
movl $0x5, %r14d
movq (%r15), %rdi
callq 0x1100
movb %al, 0x10(%rsp,%r14)
incq %r14
cmpq $0x20, %r14
jne 0x84e8
movb $0x0, 0x30(%rsp)
movq (%r15), %rdi
callq 0x1100
movl %eax, %r14d
movl %eax, %r12d
xorl %ecx, %ecx
movq %rcx, %rbp
movq (%r15), %rdi
callq 0x1100
movb %al, (%rbx,%rbp)
leaq 0x1(%rbp), %rcx
cmpq $0x10a, %rbp            # imm = 0x10A
ja 0x8536
movzbl %al, %eax
cmpl $0xa, %eax
jne 0x8513
movb $0x0, -0x1(%rbx,%rcx)
shll $0x18, %r14d
cmpl $0x4d000000, %r14d      # imm = 0x4D000000
je 0x8555
cmpl $0x20000000, %r14d      # imm = 0x20000000
jne 0x871f
xorl %eax, %eax
leaq 0x5d64(%rip), %rcx      # 0xe2c2
movb %al, (%rcx)
leaq 0x5d5a(%rip), %rcx      # 0xe2c1
movb %al, (%rcx)
leaq 0x5d50(%rip), %rcx      # 0xe2c0
movb %al, (%rcx)
leaq 0x5d4a(%rip), %rax      # 0xe2c3
movb $0x1, (%rax)
leaq 0x5869(%rip), %rax      # 0xddec
movl $0x1, (%rax)
leaq 0x25(%rsp), %rdi
leaq 0x26ad(%rip), %rsi      # 0xac42
leaq 0x55dc(%rip), %rdx      # 0xdb78
xorl %eax, %eax
callq 0x1190
callq 0x1230
movq (%rax), %rax
movsbq 0x21(%rsp), %rcx
movzwl (%rax,%rcx,2), %eax
xorl %ecx, %ecx
btl $0xd, %eax
setae %cl
leaq 0x54fb(%rip), %rax      # 0xdac0
movl %ecx, (%rax)
movb 0x2d(%rsp), %al
leaq 0x56f0(%rip), %rcx      # 0xdcc2
movb %al, (%rcx)
leaq 0x5235(%rip), %rax      # 0xd810
movq (%rax), %rax
leaq 0x57eb(%rip), %rcx      # 0xddd0
movq %rax, (%rcx)
xorl %eax, %eax
callq 0x4e6c
leaq 0x5620(%rip), %rax      # 0xdc16
movb %r12b, (%rax)
cmpl $0x4d000000, %r14d      # imm = 0x4D000000
jne 0x8626
leaq 0x5cb7(%rip), %rax      # 0xe2c0
movb $0x1, (%rax)
leaq 0x5a8d(%rip), %rax      # 0xe0a0
movq (%rax), %rax
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x5a77(%rip), %rax      # 0xe098
movq (%rax), %rax
movb %cl, (%rax)
leaq 0x5a6b(%rip), %rax      # 0xe098
movq (%rax), %rax
cmpb $0x0, (%rax)
jne 0x8655
leaq 0x544c(%rip), %rax      # 0xda88
movq (%rax), %r14
movq %r14, %rdi
movl $0x3d, %esi
callq 0x10d0
testq %rax, %rax
je 0x8733
xorl %eax, %eax
callq 0x3018
testl %eax, %eax
jne 0x86c3
leaq 0x5421(%rip), %rax      # 0xda88
leaq 0x5392(%rip), %rcx      # 0xda00
movq %rcx, (%rax)
leaq 0x5a20(%rip), %rax      # 0xe098
leaq 0x5901(%rip), %rdx      # 0xdf80
movq %rdx, (%rax)
leaq 0x5a17(%rip), %rax      # 0xe0a0
leaq 0x5980(%rip), %rdx      # 0xe010
movq %rdx, (%rax)
cmpb $0x0, (%rcx)
je 0x86bc
leaq 0x5361(%rip), %rdi      # 0xda00
callq 0x7db8
testl %eax, %eax
je 0x86bc
leaq 0x53d9(%rip), %rax      # 0xda88
movq (%rax), %rdi
movl $0x1, %esi
callq 0x7e93
xorl %eax, %eax
callq 0x5c58
movq (%r15), %rdi
movq 0x8(%rsp), %rsi
xorl %edx, %edx
callq 0x11a0
leaq 0x5be7(%rip), %rax      # 0xe2c0
movsbl (%rax), %edi
leaq 0x5bde(%rip), %rax      # 0xe2c1
movsbl (%rax), %esi
leaq 0x5bd5(%rip), %rax      # 0xe2c2
movsbl (%rax), %ecx
leaq 0x5bcc(%rip), %rax      # 0xe2c3
movsbl (%rax), %r8d
leaq 0x5abe(%rip), %rdx      # 0xe1c0
callq 0x7bf7
movq (%r15), %r14
movq %r14, %rdi
callq 0x1150
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x11a0
movq (%r15), %rdi
callq 0x1150
cmpq (%rsp), %rax
jl 0x84bf
jmp 0x8762
cmpb $0x0, (%r14)
je 0x86c3
movq %r14, %rdi
callq 0x7db8
testl %eax, %eax
je 0x86c3
leaq 0x5338(%rip), %rax      # 0xda88
movq (%rax), %rdi
movl $0x1, %esi
callq 0x7e93
jmp 0x86c3
movq (%r15), %rdi
movq (%rsp), %rsi
xorl %edx, %edx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11a0
nop