// File: /workspace/github_c_makefile_star2_O1/lh3[P]minimap/sdust.c
// Function: sdust_core
const uint64_t *sdust_core(const uint8_t *seq, int l_seq, int T, int W, int *n, sdust_buf_t *buf)
{
	int rv = 0, rw = 0, L = 0, cv[SD_WTOT], cw[SD_WTOT];
	int i, start, l; // _start_: start of the current window; _l_: length of a contiguous A/C/G/T (sub)sequence
	unsigned t; // current word

	buf->P.n = buf->res.n = 0;
	buf->w->front = buf->w->count = 0;
	memset(cv, 0, SD_WTOT * sizeof(int));
	memset(cw, 0, SD_WTOT * sizeof(int));
	if (l_seq < 0) l_seq = strlen((const char*)seq);
	for (i = l = t = 0; i <= l_seq; ++i) {
		int b = i < l_seq? seq_nt4_table[seq[i]] : 4;
		if (b < 4) { // an A/C/G/T base
			++l, t = (t<<2 | b) & SD_WMSK;
			if (l >= SD_WLEN) { // we have seen a word
				start = (l - W > 0? l - W : 0) + (i + 1 - l); // set the start of the current window
				save_masked_regions(&buf->res, &buf->P, start); // save intervals falling out of the current window?
				shift_window(t, buf->w, T, W, &L, &rw, &rv, cw, cv);
				if (rw * 10 > L * T)
					find_perfect(&buf->P, buf->w, T, start, L, rv, cv);
			}
		} else { // N or the end of sequence; N effectively breaks input into pieces of independent sequences
			start = (l - W + 1 > 0? l - W + 1 : 0) + (i + 1 - l);
			while (buf->P.n) save_masked_regions(&buf->res, &buf->P, start++); // clear up unsaved perfect intervals
			l = t = 0;
		}
	}
	*n = buf->res.n;
	return buf->res.a;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x388, %rsp            # imm = 0x388
movq %r9, %rbx
movq %r8, 0x68(%rsp)
movl %ecx, %r14d
movq %rdx, 0x48(%rsp)
movl %esi, %r12d
movq %rdi, 0x60(%rsp)
movabsq $-0x400000000000000, %rdx # imm = 0xFC00000000000000
xorl %eax, %eax
movq %rax, 0x20(%r9)
movq %rax, 0x8(%r9)
movq (%r9), %rcx
movq %rax, 0x8(%rcx)
andq %rdx, (%rcx)
leaq 0x80(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x2130
leaq 0x180(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x2130
testl %r12d, %r12d
jns 0x73d1
movq 0x60(%rsp), %rdi
callq 0x20d0
movq %rax, %r12
testl %r12d, %r12d
js 0x7beb
movabsq $-0x100000000, %r13     # imm = 0xFFFFFFFF00000000
movabsq $0x3ffffffffffffff, %r10 # imm = 0x3FFFFFFFFFFFFFF
leal -0x2(%r14), %eax
cltq
movq %rax, 0x78(%rsp)
movq 0x48(%rsp), %rax
addl %eax, %eax
movl %eax, 0x54(%rsp)
movl %r12d, %r8d
incl %r12d
xorl %esi, %esi
movq $0x0, 0x18(%rsp)
xorl %eax, %eax
movl $0x0, 0x10(%rsp)
xorl %r15d, %r15d
movl $0x0, 0xc(%rsp)
movq %r8, 0x30(%rsp)
movq %r14, 0x38(%rsp)
movq %r12, 0x58(%rsp)
movl $0x4, %ecx
cmpq %r8, %rsi
jae 0x7457
movq 0x60(%rsp), %rcx
movzbl (%rcx,%rsi), %ecx
leaq 0x3d4d(%rip), %rdx      # 0xb1a0
movzbl (%rdx,%rcx), %ecx
cmpl $0x3, %ecx
ja 0x7547
leal 0x1(%rax), %edx
movq 0x18(%rsp), %rdi
andl $0xf, %edi
leal (%rcx,%rdi,4), %edi
movq %rdi, 0x18(%rsp)
cmpl $0x2, %eax
jl 0x7686
movl %edx, 0x24(%rsp)
movl %edx, %ecx
subl %r14d, %ecx
testl %ecx, %ecx
movl $0x0, %edx
cmovlel %edx, %ecx
movq %rsi, 0x28(%rsp)
movl %esi, %r8d
subl %eax, %r8d
addl %ecx, %r8d
movq 0x8(%rbx), %rax
testq %rax, %rax
movq %r8, 0x40(%rsp)
je 0x76f7
movq 0x18(%rbx), %r14
shlq $0x4, %rax
movl -0x10(%r14,%rax), %edx
cmpl %r8d, %edx
jge 0x76f7
addq %rax, %r14
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x74e2
movq 0x30(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %rsi
cmpl %esi, %edx
jle 0x7699
movq 0x28(%rbx), %rcx
cmpq %rcx, %rax
jne 0x751f
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x28(%rbx)
movq 0x30(%rbx), %rdi
shlq $0x3, %rsi
callq 0x2200
movq 0x40(%rsp), %r8
movabsq $0x3ffffffffffffff, %r10 # imm = 0x3FFFFFFFFFFFFFF
movq %rax, 0x30(%rbx)
movl -0x10(%r14), %eax
shlq $0x20, %rax
movslq -0xc(%r14), %rcx
orq %rax, %rcx
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rdx
leaq 0x1(%rax), %rsi
movq %rsi, 0x20(%rbx)
movq %rcx, (%rdx,%rax,8)
jmp 0x76b3
movq 0x8(%rbx), %rcx
xorl %edx, %edx
testq %rcx, %rcx
je 0x768b
movq %rsi, 0x28(%rsp)
movl %esi, %edx
subl %eax, %edx
subl %r14d, %eax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
cmovsl %esi, %eax
leal (%rdx,%rax), %ebp
addl $0x2, %ebp
movq 0x18(%rbx), %r14
shlq $0x4, %rcx
movl -0x10(%r14,%rcx), %edx
cmpl %ebp, %edx
jge 0x7658
addq %rcx, %r14
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x759e
movq 0x30(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %rsi
cmpl %esi, %edx
jle 0x75fb
movq 0x28(%rbx), %rcx
cmpq %rcx, %rax
jne 0x75d6
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x28(%rbx)
movq 0x30(%rbx), %rdi
shlq $0x3, %rsi
callq 0x2200
movabsq $0x3ffffffffffffff, %r10 # imm = 0x3FFFFFFFFFFFFFF
movq %rax, 0x30(%rbx)
movl -0x10(%r14), %eax
shlq $0x20, %rax
movslq -0xc(%r14), %rcx
orq %rax, %rcx
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rdx
leaq 0x1(%rax), %rsi
movq %rsi, 0x20(%rbx)
movq %rcx, (%rdx,%rax,8)
jmp 0x7615
movq %rsi, %rdx
andq %r13, %rdx
movl -0xc(%r14), %edi
cmpl %esi, %edi
cmovlel %esi, %edi
movslq %edi, %rsi
orq %rdx, %rsi
movq %rsi, -0x8(%rcx,%rax,8)
movq 0x8(%rbx), %rax
leal -0x1(%rax), %ecx
cmpl $-0x1, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmovgel %edx, %ecx
incl %ecx
leal 0x1(%rax), %edx
decq %rax
testl %eax, %eax
js 0x764f
movq 0x18(%rbx), %rsi
movl %eax, %edi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
shlq $0x4, %rdi
decl %edx
decq %rax
cmpl %ebp, (%rsi,%rdi)
jl 0x762f
jmp 0x7651
movl %ecx, %edx
movslq %edx, %rax
movq %rax, 0x8(%rbx)
incl %ebp
movq 0x8(%rbx), %rcx
testq %rcx, %rcx
jne 0x7570
movq $0x0, 0x18(%rsp)
movq 0x30(%rsp), %r8
movq 0x28(%rsp), %rsi
xorl %edx, %edx
movq 0x38(%rsp), %r14
jmp 0x7bdd
jmp 0x7bdd
movq $0x0, 0x18(%rsp)
jmp 0x7bdd
movq %rsi, %rdx
andq %r13, %rdx
movl -0xc(%r14), %edi
cmpl %esi, %edi
cmovlel %esi, %edi
movslq %edi, %rsi
orq %rdx, %rsi
movq %rsi, -0x8(%rcx,%rax,8)
movq 0x8(%rbx), %rax
leal -0x1(%rax), %ecx
cmpl $-0x1, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmovgel %edx, %ecx
incl %ecx
leal 0x1(%rax), %edx
decq %rax
testl %eax, %eax
js 0x76ee
movq 0x18(%rbx), %rsi
movl %eax, %edi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
shlq $0x4, %rdi
decl %edx
decq %rax
cmpl %r8d, (%rsi,%rdi)
jl 0x76cd
jmp 0x76f0
movl %ecx, %edx
movslq %edx, %rax
movq %rax, 0x8(%rbx)
movq (%rbx), %r13
movq 0x8(%r13), %rax
cmpq 0x78(%rsp), %rax
jae 0x770c
movl %r15d, 0x14(%rsp)
jmp 0x7782
movq (%r13), %rcx
movq 0x18(%r13), %rdx
movq %rcx, %rsi
andq %r10, %rsi
leaq 0x1(%rcx), %rdi
andq %r10, %rdi
andq 0x10(%r13), %rdi
movabsq $-0x400000000000000, %r8 # imm = 0xFC00000000000000
andq %r8, %rcx
orq %rcx, %rdi
movq %rdi, (%r13)
decq %rax
movq %rax, 0x8(%r13)
movslq (%rdx,%rsi,4), %rcx
movl 0x180(%rsp,%rcx,4), %edx
decl %edx
movl %edx, 0x180(%rsp,%rcx,4)
subl %edx, %r15d
movl 0x10(%rsp), %esi
movslq %esi, %rdx
cmpq %rdx, %rax
movl %r15d, 0x14(%rsp)
jae 0x7782
decl %esi
movl %esi, 0x10(%rsp)
movl 0x80(%rsp,%rcx,4), %eax
decl %eax
movl %eax, 0x80(%rsp,%rcx,4)
subl %eax, 0xc(%rsp)
movq (%r13), %rax
movq 0x8(%r13), %rdx
shrq $0x3a, %rax
movl $0x1, %r15d
movl %eax, %ecx
shlq %cl, %r15
cmpq %r15, %rdx
jne 0x78d4
leal 0x1(%rax), %r14d
movl $0x1, %r12d
movl %r14d, %ecx
shlq %cl, %r12
cmpq %rdx, %r12
jae 0x77e1
movq $-0x1, %r14
incq %r14
movq %rdx, %rsi
movl %r14d, %ecx
shrq %cl, %rsi
cmpq $0x3f, %r14
ja 0x77d5
testq %rsi, %rsi
jne 0x77be
movl $0x1, %r12d
movl %r14d, %ecx
shlq %cl, %r12
cmpl %eax, %r14d
je 0x78d4
jle 0x780e
movq 0x18(%r13), %rdi
movl $0x4, %esi
movl %r14d, %ecx
shlq %cl, %rsi
callq 0x2200
movabsq $0x3ffffffffffffff, %r10 # imm = 0x3FFFFFFFFFFFFFF
movq %rax, 0x18(%r13)
movq (%r13), %rax
andq %r10, %rax
movq 0x8(%r13), %rdx
addq %rax, %rdx
cmpq %r15, %rdx
jbe 0x786f
movq 0x18(%r13), %rcx
movq %r15, %rdx
subq %rax, %rdx
movq %r12, %rsi
subq %rdx, %rsi
leaq (%rcx,%rsi,4), %rdi
leaq (%rcx,%rax,4), %rsi
shlq $0x2, %rdx
callq 0x2220
movabsq $0x3ffffffffffffff, %r10 # imm = 0x3FFFFFFFFFFFFFF
movq (%r13), %rax
subq %r15, %r12
addq %rax, %r12
andq %r10, %r12
movabsq $-0x400000000000000, %rcx # imm = 0xFC00000000000000
andq %rcx, %rax
orq %r12, %rax
movq %rax, (%r13)
jmp 0x788f
subq %r12, %rdx
jbe 0x788f
movq 0x18(%r13), %rdi
leaq (%rdi,%r12,4), %rsi
shlq $0x2, %rdx
callq 0x2220
movabsq $0x3ffffffffffffff, %r10 # imm = 0x3FFFFFFFFFFFFFF
movq %r14, %rax
shlq $0x3a, %rax
movq (%r13), %rdx
andq %r10, %rdx
orq %rax, %rdx
movq $-0x1, %rax
movl %r14d, %ecx
shlq %cl, %rax
movq %rdx, (%r13)
notq %rax
movq %rax, 0x10(%r13)
testl %r14d, %r14d
jns 0x78d4
movq 0x18(%r13), %rdi
callq 0x2200
movabsq $0x3ffffffffffffff, %r10 # imm = 0x3FFFFFFFFFFFFFF
movq %rax, 0x18(%r13)
movq 0x18(%r13), %rax
movq 0x8(%r13), %rcx
movq 0x10(%r13), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x8(%r13)
movq (%r13), %rsi
andq %r10, %rsi
addq %rcx, %rsi
andq %rdx, %rsi
movq 0x18(%rsp), %r9
movl %r9d, (%rax,%rsi,4)
movl 0x10(%rsp), %r14d
incl %r14d
leal (,%r9,4), %esi
movl 0x180(%rsp,%rsi), %r15d
leal 0x1(%r15), %edi
movl %edi, 0x180(%rsp,%rsi)
movl 0x80(%rsp,%rsi), %edi
leal 0x1(%rdi), %r8d
movl %r8d, 0x80(%rsp,%rsi)
movl 0xc(%rsp), %r8d
addl %edi, %r8d
leal 0x2(,%rdi,2), %esi
leal (%rsi,%rsi,4), %esi
cmpl 0x54(%rsp), %esi
movl 0x14(%rsp), %r11d
jle 0x7998
movq (%r13), %rsi
andq %r10, %rsi
movslq %r14d, %rdi
addq %rsi, %rcx
subq %rdi, %rcx
incq %rcx
movabsq $-0x100000000, %r13     # imm = 0xFFFFFFFF00000000
movq %rcx, %rsi
andq %rdx, %rsi
movslq (%rax,%rsi,4), %rsi
movl 0x80(%rsp,%rsi,4), %edi
decl %edi
movl %edi, 0x80(%rsp,%rsi,4)
subl %edi, %r8d
incq %rcx
decl %r14d
cmpl %r9d, %esi
jne 0x796e
jmp 0x79a2
movabsq $-0x100000000, %r13     # imm = 0xFFFFFFFF00000000
movl %r8d, 0xc(%rsp)
addl %r11d, %r15d
leal (%r15,%r15), %eax
leal (%rax,%rax,4), %eax
movl %r14d, %ecx
imull 0x48(%rsp), %ecx
cmpl %ecx, %eax
movl %r14d, 0x10(%rsp)
jle 0x7bc5
movq %r15, 0x70(%rsp)
movq (%rbx), %r13
movl $0x100, %edx            # imm = 0x100
leaq 0x280(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x2190
movq 0x40(%rsp), %r11
movabsq $0x3ffffffffffffff, %r10 # imm = 0x3FFFFFFFFFFFFFF
movl %r14d, %eax
notl %eax
addl 0x8(%r13), %eax
js 0x7b9c
leal 0x2(%r11), %ecx
movl %ecx, 0x14(%rsp)
movl %eax, %r14d
xorl %eax, %eax
movl 0xc(%rsp), %ecx
movl %ecx, %ebp
xorl %ecx, %ecx
movq 0x18(%r13), %rdx
movq (%r13), %rsi
andq %r10, %rsi
addq %r14, %rsi
andq 0x10(%r13), %rsi
movslq (%rdx,%rsi,4), %rdx
movl 0x280(%rsp,%rdx,4), %esi
leal 0x1(%rsi), %edi
movl %edi, 0x280(%rsp,%rdx,4)
addl %esi, %ebp
movl %r14d, %r12d
notl %r12d
addl 0x8(%r13), %r12d
leal (,%rbp,2), %edx
leal (%rdx,%rdx,4), %edx
movl %r12d, %esi
imull 0x48(%rsp), %esi
cmpl %esi, %edx
jle 0x7b8c
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
je 0x7ab3
movq 0x18(%rbx), %rsi
leal (%r11,%r14), %edi
addq $0xc, %rsi
xorl %r15d, %r15d
cmpl %edi, -0xc(%rsi)
jl 0x7ab6
testl %eax, %eax
je 0x7a9d
movl -0x4(%rsi), %r8d
imull %ecx, %r8d
movl (%rsi), %r9d
imull %eax, %r9d
cmpl %r9d, %r8d
jle 0x7aa2
movl -0x4(%rsi), %eax
movl (%rsi), %ecx
incq %r15
addq $0x10, %rsi
cmpq %r15, %rdx
jne 0x7a80
movq %rdx, %r15
jmp 0x7ab6
xorl %r15d, %r15d
testl %eax, %eax
je 0x7acd
movl %ecx, %esi
imull %ebp, %esi
movl %eax, %edi
imull %r12d, %edi
cmpl %edi, %esi
jl 0x7b8c
movq 0x10(%rbx), %rax
cmpq %rax, %rdx
setne %cl
leaq 0x1(%rdx), %rsi
cmpq %rsi, %rax
setae %al
orb %cl, %al
jne 0x7b2e
movq %rdx, %rax
shrq %rax
orq %rdx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rsi
shrq $0x10, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, 0x10(%rbx)
movq 0x18(%rbx), %rdi
shlq $0x4, %rsi
callq 0x2200
movq %rax, 0x18(%rbx)
movq 0x8(%rbx), %rdx
movq 0x18(%rbx), %rsi
subq %r15, %rdx
shlq $0x4, %r15
leaq (%rsi,%r15), %rdi
addq $0x10, %rdi
addq %r15, %rsi
shlq $0x4, %rdx
callq 0x2220
incq 0x8(%rbx)
movq 0x40(%rsp), %r11
leal (%r11,%r14), %eax
movq 0x18(%rbx), %rcx
movl %eax, (%rcx,%r15)
movl 0x8(%r13), %eax
addl 0x14(%rsp), %eax
movl %eax, 0x4(%rcx,%r15)
movl %ebp, 0x8(%rcx,%r15)
movl %r12d, 0xc(%rcx,%r15)
movl %r12d, %ecx
movl %ebp, %eax
movabsq $0x3ffffffffffffff, %r10 # imm = 0x3FFFFFFFFFFFFFF
leaq -0x1(%r14), %rdx
testl %r14d, %r14d
movq %rdx, %r14
jg 0x7a1b
movq 0x38(%rsp), %r14
movq 0x58(%rsp), %r12
movabsq $-0x100000000, %r13     # imm = 0xFFFFFFFF00000000
movq 0x30(%rsp), %r8
movq 0x28(%rsp), %rsi
movl 0x24(%rsp), %edx
movq 0x70(%rsp), %r15
jmp 0x7bdd
movq 0x38(%rsp), %r14
movq 0x58(%rsp), %r12
movq 0x28(%rsp), %rsi
movl 0x24(%rsp), %edx
movq 0x30(%rsp), %r8
incq %rsi
movl %edx, %eax
cmpq %r12, %rsi
jne 0x7439
movl 0x20(%rbx), %eax
movq 0x68(%rsp), %rcx
movl %eax, (%rcx)
movq 0x30(%rbx), %rax
addq $0x388, %rsp            # imm = 0x388
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq