// File: chhylp123[P]hifiasm/Correct.cpp
// Function: hc_phase_robust_rr(overlap_region*, All_reads*, haplotype_evdience_alloc*, char*, unsigned long, UC_Read*, unsigned long*, unsigned long, unsigned long, unsigned long, ul_ov_t*, long, unsigned char, unsigned long)
uint64_t hc_phase_robust_rr(overlap_region* ol, All_reads *rref, haplotype_evdience_alloc* hp, char* qstr, uint64_t ql, UC_Read* tu, uint64_t *id_a, uint64_t id_n, uint64_t s, uint64_t e, ul_ov_t *c_idx, int64_t set_f, uint8_t occ_thres, uint64_t hpc_len/**, uint8_t is_dbg**/)
{
    uint64_t k, q[2], rr = 0, os, oe; ul_ov_t *p; overlap_region *z;
    for (k = 0; k < id_n; k++) {
        p = &(c_idx[id_a[k]]); z = &(ol[ovlp_id(*p)]); 
        q[0] = z->w_list.a[ovlp_cur_wid(*p)].x_start+ovlp_bd(*p);
        q[1] = z->w_list.a[ovlp_cur_wid(*p)].x_end+1-ovlp_bd(*p);
        if(q[1] <= e) rr = 1;
        os = MAX(q[0], s); oe = MIN(q[1], e);
        if(oe > os) {
            // if(is_dbg) fprintf(stderr, "[M::%s]\ttn::%u\t%c\to::[%lu,\t%lu)\n", __func__, z->y_id, "+-"[z->y_pos_strand], os, oe);
            extract_sub_cigar_hc(z, rref, hp, qstr, ql, tu, os, oe, p, set_f, hp->flag + os - s, occ_thres, hpc_len/**, is_dbg**/);
        }
    }
    return rr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc0, %rsp
movq 0x48(%rbp), %rax
movb 0x40(%rbp), %al
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x28(%rbp)
movq %rsi, -0x30(%rbp)
movq %rdx, -0x38(%rbp)
movq %rcx, -0x40(%rbp)
movq %r8, -0x48(%rbp)
movq %r9, -0x50(%rbp)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq 0x18(%rbp), %rax
jae 0x71a77
movq 0x30(%rbp), %rax
movq 0x10(%rbp), %rcx
movq -0x58(%rbp), %rdx
imulq $0x1c, (%rcx,%rdx,8), %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x28(%rbp), %rax
movq -0x90(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x90(%rbp), %rcx
movl (%rcx), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x90(%rbp), %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
addl %ecx, %eax
cltq
movq %rax, -0x70(%rbp)
movq -0x98(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x90(%rbp), %rcx
movl (%rcx), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movq -0x90(%rbp), %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
subl %ecx, %eax
cltq
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpq 0x28(%rbp), %rax
ja 0x71981
movq $0x1, -0x78(%rbp)
movq -0x70(%rbp), %rax
cmpq 0x20(%rbp), %rax
jb 0x71998
movq -0x70(%rbp), %rax
movq %rax, -0xa0(%rbp)
jmp 0x719a3
movq 0x20(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x68(%rbp), %rax
cmpq 0x28(%rbp), %rax
ja 0x719c5
movq -0x68(%rbp), %rax
movq %rax, -0xa8(%rbp)
jmp 0x719d0
movq 0x28(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
cmpq -0x80(%rbp), %rax
jbe 0x71a64
movq -0x98(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %r8
movq -0x50(%rbp), %r9
movq -0x80(%rbp), %r12
movq -0x88(%rbp), %r15
movq -0x90(%rbp), %r14
movq 0x38(%rbp), %rbx
movq -0x38(%rbp), %r11
addq $0x18, %r11
addq -0x80(%rbp), %r11
xorl %eax, %eax
subq 0x20(%rbp), %rax
addq %rax, %r11
movb 0x40(%rbp), %r10b
movq 0x48(%rbp), %rax
movq %r12, (%rsp)
movq %r15, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movq %rbx, 0x18(%rsp)
movq %r11, 0x20(%rsp)
movzbl %r10b, %r10d
movl %r10d, 0x28(%rsp)
movq %rax, 0x30(%rsp)
callq 0x6e010
jmp 0x71a66
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x718b9
movq -0x78(%rbp), %rax
addq $0xc0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax,%rax)