// File: chhylp123[P]hifiasm/./Levenshtein_distance.h
// Function: pop_trace_bp(asg16_v*, unsigned int, unsigned short*, unsigned short*, unsigned int*)
inline uint32_t pop_trace_bp(asg16_v *res, uint32_t i, uint16_t *c, uint16_t *b, uint32_t *len)
{
	(*c) = (res->a[i]>>14); 
	if((*c) == 1 || (*c) == 2) {
		(*b) = ((res->a[i]>>12)&3); 
		(*len) = (res->a[i]&(0xfff));
	} else {
		(*b) = (uint16_t)-1; 
		(*len) = (res->a[i]&(0x3fff));
	}

	uint32_t sl; uint16_t sb;
	for (i++; (i < res->n) && ((*c) == (res->a[i]>>14)); i++) {
		if((*c) == 1 || (*c) == 2) {
			sb = ((res->a[i]>>12)&3); sl = (res->a[i]&(0xfff));
		} else {
			sb = (uint16_t)-1; sl = (res->a[i]&(0x3fff));
		}
		if((*b) != sb) break;
		(*len) += sl;
	}
	return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
movzwl (%rax,%rcx,2), %eax
sarl $0xe, %eax
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, (%rax)
movq -0x18(%rbp), %rax
movzwl (%rax), %eax
cmpl $0x1, %eax
je 0x26db7b
movq -0x18(%rbp), %rax
movzwl (%rax), %eax
cmpl $0x2, %eax
jne 0x26dbb7
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
movzwl (%rax,%rcx,2), %eax
sarl $0xc, %eax
andl $0x3, %eax
movw %ax, %cx
movq -0x20(%rbp), %rax
movw %cx, (%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
movzwl (%rax,%rcx,2), %ecx
andl $0xfff, %ecx            # imm = 0xFFF
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
jmp 0x26dbdb
movq -0x20(%rbp), %rax
movw $0xffff, (%rax)         # imm = 0xFFFF
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
movzwl (%rax,%rcx,2), %ecx
andl $0x3fff, %ecx           # imm = 0x3FFF
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl %eax, %ecx
movq -0x8(%rbp), %rdx
xorl %eax, %eax
cmpq (%rdx), %rcx
movb %al, -0x2f(%rbp)
jae 0x26dc18
movq -0x18(%rbp), %rax
movzwl (%rax), %eax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0xc(%rbp), %edx
movzwl (%rcx,%rdx,2), %ecx
sarl $0xe, %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x2f(%rbp)
movb -0x2f(%rbp), %al
testb $0x1, %al
jne 0x26dc24
jmp 0x26dcb5
movq -0x18(%rbp), %rax
movzwl (%rax), %eax
cmpl $0x1, %eax
je 0x26dc3c
movq -0x18(%rbp), %rax
movzwl (%rax), %eax
cmpl $0x2, %eax
jne 0x26dc6e
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
movzwl (%rax,%rcx,2), %eax
sarl $0xc, %eax
andl $0x3, %eax
movw %ax, -0x2e(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
movzwl (%rax,%rcx,2), %eax
andl $0xfff, %eax            # imm = 0xFFF
movl %eax, -0x2c(%rbp)
jmp 0x26dc8b
movw $0xffff, -0x2e(%rbp)    # imm = 0xFFFF
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
movzwl (%rax,%rcx,2), %eax
andl $0x3fff, %eax           # imm = 0x3FFF
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movzwl (%rax), %eax
movzwl -0x2e(%rbp), %ecx
cmpl %ecx, %eax
je 0x26dc9c
jmp 0x26dcb5
movl -0x2c(%rbp), %ecx
movq -0x28(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x26dbe4
movl -0xc(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)