// File: chhylp123[P]hifiasm/ecovlp.cpp
// Function: worker_hap_ec_dbg_paf(void*, long, int)
static void worker_hap_ec_dbg_paf(void *data, long i, int tid)
{
	ec_ovec_buf_t0 *b = &(((cal_ec_r_dbg_step_t*)data)->buf->a[tid]);
    r_dbg_step_res_t *rr = &(((cal_ec_r_dbg_step_t*)data)->res[tid]);
    uint32_t high_occ = asm_opt.hom_cov * (2.0 - HA_KMER_GOOD_RATIO);
    uint32_t low_occ = asm_opt.hom_cov * HA_KMER_GOOD_RATIO;
    overlap_region *aux_o = NULL; i += ((cal_ec_r_dbg_step_t*)data)->si;

    // debug_retrive_bqual(D, &b->v8t, i, 256); return;

    recover_UC_Read(&b->self_read, &R_INF, i); 

    h_ec_lchain(b->ab, i, b->self_read.seq, b->self_read.length, asm_opt.mz_win, asm_opt.k_mer_length, &R_INF, &b->olist, &b->clist, ((asm_opt.is_ont)?(0.05):(0.02)), asm_opt.max_n_chain, 1, NULL, NULL, &(b->sp), &high_occ, &low_occ, 1, 1, 3, 0.7, 2, 32, COV_W);///ONT high error

    aux_o = fetch_aux_ovlp(&b->olist);///must be here

    // stderr_phase_ovlp(&b->olist);
    gen_hc_r_alin_ea(&b->olist, &b->clist, &R_INF, &b->self_read, &b->ovlp_read, &b->exz, aux_o, asm_opt.max_ov_diff_ec, (asm_opt.is_ont)?(WINDOW_OHC):(WINDOW_HC), i, E_KHIT, 1, &b->v16, &b->v64, &(R_INF.paf[i]), 0, -1, -1);

    uint32_t k, m, tl; overlap_region *z; bit_extz_t ez; ma_hit_t *t; 
    for (k = 0; k < b->olist.length; k++) {
        z = &(b->olist.list[k]);
        if(!(z->w_list.n)) continue;

        tl = Get_READ_LENGTH((R_INF), z->y_id);
        for (m = 0; m < z->w_list.n; m++) {
            if(is_ualn_win(z->w_list.a[m])) continue;
            set_bit_extz_t(ez, (*z), m);
            kv_pushp(ma_hit_t, *rr, &t);

            t->qns = z->x_id; t->qns = t->qns << 32;
            t->tn = z->y_id;

            t->qns = t->qns | (uint64_t)(z->w_list.a[m].x_start);
            t->qe = z->w_list.a[m].x_end + 1;

            t->ts = z->w_list.a[m].y_start;
            t->te = z->w_list.a[m].y_end + 1;

            t->rev = z->y_pos_strand;
            
            t->bl = rr->ec.n;
            kv_resize(uint16_t, rr->ec, rr->ec.n + ez.cigar.n);
            memcpy(rr->ec.a + rr->ec.n, ez.cigar.a, ez.cigar.n * sizeof((*(rr->ec.a))));
            rr->ec.n += ez.cigar.n;
            t->cc = rr->ec.n - t->bl;

            if(t->rev) {
                t->ts = tl - z->w_list.a[m].y_end - 1;
                t->te = tl - z->w_list.a[m].y_start;
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rdi, -0x28(%rbp)
movq %rsi, -0x30(%rbp)
movl %edx, -0x34(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movslq -0x34(%rbp), %rcx
imulq $0x5c0, %rcx, %rcx      # imm = 0x5C0
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
leaq 0x15861d(%rip), %rax    # 0x3c47f8
cvtsi2sdl 0xd0(%rax), %xmm0
movsd 0x11f635(%rip), %xmm1   # 0x38b820
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
movl %ecx, -0x4c(%rbp)
cvtsi2sdl 0xd0(%rax), %xmm0
movsd 0x11e0b1(%rip), %xmm1   # 0x38a2b8
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x159097(%rip), %rsi    # 0x3c52d0
callq 0xa380
movq -0x40(%rbp), %rax
movq 0xb8(%rax), %rax
movq %rax, -0x1a0(%rbp)
movq -0x30(%rbp), %rax
movl %eax, -0x194(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x190(%rbp)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x188(%rbp)
leaq 0x15857a(%rip), %rax    # 0x3c47f8
movslq 0x94(%rax), %rax
movq %rax, -0x180(%rbp)
leaq 0x158565(%rip), %rax    # 0x3c47f8
movslq 0x80(%rax), %rax
movq %rax, -0x178(%rbp)
movq -0x40(%rbp), %rax
addq $0x98, %rax
movq %rax, -0x170(%rbp)
movq -0x40(%rbp), %rax
addq $0x40, %rax
movq %rax, -0x168(%rbp)
leaq 0x158530(%rip), %rax    # 0x3c47f8
movq 0x2a8(%rax), %rax
movsd 0x115f69(%rip), %xmm0   # 0x382240
movsd 0x112d69(%rip), %xmm1   # 0x37f048
movsd %xmm1, -0x160(%rbp)
cmpq $0x0, %rax
movsd %xmm0, -0x158(%rbp)
jne 0x26c305
movsd -0x160(%rbp), %xmm0
movsd %xmm0, -0x158(%rbp)
movq -0x168(%rbp), %r14
movq -0x170(%rbp), %r15
movq -0x178(%rbp), %r9
movq -0x180(%rbp), %r8
movq -0x188(%rbp), %rcx
movq -0x190(%rbp), %rdx
movl -0x194(%rbp), %esi
movq -0x1a0(%rbp), %rdi
movsd -0x158(%rbp), %xmm0
leaq 0x1584ad(%rip), %rax    # 0x3c47f8
movl 0xe8(%rax), %ebx
movq -0x40(%rbp), %r11
addq $0x568, %r11            # imm = 0x568
leaq 0x158f6d(%rip), %r12    # 0x3c52d0
xorl %eax, %eax
leaq -0x4c(%rbp), %r10
leaq -0x50(%rbp), %rax
movsd 0x115eb3(%rip), %xmm1   # 0x382228
movq %r12, (%rsp)
movq %r15, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movl %ebx, 0x18(%rsp)
movl $0x1, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x30(%rsp)
movq %r11, 0x38(%rsp)
movq %r10, 0x40(%rsp)
movq %rax, 0x48(%rsp)
movl $0x1, 0x50(%rsp)
movl $0x1, 0x58(%rsp)
movq $0x3, 0x60(%rsp)
movl $0x2, 0x68(%rsp)
movl $0x20, 0x70(%rsp)
movq $0xc00, 0x78(%rsp)      # imm = 0xC00
callq 0x1acda0
movq -0x40(%rbp), %rdi
addq $0x98, %rdi
callq 0x24b330
movq %rax, -0x58(%rbp)
movq -0x40(%rbp), %rdi
addq $0x98, %rdi
movq -0x40(%rbp), %rsi
addq $0x40, %rsi
movq -0x40(%rbp), %rcx
movq -0x40(%rbp), %r8
addq $0x20, %r8
movq -0x40(%rbp), %r9
addq $0x3e0, %r9             # imm = 0x3E0
movq -0x58(%rbp), %r15
leaq 0x1583c8(%rip), %rax    # 0x3c47f8
movsd 0xc0(%rax), %xmm0
leaq 0x1583b9(%rip), %rax    # 0x3c47f8
movq 0x2a8(%rax), %r10
movl $0x307, %eax            # imm = 0x307
movl $0x177, %edx            # imm = 0x177
cmpq $0x0, %r10
cmovnel %edx, %eax
movslq %eax, %r14
movq -0x30(%rbp), %rbx
movq -0x40(%rbp), %r11
addq $0x500, %r11            # imm = 0x500
movq -0x40(%rbp), %r10
addq $0x4d0, %r10            # imm = 0x4D0
leaq 0x158e55(%rip), %rax    # 0x3c52d0
movq 0x78(%rax), %rax
imulq $0x18, -0x30(%rbp), %rdx
addq %rdx, %rax
leaq 0x158e42(%rip), %rdx    # 0x3c52d0
xorl %r12d, %r12d
movsd 0x115ddf(%rip), %xmm1   # 0x382278
movq %r15, (%rsp)
movq %r14, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movq $0x1f, 0x18(%rsp)
movq $0x1, 0x20(%rsp)
movq %r11, 0x28(%rsp)
movq %r10, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movl $0x0, 0x40(%rsp)
movq $-0x1, 0x48(%rsp)
callq 0x257380
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpq 0xa8(%rcx), %rax
jae 0x26ca62
movq -0x40(%rbp), %rax
movq 0x98(%rax), %rax
movl -0x5c(%rbp), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x26c525
jmp 0x26ca54
leaq 0x158da4(%rip), %rax    # 0x3c52d0
movq 0x18(%rax), %rax
movq -0x70(%rbp), %rcx
movl 0x10(%rcx), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x64(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
movq -0x70(%rbp), %rcx
cmpq 0x48(%rcx), %rax
jae 0x26ca52
movq -0x70(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x60(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
cmpl $0x7fff, %eax           # imm = 0x7FFF
jne 0x26c5ab
movq -0x70(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x60(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x0, 0x1c(%rax)
jne 0x26c5ab
movq -0x70(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x60(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x12(%rax), %eax
cmpl $0x0, %eax
jge 0x26c5ab
jmp 0x26ca44
jmp 0x26c5ad
movq -0x70(%rbp), %rax
movq 0x70(%rax), %rax
movq -0x70(%rbp), %rcx
movq 0x58(%rcx), %rcx
movl -0x60(%rbp), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
movl 0x18(%rcx), %ecx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x70(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x60(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
movq %rax, -0x98(%rbp)
movq %rax, -0xa0(%rbp)
movq -0x70(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x60(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x12c(%rbp)
movq -0x70(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x60(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x128(%rbp)
movq -0x70(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x60(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x138(%rbp)
movq -0x70(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x60(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0x134(%rbp)
movq -0x70(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x60(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
movl %eax, -0x11c(%rbp)
movq -0x70(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x60(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
movl %eax, -0x120(%rbp)
jmp 0x26c69f
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x48(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x26c70c
movq -0x48(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x26c6d0
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x1a8(%rbp)
jmp 0x26c6de
movl $0x2, %eax
movq %rax, -0x1a8(%rbp)
jmp 0x26c6de
movq -0x1a8(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rax
movq (%rax), %rdi
movq -0x48(%rbp), %rax
imulq $0x28, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x8(%rdx)
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x150(%rbp)
movq -0x70(%rbp), %rax
movl (%rax), %eax
movl %eax, %ecx
movq -0x150(%rbp), %rax
movq %rcx, (%rax)
movq -0x150(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq -0x150(%rbp), %rax
movq %rcx, (%rax)
movq -0x70(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x150(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x150(%rbp), %rax
movq (%rax), %rcx
movq -0x70(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x60(%rbp), %edx
shlq $0x5, %rdx
addq %rdx, %rax
movslq (%rax), %rax
orq %rax, %rcx
movq -0x150(%rbp), %rax
movq %rcx, (%rax)
movq -0x70(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x60(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movq -0x150(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x70(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x60(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x150(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x70(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x60(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movq -0x150(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x70(%rbp), %rax
movl 0x1c(%rax), %ecx
movq -0x150(%rbp), %rax
movl %ecx, %ecx
movl %ecx, %edx
movq 0x18(%rax), %rcx
andq $0x1, %rdx
shlq $0x1f, %rdx
movabsq $-0x80000001, %rsi      # imm = 0xFFFFFFFF7FFFFFFF
andq %rsi, %rcx
orq %rdx, %rcx
movq %rcx, 0x18(%rax)
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, %ecx
movq -0x150(%rbp), %rax
movl %ecx, %ecx
movl %ecx, %edx
movq 0x18(%rax), %rcx
andq $0x7fffffff, %rdx       # imm = 0x7FFFFFFF
shlq $0x20, %rdx
movabsq $-0x7fffffff00000001, %rsi # imm = 0x80000000FFFFFFFF
andq %rsi, %rcx
orq %rdx, %rcx
movq %rcx, 0x18(%rax)
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x48(%rbp), %rcx
movq 0x18(%rcx), %rcx
addq -0xa0(%rbp), %rcx
cmpq %rcx, %rax
jae 0x26c959
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rcx
addq -0xa0(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x20(%rax)
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rcx
shrq %rcx
movq -0x48(%rbp), %rax
orq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rcx
shrq $0x2, %rcx
movq -0x48(%rbp), %rax
orq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rcx
shrq $0x4, %rcx
movq -0x48(%rbp), %rax
orq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rcx
shrq $0x8, %rcx
movq -0x48(%rbp), %rax
orq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rcx
shrq $0x10, %rcx
movq -0x48(%rbp), %rax
orq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rax)
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rsi
shlq %rsi
callq 0x2360
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x26c95b
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
shlq %rax
addq %rax, %rdi
movq -0x90(%rbp), %rsi
movq -0xa0(%rbp), %rdx
shlq %rdx
callq 0x2180
movq -0xa0(%rbp), %rcx
movq -0x48(%rbp), %rax
addq 0x18(%rax), %rcx
movq %rcx, 0x18(%rax)
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x150(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x20, %rcx
andq $0x7fffffff, %rcx       # imm = 0x7FFFFFFF
movl %ecx, %ecx
subq %rcx, %rax
movl %eax, %ecx
movq -0x150(%rbp), %rax
movl %ecx, %ecx
movl %ecx, %edx
movq 0x18(%rax), %rcx
andq $0x3fffffff, %rdx       # imm = 0x3FFFFFFF
andq $-0x40000000, %rcx      # imm = 0xC0000000
orq %rdx, %rcx
movq %rcx, 0x18(%rax)
movq -0x150(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
cmpl $0x0, %eax
je 0x26ca42
movl -0x64(%rbp), %ecx
movq -0x70(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x60(%rbp), %edx
shlq $0x5, %rdx
addq %rdx, %rax
subl 0xc(%rax), %ecx
subl $0x1, %ecx
movq -0x150(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0x64(%rbp), %ecx
movq -0x70(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x60(%rbp), %edx
shlq $0x5, %rdx
addq %rdx, %rax
subl 0x8(%rax), %ecx
movq -0x150(%rbp), %rax
movl %ecx, 0x14(%rax)
jmp 0x26ca44
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x26c545
jmp 0x26ca54
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x26c4e5
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)