// File: /workspace/github_c_makefile_star2_O0/lh3[P]fermi2/correct.c
// Function: fmc_traverse
rldintv_t *fmc_traverse(const rld_t *e, int depth) // traverse FM-index up to $depth
{
	rldintv_v stack = {0,0,0};
	rldintv_t *p, *ret;
	uint64_t x;

	ret = calloc(1<<depth*2, sizeof(rldintv_t));
	kv_pushp(rldintv_t, stack, &p);
	p->x[0] = p->x[1] = 0, p->x[2] = e->mcnt[0], p->info = 0;
	x = 0;
	while (stack.n) {
		rldintv_t top = kv_pop(stack);
		if (top.info>>2 > 0) {
			int shift = ((top.info>>2) - 1) << 1;
			x = (x & ~(3ULL<<shift)) | (uint64_t)(top.info&3)<<shift;
		}
		if (top.info>>2 != depth) {
			int c;
			rldintv_t t[6];
			rld_extend(e, &top, t, 1);
			for (c = 1; c < 5; ++c) {
				if (t[c].x[2] == 0) continue;
				t[c].info = ((top.info>>2) + 1) << 2 | (c - 1);
				kv_push(rldintv_t, stack, t[c]);
			}
		} else ret[x] = top, ret[x].info = x;
	}
	free(stack.a);
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq -0x28(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2160
movl -0xc(%rbp), %ecx
shll %ecx
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rdi
movl $0x20, %esi
callq 0x21a0
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x773e
cmpq $0x0, -0x20(%rbp)
je 0x7710
movq -0x20(%rbp), %rax
shlq %rax
movq %rax, -0x138(%rbp)
jmp 0x771e
movl $0x2, %eax
movq %rax, -0x138(%rbp)
jmp 0x771e
movq -0x138(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
shlq $0x5, %rsi
callq 0x2270
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x30(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x18(%rax)
movq $0x0, -0x40(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x79af
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
addq $-0x1, %rcx
movq %rcx, -0x28(%rbp)
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x60(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x58(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x50(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
shrq $0x2, %rax
cmpq $0x0, %rax
jbe 0x782c
movq -0x48(%rbp), %rax
shrq $0x2, %rax
subq $0x1, %rax
shlq %rax
movl %eax, -0x64(%rbp)
movq -0x40(%rbp), %rax
movl -0x64(%rbp), %ecx
movl $0x3, %edx
shlq %cl, %rdx
movq %rdx, %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq -0x48(%rbp), %rdx
andq $0x3, %rdx
movl -0x64(%rbp), %ecx
shlq %cl, %rdx
movq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x48(%rbp), %rax
shrq $0x2, %rax
movslq -0xc(%rbp), %rcx
cmpq %rcx, %rax
je 0x7965
movq -0x8(%rbp), %rdi
leaq -0x130(%rbp), %rdx
leaq -0x60(%rbp), %rsi
movl $0x1, %ecx
callq 0x49a0
movl $0x1, -0x68(%rbp)
cmpl $0x5, -0x68(%rbp)
jge 0x7963
movslq -0x68(%rbp), %rcx
leaq -0x130(%rbp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, 0x10(%rax)
jne 0x7889
jmp 0x7955
movq -0x48(%rbp), %rcx
shrq $0x2, %rcx
addq $0x1, %rcx
shlq $0x2, %rcx
movl -0x68(%rbp), %eax
subl $0x1, %eax
cltq
orq %rax, %rcx
movslq -0x68(%rbp), %rdx
leaq -0x130(%rbp), %rax
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x7909
cmpq $0x0, -0x20(%rbp)
je 0x78db
movq -0x20(%rbp), %rax
shlq %rax
movq %rax, -0x140(%rbp)
jmp 0x78e9
movl $0x2, %eax
movq %rax, -0x140(%rbp)
jmp 0x78e9
movq -0x140(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
shlq $0x5, %rsi
callq 0x2270
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x68(%rbp), %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)
jmp 0x7955
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x7861
jmp 0x79aa
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq -0x60(%rbp), %rcx
movq %rcx, (%rax)
movq -0x58(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x50(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
jmp 0x779a
movq -0x18(%rbp), %rdi
callq 0x2040
movq -0x38(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)