// File: chhylp123[P]hifiasm/./Levenshtein_distance.h
// Function: push_trace_bp(asg16_v*, unsigned short, unsigned short, unsigned int, unsigned int)
inline void push_trace_bp(asg16_v *res, uint16_t c, uint16_t b, uint32_t len, uint32_t is_append)
{
    uint16_t p, c0, b0, len0, mm; 
	if((is_append) && (res->n)) {
		b0 = b;
		pop_trac_bpc(res->a[res->n-1], c0, b0, len0);
		if((c == c0) && (b == b0)) {
			res->n--; len += len0;
		}
	}
	
	mm = (0x3fff); c0 = c; c <<= 14;
	if(c0 == 1 || c0 == 2) {
		mm = (0xfff); c += ((b&3) << 12);
	}

	
	while (len >= mm) {
		p = (c + mm); kv_push(uint16_t, *res, p); len -= mm;
	}
	// fprintf(stderr, "[M::%s] c::%u, len::%u\n", __func__, c, len);
	if(len) {
		p = (c + len); kv_push(uint16_t, *res, p);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movw %dx, %ax
movw %si, %dx
movq %rdi, -0x8(%rbp)
movw %dx, -0xa(%rbp)
movw %ax, -0xc(%rbp)
movl %ecx, -0x10(%rbp)
movl %r8d, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x26d5e8
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
je 0x26d5e8
movw -0xc(%rbp), %ax
movw %ax, -0x1a(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
movzwl (%rax,%rcx,2), %eax
sarl $0xe, %eax
movw %ax, -0x18(%rbp)
movzwl -0x18(%rbp), %eax
cmpl $0x1, %eax
je 0x26d551
movzwl -0x18(%rbp), %eax
cmpl $0x2, %eax
jne 0x26d594
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
movzwl (%rax,%rcx,2), %eax
sarl $0xc, %eax
andl $0x3, %eax
movw %ax, -0x1a(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0xfff, %eax            # imm = 0xFFF
movw %ax, -0x1c(%rbp)
jmp 0x26d5b4
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x3fff, %eax           # imm = 0x3FFF
movw %ax, -0x1c(%rbp)
jmp 0x26d5b6
movzwl -0xa(%rbp), %eax
movzwl -0x18(%rbp), %ecx
cmpl %ecx, %eax
jne 0x26d5e6
movzwl -0xc(%rbp), %eax
movzwl -0x1a(%rbp), %ecx
cmpl %ecx, %eax
jne 0x26d5e6
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $-0x1, %rcx
movq %rcx, (%rax)
movzwl -0x1c(%rbp), %eax
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
jmp 0x26d5e8
movw $0x3fff, -0x1e(%rbp)    # imm = 0x3FFF
movw -0xa(%rbp), %ax
movw %ax, -0x18(%rbp)
movzwl -0xa(%rbp), %eax
shll $0xe, %eax
movw %ax, -0xa(%rbp)
movzwl -0x18(%rbp), %eax
cmpl $0x1, %eax
je 0x26d613
movzwl -0x18(%rbp), %eax
cmpl $0x2, %eax
jne 0x26d62d
movw $0xfff, -0x1e(%rbp)     # imm = 0xFFF
movzwl -0xc(%rbp), %ecx
andl $0x3, %ecx
shll $0xc, %ecx
movzwl -0xa(%rbp), %eax
addl %ecx, %eax
movw %ax, -0xa(%rbp)
jmp 0x26d62f
movl -0x10(%rbp), %eax
movzwl -0x1e(%rbp), %ecx
cmpl %ecx, %eax
jb 0x26d6e5
movzwl -0xa(%rbp), %eax
movzwl -0x1e(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x16(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x26d6b3
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x26d679
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x28(%rbp)
jmp 0x26d684
movl $0x2, %eax
movq %rax, -0x28(%rbp)
jmp 0x26d684
movq -0x28(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
shlq %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movw -0x16(%rbp), %dx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movw %dx, (%rax,%rcx,2)
movzwl -0x1e(%rbp), %ecx
movl -0x10(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x10(%rbp)
jmp 0x26d62f
cmpl $0x0, -0x10(%rbp)
je 0x26d784
movzwl -0xa(%rbp), %eax
addl -0x10(%rbp), %eax
movw %ax, -0x16(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x26d761
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x26d727
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x30(%rbp)
jmp 0x26d732
movl $0x2, %eax
movq %rax, -0x30(%rbp)
jmp 0x26d732
movq -0x30(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
shlq %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movw -0x16(%rbp), %dx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movw %dx, (%rax,%rcx,2)
jmp 0x26d784
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)