// File: /workspace/github_c_makefile_star2_O1/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 0x1a931(%rip), %rcx     # 0x1e600
movq %rsi, %rdx
testq %rdi, %rdi
js 0x3d20
movq 0x1a902(%rip), %rsi     # 0x1e5e0
movzbl (%rsi,%rdi), %r8d
testb $0x2, %r8b
jne 0x3d20
testb $0x10, %r8b
jne 0x3e08
testb $0x1, %r8b
jne 0x3e90
movq 0x1a46c(%rip), %r8      # 0x1e170
movq (%r8,%rdi,8), %r9
movq %rdx, (%r8,%rdi,8)
orb $0x2, (%rsi,%rdi)
movq 0x1a8c9(%rip), %rdx     # 0x1e5e0
orb $0x4, (%rdx,%rdi)
jmp 0x3ee8
cmpq $-0x1, %rdx
je 0x3ef3
movq 0x1a8af(%rip), %rsi     # 0x1e5e0
movzbl (%rsi,%rdx), %r11d
testb $0x10, %r11b
jne 0x3d60
movq 0x1a87d(%rip), %r9      # 0x1e5c0
movq (%r9,%rdx,8), %r8
testb $0x4, %r11b
jne 0x3ddb
movq %rdi, (%r9,%rdx,8)
movq %r8, %rsi
movq %rdx, %rdi
jmp 0x3ccf
movq 0x1a881(%rip), %rsi     # 0x1e5e8
movq 0x1a852(%rip), %r9      # 0x1e5c0
movq (%r9,%rdx,8), %r8
leaq (%rsi,%r8,8), %r8
movq -0x10(%r8), %r10
testb $0x4, %r11b
je 0x3dc8
movq %r10, %rbx
shlq $0x20, %rbx
leaq (%rbx,%rax), %r11
sarq $0x20, %r11
movq -0x8(%r8), %r14
addq $0x7, %r14
shrq $0x3, %r14
cmpq %r14, %r11
jae 0x3dc8
movq (%r8,%r11,8), %r10
sarq $0x1d, %rbx
movq (%r8,%rbx), %r14
movq %r14, (%r8,%r11,8)
movq %rdi, (%r8,%rbx)
movq (%r9,%rdx,8), %rdi
movq %r11, -0x10(%rsi,%rdi,8)
movq %rdx, %rsi
movq %r10, %rdi
jmp 0x3ccf
movslq %r10d, %r9
movq (%r8,%r9,8), %rsi
movq %rdi, (%r8,%r9,8)
movq %rdx, %rdi
jmp 0x3ccf
movq 0x1a38e(%rip), %r10     # 0x1e170
movq (%r10,%rdx,8), %r11
movq %r11, (%r9,%rdx,8)
movq %rdi, (%r10,%rdx,8)
andb $-0x5, (%rsi,%rdx)
movq 0x1a7e7(%rip), %rsi     # 0x1e5e0
orb $0x2, (%rsi,%rdx)
movq %rdx, %rsi
movq %r8, %rdi
jmp 0x3ccf
orb $0x2, %r8b
movb %r8b, (%rsi,%rdi)
movq 0x1a7d1(%rip), %r8      # 0x1e5e8
movq 0x1a7a2(%rip), %r9      # 0x1e5c0
movq (%r9,%rdi,8), %rsi
movq %rdi, -0x18(%r8,%rsi,8)
movq 0x1a342(%rip), %rsi     # 0x1e170
cmpq $-0x24, (%rsi,%rdi,8)
movq %rdx, %rsi
jne 0x3ccf
movq (%r9,%rdi,8), %rsi
movq -0x8(%r8,%rsi,8), %r8
addq $0x7, %r8
movq %rdx, %rsi
cmpq $0x8, %r8
jb 0x3ccf
movq 0x1a783(%rip), %rsi     # 0x1e5e0
orb $0x4, (%rsi,%rdi)
movq 0x1a780(%rip), %r8      # 0x1e5e8
movq 0x1a751(%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 0x3ccf
testb $0x20, %r8b
je 0x3ed5
movq 0x1a2d3(%rip), %r9      # 0x1e170
cmpq $-0x17, (%r9,%rdi,8)
jne 0x3ec1
movq 0x1a2c5(%rip), %r8      # 0x1e170
movq 0x1a70e(%rip), %r9      # 0x1e5c0
movq (%r9,%rdi,8), %r9
movq (%r8,%r9,8), %r8
orb $0x40, (%r8,%rcx)
jmp 0x3ed5
testb $0x20, %r8b
je 0x3ed5
movq 0x1a2a2(%rip), %r8      # 0x1e170
cmpq $-0x19, (%r8,%rdi,8)
je 0x3ea4
movq 0x1a6e4(%rip), %r8      # 0x1e5c0
movq (%r8,%rdi,8), %r9
movq %rdx, (%r8,%rdi,8)
orb $0x2, (%rsi,%rdi)
movq %rdi, %rsi
movq %r9, %rdi
jmp 0x3ccf
popq %rbx
popq %r14
popq %rbp
retq