// File: /workspace/github_c_makefile_star2_O3/azhai[P]mlite/mlite.c
// Function: mark
void mark(cell n) {
	cell	p, parent, *v;
	int	i;

	parent = NIL;	/* Initially, there is no parent node */
	while (1) {
		if (special_value_p(n) || Tag[n] & MARK_TAG) {
			if (parent == NIL)
				break;
			if (Tag[parent] & VECTOR_TAG) {	/* S1 --> S1|done */
				i = vector_index(parent);
				v = vector(parent);
				if (Tag[parent] & STATE_TAG &&
				    i+1 < vector_len(parent)
				) {			/* S1 --> S1 */
					p = v[i+1];
					v[i+1] = v[i];
					v[i] = n;
					n = p;
					vector_index(parent) = i+1;
				}
				else {			/* S1 --> done */
					p = parent;
					parent = v[i];
					v[i] = n;
					n = p;
				}
			}
			else if (Tag[parent] & STATE_TAG) {	/* S1 --> S2 */
				p = cdr(parent);
				cdr(parent) = car(parent);
				car(parent) = n;
				Tag[parent] &= ~STATE_TAG;
				Tag[parent] |=  MARK_TAG;
				n = p;
			}
			else {				/* S2 --> done */
				p = parent;
				parent = cdr(p);
				cdr(p) = n;
				n = p;
			}
		}
		else {
			if (Tag[n] & VECTOR_TAG) {	/* S0 --> S1|S2 */
				Tag[n] |= MARK_TAG;
				/* Tag[n] &= ~STATE_TAG; */
				vector_link(n) = n;
				if (car(n) == T_VECTOR && vector_len(n) != 0) {
					Tag[n] |= STATE_TAG;
					vector_index(n) = 0;
					v = vector(n);
					p = v[0];
					v[0] = parent;
					parent = n;
					n = p;
				}
			}
			else if (Tag[n] & ATOM_TAG) {	/* S0 --> S2 */
				if (instream_p(n) || outstream_p(n))
					Stream_flags[stream_id(n)] |= USED_TAG;
				p = cdr(n);
				cdr(n) = parent;
				/*Tag[n] &= ~STATE_TAG;*/
				parent = n;
				n = p;
				Tag[parent] |= MARK_TAG;
			}
			else {				/* S0 --> S1 */
				p = car(n);
				car(n) = parent;
				Tag[n] |= MARK_TAG;
				parent = n;
				n = p;
				Tag[parent] |= STATE_TAG;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq $-0x1, %rsi
movabsq $0x100000000, %rax      # imm = 0x100000000
leaq 0x1a93a(%rip), %rcx     # 0x1e600
movq %rsi, %rdx
testq %rdi, %rdi
js 0x3d17
movq 0x1a90b(%rip), %rsi     # 0x1e5e0
movzbl (%rsi,%rdi), %r8d
testb $0x2, %r8b
jne 0x3d17
testb $0x10, %r8b
jne 0x3dfd
testb $0x1, %r8b
jne 0x3e85
movq 0x1a475(%rip), %r8      # 0x1e170
movq (%r8,%rdi,8), %r9
movq %rdx, (%r8,%rdi,8)
orb $0x2, (%rsi,%rdi)
movq 0x1a8d2(%rip), %rdx     # 0x1e5e0
orb $0x4, (%rdx,%rdi)
jmp 0x3ec9
cmpq $-0x1, %rdx
je 0x3ed4
movq 0x1a8b8(%rip), %rsi     # 0x1e5e0
movzbl (%rsi,%rdx), %r11d
testb $0x10, %r11b
jne 0x3d57
movq 0x1a886(%rip), %r9      # 0x1e5c0
movq (%r9,%rdx,8), %r8
testb $0x4, %r11b
jne 0x3dd0
movq %rdi, (%r9,%rdx,8)
movq %r8, %rsi
movq %rdx, %rdi
jmp 0x3cc6
movq 0x1a88a(%rip), %rsi     # 0x1e5e8
movq 0x1a85b(%rip), %r10     # 0x1e5c0
movq (%r10,%rdx,8), %r8
leaq (%rsi,%r8,8), %r8
movq -0x10(%r8), %r9
shlq $0x20, %r9
testb $0x4, %r11b
je 0x3dbc
leaq (%r9,%rax), %r11
sarq $0x20, %r11
movq -0x8(%r8), %rbx
addq $0x7, %rbx
shrq $0x3, %rbx
cmpq %rbx, %r11
jae 0x3dbc
movq (%r8,%r11,8), %rbx
sarq $0x1d, %r9
movq (%r8,%r9), %r14
movq %r14, (%r8,%r11,8)
movq %rdi, (%r8,%r9)
movq (%r10,%rdx,8), %rdi
movq %r11, -0x10(%rsi,%rdi,8)
movq %rdx, %rsi
movq %rbx, %rdi
jmp 0x3cc6
sarq $0x1d, %r9
movq (%r8,%r9), %rsi
movq %rdi, (%r8,%r9)
movq %rdx, %rdi
jmp 0x3cc6
movq 0x1a399(%rip), %r10     # 0x1e170
movq (%r10,%rdx,8), %r11
movq %r11, (%r9,%rdx,8)
movq %rdi, (%r10,%rdx,8)
andb $-0x5, (%rsi,%rdx)
movq 0x1a7f2(%rip), %rsi     # 0x1e5e0
orb $0x2, (%rsi,%rdx)
movq %rdx, %rsi
movq %r8, %rdi
jmp 0x3cc6
orb $0x2, %r8b
movb %r8b, (%rsi,%rdi)
movq 0x1a7dc(%rip), %r8      # 0x1e5e8
movq 0x1a7ad(%rip), %r9      # 0x1e5c0
movq (%r9,%rdi,8), %rsi
movq %rdi, -0x18(%r8,%rsi,8)
movq 0x1a34d(%rip), %rsi     # 0x1e170
cmpq $-0x24, (%rsi,%rdi,8)
movq %rdx, %rsi
jne 0x3cc6
movq (%r9,%rdi,8), %rsi
movq -0x8(%r8,%rsi,8), %r8
addq $0x7, %r8
movq %rdx, %rsi
cmpq $0x8, %r8
jb 0x3cc6
movq 0x1a78e(%rip), %rsi     # 0x1e5e0
orb $0x4, (%rsi,%rdi)
movq 0x1a78b(%rip), %r8      # 0x1e5e8
movq 0x1a75c(%rip), %rsi     # 0x1e5c0
movq (%rsi,%rdi,8), %r9
movq $0x0, -0x10(%r8,%r9,8)
movq (%rsi,%rdi,8), %r9
movq %rdi, %rsi
movq (%r8,%r9,8), %rdi
movq %rdx, (%r8,%r9,8)
jmp 0x3cc6
testb $0x20, %r8b
je 0x3eb6
movq 0x1a2de(%rip), %r8      # 0x1e170
movq (%r8,%rdi,8), %r9
cmpq $-0x17, %r9
je 0x3ea2
cmpq $-0x19, %r9
jne 0x3eb6
movq 0x1a717(%rip), %r9      # 0x1e5c0
movq (%r9,%rdi,8), %r9
movq (%r8,%r9,8), %r8
orb $0x40, (%r8,%rcx)
movq 0x1a703(%rip), %r8      # 0x1e5c0
movq (%r8,%rdi,8), %r9
movq %rdx, (%r8,%rdi,8)
orb $0x2, (%rsi,%rdi)
movq %rdi, %rsi
movq %r9, %rdi
jmp 0x3cc6
popq %rbx
popq %r14
popq %rbp
retq