// File: /workspace/github_c_makefile_star2_O0/lh3[P]fermi2/correct.c
// Function: fmc_collect1
void fmc_collect1(const rld_t *e, uint8_t *qtab[2], int suf_len, int depth, int min_occ, int max_ec_depth, int q1_depth, const rldintv_t *start, fmc64_v *a)
{
	rldintv_v stack = {0,0,0};
	uint64_t x = 0, *p;

	kv_push(rldintv_t, stack, *start);
	stack.a[0].info = 0;
	a->n = 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) { // reach the length; collect info at the two tips
			rldintv_t t[6];
			int val[2];
			kv_pushp(uint64_t, *a, &p);
			rld_extend(e, &top, t, 1); // backward tip
			val[0] = fmc_intv2tip(qtab, t, max_ec_depth, q1_depth, min_occ);
			rld_extend(e, &top, t, 0); // forward tip
			val[1] = fmc_intv2tip(qtab, t, max_ec_depth, q1_depth, min_occ);
			*p = fmc_cell_set_keyval(x, val[0], val[1]);
		} else {
			int c, end = (suf_len + (top.info>>2)) == (suf_len + depth) / 2? 2 : 4;
			rldintv_t t[6];
			rld_extend(e, &top, t, 1);
			for (c = 1; c <= end; ++c) {
				if (t[c].x[2] < min_occ) continue;
				t[c].info = ((top.info>>2) + 1) << 2 | (c - 1);
				kv_push(rldintv_t, stack, t[c]);
			}
		}
	}
	free(stack.a);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2160
movq $0x0, -0x40(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0x7d33
cmpq $0x0, -0x30(%rbp)
je 0x7d05
movq -0x30(%rbp), %rax
shlq %rax
movq %rax, -0x208(%rbp)
jmp 0x7d13
movl $0x2, %eax
movq %rax, -0x208(%rbp)
jmp 0x7d13
movq -0x208(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
shlq $0x5, %rsi
callq 0x2270
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rbp)
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rbp), %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)
movq -0x28(%rbp), %rax
movq $0x0, 0x18(%rax)
movq 0x20(%rbp), %rax
movq $0x0, (%rax)
cmpq $0x0, -0x38(%rbp)
je 0x80ef
movq -0x28(%rbp), %rax
movq -0x38(%rbp), %rcx
addq $-0x1, %rcx
movq %rcx, -0x38(%rbp)
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x68(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x60(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x58(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
shrq $0x2, %rax
cmpq $0x0, %rax
jbe 0x7e18
movq -0x50(%rbp), %rax
shrq $0x2, %rax
subq $0x1, %rax
shlq %rax
movl %eax, -0x6c(%rbp)
movq -0x40(%rbp), %rax
movl -0x6c(%rbp), %ecx
movl $0x3, %edx
shlq %cl, %rdx
movq %rdx, %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq -0x50(%rbp), %rdx
andq $0x3, %rdx
movl -0x6c(%rbp), %ecx
shlq %cl, %rdx
movq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x50(%rbp), %rax
shrq $0x2, %rax
movslq -0x18(%rbp), %rcx
cmpq %rcx, %rax
jne 0x7f5f
jmp 0x7e2f
movq 0x20(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x7ea0
movq 0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x7e5f
movq 0x20(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x210(%rbp)
jmp 0x7e6d
movl $0x2, %eax
movq %rax, -0x210(%rbp)
jmp 0x7e6d
movq -0x210(%rbp), %rcx
movq 0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x20(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2270
movq %rax, %rcx
movq 0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x20(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x130(%rbp), %rdx
leaq -0x68(%rbp), %rsi
movl $0x1, %ecx
callq 0x49a0
movq -0x10(%rbp), %rdi
leaq -0x130(%rbp), %rsi
movl -0x20(%rbp), %edx
movl 0x10(%rbp), %ecx
movl -0x1c(%rbp), %r8d
callq 0x79d0
movl %eax, -0x138(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x130(%rbp), %rdx
leaq -0x68(%rbp), %rsi
xorl %ecx, %ecx
callq 0x49a0
movq -0x10(%rbp), %rdi
leaq -0x130(%rbp), %rsi
movl -0x20(%rbp), %edx
movl 0x10(%rbp), %ecx
movl -0x1c(%rbp), %r8d
callq 0x79d0
movl %eax, -0x134(%rbp)
movq -0x40(%rbp), %rcx
shlq $0x1c, %rcx
movl -0x134(%rbp), %eax
shll $0xe, %eax
cltq
orq %rax, %rcx
movslq -0x138(%rbp), %rax
orq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
jmp 0x80ea
movslq -0x14(%rbp), %rax
movq -0x50(%rbp), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x218(%rbp)
movl -0x14(%rbp), %eax
addl -0x18(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movq -0x218(%rbp), %rdx
movslq %eax, %rsi
movl $0x4, %eax
movl $0x2, %ecx
cmpq %rsi, %rdx
cmovel %ecx, %eax
movl %eax, -0x140(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x200(%rbp), %rdx
leaq -0x68(%rbp), %rsi
movl $0x1, %ecx
callq 0x49a0
movl $0x1, -0x13c(%rbp)
movl -0x13c(%rbp), %eax
cmpl -0x140(%rbp), %eax
jg 0x80e8
movslq -0x13c(%rbp), %rcx
leaq -0x200(%rbp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x1c(%rbp), %rcx
cmpq %rcx, %rax
jae 0x7fff
jmp 0x80d4
movq -0x50(%rbp), %rcx
shrq $0x2, %rcx
addq $0x1, %rcx
shlq $0x2, %rcx
movl -0x13c(%rbp), %eax
subl $0x1, %eax
cltq
orq %rax, %rcx
movslq -0x13c(%rbp), %rdx
leaq -0x200(%rbp), %rax
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
movq -0x38(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0x8085
cmpq $0x0, -0x30(%rbp)
je 0x8057
movq -0x30(%rbp), %rax
shlq %rax
movq %rax, -0x220(%rbp)
jmp 0x8065
movl $0x2, %eax
movq %rax, -0x220(%rbp)
jmp 0x8065
movq -0x220(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
shlq $0x5, %rsi
callq 0x2270
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rbp)
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x13c(%rbp), %rdx
leaq -0x200(%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 0x80d4
movl -0x13c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
jmp 0x7fc6
jmp 0x80ea
jmp 0x7d86
movq -0x28(%rbp), %rdi
callq 0x2040
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
nopw %cs:(%rax,%rax)