// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/./Levenshtein_distance.h
// Function: cigar_check(char*, char*, bit_extz_t*)
inline uint32_t cigar_check(char *pstr, char *tstr, bit_extz_t *ez)
{
	int32_t pi = ez->ps, ti = ez->ts, err = 0; uint32_t ci = 0, cl, k; uint16_t c;
	while (ci < ez->cigar.n) {
		ci = pop_trace(&(ez->cigar), ci, &c, &cl);
		// fprintf(stderr, "# %u = %u\n", c, cl); 
		if(c == 0) {
			for (k=0;(k<cl)&&(pstr[pi]==tstr[ti]);k++,pi++,ti++);
			if(k!=cl) {
				fprintf(stderr, "ERROR-d-0, pi::%d, ti::%d\n", pi, ti); 
				return 0;
			}
		} else {
			err += cl;
			if(c == 1) {
				for (k=0;(k<cl)&&(pstr[pi]!=tstr[ti]);k++,pi++,ti++);
				if(k!=cl) {
					fprintf(stderr, "ERROR-d-1, pi::%d, ti::%d\n", pi, ti);  
					return 0;
				}
			} else if(c == 2) {///more p
				pi+=cl;
			} else if(c == 3) {
				ti+=cl;
			}
		}
	}
	if(err != ez->err) {
		fprintf(stderr, "ERROR-err\n"); 
		return 0;
	}
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, 0x8(%rsp)
movq 0xa8(%rdx), %r8
testq %r8, %r8
movq %rdx, 0x10(%rsp)
je 0x98b4e
movq %rdx, %rax
movl 0x10(%rdx), %edx
movl 0x1c(%rax), %ecx
movq 0xb8(%rax), %r10
xorl %ebx, %ebx
xorl %r11d, %r11d
xorl %esi, %esi
movzwl (%r10,%rbx,2), %r14d
movl %r14d, %ebp
shrl $0xe, %ebp
movl %r14d, %ebx
andl $0x3fff, %ebx           # imm = 0x3FFF
incl %r11d
cmpq %r11, %r8
jbe 0x98a8e
movzwl (%r10,%r11,2), %eax
movl %eax, %r15d
shrl $0xe, %r15d
cmpl %ebp, %r15d
jne 0x98a8e
andl $0x3fff, %eax           # imm = 0x3FFF
addl %eax, %ebx
jmp 0x98a6c
movzwl %r14w, %eax
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x98acb
testl %ebx, %ebx
je 0x98ae1
movslq %ecx, %r15
movslq %edx, %r12
leal (%rbx,%rdx), %ebp
leal (%rbx,%rcx), %r13d
addq %rdi, %r12
addq 0x8(%rsp), %r15
movl %ebx, %eax
xorl %r14d, %r14d
movb (%r12,%r14), %r9b
cmpb (%r15,%r14), %r9b
jne 0x98b23
incq %r14
cmpl %r14d, %eax
jne 0x98ab7
jmp 0x98b1c
addl %ebx, %esi
cmpw $0x3, %bp
je 0x98ae6
movzwl %bp, %eax
cmpl $0x2, %eax
jne 0x98aec
addl %edx, %ebx
movl %ebx, %edx
jmp 0x98b40
xorl %r14d, %r14d
jmp 0x98b29
addl %ecx, %ebx
movl %ebx, %ecx
jmp 0x98b40
testl %ebx, %ebx
je 0x98b30
movslq %ecx, %r15
movslq %edx, %r12
leal (%rbx,%rdx), %ebp
leal (%rbx,%rcx), %r13d
addq %rdi, %r12
addq 0x8(%rsp), %r15
movl %ebx, %eax
xorl %r14d, %r14d
movb (%r12,%r14), %r9b
cmpb (%r15,%r14), %r9b
je 0x98b35
incq %r14
cmpl %r14d, %eax
jne 0x98b0a
movl %ebp, %edx
movl %r13d, %ecx
jmp 0x98b40
addl %r14d, %ecx
addl %r14d, %edx
cmpl %ebx, %r14d
je 0x98b40
jmp 0x98b79
xorl %r14d, %r14d
jmp 0x98b3b
addl %r14d, %ecx
addl %r14d, %edx
cmpl %ebx, %r14d
jne 0x98b8c
movl %r11d, %ebx
cmpq %rbx, %r8
ja 0x98a58
jmp 0x98b50
xorl %esi, %esi
movl $0x1, %ebx
movq 0x10(%rsp), %rax
cmpl 0x2c(%rax), %esi
jne 0x98b70
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6010
xorl %ebx, %ebx
jmp 0x98b5f
movq 0x1fc460(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x19d003(%rip), %rsi    # 0x235b8d
jmp 0x98b9d
movq 0x1fc44d(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x19d00b(%rip), %rsi    # 0x235ba8
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x22b0
jmp 0x98b5f