// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: rd_hm_drop0(asg_t*, asg_t*, unsigned int, double, unsigned int)
uint64_t rd_hm_drop0(asg_t *g, asg_t *ref, uint32_t v, double cutoff, uint32_t drop_inexact)
{
    uint32_t nv0, nv1, mol = 0, i0, i1, ncut = 0; asg_arc_t *av0, *av1;
    nv0 = asg_arc_n(g, v); av0 = asg_arc_a(g, v);
    nv1 = asg_arc_n(ref, v); av1 = asg_arc_a(ref, v);
    if(drop_inexact) {
        for (i0 = 0; i0 < nv0; ++i0) { // loop through v's neighbors
            if (av0[i0].del) continue;
            if (av0[i0].el) continue;
            av0[i0].del = 1; asg_arc_del(g, av0[i0].v^1, (av0[i0].ul>>32)^1, 1);
            ncut++;
        }
    } else if(cutoff < 1) {
        for (i0 = 0; i0 < nv0; ++i0) { // loop through v's neighbors
            if (av0[i0].del) continue;
            if(mol < av0[i0].ol) mol = av0[i0].ol;
        }
        for (i1 = 0; i1 < nv1; ++i1) { // loop through v's neighbors
            if (av1[i1].del) continue;
            if(mol < av1[i1].ol) mol = av1[i1].ol;
        }
        if(mol > 0) {
            for (i0 = 0; i0 < nv0; ++i0) { // loop through v's neighbors
                if (av0[i0].del) continue;
                if(av0[i0].ol < (mol*cutoff)) {
                    av0[i0].del = 1; asg_arc_del(g, av0[i0].v^1, (av0[i0].ul>>32)^1, 1);
                    ncut++;
                }
            }
        }
    } else {
        for (i0 = 0; i0 < nv0; ++i0) { // loop through v's neighbors
            if (av0[i0].del) continue;
            av0[i0].del = 1; asg_arc_del(g, av0[i0].v^1, (av0[i0].ul>>32)^1, 1);
            ncut++;
        }
    }
    return ncut;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movsd %xmm0, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x14(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x14(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x14(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x14(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x138a90
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x28(%rbp), %eax
jae 0x138a8b
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x138a01
jmp 0x138a7d
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpb $0x0, 0x12(%rax)
je 0x138a17
jmp 0x138a7d
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
xorq $0x1, %rax
movl %eax, %edx
movl $0x1, %ecx
callq 0xd6530
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1389da
jmp 0x138d08
movsd 0x249568(%rip), %xmm0   # 0x382000
ucomisd -0x20(%rbp), %xmm0
jbe 0x138c62
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x28(%rbp), %eax
jae 0x138b11
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x138acd
jmp 0x138b06
movl -0x30(%rbp), %eax
movq -0x48(%rbp), %rcx
movl -0x34(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x138b04
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x30(%rbp)
jmp 0x138b06
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x138aaa
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jae 0x138b7f
movq -0x50(%rbp), %rax
movl -0x38(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x138b3b
jmp 0x138b74
movl -0x30(%rbp), %eax
movq -0x50(%rbp), %rcx
movl -0x38(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x138b72
movq -0x50(%rbp), %rax
movl -0x38(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x30(%rbp)
jmp 0x138b74
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x138b18
cmpl $0x0, -0x30(%rbp)
jbe 0x138c5d
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x28(%rbp), %eax
jae 0x138c5b
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x138bba
jmp 0x138c4d
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
leaq (%rcx,%rcx,2), %rcx
movl 0xc(%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cvtsi2sd %eax, %xmm1
movl -0x30(%rbp), %eax
cvtsi2sd %rax, %xmm0
mulsd -0x20(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x138c4b
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
xorq $0x1, %rax
movl %eax, %edx
movl $0x1, %ecx
callq 0xd6530
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x138c4d
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x138b90
jmp 0x138c5d
jmp 0x138d06
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x28(%rbp), %eax
jae 0x138d04
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x138c90
jmp 0x138cf6
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
movq -0x48(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
xorq $0x1, %rax
movl %eax, %edx
movl $0x1, %ecx
callq 0xd6530
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x138c69
jmp 0x138d06
jmp 0x138d08
movl -0x3c(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)