// File: /workspace/github_c_makefile_star2_O0/lh3[P]fermi2/match.c
// Function: fmd_smem1_core
int fmd_smem1_core(const rld_t *e, int min_occ, int len, const uint8_t *q, int x, fmdsmem_v *mem, rldintv_v *curr, rldintv_v *prev)
{ // for more comments, see bwa/bwt.c
	int i, j, c, ret;
	rldintv_t ik, ok[6];
	rldintv_v *swap;
	size_t oldn = mem->n;

	fmd_set_intv(e, q[x], ik);
	ik.info = x + 1;
	if (ik.x[2] == 0) return x + 1;
	for (i = x + 1, curr->n = 0; i < len; ++i) { // forward extension
		c = fmd_comp(q[i]);
		rld_extend(e, &ik, ok, 0);
		if (ok[c].x[2] != ik.x[2]) {
			kv_push(rldintv_t, *curr, ik);
			if (ok[c].x[2] < min_occ) break;
		}
		ik = ok[c]; ik.info = i + 1;
	}
	if (i == len) kv_push(rldintv_t, *curr, ik);
	kv_reverse(rldintv_t, *curr, 0);
	ret = curr->a[0].info;
	swap = curr; curr = prev; prev = swap;

	for (i = x - 1; i >= -1; --i) {
		c = i < 0? 0 : q[i];
		for (j = 0, curr->n = 0; j < prev->n; ++j) {
			rldintv_t *p = &prev->a[j];
			rld_extend(e, p, ok, 1);
			if (c == 0 || ok[c].x[2] < min_occ) {
				if (curr->n == 0) {
					if (mem->n == oldn || i + 1 < mem->a[mem->n-1].ik.info>>32) {
						fmdsmem_t *q;
						kv_pushp(fmdsmem_t, *mem, &q);
						q->ik = *p; q->ik.info |= (uint64_t)(i + 1)<<32;
						memcpy(q->ok[0], ok, 6 * sizeof(rldintv_t));
					}
				}
			} else if (curr->n == 0 || ok[c].x[2] != curr->a[curr->n-1].x[2]) {
				ok[c].info = p->info;
				kv_push(rldintv_t, *curr, ok[c]);
			}
		}
		if (curr->n == 0) break;
		swap = curr; curr = prev; prev = swap;
	}

	kv_reverse(fmdsmem_t, *mem, oldn);
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x130(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x20(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x20(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq -0x10(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq -0x20(%rbp), %rdx
movslq -0x24(%rbp), %rsi
movzbl (%rdx,%rsi), %edx
movslq %edx, %rdx
subq (%rcx,%rdx,8), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x338(%rbp)
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x1, %eax
jl 0x2756f
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x4, %eax
jg 0x2756f
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %ecx
movl $0x5, %eax
subl %ecx, %eax
movl %eax, -0x33c(%rbp)
jmp 0x27581
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x33c(%rbp)
movq -0x338(%rbp), %rax
movl -0x33c(%rbp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x48(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
cltq
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x275c2
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x27ea2
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movq 0x10(%rbp), %rax
movq $0x0, (%rax)
movl -0x34(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x27790
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x1, %eax
jl 0x2761f
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x4, %eax
jg 0x2761f
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %ecx
movl $0x5, %eax
subl %ecx, %eax
movl %eax, -0x340(%rbp)
jmp 0x27631
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x340(%rbp)
movl -0x340(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x120(%rbp), %rdx
leaq -0x60(%rbp), %rsi
xorl %ecx, %ecx
callq 0x49a0
movslq -0x3c(%rbp), %rcx
leaq -0x120(%rbp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
cmpq -0x50(%rbp), %rax
je 0x27745
jmp 0x27672
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x276e3
movq 0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x276a2
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x348(%rbp)
jmp 0x276b0
movl $0x2, %eax
movq %rax, -0x348(%rbp)
jmp 0x276b0
movq -0x348(%rbp), %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x5, %rsi
callq 0x2270
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
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)
movslq -0x3c(%rbp), %rcx
leaq -0x120(%rbp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
cmpq %rcx, %rax
jae 0x27743
jmp 0x27790
jmp 0x27745
movslq -0x3c(%rbp), %rcx
leaq -0x120(%rbp), %rax
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)
movl -0x34(%rbp), %eax
addl $0x1, %eax
cltq
movq %rax, -0x48(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x275d6
movl -0x34(%rbp), %eax
cmpl -0x18(%rbp), %eax
jne 0x27850
jmp 0x2779e
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x2780f
movq 0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x277ce
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x350(%rbp)
jmp 0x277dc
movl $0x2, %eax
movq %rax, -0x350(%rbp)
jmp 0x277dc
movq -0x350(%rbp), %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x5, %rsi
callq 0x2270
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
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)
jmp 0x27850
jmp 0x27852
movq 0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jbe 0x279ac
movq 0x10(%rbp), %rax
cmpq $0x0, (%rax)
jbe 0x279ac
movq 0x10(%rbp), %rax
movq (%rax), %rax
subq $0x0, %rax
movq %rax, -0x140(%rbp)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x148(%rbp)
movq $0x0, -0x138(%rbp)
movq -0x138(%rbp), %rax
movq -0x140(%rbp), %rcx
shrq %rcx
cmpq %rcx, %rax
jae 0x279aa
movq -0x148(%rbp), %rax
movq -0x140(%rbp), %rcx
subq $0x1, %rcx
subq -0x138(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x168(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x160(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x158(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x150(%rbp)
movq -0x148(%rbp), %rax
movq -0x140(%rbp), %rcx
subq $0x1, %rcx
subq -0x138(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq -0x148(%rbp), %rcx
movq -0x138(%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)
movq -0x148(%rbp), %rax
movq -0x138(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq -0x168(%rbp), %rcx
movq %rcx, (%rax)
movq -0x160(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x158(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x150(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq -0x138(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x138(%rbp)
jmp 0x2789b
jmp 0x279ac
jmp 0x279ae
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rax), %rax
movl %eax, -0x40(%rbp)
movq 0x10(%rbp), %rax
movq %rax, -0x128(%rbp)
movq 0x18(%rbp), %rax
movq %rax, 0x10(%rbp)
movq -0x128(%rbp), %rax
movq %rax, 0x18(%rbp)
movl -0x24(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x34(%rbp)
cmpl $-0x1, -0x34(%rbp)
jl 0x27d69
cmpl $0x0, -0x34(%rbp)
jge 0x279fe
xorl %eax, %eax
movl %eax, -0x354(%rbp)
jmp 0x27a10
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x354(%rbp)
movl -0x354(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x38(%rbp)
movq 0x10(%rbp), %rax
movq $0x0, (%rax)
movslq -0x38(%rbp), %rax
movq 0x18(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x27d31
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x170(%rbp)
movq -0x10(%rbp), %rdi
movq -0x170(%rbp), %rsi
leaq -0x120(%rbp), %rdx
movl $0x1, %ecx
callq 0x49a0
cmpl $0x0, -0x3c(%rbp)
je 0x27a9b
movslq -0x3c(%rbp), %rcx
leaq -0x120(%rbp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
cmpq %rcx, %rax
jae 0x27bf7
movq 0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x27bf2
movq -0x30(%rbp), %rax
movq (%rax), %rax
cmpq -0x130(%rbp), %rax
je 0x27aef
movl -0x34(%rbp), %eax
addl $0x1, %eax
cltq
movq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x30(%rbp), %rdx
movq (%rdx), %rdx
subq $0x1, %rdx
imulq $0x1a0, %rdx, %rdx      # imm = 0x1A0
addq %rdx, %rcx
movq 0x18(%rcx), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
jae 0x27bf0
jmp 0x27af1
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x27b62
movq -0x30(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x27b21
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x360(%rbp)
jmp 0x27b2f
movl $0x2, %eax
movq %rax, -0x360(%rbp)
jmp 0x27b2f
movq -0x360(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x30(%rbp), %rax
imulq $0x1a0, 0x8(%rax), %rsi # imm = 0x1A0
callq 0x2270
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
imulq $0x1a0, %rcx, %rcx      # imm = 0x1A0
addq %rcx, %rax
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rax
movq -0x170(%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)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
shlq $0x20, %rcx
movq -0x178(%rbp), %rax
orq 0x18(%rax), %rcx
movq %rcx, 0x18(%rax)
movq -0x178(%rbp), %rdi
addq $0x20, %rdi
leaq -0x120(%rbp), %rsi
movl $0xc0, %edx
callq 0x2200
jmp 0x27bf2
jmp 0x27d21
movq 0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x27c3b
movslq -0x3c(%rbp), %rcx
leaq -0x120(%rbp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq 0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq 0x10(%rbp), %rdx
movq (%rdx), %rdx
subq $0x1, %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
cmpq 0x10(%rcx), %rax
je 0x27d1f
movq -0x170(%rbp), %rax
movq 0x18(%rax), %rcx
movslq -0x3c(%rbp), %rdx
leaq -0x120(%rbp), %rax
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x27ccd
movq 0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x27c8c
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x368(%rbp)
jmp 0x27c9a
movl $0x2, %eax
movq %rax, -0x368(%rbp)
jmp 0x27c9a
movq -0x368(%rbp), %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x5, %rsi
callq 0x2270
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x3c(%rbp), %rdx
leaq -0x120(%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 0x27d1f
jmp 0x27d21
jmp 0x27d23
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x27a2b
movq 0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x27d3d
jmp 0x27d69
movq 0x10(%rbp), %rax
movq %rax, -0x128(%rbp)
movq 0x18(%rbp), %rax
movq %rax, 0x10(%rbp)
movq -0x128(%rbp), %rax
movq %rax, 0x18(%rbp)
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x279e4
jmp 0x27d6b
movq -0x30(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jbe 0x27e9a
movq -0x30(%rbp), %rax
movq (%rax), %rax
cmpq -0x130(%rbp), %rax
jbe 0x27e9a
movq -0x30(%rbp), %rax
movq (%rax), %rax
subq -0x130(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x1a0, -0x130(%rbp), %rcx # imm = 0x1A0
addq %rcx, %rax
movq %rax, -0x190(%rbp)
movq $0x0, -0x180(%rbp)
movq -0x180(%rbp), %rax
movq -0x188(%rbp), %rcx
shrq %rcx
cmpq %rcx, %rax
jae 0x27e98
movq -0x190(%rbp), %rsi
movq -0x188(%rbp), %rax
subq $0x1, %rax
subq -0x180(%rbp), %rax
imulq $0x1a0, %rax, %rax      # imm = 0x1A0
addq %rax, %rsi
leaq -0x330(%rbp), %rdi
movl $0x1a0, %edx            # imm = 0x1A0
callq 0x2200
movq -0x190(%rbp), %rdi
movq -0x188(%rbp), %rax
subq $0x1, %rax
subq -0x180(%rbp), %rax
imulq $0x1a0, %rax, %rax      # imm = 0x1A0
addq %rax, %rdi
movq -0x190(%rbp), %rsi
imulq $0x1a0, -0x180(%rbp), %rax # imm = 0x1A0
addq %rax, %rsi
movl $0x1a0, %edx            # imm = 0x1A0
callq 0x2200
movq -0x190(%rbp), %rdi
imulq $0x1a0, -0x180(%rbp), %rax # imm = 0x1A0
addq %rax, %rdi
leaq -0x330(%rbp), %rsi
movl $0x1a0, %edx            # imm = 0x1A0
callq 0x2200
movq -0x180(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x180(%rbp)
jmp 0x27dcb
jmp 0x27e9a
jmp 0x27e9c
movl -0x40(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
nop