// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/ecovlp.cpp
// Function: push_correct0_fhc(window_list*, window_list_alloc*, unsigned int, unsigned int, char*)
uint64_t push_correct0_fhc(window_list *idx, window_list_alloc *res, uint32_t len0, uint32_t rc, char *qstr)
{
    uint64_t nec = 0;
    // fprintf(stderr, "[M::%s] NULL(idx)::%u\n", __func__, idx?0:1);
    if(len0 != ((uint32_t)-1)) {
        push_trace_bp_f(((asg16_v *)(&(res->c))), 0, (uint16_t)-1, (uint16_t)-1, len0, ((idx->clen>0)?1:0)); 
        idx->clen = res->c.n - idx->cidx;
    } else if(rc != ((uint32_t)-1)) {
        // fprintf(stderr, "[M::%s]\t", __func__);
        uint32_t cc = (rc<<4)>>20, cn = rc>>28, ck = 0, cs, cp;
        uint32_t bc = (rc<<20)>>20, bn = (rc<<16)>>28, btk = 0, bqk = 0, bs, bqp, btp;
        ///debug
        // prt_cigar0(cc, cn);
        // prt_bp0(bc, bn);

        for (ck = 0; ck < cn; ck++) {
            cs = (cn-1-ck)<<1; cp = (cc>>cs)&3;

            bqp = btp = (uint32_t)-1;
            if(cp != 3) {///bp == 3: more x
                bs = (bn-1-btk)<<1; btp = (bc>>bs)&3; btk++;
            }
            if(cp != 2) {///bp == 2: more y
                bqp = seq_nt6_table[(uint32_t)qstr[bqk]]; bqk++;
            }
            // fprintf(stderr, "[M::%s] cp::%u, btp::%u, bqp::%u\n", __func__, cp, btp, bqp);

            push_trace_bp_f(((asg16_v *)(&(res->c))), cp, bqp, btp, 1, ((idx->clen>0)?1:0)); 
            idx->clen = res->c.n - idx->cidx;
            // fprintf(stderr, "%c", cm[(in >> mp)&3]);

            // fprintf(stderr, "%c", "MSID"[cp]);
            if(cp != 0) nec++;
        }

        // fprintf(stderr, "\n");
    }

    return nec;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
cmpl $-0x1, %edx
je 0x1414b2
movl %edx, %eax
leaq 0x18(%r14), %rdi
xorl %r9d, %r9d
cmpl $0x0, 0x1c(%rbx)
setne %r9b
xorl %r12d, %r12d
xorl %esi, %esi
movl $0xffff, %edx           # imm = 0xFFFF
movl $0xffff, %ecx           # imm = 0xFFFF
movl %eax, %r8d
callq 0x14f542
movl 0x18(%r14), %eax
subl 0x18(%rbx), %eax
movl %eax, 0x1c(%rbx)
movq %r12, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $-0x1, %ecx
je 0x14159b
movq $0x0, 0x18(%rsp)
movq %r8, 0x20(%rsp)
movl %ecx, %eax
shrl $0x10, %eax
movl $0xfff, %edx            # imm = 0xFFF
andl %edx, %eax
movl %eax, 0x14(%rsp)
andl %ecx, %edx
movl %edx, 0x10(%rsp)
movl %ecx, %eax
shrl $0xc, %eax
andl $0xf, %eax
movl %eax, 0xc(%rsp)
addq $0x18, %r14
shrl $0x1c, %ecx
leal -0x2(,%rcx,2), %ebp
xorl %r15d, %r15d
xorl %r12d, %r12d
cmpl $-0x2, %ebp
je 0x1414a0
movl 0x14(%rsp), %r13d
movl %ebp, %ecx
shrl %cl, %r13d
andl $0x3, %r13d
movw $0xffff, %ax            # imm = 0xFFFF
cmpl $0x3, %r13d
je 0x141545
movq 0x18(%rsp), %rdx
movl %edx, %ecx
notl %ecx
addl 0xc(%rsp), %ecx
addl %ecx, %ecx
movl 0x10(%rsp), %eax
shrl %cl, %eax
incl %edx
movq %rdx, 0x18(%rsp)
andl $0x3, %eax
movw $0xffff, %cx            # imm = 0xFFFF
cmpl $0x2, %r13d
je 0x141562
movl %r15d, %ecx
movq 0x20(%rsp), %rdx
movsbq (%rdx,%rcx), %rcx
movl %ecx, %ecx
leaq 0x1120d5(%rip), %rdx    # 0x253630
movzbl (%rdx,%rcx), %ecx
incl %r15d
xorl %r9d, %r9d
cmpl $0x0, 0x1c(%rbx)
setne %r9b
movzwl %cx, %edx
movzwl %ax, %ecx
movq %r14, %rdi
movl %r13d, %esi
pushq $0x1
popq %r8
callq 0x14f542
movl (%r14), %eax
subl 0x18(%rbx), %eax
movl %eax, 0x1c(%rbx)
cmpl $0x1, %r13d
sbbq $-0x1, %r12
addl $-0x2, %ebp
jmp 0x1414ff
xorl %r12d, %r12d
jmp 0x1414a0