// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Correct.cpp
// Function: push_alnw(overlap_region*, bit_extz_t*)
void push_alnw(overlap_region *aux_o, bit_extz_t *exz)
{
    window_list *p = NULL; int64_t t;
    if(aux_o->w_list.n > 0) {
        p = &(aux_o->w_list.a[aux_o->w_list.n-1]);
        // fprintf(stderr, "+[M::%s::wn->%d] px::[%d, %d], py::[%d, %d], pe::%d, exz->t::[%u, %u], exz->p::[%u, %u], exz->e::%d, clen::%u\n", 
        //     __func__, (int32_t)(aux_o->w_list.n), p->x_start, p->x_end, p->y_start, p->y_end, p->error, 
        //     exz->ts, exz->te, exz->ps, exz->pe, exz->err, p->clen);
        // assert((p->x_end<exz->ts)&&(p->y_end<exz->ps));
        
        if(p->clen > 0) {
            t = ((int64_t)p->error) + ((int64_t)exz->err);
            ///note: t cannot be equal to INT16_MAX; otherwise it is unable to distiguish unaligned regions
            if(((p->x_end+1) == exz->ts) && ((p->y_end+1) == exz->ps) && (t < INT16_MAX)) {
                p->x_end = exz->te; p->y_end = exz->pe; p->error += exz->err;
                append_wcigar(p, &(aux_o->w_list), exz);
            //     fprintf(stderr, "-[M::%s::wn->%d] px::[%d, %d], py::[%d, %d], pe::%d, exz->t::[%u, %u], exz->p::[%u, %u], exz->e::%d, clen::%u\n", 
            // __func__, (int32_t)(aux_o->w_list.n), p->x_start, p->x_end, p->y_start, p->y_end, p->error, 
            // exz->ts, exz->te, exz->ps, exz->pe, exz->err, p->clen);
                return;
            }
        }
    }
    // fprintf(stderr, "[M::%s::wn->%d] exz->t::[%u, %u], exz->p::[%u, %u], exz->e::%d\n", 
    //         __func__, (int32_t)(aux_o->w_list.n), exz->ts, exz->te, exz->ps, exz->pe, exz->err);
    kv_pushp(window_list, aux_o->w_list, &p);
    p->x_start = exz->ts; p->x_end = exz->te;
    p->y_start = exz->ps; p->y_end = exz->pe;
    p->error_threshold = 0; p->error = exz->err;///single round of alignment cannot have INT16_MAX errors
    push_wcigar(p, &(aux_o->w_list), exz);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x48(%rdi), %r14
movq 0x48(%rdi), %rcx
testq %rcx, %rcx
je 0x349e9
movq 0x58(%r15), %rdx
movq %rcx, %rsi
shlq $0x5, %rsi
cmpl $0x0, -0x4(%rdx,%rsi)
je 0x349e9
leaq (%rdx,%rsi), %rax
movl -0x1c(%rax), %edi
incl %edi
cmpl 0x1c(%rbx), %edi
jne 0x349e9
movswq -0xc(%rax), %r8
movslq 0x2c(%rbx), %r9
leaq (%r9,%r8), %rdi
movl -0x14(%rax), %r10d
incl %r10d
cmpl 0x10(%rbx), %r10d
sete %r10b
cmpq $0x7fff, %rdi           # imm = 0x7FFF
setl %dil
andb %r10b, %dil
cmpb $0x1, %dil
jne 0x349e9
leaq (%rdx,%rsi), %rdi
addq $-0x20, %rdi
movl 0x20(%rbx), %ecx
movl %ecx, -0x1c(%rax)
movl 0x14(%rbx), %ecx
movl %ecx, -0x14(%rax)
addl %r9d, %r8d
movw %r8w, -0xc(%rax)
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x347ac
cmpq 0x50(%r15), %rcx
jne 0x34a18
leaq (%rcx,%rcx), %rax
testq %rcx, %rcx
pushq $0x2
popq %rsi
cmovneq %rax, %rsi
movq %rsi, 0x50(%r15)
movq 0x58(%r15), %rdi
shlq $0x5, %rsi
callq 0x2370
movq %rax, 0x58(%r15)
movq 0x48(%r15), %rcx
jmp 0x34a1c
movq 0x58(%r15), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, (%r14)
shlq $0x5, %rcx
leaq (%rax,%rcx), %rdi
movsd 0x10(%rbx), %xmm0
movsd 0x1c(%rbx), %xmm1
movlhps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movups %xmm1, (%rax,%rcx)
andw $0x0, 0x16(%rax,%rcx)
movzwl 0x2c(%rbx), %edx
movw %dx, 0x14(%rax,%rcx)
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x1e842