// File: /workspace/github_c_makefile_star2_O3/lh3[P]fermi2/dfs.c
// Function: fm_dfs_core
void fm_dfs_core(int n, rld_t *const*e, int is_half, int max_k, int suf_len, int suf, fmdfs_f func, void *data, int tid)
{ // this routine is similar to fmc_collect1()
	int i, j, c;
	fmint6_t *size, *tk, *tl;
	elem_t *t;
	char *_path, *path;
	uint64_t ok[6], ol[6];
	kvec_t(elem_t) stack = {0,0,0};

	assert((max_k&1) || !is_half);
	t = alloca(sizeof(elem_t) * n);
	size = alloca(sizeof(fmint6_t) * n);
	tk = alloca(sizeof(fmint6_t) * n);
	tl = alloca(sizeof(fmint6_t) * n);
	_path = alloca(max_k + 2);
	path = _path + 1;
	kv_resize(elem_t, stack, n * max_k * 6);
	// descend
	for (i = 0; i < n; ++i) {
		elem_t *p;
		kv_pushp(elem_t, stack, &p);
		p->k = 0, p->l = e[i]->mcnt[0];
		for (j = 0; j < suf_len; ++j) {
			c = (suf>>j*2&3) + 1;
			rld_rank2a(e[i], p->k, p->l, ok, ol);
			p->k = e[i]->cnt[c] + ok[c];
			p->l = e[i]->cnt[c] + ol[c];
		}
		p->d = suf_len, p->c = (suf>>(suf_len-1)*2&3) + 1;
	}
	for (j = 0; j < suf_len; ++j)
		path[max_k - j - 1] = "ACGT"[suf>>j*2&3];
	path[max_k] = 0;
	// traverse
	while (stack.n) {
		int end, cont = 0x1E;
		for (i = n - 1; i >= 0; --i) t[i] = kv_pop(stack);
		if (t->d > max_k) continue;
		path[max_k - t->d] = "\0ACGTN"[t->c];
		for (i = 0; i < n; ++i) {
			assert(t[i].k < e[i]->mcnt[0]);
			rld_rank2a(e[i], t[i].k, t[i].l, tk[i].c, tl[i].c);
			for (c = 0; c < 6; ++c) {
				size[i].c[c] = tl[i].c[c] - tk[i].c[c];
				if (size[i].c[c] == 0) cont &= ~(1<<c);
			}
		}
		func(data, tid, t->d, path + (max_k - t->d), size, &cont);
		end = t->d == max_k>>1 && is_half? 2 : 4;
		for (c = 1; c <= end; ++c) {
			if ((cont>>c&1) == 0) continue;
			for (i = 0; i < n; ++i) {
				elem_t *p;
				kv_pushp(elem_t, stack, &p);
				p->k = e[i]->cnt[c] + tk[i].c[c];
				p->l = e[i]->cnt[c] + tl[i].c[c];
				p->d = t->d + 1;
				p->c = c;
			}
		}
	}
	free(stack.a);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %r8, -0x48(%rbp)
movl %ecx, %ebx
movq %rsi, -0x68(%rbp)
movl %edx, -0xb0(%rbp)
testl %edx, %edx
sete %al
orb %bl, %al
testb $0x1, %al
je 0xbfdb
movl %r9d, %r13d
movl %edi, %r14d
movslq %edi, %rax
leaq (%rax,%rax,2), %rcx
movq %rsp, %rdx
leaq 0xf(,%rcx,8), %rcx
andq $-0x10, %rcx
subq %rcx, %rdx
movq %rdx, -0xa0(%rbp)
movq %rdx, %rsp
shlq $0x4, %rax
leaq (%rax,%rax,2), %rax
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0xb8(%rbp)
movq %rcx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x98(%rbp)
movq %rcx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x90(%rbp)
movq %rcx, %rsp
movslq %ebx, %r12
movq %rsp, %rax
leaq 0x11(%r12), %rcx
andq $-0x10, %rcx
movq %rax, -0x80(%rbp)
subq %rcx, %rax
movq %rax, %rsp
movl %ebx, %eax
imull %edi, %eax
testl %eax, %eax
je 0xbab2
addl %eax, %eax
leal (%rax,%rax,2), %eax
cltq
decq %rax
movq %rcx, -0x60(%rbp)
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %r15
shrq $0x10, %r15
orq %rax, %r15
leaq 0x8(,%r15,8), %rax
incq %r15
leaq (%rax,%rax,2), %rdi
callq 0x2220
movq -0x60(%rbp), %rcx
movq %rax, %rdi
jmp 0xbab7
xorl %r15d, %r15d
xorl %edi, %edi
negq %rcx
movl %r14d, %eax
movq %rax, -0x78(%rbp)
movl %r14d, -0x4c(%rbp)
testl %r14d, %r14d
movq %rbx, -0xc0(%rbp)
movq %r12, -0x88(%rbp)
jle 0xbc32
movq %rcx, -0x60(%rbp)
movq -0x48(%rbp), %r14
leal (%r14,%r14), %ecx
addb $-0x2, %cl
movl %r13d, -0x58(%rbp)
sarl %cl, %r13d
andl $0x3, %r13d
incl %r13d
movl %r13d, -0x70(%rbp)
xorl %r9d, %r9d
leaq -0x140(%rbp), %r13
leaq -0x110(%rbp), %r8
movq -0x68(%rbp), %rcx
cmpq %r15, %r9
jne 0xbb52
leaq (%r15,%r15), %rbx
testq %r15, %r15
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rax
leaq (%rax,%rax,2), %rsi
movq %r9, %r15
callq 0x2260
leaq -0x110(%rbp), %r8
movq %r15, %r9
movq -0x68(%rbp), %rcx
movq %rax, %rdi
movq %rbx, -0x40(%rbp)
jmp 0xbb56
movq %r15, -0x40(%rbp)
leaq (%r9,%r9,2), %rax
movq %rdi, -0x30(%rbp)
leaq (%rdi,%rax,8), %rbx
movq $0x0, (%rbx)
movq (%rcx,%r9,8), %rdi
movq 0x28(%rdi), %rax
movq (%rax), %rdx
movq %rdx, 0x8(%rbx)
testl %r14d, %r14d
movl -0x58(%rbp), %r11d
jle 0xbbfa
xorl %r15d, %r15d
movq -0x48(%rbp), %rax
movl %eax, %r14d
xorl %esi, %esi
movq %r9, -0xa8(%rbp)
movl %r11d, %r12d
movl %r15d, %ecx
sarl %cl, %r12d
andl $0x3, %r12d
movq %r13, %rcx
movl %r11d, %r13d
callq 0x4c20
movl %r13d, %r11d
leaq -0x110(%rbp), %r8
movq -0xa8(%rbp), %r9
leaq -0x140(%rbp), %r13
movq -0x68(%rbp), %rcx
movq (%rcx,%r9,8), %rdi
movq 0x20(%rdi), %rax
movq -0x138(%rbp,%r12,8), %rsi
addq 0x8(%rax,%r12,8), %rsi
movq %rsi, (%rbx)
movq -0x108(%rbp,%r12,8), %rdx
addq 0x8(%rax,%r12,8), %rdx
movq %rdx, 0x8(%rbx)
addl $0x2, %r15d
decl %r14d
jne 0xbb94
incq %r9
movq -0x48(%rbp), %r14
movl %r14d, 0x10(%rbx)
movl -0x70(%rbp), %eax
movl %eax, 0x14(%rbx)
cmpq -0x78(%rbp), %r9
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %r15
jne 0xbb12
movq -0x78(%rbp), %r12
movq -0xc0(%rbp), %rbx
movl -0x58(%rbp), %r13d
movq -0x60(%rbp), %rcx
jmp 0xbc41
movq %r15, -0x40(%rbp)
movq %rdi, -0x30(%rbp)
xorl %r12d, %r12d
movq -0x48(%rbp), %r14
movq -0x80(%rbp), %rax
leaq (%rax,%rcx), %r9
incq %r9
testl %r14d, %r14d
jle 0xbc81
movl %r14d, %eax
leal -0x1(%rbx), %edx
addq %rax, %rax
xorl %ecx, %ecx
leaq 0x1208c(%rip), %rsi     # 0x1dcef
movl %r13d, %edi
sarl %cl, %edi
andl $0x3, %edi
movb (%rdi,%rsi), %dil
movslq %edx, %rdx
movb %dil, (%r9,%rdx)
decl %edx
addq $0x2, %rcx
cmpq %rcx, %rax
jne 0xbc63
movq -0x88(%rbp), %rax
movb $0x0, (%r9,%rax)
testq %r12, %r12
movl -0x4c(%rbp), %edi
je 0xbfa4
movl %ebx, %eax
sarl %eax
movl %eax, -0xac(%rbp)
movq -0x78(%rbp), %rcx
leaq 0x1(%rcx), %rax
movq %rax, -0x80(%rbp)
leaq (,%rcx,8), %rax
leaq (%rax,%rax,2), %rdx
movq -0xa0(%rbp), %rax
movq %rdx, -0xa8(%rbp)
leaq (%rax,%rdx), %r10
negq %rcx
movq %rcx, -0xd8(%rbp)
movq -0x98(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xd0(%rbp)
movq -0x90(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xc8(%rbp)
movq -0x40(%rbp), %rsi
movq %r9, -0x70(%rbp)
movq %r10, -0x60(%rbp)
movl $0x1e, -0x34(%rbp)
testl %edi, %edi
jle 0xbd56
movq %rsi, %r8
leaq (%r12,%r12,2), %rax
movq -0x30(%rbp), %rcx
leaq (%rcx,%rax,8), %rax
addq -0xd8(%rbp), %r12
movq $-0x18, %rcx
movq -0x80(%rbp), %rdx
movq 0x10(%rax,%rcx), %rsi
movq %rsi, 0x10(%r10,%rcx)
movups (%rax,%rcx), %xmm0
movups %xmm0, (%r10,%rcx)
decq %rdx
addq $-0x18, %rcx
cmpq $0x1, %rdx
jg 0xbd33
movq %r8, %rsi
movq -0xa0(%rbp), %rcx
movl 0x10(%rcx), %edx
movl %ebx, %eax
subl %edx, %eax
jge 0xbd6f
movq -0x30(%rbp), %rdi
jmp 0xbf85
movl %edx, -0x58(%rbp)
movq %rsi, -0x40(%rbp)
movslq %eax, %rsi
movslq 0x14(%rcx), %rax
leaq 0x122bb(%rip), %rdx     # 0x1e03f
movb (%rax,%rdx), %al
movq %rsi, -0x88(%rbp)
movb %al, (%r9,%rsi)
testl %edi, %edi
movq %rcx, %rbx
jle 0xbe40
movq -0x90(%rbp), %r14
movq -0x98(%rbp), %r15
movq -0xb8(%rbp), %r13
xorl %r8d, %r8d
leaq (%r8,%r8,2), %rax
movq (%rbx,%rax,8), %rsi
movq -0x68(%rbp), %rcx
movq (%rcx,%r8,8), %rdi
movq 0x28(%rdi), %rcx
cmpq (%rcx), %rsi
jae 0xbfbc
leaq (%rbx,%rax,8), %rax
movq 0x8(%rax), %rdx
movq %r8, -0x48(%rbp)
movq %r8, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %r8
movq -0x98(%rbp), %rax
leaq (%rax,%r8), %rcx
addq -0x90(%rbp), %r8
callq 0x4c20
movl -0x34(%rbp), %eax
xorl %ecx, %ecx
movq (%r14,%rcx,8), %rdx
subq (%r15,%rcx,8), %rdx
movq %rdx, (%r13,%rcx,8)
jne 0xbe1a
btrl %ecx, %eax
movl %eax, -0x34(%rbp)
incq %rcx
cmpq $0x6, %rcx
jne 0xbe05
movq -0x48(%rbp), %r8
incq %r8
addq $0x30, %r13
addq $0x30, %r15
addq $0x30, %r14
cmpq -0x78(%rbp), %r8
jne 0xbdb5
movq -0x88(%rbp), %rcx
addq -0x70(%rbp), %rcx
movq 0x18(%rbp), %rdi
movl 0x20(%rbp), %esi
movl -0x58(%rbp), %r14d
movl %r14d, %edx
movq -0xb8(%rbp), %r8
leaq -0x34(%rbp), %r9
callq *0x10(%rbp)
xorl %eax, %eax
cmpl -0xac(%rbp), %r14d
setne %al
cmpl $0x0, -0xb0(%rbp)
leaq 0x3(%rax,%rax), %rcx
movl $0x5, %eax
cmoveq %rax, %rcx
movq %rcx, -0x58(%rbp)
movl $0x1, %r13d
movq -0xc8(%rbp), %r8
movq -0xd0(%rbp), %r10
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
cmpl $0x0, -0x4c(%rbp)
setle %al
movl -0x34(%rbp), %ecx
btl %r13d, %ecx
setae %cl
orb %al, %cl
jne 0xbf70
leaq (,%r12,8), %rax
leaq (%rax,%rax,2), %r11
xorl %r15d, %r15d
movq -0x68(%rbp), %r14
movq %r10, -0x30(%rbp)
movq %r8, -0x40(%rbp)
cmpq %rsi, %r12
jne 0xbf25
leaq (%rsi,%rsi), %rbx
testq %rsi, %rsi
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rax
leaq (%rax,%rax,2), %rsi
movq %r12, -0x48(%rbp)
movq %r11, %r12
callq 0x2260
movq %r12, %r11
movq -0x30(%rbp), %r10
movq -0x40(%rbp), %r8
movq -0x48(%rbp), %r12
movq %rax, %rdi
movq %rbx, %rsi
movq -0xa0(%rbp), %rbx
incq %r12
leaq (%rdi,%r11), %rax
movq (%r14), %rcx
movq 0x20(%rcx), %rcx
movq (%r10,%r15,2), %rdx
addq (%rcx,%r13,8), %rdx
movq %rdx, (%r15,%rax)
movq (%r8,%r15,2), %rdx
addq (%rcx,%r13,8), %rdx
movq %rdx, 0x8(%r15,%rax)
movl 0x10(%rbx), %ecx
incl %ecx
movl %ecx, 0x10(%r15,%rax)
movl %r13d, 0x14(%r15,%rax)
addq $0x8, %r14
addq $0x18, %r15
cmpq %r15, -0xa8(%rbp)
jne 0xbedc
incq %r13
addq $0x8, %r10
addq $0x8, %r8
cmpq -0x58(%rbp), %r13
jne 0xbea8
movq %rdi, -0x30(%rbp)
testq %r12, %r12
movq -0xc0(%rbp), %rbx
movl -0x4c(%rbp), %edi
movq -0x70(%rbp), %r9
movq -0x60(%rbp), %r10
jne 0xbd07
movq -0x30(%rbp), %rdi
callq 0x2040
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11e73(%rip), %rdi     # 0x1de36
leaq 0x11e16(%rip), %rsi     # 0x1dde0
leaq 0x11e15(%rip), %rcx     # 0x1dde6
movl $0x45, %edx
callq 0x2120
leaq 0x11de8(%rip), %rdi     # 0x1ddca
leaq 0x11df7(%rip), %rsi     # 0x1dde0
leaq 0x11df6(%rip), %rcx     # 0x1dde6
movl $0x26, %edx
callq 0x2120