// File: /workspace/github_c_makefile_star2_O1/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
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
leaq 0x168dd(%rip), %r14     # 0x19600
movl %ecx, %ebp
testl %ebx, %ebx
js 0x2d73
movq 0x16620(%rip), %rax     # 0x19350
movl %ebx, %r15d
movzbl (%rax,%r15), %ecx
testb $0x2, %cl
jne 0x2d73
testb $0x8, %cl
jne 0x2e3c
testb $0x1, %cl
jne 0x2e8f
movq 0x165ea(%rip), %rdx     # 0x19340
movl %ebx, %ecx
movl (%rdx,%r15,4), %ebx
movl %ebp, (%rdx,%r15,4)
orb $0x2, (%rax,%r15)
movq 0x165e4(%rip), %rax     # 0x19350
orb $0x4, (%rax,%r15)
jmp 0x2d23
cmpl $-0x1, %ebp
je 0x2f21
movq 0x165cd(%rip), %rcx     # 0x19350
movslq %ebp, %rax
movzbl (%rcx,%rax), %r9d
testb $0x8, %r9b
jne 0x2dad
movq 0x165b0(%rip), %rsi     # 0x19348
movl (%rsi,%rax,4), %edx
testb $0x4, %r9b
jne 0x2e1d
movl %ebx, (%rsi,%rax,4)
movl %edx, %ecx
movl %ebp, %ebx
jmp 0x2d23
movq 0x165a4(%rip), %rdx     # 0x19358
movq 0x1658d(%rip), %rsi     # 0x19348
movslq (%rsi,%rax,4), %rcx
leaq (%rdx,%rcx,4), %rdi
movslq -0x8(%rdi), %r8
testb $0x4, %r9b
je 0x2e06
leaq 0x1(%r8), %rcx
movslq -0x4(%rdi), %r9
addq $0x3, %r9
shrq $0x2, %r9
cmpq %rcx, %r9
jbe 0x2e06
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 0x2d23
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 0x2d23
movq 0x1651c(%rip), %rdi     # 0x19340
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 0x2d23
orb $0x2, %cl
movb %cl, (%rax,%r15)
movq 0x164f6(%rip), %rax     # 0x19340
cmpl $-0x13, (%rax,%r15,4)
jne 0x2e72
movq 0x16500(%rip), %rax     # 0x19358
movq 0x164e9(%rip), %rcx     # 0x19348
movslq (%rcx,%r15,4), %rcx
movslq -0x4(%rax,%rcx,4), %rax
addq $0x3, %rax
cmpq $0x4, %rax
jae 0x2ebe
movq 0x164df(%rip), %rax     # 0x19358
movq 0x164c8(%rip), %rcx     # 0x19348
movslq (%rcx,%r15,4), %rcx
movl %ebx, -0x8(%rax,%rcx,4)
movl %ebp, %ecx
jmp 0x2d23
movq 0x164b2(%rip), %rax     # 0x19348
movslq (%rax,%r15,4), %rdi
cmpq $-0x1, %rdi
je 0x2eff
movq 0x16499(%rip), %rax     # 0x19340
movl (%rax,%r15,4), %ecx
leal 0x10(%rcx), %edx
cmpl $0x2, %edx
jae 0x2ef5
movslq (%rax,%rdi,4), %rax
orb $0x20, (%rax,%r14)
jmp 0x2eff
movq 0x1648b(%rip), %rax     # 0x19350
orb $0x4, (%rax,%r15)
movq 0x16487(%rip), %rax     # 0x19358
movq 0x16470(%rip), %rcx     # 0x19348
movslq (%rcx,%r15,4), %rdx
movl $0x0, -0x8(%rax,%rdx,4)
movslq (%rcx,%r15,4), %rdx
movl %ebx, %ecx
movl (%rax,%rdx,4), %ebx
movl %ebp, (%rax,%rdx,4)
jmp 0x2d23
cmpl $-0xa, %ecx
jne 0x2eff
callq 0x2c7c
movq 0x16442(%rip), %rax     # 0x19348
movl %ebx, %ecx
movl (%rax,%r15,4), %ebx
movl %ebp, (%rax,%r15,4)
movq 0x16439(%rip), %rax     # 0x19350
orb $0x2, (%rax,%r15)
jmp 0x2d23
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq