// File: /workspace/github_c_makefile_star2_O2/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 $0xf8, %rsp
movl %r9d, -0x40(%rbp)
movq %r8, -0x60(%rbp)
movq %rsi, -0x78(%rbp)
movl %edx, -0x9c(%rbp)
testl %edx, %edx
sete %al
orb %cl, %al
testb $0x1, %al
je 0xa6b5
movslq %edi, %rax
imulq $0x18, %rax, %rdx
movq %rsp, %rsi
addq $0xf, %rdx
andq $-0x10, %rdx
subq %rdx, %rsi
movq %rsi, -0x48(%rbp)
movq %rsi, %rsp
imulq $0x30, %rax, %rax
movq %rsp, %rdx
subq %rax, %rdx
movq %rdx, -0xa8(%rbp)
movq %rdx, %rsp
movq %rsp, %rdx
subq %rax, %rdx
movq %rdx, -0x98(%rbp)
movq %rdx, %rsp
movq %rsp, %rdx
subq %rax, %rdx
movq %rdx, -0x90(%rbp)
movq %rdx, %rsp
movslq %ecx, %rdx
movq %rsp, %r15
movq %rdx, -0x80(%rbp)
leaq 0x11(%rdx), %r13
andq $-0x10, %r13
movq %r15, %rax
subq %r13, %rax
movq %rax, %rsp
negq %r13
movq %rcx, -0xb0(%rbp)
movl %ecx, %eax
movl %edi, -0x50(%rbp)
imull %edi, %eax
xorl %ebx, %ebx
testl %eax, %eax
je 0xa23a
imull $0x6, %eax, %eax
cltq
decq %rax
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, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
incq %rcx
movq %rcx, -0x38(%rbp)
imulq $0x18, %rcx, %rdi
callq 0x2220
movq %rax, %r8
jmp 0xa245
movq $0x0, -0x38(%rbp)
xorl %r8d, %r8d
movq -0x60(%rbp), %rax
leal (%rax,%rax), %ecx
addb $-0x2, %cl
movl -0x40(%rbp), %edx
sarl %cl, %edx
andl $0x3, %edx
incl %edx
movl %edx, -0x4c(%rbp)
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
movl %ecx, -0x58(%rbp)
movl -0x50(%rbp), %eax
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
movq %rcx, -0x70(%rbp)
leaq (%r15,%r13), %rax
incq %rax
movq %rax, -0x88(%rbp)
movq -0x48(%rbp), %rdi
cmpq -0x70(%rbp), %rbx
je 0xa370
cmpq -0x38(%rbp), %rbx
jne 0xa2bd
leaq (%rbx,%rbx), %rcx
testq %rbx, %rbx
pushq $0x2
popq %rax
cmoveq %rax, %rcx
movq %rcx, -0x38(%rbp)
imulq $0x18, %rcx, %rsi
movq %r8, %rdi
callq 0x2260
movq %rax, %r8
imulq $0x18, %rbx, %rax
andq $0x0, (%r8,%rax)
leaq (%r8,%rax), %rcx
movq %rcx, -0x68(%rbp)
movq -0x78(%rbp), %rcx
movq (%rcx,%rbx,8), %rdi
movq 0x28(%rdi), %rcx
movq (%rcx), %rdx
movq %rdx, 0x8(%r8,%rax)
xorl %r13d, %r13d
movl -0x58(%rbp), %r12d
xorl %esi, %esi
subl $0x1, %r12d
jb 0xa357
movl -0x40(%rbp), %eax
movl %eax, %r14d
movl %r13d, %ecx
sarl %cl, %r14d
andl $0x3, %r14d
leaq -0x120(%rbp), %rcx
movq %rbx, %r15
movq %r8, %rbx
leaq -0xf0(%rbp), %r8
callq 0x37c8
movq %rbx, %r8
movq %r15, %rbx
movq -0x78(%rbp), %rax
movq (%rax,%r15,8), %rdi
movq 0x20(%rdi), %rax
movq -0x118(%rbp,%r14,8), %rsi
addq 0x8(%rax,%r14,8), %rsi
movq -0x68(%rbp), %rcx
movq %rsi, (%rcx)
movq -0xe8(%rbp,%r14,8), %rdx
addq 0x8(%rax,%r14,8), %rdx
movq %rdx, 0x8(%rcx)
addl $0x2, %r13d
jmp 0xa2eb
incq %rbx
movq -0x60(%rbp), %rax
movq -0x68(%rbp), %rcx
movl %eax, 0x10(%rcx)
movl -0x4c(%rbp), %eax
movl %eax, 0x14(%rcx)
jmp 0xa288
movl -0x58(%rbp), %eax
movq -0xb0(%rbp), %rbx
leal -0x1(%rbx), %edx
addq %rax, %rax
xorl %ecx, %ecx
leaq 0xf8b6(%rip), %rsi      # 0x19c3f
movq -0x88(%rbp), %r9
cmpq %rcx, %rax
je 0xa3b4
movl -0x40(%rbp), %edi
sarl %cl, %edi
andl $0x3, %edi
movb (%rdi,%rsi), %dil
movslq %edx, %rdx
movb %dil, (%r9,%rdx)
movq -0x48(%rbp), %rdi
decl %edx
addq $0x2, %rcx
jmp 0xa390
movq -0x88(%rbp), %rax
movq -0x80(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl %ebx, %eax
sarl %eax
movl %eax, -0x4c(%rbp)
movl -0x50(%rbp), %eax
imulq $0x18, %rax, %r9
addq %rdi, %r9
movq -0x98(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xc0(%rbp)
movq -0x90(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xb8(%rbp)
pushq $-0x18
popq %r10
movq -0x70(%rbp), %r11
movq %r9, -0x80(%rbp)
testq %r11, %r11
je 0xa681
movl $0x1e, -0x2c(%rbp)
imulq $0x18, %r11, %rax
addq %r8, %rax
movq %r10, %rcx
movl -0x50(%rbp), %edx
testl %edx, %edx
jle 0xa443
decq %r11
movq 0x10(%rax,%rcx), %rsi
movq %rsi, 0x10(%r9,%rcx)
movups (%rax,%rcx), %xmm0
movups %xmm0, (%r9,%rcx)
decl %edx
addq $-0x18, %rcx
jmp 0xa421
movl 0x10(%rdi), %ecx
movl %ebx, %eax
subl %ecx, %eax
jl 0xa404
movl %ecx, -0x60(%rbp)
movslq 0x14(%rdi), %rcx
leaq 0xfb35(%rip), %rdx      # 0x19f8f
movb (%rcx,%rdx), %cl
cltq
movq -0x88(%rbp), %rdx
leaq (%rdx,%rax), %rsi
movq %rsi, -0x58(%rbp)
movb %cl, (%rdx,%rax)
movq -0x90(%rbp), %r14
movq -0x98(%rbp), %r15
movq -0xa8(%rbp), %r13
xorl %r9d, %r9d
movq %r8, -0x40(%rbp)
movq %r11, -0x68(%rbp)
cmpq -0x70(%rbp), %r9
je 0xa520
imulq $0x18, %r9, %rax
movq (%rdi,%rax), %rsi
movq -0x78(%rbp), %rcx
movq %rdi, %rdx
movq (%rcx,%r9,8), %rdi
movq 0x28(%rdi), %rcx
cmpq (%rcx), %rsi
jae 0xa698
addq %rdx, %rax
movq 0x8(%rax), %rdx
movq %r9, %r12
imulq $0x30, %r9, %r8
movq -0x98(%rbp), %rax
leaq (%rax,%r8), %rcx
addq -0x90(%rbp), %r8
callq 0x37c8
movl -0x2c(%rbp), %eax
xorl %ecx, %ecx
cmpq $0x6, %rcx
je 0xa505
movq (%r14,%rcx,8), %rdx
subq (%r15,%rcx,8), %rdx
movq %rdx, (%r13,%rcx,8)
jne 0xa500
btrl %ecx, %eax
movl %eax, -0x2c(%rbp)
incq %rcx
jmp 0xa4e5
movq %r12, %r9
incq %r9
addq $0x30, %r13
addq $0x30, %r15
addq $0x30, %r14
movq -0x48(%rbp), %rdi
jmp 0xa491
movq 0x18(%rbp), %rdi
movl 0x20(%rbp), %esi
movl -0x60(%rbp), %r14d
movl %r14d, %edx
movq -0x58(%rbp), %rcx
movq -0xa8(%rbp), %r8
leaq -0x2c(%rbp), %r9
callq *0x10(%rbp)
movq -0x68(%rbp), %r11
movq -0x40(%rbp), %r8
xorl %eax, %eax
cmpl -0x4c(%rbp), %r14d
setne %al
cmpl $0x0, -0x9c(%rbp)
leaq 0x3(%rax,%rax), %rcx
pushq $0x5
popq %rax
cmoveq %rax, %rcx
movq %rcx, -0x58(%rbp)
movq -0xb8(%rbp), %r9
movq -0xc0(%rbp), %r10
pushq $0x1
popq %r12
movq -0x38(%rbp), %rdi
cmpq -0x58(%rbp), %r12
je 0xa66c
movl -0x2c(%rbp), %eax
btl %r12d, %eax
movq -0x48(%rbp), %rsi
jae 0xa65c
leaq (%r11,%r11), %rbx
imulq $0x18, %r11, %r14
addq $0x14, %r14
xorl %r13d, %r13d
xorl %r15d, %r15d
movq %r10, -0x40(%rbp)
movq %r12, -0x38(%rbp)
movq %r11, -0x68(%rbp)
movq %r14, -0x60(%rbp)
leaq (%r11,%r15), %rax
cmpq %r15, -0x70(%rbp)
je 0xa652
cmpq %rdi, %rax
jne 0xa60a
testq %rax, %rax
movq %rbx, %r14
pushq $0x2
popq %rax
cmoveq %rax, %rbx
imulq $0x18, %rbx, %rsi
movq %r8, %rdi
movq %r9, %r12
callq 0x2260
movq -0x40(%rbp), %r10
movq %r12, %r9
movq -0x68(%rbp), %r11
movq -0x38(%rbp), %r12
movq %rbx, %rdi
movq %r14, %rbx
movq -0x60(%rbp), %r14
movq -0x48(%rbp), %rsi
movq %rax, %r8
leaq (%r8,%r14), %rax
movq -0x78(%rbp), %rcx
movq (%rcx,%r15,8), %rcx
movq 0x20(%rcx), %rcx
movq (%r10,%r13,4), %rdx
addq (%rcx,%r12,8), %rdx
movq %rdx, -0x14(%rax,%r13,2)
movq (%r9,%r13,4), %rdx
addq (%rcx,%r12,8), %rdx
movq %rdx, -0xc(%rax,%r13,2)
movl 0x10(%rsi), %ecx
incl %ecx
movl %ecx, -0x4(%rax,%r13,2)
movl %r12d, (%rax,%r13,2)
incq %r15
addq $0xc, %r13
addq $0x2, %rbx
jmp 0xa5bb
movq %rax, %r11
movq -0xb0(%rbp), %rbx
incq %r12
addq $0x8, %r10
addq $0x8, %r9
jmp 0xa57e
movq %rdi, -0x38(%rbp)
movq -0x48(%rbp), %rdi
movq -0x80(%rbp), %r9
pushq $-0x18
popq %r10
jmp 0xa404
movq %r8, %rdi
callq 0x2040
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf6e7(%rip), %rdi      # 0x19d86
leaq 0xf68a(%rip), %rsi      # 0x19d30
leaq 0xf689(%rip), %rcx      # 0x19d36
pushq $0x45
popq %rdx
callq 0x2120
leaq 0xf65e(%rip), %rdi      # 0x19d1a
leaq 0xf66d(%rip), %rsi      # 0x19d30
leaq 0xf66c(%rip), %rcx      # 0x19d36
pushq $0x26
jmp 0xa6af