// File: chhylp123[P]hifiasm/hic.cpp
// Function: determine_bub_idx(bubble_type*, ma_utg_t*, asg_t*, unsigned long, unsigned long, unsigned long, int, int, unsigned int)
void determine_bub_idx(bubble_type* bub, ma_utg_t *bu, asg_t *untig_sg, uint64_t pLen, 
uint64_t rLEN, uint64_t r_hetLen, int beg_idx, int end_idx, uint32_t check_het)
{
    if(beg_idx > end_idx) return;

    uint64_t r_homLen = rLEN - r_hetLen;
    ///pLen: total length, rLEN: beg/sink length
    if(pLen > 0 && rLEN > 0 && r_hetLen > 0 && rLEN < pLen*0.5 && r_hetLen < rLEN * 0.2) ///set het to hom
    {
        set_bub_idx(bub, bu, untig_sg, beg_idx, end_idx, 1, bub->check_het);
    }
    else if(pLen > 0 && rLEN > 0 && r_homLen > 0 && rLEN > pLen*0.9 && r_homLen < rLEN * 0.1) ///set hom to het
    {
        set_bub_idx(bub, bu, untig_sg, beg_idx, end_idx, 0, bub->check_het);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movl 0x10(%rbp), %eax
cmpl 0x18(%rbp), %eax
jle 0x1dd116
jmp 0x1dd306
movq -0x28(%rbp), %rax
subq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x20(%rbp)
jbe 0x1dd219
cmpq $0x0, -0x28(%rbp)
jbe 0x1dd219
cmpq $0x0, -0x30(%rbp)
jbe 0x1dd219
movq -0x28(%rbp), %xmm1
movaps 0x1a4ec1(%rip), %xmm3   # 0x382010
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movapd 0x1a4ec5(%rip), %xmm2   # 0x382020
subpd %xmm2, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movq -0x20(%rbp), %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm2, %xmm0
movaps %xmm0, %xmm2
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm2, %xmm0
movsd 0x1a50e6(%rip), %xmm2   # 0x382270
mulsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x1dd219
movq -0x30(%rbp), %xmm1
movaps 0x1a4e6c(%rip), %xmm3   # 0x382010
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movapd 0x1a4e70(%rip), %xmm2   # 0x382020
subpd %xmm2, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movq -0x28(%rbp), %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm2, %xmm0
movaps %xmm0, %xmm2
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm2, %xmm0
movsd 0x1a1e31(%rip), %xmm2   # 0x37f010
mulsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x1dd219
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl 0x10(%rbp), %ecx
movl 0x18(%rbp), %r8d
movq -0x8(%rbp), %rax
movl 0xb0(%rax), %eax
movl $0x1, %r9d
movl %eax, (%rsp)
callq 0x214aa0
jmp 0x1dd306
cmpq $0x0, -0x20(%rbp)
jbe 0x1dd304
cmpq $0x0, -0x28(%rbp)
jbe 0x1dd304
cmpq $0x0, -0x38(%rbp)
jbe 0x1dd304
movq -0x28(%rbp), %xmm0
movaps 0x1a4dca(%rip), %xmm3   # 0x382010
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x1a4dce(%rip), %xmm2   # 0x382020
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq -0x20(%rbp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
movsd 0x1a4fe7(%rip), %xmm2   # 0x382268
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1dd304
movq -0x38(%rbp), %xmm1
movaps 0x1a4d79(%rip), %xmm3   # 0x382010
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movapd 0x1a4d7d(%rip), %xmm2   # 0x382020
subpd %xmm2, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movq -0x28(%rbp), %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm2, %xmm0
movaps %xmm0, %xmm2
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm2, %xmm0
movsd 0x1a1d46(%rip), %xmm2   # 0x37f018
mulsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x1dd304
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl 0x10(%rbp), %ecx
movl 0x18(%rbp), %r8d
movq -0x8(%rbp), %rax
movl 0xb0(%rax), %eax
xorl %r9d, %r9d
movl %eax, (%rsp)
callq 0x214aa0
jmp 0x1dd306
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)