// File: /workspace/github_c_makefile_star2_O2/blakemcbride[P]LISP9/ls9.c
// Function: mark
void mark(cell n) {
	cell	x, parent, *v;
	int	i;

	parent = NIL;
	while (1) {
		if (specialp(n) || (tag(n) & MARK_TAG)) {
			if (NIL == parent)
				break;
			if (tag(parent) & VECTOR_TAG) { /* S1 --> S1|done */
				i = vecndx(parent);
				v = vector(parent);
				if (tag(parent) & TRAV_TAG &&
				    i+1 < veclen(parent)
				) {			/* S1 --> S1 */
					x = v[i+1];
					v[i+1] = v[i];
					v[i] = n;
					n = x;
					vecndx(parent) = i+1;
				}
				else {			/* S1 --> done */
					x = parent;
					parent = v[i];
					v[i] = n;
					n = x;
					veclink(n) = n;
				}
			}
			else if (tag(parent) & TRAV_TAG) { /* S1 --> S2 */
				x = cdr(parent);
				cdr(parent) = car(parent);
				car(parent) = n;
				tag(parent) &= ~TRAV_TAG;
				n = x;
			}
			else {				/* S2 --> done */
				x = parent;
				parent = cdr(x);
				cdr(x) = n;
				n = x;
			}
		}
		else if (tag(n) & VECTOR_TAG) {		/* S0 --> S1 */
			tag(n) |= MARK_TAG;
			if (T_VECTOR == car(n) && veclen(n) != 0) {
				tag(n) |= TRAV_TAG;
				vecndx(n) = 0;
				v = vector(n);
				x = v[0];
				v[0] = parent;
				parent = n;
				n = x;
			}
			else {
				veclink(n) = n;
			}
		}
		else if (tag(n) & ATOM_TAG) {		/* S0 --> S2 */
			if (cdr(n) != NIL) {
				if (T_BYTECODE == car(n)) {
					marklit(cdr(n));
				}
				else if (T_INPORT == car(n) ||
					 T_OUTPORT == car(n)
				)
					Port_flags[portno(n)] |= USED_TAG;
			}
			x = cdr(n);
			cdr(n) = parent;
			parent = n;
			n = x;
			tag(parent) |= MARK_TAG;
		}
		else {					/* S0 --> S1 */
			x = car(n);
			car(n) = parent;
			tag(n) |= MARK_TAG;
			parent = n;
			n = x;
			tag(parent) |= TRAV_TAG;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
pushq $-0x1
popq %rcx
leaq 0x14a6b(%rip), %r14     # 0x17600
movl %ecx, %ebp
testl %ebx, %ebx
js 0x2be5
movq 0x147ae(%rip), %rax     # 0x17350
movl %ebx, %r15d
movzbl (%rax,%r15), %ecx
testb $0x2, %cl
jne 0x2be5
testb $0x8, %cl
jne 0x2cae
testb $0x1, %cl
jne 0x2cef
movq 0x14778(%rip), %rdx     # 0x17340
movl %ebx, %ecx
movl (%rdx,%r15,4), %ebx
movl %ebp, (%rdx,%r15,4)
orb $0x2, (%rax,%r15)
movq 0x14772(%rip), %rax     # 0x17350
orb $0x4, (%rax,%r15)
jmp 0x2b95
cmpl $-0x1, %ebp
je 0x2d80
movq 0x1475b(%rip), %rcx     # 0x17350
movslq %ebp, %rax
movzbl (%rcx,%rax), %r9d
testb $0x8, %r9b
jne 0x2c1f
movq 0x1473e(%rip), %rsi     # 0x17348
movl (%rsi,%rax,4), %edx
testb $0x4, %r9b
jne 0x2c8f
movl %ebx, (%rsi,%rax,4)
movl %edx, %ecx
movl %ebp, %ebx
jmp 0x2b95
movq 0x14732(%rip), %rdx     # 0x17358
movq 0x1471b(%rip), %rsi     # 0x17348
movslq (%rsi,%rax,4), %rcx
leaq (%rdx,%rcx,4), %rdi
movslq -0x8(%rdi), %r8
testb $0x4, %r9b
je 0x2c78
leaq 0x1(%r8), %rcx
movslq -0x4(%rdi), %r9
addq $0x3, %r9
shrq $0x2, %r9
cmpq %rcx, %r9
jbe 0x2c78
movl (%rdi,%r8,4), %r9d
movl 0x4(%rdi,%r8,4), %r10d
movl %r9d, 0x4(%rdi,%r8,4)
movl %ebx, (%rdi,%r8,4)
movslq (%rsi,%rax,4), %rax
movl %ecx, -0x8(%rdx,%rax,4)
movl %ebp, %ecx
movl %r10d, %ebx
jmp 0x2b95
movl (%rdi,%r8,4), %ecx
movl %ebx, (%rdi,%r8,4)
movslq (%rsi,%rax,4), %rax
movl %ebp, -0x8(%rdx,%rax,4)
movl %ebp, %ebx
jmp 0x2b95
movq 0x146aa(%rip), %rdi     # 0x17340
movl (%rdi,%rax,4), %r8d
movl %r8d, (%rsi,%rax,4)
movl %ebx, (%rdi,%rax,4)
andb $-0x5, (%rcx,%rax)
movl %ebp, %ecx
movl %edx, %ebx
jmp 0x2b95
orb $0x2, %cl
movb %cl, (%rax,%r15)
movq 0x14684(%rip), %rax     # 0x17340
cmpl $-0x13, (%rax,%r15,4)
movq 0x14690(%rip), %rax     # 0x17358
movq 0x14679(%rip), %rcx     # 0x17348
movslq (%rcx,%r15,4), %rcx
jne 0x2ce4
movslq -0x4(%rax,%rcx,4), %rdx
addq $0x3, %rdx
cmpq $0x4, %rdx
jae 0x2d20
movl %ebx, -0x8(%rax,%rcx,4)
movl %ebp, %ecx
jmp 0x2b95
movq 0x14652(%rip), %rdx     # 0x17348
movslq (%rdx,%r15,4), %rdi
cmpq $-0x1, %rdi
je 0x2d6c
movq 0x14639(%rip), %rcx     # 0x17340
movl (%rcx,%r15,4), %esi
leal 0x10(%rsi), %r8d
cmpl $0x2, %r8d
jae 0x2d54
movslq (%rcx,%rdi,4), %rcx
orb $0x20, (%rcx,%r14)
jmp 0x2d6c
movq 0x14629(%rip), %rax     # 0x17350
orb $0x4, (%rax,%r15)
movq 0x14625(%rip), %rax     # 0x17358
movq 0x1460e(%rip), %rcx     # 0x17348
movslq (%rcx,%r15,4), %rdx
andl $0x0, -0x8(%rax,%rdx,4)
movslq (%rcx,%r15,4), %rdx
movl %ebx, %ecx
movl (%rax,%rdx,4), %ebx
movl %ebp, (%rax,%rdx,4)
jmp 0x2b95
cmpl $-0xa, %esi
jne 0x2d6c
callq 0x2ae8
movq 0x145e3(%rip), %rdx     # 0x17348
movq 0x145e4(%rip), %rax     # 0x17350
movl %ebx, %ecx
movl (%rdx,%r15,4), %ebx
movl %ebp, (%rdx,%r15,4)
orb $0x2, (%rax,%r15)
jmp 0x2b95
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq