// File: /workspace/github_cpp_makefile_star2_O3/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
movq %rdi, %rbx
cmpl $0x3, %esi
movl $0xffff, %r8d           # imm = 0xFFFF
cmovnel %edx, %r8d
movl %ecx, %eax
cmovel %edx, %eax
testl %r9d, %r9d
je 0x196890
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x196890
movq 0x10(%rbx), %r9
movzwl -0x2(%r9,%rdi,2), %r9d
movl %r9d, %r10d
shrl $0xe, %r10d
testw %r9w, %r9w
js 0x19685b
movw $0x3fff, %r14w          # imm = 0x3FFF
movl %r8d, %r15d
movl %eax, %r11d
cmpw $0x1, %r10w
jne 0x19686e
movl %r9d, %r11d
shrl $0xc, %r11d
andl $0x3, %r11d
movl %r9d, %r15d
shrl $0xa, %r15d
andl $0x3, %r15d
movw $0x3ff, %r14w           # imm = 0x3FF
jmp 0x19686e
movl %r9d, %r11d
shrl $0xc, %r11d
andl $0x3, %r11d
movw $0xfff, %r14w           # imm = 0xFFF
movl %r8d, %r15d
cmpw %si, %r10w
jne 0x196890
cmpw %r15w, %r8w
jne 0x196890
cmpw %r11w, %ax
jne 0x196890
movzwl %r14w, %r8d
andl %r9d, %r8d
decq %rdi
movq %rdi, (%rbx)
addl %r8d, %ebp
movl %esi, %r14d
shll $0xe, %r14d
movl %esi, %edi
andl $0xfffe, %edi           # imm = 0xFFFE
cmpw $0x2, %di
jne 0x1968b6
andl $0x3, %eax
shll $0xc, %eax
orl %eax, %r14d
movl $0xfff, %r15d           # imm = 0xFFF
jmp 0x1968df
movl $0x3fff, %r15d          # imm = 0x3FFF
cmpw $0x1, %si
jne 0x1968df
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
cmpl %r15d, %ebp
jb 0x196933
leal (%r14,%r15), %r12d
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
movl $0x2, %r13d
cmpq 0x8(%rbx), %rcx
jne 0x19691c
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
cmoveq %r13, %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 %r12w, (%rax,%rcx,2)
subl %r15d, %ebp
movq %rdx, %rcx
cmpl %r15d, %ebp
jae 0x1968f5
testl %ebp, %ebp
je 0x19697c
addl %ebp, %r14d
movq (%rbx), %rcx
cmpq 0x8(%rbx), %rcx
jne 0x19696c
leaq (%rcx,%rcx), %rax
testq %rcx, %rcx
movl $0x2, %esi
cmovneq %rax, %rsi
movq %rsi, 0x8(%rbx)
movq 0x10(%rbx), %rdi
addq %rsi, %rsi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
jmp 0x196970
movq 0x10(%rbx), %rax
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