// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x3, %esi
movl $0xffff, %r10d          # imm = 0xFFFF
cmovnel %edx, %r10d
movl %ecx, %eax
cmovel %edx, %eax
testl %r9d, %r9d
je 0x14f5e4
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x14f5e4
movq 0x10(%rbx), %r9
movzwl -0x2(%r9,%rdi,2), %r9d
movl %r9d, %r11d
shrl $0xe, %r11d
testw %r9w, %r9w
js 0x14f5b2
movw $0x3fff, %r14w          # imm = 0x3FFF
movl %r10d, %r15d
movl %eax, %ebp
cmpw $0x1, %r11w
jne 0x14f5c3
movl %r9d, %ebp
shrl $0xc, %ebp
andl $0x3, %ebp
movl %r9d, %r15d
shrl $0xa, %r15d
andl $0x3, %r15d
movw $0x3ff, %r14w           # imm = 0x3FF
jmp 0x14f5c3
movl %r9d, %ebp
shrl $0xc, %ebp
andl $0x3, %ebp
movw $0xfff, %r14w           # imm = 0xFFF
movl %r10d, %r15d
cmpw %si, %r11w
jne 0x14f5e4
cmpw %r15w, %r10w
jne 0x14f5e4
cmpw %bp, %ax
jne 0x14f5e4
movzwl %r14w, %r10d
andl %r9d, %r10d
decq %rdi
movq %rdi, (%rbx)
addl %r10d, %r8d
movl %esi, %r14d
shll $0xe, %r14d
movl %esi, %edi
andl $0xfffe, %edi           # imm = 0xFFFE
cmpw $0x2, %di
jne 0x14f60a
andl $0x3, %eax
shll $0xc, %eax
orl %eax, %r14d
movl $0xfff, %r15d           # imm = 0xFFF
jmp 0x14f633
movl $0x3fff, %r15d          # imm = 0x3FFF
cmpw $0x1, %si
jne 0x14f633
andl $0x3, %ecx
shll $0xc, %ecx
andl $0x3, %edx
shll $0xa, %edx
leal (%rdx,%rcx), %r14d
addl $0x4000, %r14d          # imm = 0x4000
movl $0x3ff, %r15d           # imm = 0x3FF
leal (%r14,%r15), %ebp
addl %r8d, %r14d
movzwl %r15w, %r13d
movl %r8d, %r12d
subl %r15d, %r12d
jb 0x14f68a
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rcx
jne 0x14f677
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%rbx)
addq %rsi, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
movw %bp, (%rax,%rcx,2)
subl %r13d, %r14d
movl %r12d, %r8d
jmp 0x14f641
testl %r8d, %r8d
je 0x14f6cc
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rcx
jne 0x14f6c0
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%rbx)
addq %rsi, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
movw %r14w, (%rax,%rcx,2)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq