// File: /workspace/github_cpp_makefile_star2_O1/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
movl %r8d, %ebp
cmpl $0x3, %esi
movl $0xffff, %eax           # imm = 0xFFFF
cmovnel %edx, %eax
movq %rdi, %rbx
cmovel %edx, %ecx
testl %r9d, %r9d
je 0x18da73
movq (%rbx), %rdx
testq %rdx, %rdx
je 0x18da73
movq 0x10(%rbx), %rdi
movzwl -0x2(%rdi,%rdx,2), %edi
movl %edi, %r8d
shrl $0xe, %r8d
testw %di, %di
js 0x18da3e
movw $0x3fff, %r10w          # imm = 0x3FFF
movl %eax, %r11d
movl %ecx, %r9d
cmpw $0x1, %r8w
jne 0x18da51
movl %edi, %r9d
shrl $0xc, %r9d
andl $0x3, %r9d
movl %edi, %r11d
shrl $0xa, %r11d
andl $0x3, %r11d
movw $0x3ff, %r10w           # imm = 0x3FF
jmp 0x18da51
movl %edi, %r9d
shrl $0xc, %r9d
andl $0x3, %r9d
movw $0xfff, %r10w           # imm = 0xFFF
movl %eax, %r11d
cmpw %si, %r8w
jne 0x18da73
cmpw %r11w, %ax
jne 0x18da73
cmpw %r9w, %cx
jne 0x18da73
movzwl %r10w, %r8d
andl %edi, %r8d
decq %rdx
movq %rdx, (%rbx)
addl %r8d, %ebp
movl %esi, %r14d
shll $0xe, %r14d
movl %esi, %edx
andl $0xfffe, %edx           # imm = 0xFFFE
cmpw $0x2, %dx
jne 0x18da99
andl $0x3, %ecx
shll $0xc, %ecx
orl %ecx, %r14d
movl $0xfff, %r15d           # imm = 0xFFF
jmp 0x18dac2
movl $0x3fff, %r15d          # imm = 0x3FFF
cmpw $0x1, %si
jne 0x18dac2
andl $0x3, %ecx
shll $0xc, %ecx
andl $0x3, %eax
shll $0xa, %eax
leal (%rax,%rcx), %r14d
addl $0x4000, %r14d          # imm = 0x4000
movl $0x3ff, %r15d           # imm = 0x3FF
cmpl %r15d, %ebp
jb 0x18db14
leal (%r14,%r15), %r12d
movl $0x2, %r13d
movq 0x8(%rbx), %rax
cmpq %rax, (%rbx)
jne 0x18daf9
leaq (%rax,%rax), %rsi
testq %rax, %rax
cmoveq %r13, %rsi
movq %rsi, 0x8(%rbx)
movq 0x10(%rbx), %rdi
addq %rsi, %rsi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rbx)
movw %r12w, (%rcx,%rax,2)
subl %r15d, %ebp
cmpl %r15d, %ebp
jae 0x18dad1
testl %ebp, %ebp
je 0x18db5b
addl %ebp, %r14d
movq 0x8(%rbx), %rax
cmpq %rax, (%rbx)
jne 0x18db48
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %esi
cmovneq %rcx, %rsi
movq %rsi, 0x8(%rbx)
movq 0x10(%rbx), %rdi
addq %rsi, %rsi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rbx)
movw %r14w, (%rcx,%rax,2)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq