// File: /workspace/github_c_makefile_star2_O2/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 0x5c53(%rip), %r15      # 0xd758
movq (%r15), %rdi
callq 0x1150
movq %rax, 0x8(%rsp)
movq (%r15), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x11b0
leaq 0x659b(%rip), %r13      # 0xe0c0
leaq 0x6154(%rip), %rbx      # 0xdc80
movq (%r15), %rdi
callq 0x1150
cmpq 0x8(%rsp), %rax
jge 0x7dce
movq %rax, %rbp
xorl %r14d, %r14d
cmpq $0x5, %r14
je 0x7b61
movq (%r15), %rdi
callq 0x1100
movb %al, (%rbx,%r14)
movb %al, 0x10(%rsp,%r14)
incq %r14
jmp 0x7b45
pushq $0x5
popq %r14
cmpq $0x20, %r14
je 0x7b7d
movq (%r15), %rdi
callq 0x1100
movb %al, 0x10(%rsp,%r14)
incq %r14
jmp 0x7b65
movb $0x0, 0x30(%rsp)
movq (%r15), %rdi
callq 0x1100
movl %eax, %r14d
xorl %r12d, %r12d
movl %eax, 0x4(%rsp)
xorl %eax, %eax
cmpq $0x10b, %r12            # imm = 0x10B
ja 0x7bb9
movzbl %al, %eax
cmpl $0xa, %eax
je 0x7bb9
movq (%r15), %rdi
callq 0x1100
movb %al, (%r13,%r12)
incq %r12
jmp 0x7b96
movb $0x0, -0x1(%r13,%r12)
shll $0x18, %r14d
cmpl $0x4d000000, %r14d      # imm = 0x4D000000
je 0x7bd9
cmpl $0x20000000, %r14d      # imm = 0x20000000
jne 0x7b2c
xorl %eax, %eax
leaq 0x66f0(%rip), %rcx      # 0xe2d2
movb %al, (%rcx)
leaq 0x66e6(%rip), %rcx      # 0xe2d1
movb %al, (%rcx)
leaq 0x66dc(%rip), %rcx      # 0xe2d0
movb %al, (%rcx)
leaq 0x66d6(%rip), %rax      # 0xe2d3
movb $0x1, (%rax)
leaq 0x61f5(%rip), %rax      # 0xddfc
movl $0x1, (%rax)
leaq 0x25(%rsp), %rdi
leaq 0x200b(%rip), %rsi      # 0x9c24
leaq 0x5f68(%rip), %rdx      # 0xdb88
xorl %eax, %eax
callq 0x1190
callq 0x1240
movq (%rax), %rax
movsbq 0x21(%rsp), %rcx
movzwl (%rax,%rcx,2), %eax
xorl %ecx, %ecx
btl $0xd, %eax
setae %cl
leaq 0x5e87(%rip), %rax      # 0xdad0
movl %ecx, (%rax)
movb 0x2d(%rsp), %al
leaq 0x607c(%rip), %rcx      # 0xdcd2
movb %al, (%rcx)
leaq 0x5bc1(%rip), %rax      # 0xd820
movq (%rax), %rax
leaq 0x6177(%rip), %rcx      # 0xdde0
movq %rax, (%rcx)
xorl %eax, %eax
callq 0x4c00
leaq 0x5fac(%rip), %rax      # 0xdc26
movl 0x4(%rsp), %ecx
movb %cl, (%rax)
cmpl $0x4d000000, %r14d      # imm = 0x4D000000
jne 0x7cad
leaq 0x6640(%rip), %rax      # 0xe2d0
movb $0x1, (%rax)
leaq 0x6416(%rip), %rax      # 0xe0b0
movq (%rax), %rax
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x6400(%rip), %rax      # 0xe0a8
movq (%rax), %rax
movb %cl, (%rax)
leaq 0x63f4(%rip), %rax      # 0xe0a8
movq (%rax), %rax
cmpb $0x0, (%rax)
jne 0x7cda
leaq 0x5dd5(%rip), %rax      # 0xda98
movq (%rax), %r14
movq %r14, %rdi
pushq $0x3d
popq %rsi
callq 0x10d0
testq %rax, %rax
je 0x7da5
xorl %eax, %eax
callq 0x2ee8
testl %eax, %eax
jne 0x7d46
leaq 0x5dac(%rip), %rax      # 0xda98
leaq 0x5d1d(%rip), %rcx      # 0xda10
movq %rcx, (%rax)
leaq 0x63ab(%rip), %rax      # 0xe0a8
leaq 0x628c(%rip), %rdx      # 0xdf90
movq %rdx, (%rax)
leaq 0x63a2(%rip), %rax      # 0xe0b0
leaq 0x630b(%rip), %rdx      # 0xe020
movq %rdx, (%rax)
cmpb $0x0, (%rcx)
je 0x7d3f
leaq 0x5cec(%rip), %rdi      # 0xda10
callq 0x74a1
testl %eax, %eax
je 0x7d3f
leaq 0x5d64(%rip), %rax      # 0xda98
movq (%rax), %rdi
pushq $0x1
popq %rsi
callq 0x7550
xorl %eax, %eax
callq 0x5878
movq (%r15), %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x11b0
leaq 0x6576(%rip), %rax      # 0xe2d0
movsbl (%rax), %edi
leaq 0x656d(%rip), %rax      # 0xe2d1
movsbl (%rax), %esi
leaq 0x6564(%rip), %rax      # 0xe2d2
movsbl (%rax), %ecx
leaq 0x655b(%rip), %rax      # 0xe2d3
movsbl (%rax), %r8d
leaq 0x644d(%rip), %rdx      # 0xe1d0
callq 0x72ed
movq (%r15), %r14
movq %r14, %rdi
callq 0x1150
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x11b0
jmp 0x7b2c
cmpb $0x0, (%r14)
je 0x7d46
movq %r14, %rdi
callq 0x74a1
testl %eax, %eax
je 0x7d46
leaq 0x5cda(%rip), %rax      # 0xda98
movq (%rax), %rdi
pushq $0x1
popq %rsi
callq 0x7550
jmp 0x7d46
movq (%r15), %rdi
movq 0x8(%rsp), %rsi
xorl %edx, %edx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11b0
nop