// File: chhylp123[P]hifiasm/./Levenshtein_distance.h
// Function: push_trace_bp_f(asg16_v*, unsigned short, unsigned short, unsigned short, unsigned int, unsigned int)
inline void push_trace_bp_f(asg16_v *res, uint16_t c, uint16_t bq, uint16_t bt, uint32_t len, uint32_t is_append)
{
    uint16_t p, c0 = c, bq0, bt0, len0, mm; 
	if(c == 3) {
		bt = bq; bq = (uint16_t)-1;
	}
	if((is_append) && (res->n)) {
		bq0 = bq; bt0 = bt;
		pop_trac_bpc_f(res->a[res->n-1], c0, bq0, bt0, len0);
		if((c == c0) && (bq == bq0) && (bt == bt0)) {
			res->n--; len += len0;
		}
	}


	c0 = c; c <<= 14;
	if(c0 == 2 || c0 == 3) {
		mm = (0xfff); c += ((bt&3) << 12);
	} else if(c0 == 1) {
		mm = (0x3ff); c += ((bt&3) << 12); c += ((bq&3) << 10);
	} else {
		mm = (0x3fff);
	}

	
	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 $0x40, %rsp
movw %cx, %ax
movw %dx, %cx
movw %si, %dx
movq %rdi, -0x8(%rbp)
movw %dx, -0xa(%rbp)
movw %cx, -0xc(%rbp)
movw %ax, -0xe(%rbp)
movl %r8d, -0x14(%rbp)
movl %r9d, -0x18(%rbp)
movw -0xa(%rbp), %ax
movw %ax, -0x1c(%rbp)
movzwl -0xa(%rbp), %eax
cmpl $0x3, %eax
jne 0x26d7d8
movw -0xc(%rbp), %ax
movw %ax, -0xe(%rbp)
movw $0xffff, -0xc(%rbp)     # imm = 0xFFFF
cmpl $0x0, -0x18(%rbp)
je 0x26d945
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
je 0x26d945
movw -0xc(%rbp), %ax
movw %ax, -0x1e(%rbp)
movw -0xe(%rbp), %ax
movw %ax, -0x20(%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, -0x1c(%rbp)
movzwl -0x1c(%rbp), %eax
cmpl $0x2, %eax
je 0x26d830
movzwl -0x1c(%rbp), %eax
cmpl $0x3, %eax
jne 0x26d876
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, -0x20(%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, -0x22(%rbp)
jmp 0x26d905
movzwl -0x1c(%rbp), %eax
cmpl $0x1, %eax
jne 0x26d8e3
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, -0x20(%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 $0xa, %eax
andl $0x3, %eax
movw %ax, -0x1e(%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 $0x3ff, %eax            # imm = 0x3FF
movw %ax, -0x22(%rbp)
jmp 0x26d903
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, -0x22(%rbp)
jmp 0x26d905
jmp 0x26d907
movzwl -0xa(%rbp), %eax
movzwl -0x1c(%rbp), %ecx
cmpl %ecx, %eax
jne 0x26d943
movzwl -0xc(%rbp), %eax
movzwl -0x1e(%rbp), %ecx
cmpl %ecx, %eax
jne 0x26d943
movzwl -0xe(%rbp), %eax
movzwl -0x20(%rbp), %ecx
cmpl %ecx, %eax
jne 0x26d943
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $-0x1, %rcx
movq %rcx, (%rax)
movzwl -0x22(%rbp), %eax
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x26d945
movw -0xa(%rbp), %ax
movw %ax, -0x1c(%rbp)
movzwl -0xa(%rbp), %eax
shll $0xe, %eax
movw %ax, -0xa(%rbp)
movzwl -0x1c(%rbp), %eax
cmpl $0x2, %eax
je 0x26d96a
movzwl -0x1c(%rbp), %eax
cmpl $0x3, %eax
jne 0x26d986
movw $0xfff, -0x24(%rbp)     # imm = 0xFFF
movzwl -0xe(%rbp), %ecx
andl $0x3, %ecx
shll $0xc, %ecx
movzwl -0xa(%rbp), %eax
addl %ecx, %eax
movw %ax, -0xa(%rbp)
jmp 0x26d9c7
movzwl -0x1c(%rbp), %eax
cmpl $0x1, %eax
jne 0x26d9bf
movw $0x3ff, -0x24(%rbp)     # imm = 0x3FF
movzwl -0xe(%rbp), %ecx
andl $0x3, %ecx
shll $0xc, %ecx
movzwl -0xa(%rbp), %eax
addl %ecx, %eax
movw %ax, -0xa(%rbp)
movzwl -0xc(%rbp), %ecx
andl $0x3, %ecx
shll $0xa, %ecx
movzwl -0xa(%rbp), %eax
addl %ecx, %eax
movw %ax, -0xa(%rbp)
jmp 0x26d9c5
movw $0x3fff, -0x24(%rbp)    # imm = 0x3FFF
jmp 0x26d9c7
jmp 0x26d9c9
movl -0x14(%rbp), %eax
movzwl -0x24(%rbp), %ecx
cmpl %ecx, %eax
jb 0x26da7f
movzwl -0xa(%rbp), %eax
movzwl -0x24(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x1a(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x26da4d
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x26da13
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x30(%rbp)
jmp 0x26da1e
movl $0x2, %eax
movq %rax, -0x30(%rbp)
jmp 0x26da1e
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 -0x1a(%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 -0x24(%rbp), %ecx
movl -0x14(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x26d9c9
cmpl $0x0, -0x14(%rbp)
je 0x26db1e
movzwl -0xa(%rbp), %eax
addl -0x14(%rbp), %eax
movw %ax, -0x1a(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x26dafb
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x26dac1
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x38(%rbp)
jmp 0x26dacc
movl $0x2, %eax
movq %rax, -0x38(%rbp)
jmp 0x26dacc
movq -0x38(%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 -0x1a(%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 0x26db1e
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop