// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/./Levenshtein_distance.h
// Function: ed_band_cal_semi_64_w_absent_diag_trace(char*, int, char*, int, int, int, bit_extz_t*)
inline void ed_band_cal_semi_64_w_absent_diag_trace(char *pstr, int32_t pn, char *tstr, int32_t tn, int32_t thre, int32_t abs_diag, bit_extz_t *ez)
{
	ez->cigar.n = 0; ez->nword = 1;//diff
	if(ez->err > thre) {//diff
		init_base_ed(*ez, thre, pn, tn); ez->ps = ez->pe = -1; ez->ts = 0; ez->te = tn-1;//diff
	} else if(ez->err == 0) {//diff
		push_trace(&(ez->cigar), 0, ez->te+1-ez->ts); //diff
		ez->ps = ez->pe - (ez->te-ez->ts);//diff
		return;//diff
	}
	Word c, Peq[5] = {0}, VP = 0, VN, X, D0, HN, HP, mm;
	int32_t bd, i, err = abs_diag, i_bd, last_high = (thre<<1), tn0 = tn - 1, cut = thre+last_high;
	if((pn > tn + cut) || (tn > pn + cut)) return;

	bd = ((thre<<1)+1)-abs_diag; bd = ((bd<=pn)?bd:pn); i_bd = abs_diag; 
	for (i = 0, mm = (((Word)1)<<i_bd); i < bd; i++) {
        Peq[seq_nt4_table[(uint8_t)pstr[i]]] |= mm; mm <<= 1;
    }
	i_bd = (thre<<1)-abs_diag; VN = (((Word)1)<<(abs_diag))-1;

	ez->path.n=(ez->nword*tn*5);//diff
    kv_resize(w_sig, ez->path, ez->path.n); ez->path.n=0;//diff

	i = 0; Peq[4] = 0; mm = ((Word)1 << (thre<<1));///for the incoming char/last char**
	while (i < tn0) {
		ed_core_64(Peq, VP, VN, X, D0, HN, HP, (uint8_t)tstr[i]);
		if (!(D0&(1ULL))) {
            ++err; if (err>cut) return;
        }

		Peq[0] >>= 1; Peq[1] >>= 1; Peq[2] >>= 1; Peq[3] >>= 1;
		++i; ++i_bd; c = 4; 
		if(i_bd < pn) c = seq_nt4_table[(uint8_t)pstr[i_bd]];
		if(c < 4) Peq[c] |= mm; 

		ez->path.a[ez->path.n++] = D0;//diff
        ez->path.a[ez->path.n++] = VP;//diff
        ez->path.a[ez->path.n++] = VN;//diff
        ez->path.a[ez->path.n++] = HP;//diff
        ez->path.a[ez->path.n++] = HN;//diff
	}
	ed_core_64(Peq, VP, VN, X, D0, HN, HP, (uint8_t)tstr[i]);
	if (!(D0&(1ULL))) {
		++err; if (err>cut) return;
	}
	ez->path.a[ez->path.n++] = D0;//diff
	ez->path.a[ez->path.n++] = VP;//diff
	ez->path.a[ez->path.n++] = VN;//diff
	ez->path.a[ez->path.n++] = HP;//diff
	ez->path.a[ez->path.n++] = HN;//diff

	int32_t site = tn - 1 - abs_diag;/**up bound**/
    /**in most cases, ai = (thre<<1)**/
    int32_t ai = pn - tn + abs_diag, uge = INT32_MAX; i = 0;
	if(ez->err > thre) {//diff
		for (i = 0; site < 0 && i < ai; i++, site++) {
			err += ((VP >> i)&(1ULL)); err -= ((VN >> i)&(1ULL));
		}
		if ((err <= thre) && (err <= ez->err)) {
			ez->err = err; ez->pe = site;
		}
		site -= i;
		while (i < ai) {
			err += ((VP >> i)&(1ULL)); err -= ((VN >> i)&(1ULL)); ++i;
			if ((err <= thre) && (err <= ez->err)) {
				ez->err = err; ez->pe = site + i;
			}
			if(i == thre) uge = err;
		}
		
		if((uge <= thre) && (uge == ez->err)) ez->pe = site + thre;
	}
    ///should update ez->path.n for extension
    gen_trace(ez, abs_diag, 1);//diff
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, 0x28(%rsp)
movq %rdi, %rbp
movq 0xb0(%rsp), %rbx
movq $0x0, 0xa8(%rbx)
movl $0x1, 0x30(%rbx)
movl 0x2c(%rbx), %eax
cmpl %r8d, %eax
jle 0x8ddf0
movl %r8d, 0x28(%rbx)
movl $0x7fffffff, 0x2c(%rbx) # imm = 0x7FFFFFFF
movl %esi, 0x18(%rbx)
movl %ecx, 0x24(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $-0x1, 0x10(%rbx)
movl $0x0, 0x1c(%rbx)
leal -0x1(%rcx), %eax
movl %eax, 0x20(%rbx)
jmp 0x8ddf8
testl %eax, %eax
je 0x8e1f4
movl %r9d, 0x4(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x50(%rsp)
movq %r8, 0x8(%rsp)
leal (%r8,%r8,2), %edx
leal (%rdx,%rcx), %eax
cmpl %esi, %eax
setl %al
movq %rsi, 0x18(%rsp)
movq %rdx, 0x20(%rsp)
addl %esi, %edx
movq %rcx, 0x10(%rsp)
cmpl %ecx, %edx
setl %cl
orb %al, %cl
jne 0x8e36a
movq 0x8(%rsp), %rax
leal (%rax,%rax), %r14d
movl %r14d, %eax
orl $0x1, %eax
movl 0x4(%rsp), %r15d
subl %r15d, %eax
movq 0x18(%rsp), %r9
cmpl %r9d, %eax
cmovgel %r9d, %eax
movl $0x1, %r12d
movl %r15d, %ecx
shlq %cl, %r12
testl %eax, %eax
jle 0x8de9c
movl %eax, %eax
xorl %ecx, %ecx
leaq 0x19fb90(%rip), %rdx    # 0x22da10
movq %r12, %rsi
movzbl (%rbp,%rcx), %edi
movzbl (%rdx,%rdi), %edi
orq %rsi, 0x30(%rsp,%rdi,8)
addq %rsi, %rsi
incq %rcx
cmpq %rcx, %rax
jne 0x8de83
movq 0x10(%rsp), %rdx
leal (%rdx,%rdx,4), %eax
cltq
movq %rax, 0xc0(%rbx)
cmpq %rax, 0xc8(%rbx)
jae 0x8df1a
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0xc8(%rbx)
movq 0xd0(%rbx), %rdi
leaq 0x8(,%rcx,8), %rsi
callq 0x2370
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %r9
movq %rax, 0xd0(%rbx)
leal -0x1(%rdx), %eax
decq %r12
xorl %esi, %esi
movq %rsi, 0xc0(%rbx)
movq %rsi, 0x50(%rsp)
movl $0x1, %edi
movl %r14d, %ecx
shlq %cl, %rdi
movq %rdi, 0x70(%rsp)
cmpl $0x2, %edx
movq %rax, 0x60(%rsp)
jl 0x8e09b
subl %r15d, %r14d
movslq %r14d, %r8
movslq %r9d, %r9
movl %eax, %r10d
leaq (%r8,%rbp), %rax
incq %rax
movq %rax, 0x68(%rsp)
incq %r8
xorl %esi, %esi
leaq 0x19faa0(%rip), %r14    # 0x22da10
xorl %edx, %edx
movl %r15d, %ecx
movq 0x28(%rsp), %rax
movzbl (%rax,%rsi), %eax
movzbl (%r14,%rax), %eax
movq 0x30(%rsp,%rax,8), %r15
orq %r12, %r15
movq %r15, %rax
andq %rdx, %rax
addq %rdx, %rax
xorq %rdx, %rax
orq %r15, %rax
testb $0x1, %al
jne 0x8dfaa
cmpl 0x20(%rsp), %ecx
jge 0x8e36a
incl %ecx
shrq 0x30(%rsp)
shrq 0x38(%rsp)
shrq 0x40(%rsp)
shrq 0x48(%rsp)
leaq (%r8,%rsi), %rbp
movl $0x4, %r15d
cmpq %r9, %rbp
jge 0x8dfdc
movq 0x68(%rsp), %rdi
movzbl (%rdi,%rsi), %r15d
movzbl (%r14,%r15), %r15d
cmpl $0x3, %r15d
ja 0x8dfec
movq 0x70(%rsp), %rdi
orq %rdi, 0x30(%rsp,%r15,8)
movq %rax, %r15
andq %rdx, %r15
orq %rax, %rdx
notq %rdx
orq %rdx, %r12
movq %rax, %rdx
shrq %rdx
movq %r12, %rbp
andq %rdx, %rbp
orq %r12, %rdx
notq %rdx
orq %r15, %rdx
incq %rsi
movq 0xc0(%rbx), %r11
movq 0xd0(%rbx), %r13
leaq 0x1(%r11), %rdi
movq %rdi, 0xc0(%rbx)
movq %rax, (%r13,%r11,8)
movq 0xc0(%rbx), %rax
leaq 0x1(%rax), %rdi
movq %rdi, 0xc0(%rbx)
movq %rdx, (%r13,%rax,8)
movq 0xc0(%rbx), %rax
leaq 0x1(%rax), %rdi
movq %rdi, 0xc0(%rbx)
movq %rbp, (%r13,%rax,8)
movq 0xc0(%rbx), %rax
leaq 0x1(%rax), %rdi
movq %rdi, 0xc0(%rbx)
movq %r12, (%r13,%rax,8)
movq 0xc0(%rbx), %rax
leaq 0x1(%rax), %rdi
movq %rdi, 0xc0(%rbx)
movq %r15, (%r13,%rax,8)
movq %rbp, %r12
cmpq %rsi, %r10
jne 0x8df75
jmp 0x8e0a3
movl %r15d, %ecx
movq %r12, %rbp
xorl %edx, %edx
movq 0x28(%rsp), %rax
movzbl (%rax,%rsi), %eax
leaq 0x19f95d(%rip), %rsi    # 0x22da10
movzbl (%rsi,%rax), %eax
movq 0x30(%rsp,%rax,8), %rsi
orq %rbp, %rsi
movq %rsi, %rax
andq %rdx, %rax
addq %rdx, %rax
xorq %rdx, %rax
orq %rsi, %rax
testb $0x1, %al
jne 0x8e0de
cmpl 0x20(%rsp), %ecx
jge 0x8e36a
incl %ecx
movl 0x4(%rsp), %esi
movq 0x8(%rsp), %r12
movq %rax, %rdi
andq %rdx, %rdi
orq %rax, %rdx
notq %rdx
orq %rdx, %rbp
movq %rax, %rdx
shrq %rdx
movq %rbp, %r15
andq %rdx, %r15
orq %rbp, %rdx
notq %rdx
orq %rdi, %rdx
movq 0xc0(%rbx), %r8
movq 0xd0(%rbx), %r9
leaq 0x1(%r8), %r10
movq %r10, 0xc0(%rbx)
movq %rax, (%r9,%r8,8)
movq 0xc0(%rbx), %rax
leaq 0x1(%rax), %r8
movq %r8, 0xc0(%rbx)
movq %rdx, (%r9,%rax,8)
movq 0xc0(%rbx), %rax
leaq 0x1(%rax), %r8
movq %r8, 0xc0(%rbx)
movq %r15, (%r9,%rax,8)
movq 0xc0(%rbx), %rax
leaq 0x1(%rax), %r8
movq %r8, 0xc0(%rbx)
movq %rbp, (%r9,%rax,8)
movq 0xc0(%rbx), %rax
leaq 0x1(%rax), %r8
movq %r8, 0xc0(%rbx)
movq %rdi, (%r9,%rax,8)
movl 0x2c(%rbx), %r8d
cmpl %r12d, %r8d
jle 0x8e35d
movq 0x18(%rsp), %r10
subl 0x10(%rsp), %r10d
addl %esi, %r10d
movq 0x60(%rsp), %r14
subl %esi, %r14d
sets %al
testl %r10d, %r10d
setg %r9b
andb %al, %r9b
xorl %edi, %edi
cmpb $0x1, %r9b
jne 0x8e2de
movq %r10, %r11
movl %r10d, %eax
movq %r14, %r13
movl %r14d, %r9d
xorl %edi, %edi
leal (%r9,%rdi), %r10d
btq %rdi, %rdx
adcl $0x0, %ecx
btq %rdi, %r15
sbbl $0x0, %ecx
incq %rdi
cmpl $-0x2, %r10d
jg 0x8e1e9
cmpq %rax, %rdi
jb 0x8e1c9
addl %edi, %r13d
movq %r11, %r10
jmp 0x8e2e1
movl 0x20(%rbx), %ebp
subl 0x1c(%rbx), %ebp
incl %ebp
cmpl $0x3fff, %ebp           # imm = 0x3FFF
jb 0x8e26f
movl $0x2, %r14d
movq 0xb0(%rbx), %rax
cmpq %rax, 0xa8(%rbx)
jne 0x8e242
leaq (%rax,%rax), %rsi
testq %rax, %rax
cmoveq %r14, %rsi
movq %rsi, 0xb0(%rbx)
movq 0xb8(%rbx), %rdi
addq %rsi, %rsi
callq 0x2370
movq %rax, 0xb8(%rbx)
movq 0xa8(%rbx), %rax
movq 0xb8(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0xa8(%rbx)
movw $0x3fff, (%rcx,%rax,2)  # imm = 0x3FFF
addl $0xffffc001, %ebp       # imm = 0xFFFFC001
cmpl $0x3ffe, %ebp           # imm = 0x3FFE
ja 0x8e20a
testl %ebp, %ebp
je 0x8e2cd
movq 0xb0(%rbx), %rax
cmpq %rax, 0xa8(%rbx)
jne 0x8e2b0
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %esi
cmovneq %rcx, %rsi
movq %rsi, 0xb0(%rbx)
movq 0xb8(%rbx), %rdi
addq %rsi, %rsi
callq 0x2370
movq %rax, 0xb8(%rbx)
movq 0xa8(%rbx), %rax
movq 0xb8(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0xa8(%rbx)
movw %bp, (%rcx,%rax,2)
movl 0x14(%rbx), %eax
subl 0x20(%rbx), %eax
addl 0x1c(%rbx), %eax
movl %eax, 0x10(%rbx)
jmp 0x8e36a
movq %r14, %r13
cmpl %r12d, %ecx
setg %al
cmpl %r8d, %ecx
setg %r8b
orb %al, %r8b
jne 0x8e2fa
movl %ecx, 0x2c(%rbx)
movl %r13d, 0x14(%rbx)
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl %r10d, %edi
jge 0x8e349
movl %r12d, %r8d
movl %edi, %r11d
movslq %r10d, %r9
movq %r8, %r10
decq %r10
leal 0x1(%r13), %ebp
btq %r11, %rdx
adcl $0x0, %ecx
btq %r11, %r15
sbbl $0x0, %ecx
cmpl %r8d, %ecx
jg 0x8e335
cmpl 0x2c(%rbx), %ecx
jg 0x8e335
movl %ecx, 0x2c(%rbx)
movl %ebp, 0x14(%rbx)
cmpq %r11, %r10
cmovel %ecx, %eax
leaq 0x1(%r11), %r14
incl %ebp
movq %r14, %r11
cmpq %r9, %r14
jl 0x8e317
cmpl %r12d, %eax
jg 0x8e35d
cmpl 0x2c(%rbx), %eax
jne 0x8e35d
subl %edi, %r13d
addl %r12d, %r13d
movl %r13d, 0x14(%rbx)
movq %rbx, %rdi
movl $0x1, %edx
callq 0x9c469
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq