// File: /workspace/github_c_makefile_star2_O0/lh3[P]fermi2/dfs.c
// Function: fm_dfs2_core
void fm_dfs2_core(int n, rld_t *const*e, int is_half, int max_k, int suf_len, int suf, fmdfs2_f func, void *data, int tid)
{ // this is the bidirectional version of fm_dfs_core(), requiring a bidirectional FM-index
	int i, j, c;
	rldintv_t *t, *o;
	char *_path, *path;
	kvec_t(rldintv_t) stack = {0,0,0};

	// check if the input is correct
	assert((max_k&1) || !is_half);
	for (i = 0; i < n; ++i) // check bidirectionality
		assert(e[i]->mcnt[2] == e[i]->mcnt[5] && e[i]->mcnt[3] == e[i]->mcnt[4]);
	// allocation
	t = alloca(sizeof(rldintv_t) * n);
	o = alloca(sizeof(rldintv_t) * n * 6);
	_path = alloca(max_k + 2);
	path = _path + 1;
	kv_resize(rldintv_t, stack, n * max_k * 6);
	// descend
	for (i = 0; i < n; ++i) {
		rldintv_t *p, t[6];
		kv_pushp(rldintv_t, stack, &p);
		p->x[0] = p->x[1] = p->info = 0, p->x[2] = e[i]->mcnt[0];
		for (j = 0; j < suf_len; ++j) {
			rld_extend(e[i], p, t, 1);
			*p = t[(suf>>j*2&3) + 1];
		}
		p->info = suf_len<<8 | ((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, depth;
		rldintv_t *oi;
		for (i = n - 1; i >= 0; --i) t[i] = kv_pop(stack);
		depth = t->info>>8;
		if (depth > max_k) continue;
		path[max_k - depth] = "\0ACGTN"[t->info&0xff];
		for (i = 0, oi = o; i < n; ++i, oi += 6) {
			rld_extend(e[i], &t[i], oi, 1);
			for (c = 0; c < 6; ++c)
				if (oi[c].x[2] == 0) cont &= ~(1<<c);
		}
		func(data, tid, depth, path + (max_k - depth), t, o, &cont);
		end = depth == max_k>>1 && is_half? 2 : 4;
		for (c = 1; c <= end; ++c) {
			if ((cont>>c&1) == 0) continue;
			for (i = 0, oi = o; i < n; ++i, oi += 6) {
				rldintv_t *p;
				kv_pushp(rldintv_t, stack, &p);
				*p = oi[c];
				p->info = (depth + 1) << 8 | c;
			}
		}
	}
	free(stack.a);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movl 0x20(%rbp), %eax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
leaq -0x68(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2160
movl -0x18(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xfcbc
cmpl $0x0, -0x14(%rbp)
jne 0xfcbe
jmp 0xfcdd
leaq 0x1cf35(%rip), %rdi     # 0x2cbfa
leaq 0x1cf44(%rip), %rsi     # 0x2cc10
movl $0x65, %edx
leaq 0x1cfa5(%rip), %rcx     # 0x2cc7d
callq 0x2140
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0xfd75
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x28(%rcx), %rcx
cmpq 0x28(%rcx), %rax
jne 0xfd46
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x28(%rcx), %rcx
cmpq 0x20(%rcx), %rax
jne 0xfd46
jmp 0xfd65
leaq 0x1cf82(%rip), %rdi     # 0x2cccf
leaq 0x1cebc(%rip), %rsi     # 0x2cc10
movl $0x67, %edx
leaq 0x1cf1d(%rip), %rcx     # 0x2cc7d
callq 0x2140
jmp 0xfd67
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xfce4
movslq -0x4(%rbp), %rcx
shlq $0x5, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0x38(%rbp)
movslq -0x4(%rbp), %rax
shlq $0x6, %rax
leaq (%rax,%rax,2), %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0x40(%rbp)
movslq -0x18(%rbp), %rcx
addq $0x11, %rcx
andq $-0x10, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
movq -0x60(%rbp), %rax
movl -0x4(%rbp), %ecx
imull -0x18(%rbp), %ecx
imull $0x6, %ecx, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jae 0xfe6e
movl -0x4(%rbp), %eax
imull -0x18(%rbp), %eax
imull $0x6, %eax, %eax
cltq
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
shrq %rax
orq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
shrq $0x2, %rax
orq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
shrq $0x4, %rax
orq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
shrq $0x8, %rax
orq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
shrq $0x10, %rax
orq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rsi
shlq $0x5, %rsi
callq 0x2270
movq %rax, -0x58(%rbp)
jmp 0xfe70
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0xffe6
jmp 0xfe85
movq -0x68(%rbp), %rax
cmpq -0x60(%rbp), %rax
jne 0xfed4
cmpq $0x0, -0x60(%rbp)
je 0xfea6
movq -0x60(%rbp), %rax
shlq %rax
movq %rax, -0x158(%rbp)
jmp 0xfeb4
movl $0x2, %eax
movq %rax, -0x158(%rbp)
jmp 0xfeb4
movq -0x158(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rsi
shlq $0x5, %rsi
callq 0x2270
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x68(%rbp)
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x70(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x70(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rax
movq (%rax), %rcx
movq -0x70(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xffb0
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x70(%rbp), %rsi
leaq -0x130(%rbp), %rdx
movl $0x1, %ecx
callq 0x49a0
movq -0x70(%rbp), %rax
movl -0x20(%rbp), %edx
movl -0x28(%rbp), %ecx
shll %ecx
sarl %cl, %edx
movl %edx, %ecx
andl $0x3, %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq -0x130(%rbp), %rcx
shlq $0x5, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xff37
movl -0x1c(%rbp), %eax
shll $0x8, %eax
movl -0x20(%rbp), %edx
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
shll %ecx
sarl %cl, %edx
movl %edx, %ecx
andl $0x3, %ecx
addl $0x1, %ecx
orl %ecx, %eax
movslq %eax, %rcx
movq -0x70(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xfe77
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x1002d
movl -0x20(%rbp), %eax
movl -0x28(%rbp), %ecx
shll %ecx
sarl %cl, %eax
andl $0x3, %eax
movslq %eax, %rcx
leaq 0x1cb13(%rip), %rax     # 0x2cb1f
movb (%rax,%rcx), %dl
movq -0x50(%rbp), %rax
movl -0x18(%rbp), %ecx
subl -0x28(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xffed
movq -0x50(%rbp), %rax
movslq -0x18(%rbp), %rcx
movb $0x0, (%rax,%rcx)
cmpq $0x0, -0x68(%rbp)
je 0x10380
movl $0x1e, -0x138(%rbp)
movl -0x4(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0x100ac
movq -0x38(%rbp), %rax
movslq -0x24(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq -0x58(%rbp), %rcx
movq -0x68(%rbp), %rdx
addq $-0x1, %rdx
movq %rdx, -0x68(%rbp)
shlq $0x5, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x10057
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x8, %rax
movl %eax, -0x13c(%rbp)
movl -0x13c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jle 0x100ce
jmp 0x10039
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rcx
andq $0xff, %rcx
leaq 0x1cdc1(%rip), %rax     # 0x2cea5
movb (%rax,%rcx), %dl
movq -0x50(%rbp), %rax
movl -0x18(%rbp), %ecx
subl -0x13c(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl $0x0, -0x24(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x148(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x101b4
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x38(%rbp), %rsi
movslq -0x24(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rsi
movq -0x148(%rbp), %rdx
movl $0x1, %ecx
callq 0x49a0
movl $0x0, -0x2c(%rbp)
cmpl $0x6, -0x2c(%rbp)
jge 0x10190
movq -0x148(%rbp), %rax
movslq -0x2c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, 0x10(%rax)
jne 0x10183
movl -0x2c(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
xorl $-0x1, %eax
andl -0x138(%rbp), %eax
movl %eax, -0x138(%rbp)
jmp 0x10185
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1014b
jmp 0x10192
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x148(%rbp), %rax
addq $0xc0, %rax
movq %rax, -0x148(%rbp)
jmp 0x1010c
movq 0x10(%rbp), %rax
movq 0x18(%rbp), %rdi
movl 0x20(%rbp), %esi
movl -0x13c(%rbp), %edx
movq -0x50(%rbp), %rcx
movl -0x18(%rbp), %r8d
subl -0x13c(%rbp), %r8d
movslq %r8d, %r8
addq %r8, %rcx
movq -0x38(%rbp), %r8
movq -0x40(%rbp), %r9
leaq -0x138(%rbp), %r10
subq $0x10, %rsp
movq %r10, (%rsp)
callq *%rax
addq $0x10, %rsp
movl -0x13c(%rbp), %ecx
movl -0x18(%rbp), %edx
sarl %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x159(%rbp)
jne 0x1021b
cmpl $0x0, -0x14(%rbp)
setne %al
movb %al, -0x159(%rbp)
movb -0x159(%rbp), %dl
movl $0x4, %eax
movl $0x2, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x134(%rbp)
movl $0x1, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x134(%rbp), %eax
jg 0x1037b
movl -0x138(%rbp), %eax
movl -0x2c(%rbp), %ecx
sarl %cl, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x10265
jmp 0x1036d
movl $0x0, -0x24(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x148(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x1036b
jmp 0x10285
movq -0x68(%rbp), %rax
cmpq -0x60(%rbp), %rax
jne 0x102d4
cmpq $0x0, -0x60(%rbp)
je 0x102a6
movq -0x60(%rbp), %rax
shlq %rax
movq %rax, -0x168(%rbp)
jmp 0x102b4
movl $0x2, %eax
movq %rax, -0x168(%rbp)
jmp 0x102b4
movq -0x168(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rsi
shlq $0x5, %rsi
callq 0x2270
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x68(%rbp)
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x150(%rbp)
movq -0x150(%rbp), %rax
movq -0x148(%rbp), %rcx
movslq -0x2c(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
movl -0x13c(%rbp), %eax
addl $0x1, %eax
shll $0x8, %eax
orl -0x2c(%rbp), %eax
movslq %eax, %rcx
movq -0x150(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x148(%rbp), %rax
addq $0xc0, %rax
movq %rax, -0x148(%rbp)
jmp 0x10277
jmp 0x1036d
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1023e
jmp 0x10039
movq -0x58(%rbp), %rdi
callq 0x2040
movq %rbp, %rsp
popq %rbp
retq
nop