// File: chhylp123[P]hifiasm/Correct.cpp
// Function: comput_sc_rphase(SnpStats*, unsigned long, SnpStats*, unsigned long, haplotype_evdience*, unsigned long)
inline int64_t comput_sc_rphase(SnpStats *ai, uint64_t id, SnpStats *aj, uint64_t jd, haplotype_evdience *za, uint64_t occ0_cut)
{
    if(ai->site == aj->site) return INT64_MIN;
    // if(ai->occ_0 < occ0_cut || aj->occ_0 < occ0_cut) return INT64_MIN;
    haplotype_evdience *iz = NULL, *jz = NULL; int64_t in, jn, ik, jk, nn[2]; uint8_t fi, fj;
    iz = za + ai->non_homopolymer_num; in = ai->homopolymer_num - ai->non_homopolymer_num;
    jz = za + aj->non_homopolymer_num; jn = aj->homopolymer_num - aj->non_homopolymer_num;

    for (ik = jk = nn[0] = nn[1] = 0; (ik < in) && (jk < jn); ik++) {
        for (; (jk < jn) && (jz[jk].overlapID < iz[ik].overlapID); jk++);
        if((jk < jn) && (jz[jk].overlapID == iz[ik].overlapID)) {

            fi = 2;
            if(hh_tp(iz[ik]) == 0) {
                fi = 0;
            } else if(iz[ik].overlapSite == id){
                fi = 1;
            }

            fj = 2;
            if(hh_tp(jz[jk]) == 0) {
                fj = 0;
            } else if(jz[jk].overlapSite == jd){
                fj = 1;
            }

            if((fi == 2) && (fj == 2) && (iz[ik].overlapSite != ((uint32_t)-1)) && (jz[jk].overlapSite != ((uint32_t)-1))) {///for rare cases
                fi = fj = 0;
            }

            if(fi == 2 || fj == 2) return INT64_MIN;
            if(fi != fj) return INT64_MIN;
            nn[fi]++;
        }
    }

    if(nn[0] > 0 && nn[1] > 0) return 1;
    return INT64_MIN;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x20(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jne 0xa1fe3
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, -0x8(%rbp)
jmp 0xa2290
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movl 0x18(%rcx), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x10(%rbp), %rcx
subl 0x18(%rcx), %eax
movl %eax, %eax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
movl 0x18(%rcx), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x20(%rbp), %rcx
subl 0x18(%rcx), %eax
movl %eax, %eax
movq %rax, -0x58(%rbp)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x80(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rcx
xorl %eax, %eax
cmpq -0x50(%rbp), %rcx
movb %al, -0x83(%rbp)
jge 0xa208a
movq -0x68(%rbp), %rax
cmpq -0x58(%rbp), %rax
setl %al
movb %al, -0x83(%rbp)
movb -0x83(%rbp), %al
testb $0x1, %al
jne 0xa2099
jmp 0xa226a
jmp 0xa209b
movq -0x68(%rbp), %rcx
xorl %eax, %eax
cmpq -0x58(%rbp), %rcx
movb %al, -0x84(%rbp)
jge 0xa20d4
movq -0x48(%rbp), %rax
imulq $0x18, -0x68(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x40(%rbp), %rcx
imulq $0x18, -0x60(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
setb %al
movb %al, -0x84(%rbp)
movb -0x84(%rbp), %al
testb $0x1, %al
jne 0xa20e0
jmp 0xa20f0
jmp 0xa20e2
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0xa209b
movq -0x68(%rbp), %rax
cmpq -0x58(%rbp), %rax
jge 0xa2257
movq -0x48(%rbp), %rax
imulq $0x18, -0x68(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x40(%rbp), %rcx
imulq $0x18, -0x60(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
jne 0xa2257
movb $0x2, -0x81(%rbp)
movq -0x40(%rbp), %rax
imulq $0x18, -0x60(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xa214a
movb $0x0, -0x81(%rbp)
jmp 0xa2168
movq -0x40(%rbp), %rax
imulq $0x18, -0x60(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpq -0x18(%rbp), %rax
jne 0xa2166
movb $0x1, -0x81(%rbp)
jmp 0xa2168
movb $0x2, -0x82(%rbp)
movq -0x48(%rbp), %rax
imulq $0x18, -0x68(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xa2190
movb $0x0, -0x82(%rbp)
jmp 0xa21ae
movq -0x48(%rbp), %rax
imulq $0x18, -0x68(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpq -0x28(%rbp), %rax
jne 0xa21ac
movb $0x1, -0x82(%rbp)
jmp 0xa21ae
movzbl -0x81(%rbp), %eax
cmpl $0x2, %eax
jne 0xa21f8
movzbl -0x82(%rbp), %eax
cmpl $0x2, %eax
jne 0xa21f8
movq -0x40(%rbp), %rax
imulq $0x18, -0x60(%rbp), %rcx
addq %rcx, %rax
cmpl $-0x1, 0x8(%rax)
je 0xa21f8
movq -0x48(%rbp), %rax
imulq $0x18, -0x68(%rbp), %rcx
addq %rcx, %rax
cmpl $-0x1, 0x8(%rax)
je 0xa21f8
movb $0x0, -0x82(%rbp)
movb $0x0, -0x81(%rbp)
movzbl -0x81(%rbp), %eax
cmpl $0x2, %eax
je 0xa2210
movzbl -0x82(%rbp), %eax
cmpl $0x2, %eax
jne 0xa2220
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, -0x8(%rbp)
jmp 0xa2290
movzbl -0x81(%rbp), %eax
movzbl -0x82(%rbp), %ecx
cmpl %ecx, %eax
je 0xa2242
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, -0x8(%rbp)
jmp 0xa2290
movzbl -0x81(%rbp), %eax
movq -0x80(%rbp,%rax,8), %rcx
addq $0x1, %rcx
movq %rcx, -0x80(%rbp,%rax,8)
jmp 0xa2259
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0xa2067
cmpq $0x0, -0x80(%rbp)
jle 0xa2282
cmpq $0x0, -0x78(%rbp)
jle 0xa2282
movq $0x1, -0x8(%rbp)
jmp 0xa2290
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)