// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x280, %rsp            # imm = 0x280
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movq %r8, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x28(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq $0x0, 0x8(%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movabsq $-0x400000000000000, %rcx # imm = 0xFC00000000000000
andq (%rax), %rcx
orq $0x0, %rcx
movq %rcx, (%rax)
leaq -0x140(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x2140
leaq -0x240(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x2140
cmpl $0x0, -0xc(%rbp)
jge 0xa7af
movq -0x8(%rbp), %rdi
callq 0x20e0
movl %eax, -0xc(%rbp)
movl $0x0, -0x250(%rbp)
movl $0x0, -0x24c(%rbp)
movl $0x0, -0x244(%rbp)
movl -0x244(%rbp), %eax
cmpl -0xc(%rbp), %eax
jg 0xa9f5
movl -0x244(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xa80b
movq -0x8(%rbp), %rax
movslq -0x244(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0x49a1(%rip), %rax      # 0xf1a0
movzbl (%rax,%rcx), %eax
movl %eax, -0x258(%rbp)
jmp 0xa818
movl $0x4, %eax
movl %eax, -0x258(%rbp)
jmp 0xa818
movl -0x258(%rbp), %eax
movl %eax, -0x254(%rbp)
cmpl $0x4, -0x254(%rbp)
jge 0xa94c
movl -0x24c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24c(%rbp)
movl -0x250(%rbp), %eax
shll $0x2, %eax
orl -0x254(%rbp), %eax
andl $0x3f, %eax
movl %eax, -0x250(%rbp)
cmpl $0x3, -0x24c(%rbp)
jl 0xa947
movl -0x24c(%rbp), %eax
subl -0x14(%rbp), %eax
cmpl $0x0, %eax
jle 0xa884
movl -0x24c(%rbp), %eax
subl -0x14(%rbp), %eax
movl %eax, -0x25c(%rbp)
jmp 0xa88e
xorl %eax, %eax
movl %eax, -0x25c(%rbp)
jmp 0xa88e
movl -0x25c(%rbp), %eax
movl -0x244(%rbp), %ecx
addl $0x1, %ecx
subl -0x24c(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x248(%rbp)
movq -0x28(%rbp), %rdi
addq $0x20, %rdi
movq -0x28(%rbp), %rsi
addq $0x8, %rsi
movl -0x248(%rbp), %edx
callq 0xaa20
movl -0x250(%rbp), %edi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movl -0x10(%rbp), %edx
movl -0x14(%rbp), %ecx
leaq -0x240(%rbp), %r10
leaq -0x140(%rbp), %rax
leaq -0x34(%rbp), %r8
leaq -0x30(%rbp), %r9
leaq -0x2c(%rbp), %r11
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0xac40
imull $0xa, -0x30(%rbp), %eax
movl -0x34(%rbp), %ecx
imull -0x10(%rbp), %ecx
cmpl %ecx, %eax
jle 0xa945
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movl -0x10(%rbp), %edx
movl -0x248(%rbp), %ecx
movl -0x34(%rbp), %r8d
movl -0x2c(%rbp), %r9d
leaq -0x140(%rbp), %rax
movq %rax, (%rsp)
callq 0xadc0
jmp 0xa947
jmp 0xa9df
movl -0x24c(%rbp), %eax
subl -0x14(%rbp), %eax
addl $0x1, %eax
cmpl $0x0, %eax
jle 0xa971
movl -0x24c(%rbp), %eax
subl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x260(%rbp)
jmp 0xa97b
xorl %eax, %eax
movl %eax, -0x260(%rbp)
jmp 0xa97b
movl -0x260(%rbp), %eax
movl -0x244(%rbp), %ecx
addl $0x1, %ecx
subl -0x24c(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x248(%rbp)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0xa9cb
movq -0x28(%rbp), %rdi
addq $0x20, %rdi
movq -0x28(%rbp), %rsi
addq $0x8, %rsi
movl -0x248(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x248(%rbp)
callq 0xaa20
jmp 0xa998
movl $0x0, -0x250(%rbp)
movl $0x0, -0x24c(%rbp)
jmp 0xa9e1
movl -0x244(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x244(%rbp)
jmp 0xa7cd
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rax
addq $0x280, %rsp            # imm = 0x280
popq %rbp
retq
nopw %cs:(%rax,%rax)