// File: /workspace/github_cpp_makefile_star2_O1/gchen98[P]macs/algorithm.cpp
// Function: GraphBuilder::pruneARG(int)
void GraphBuilder::pruneARG(int iHistoryMax){
    bool found = false;
    EdgePtrList candidateEdges;
    EdgePtrList::iterator it = pEdgeListInARG->begin();
    // look for old edges that have an expired graph iteration value
    while (it!=pEdgeListInARG->end()){
        EdgePtr curEdge = *it;
        if (curEdge->iGraphIteration<=iHistoryMax)
            candidateEdges.push_back(curEdge);
        ++it;
    }
    candidateEdges.sort(byBottomNode());
    do{
        EdgePtr oldEdge;
        found = false;
        // sort the edges from top to bottom as the pruning order
        EdgePtrList::iterator it2 = candidateEdges.begin();
        while(!found && it2!=candidateEdges.end()){
            EdgePtr curEdge = *it2;
            if (!curEdge->bDeleted &&curEdge->getBottomNodeRef()->
            getType()==Node::XOVER){
                oldEdge = curEdge;
                found = true;
            }else{
                ++it2;
            }
        }
        if (found){
            NodePtr & xoverNode = oldEdge->getBottomNodeRef();
            EdgePtr edge0 = xoverNode->getTopEdgeByIndex(0);
            EdgePtr edge1 = xoverNode->getTopEdgeByIndex(1);
            EdgePtr edgeToPrune = edge0->iGraphIteration<
            edge1->iGraphIteration?edge0:edge1;

            pruneEdgesAbove(edgeToPrune);

            edge0 = xoverNode->getTopEdgeByIndex(0);
            edge1 = xoverNode->getTopEdgeByIndex(1);

            EdgePtr otherTopEdge = edge0->iGraphIteration>
            edge1->iGraphIteration?edge0:edge1;

            EdgePtr bottomEdge = xoverNode->getBottomEdgeByIndex(0);

            if (grandMRCA->getHeight()>xoverNode->getHeight()){
                mergeEdges(otherTopEdge,bottomEdge);
                xoverNode->removeEvent();
            }else{
                // we just removed a loop above the grandMRCA which
                // includes the edges around the xover point.
            }
        }
    }while(found);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
leaq 0x60(%rsp), %rax
movq %rax, 0x8(%rax)
movq %rax, (%rax)
movq $0x0, 0x10(%rax)
movq 0x10(%rdi), %rax
movq (%rax), %r13
cmpq %rax, %r13
je 0xeff7
movl %esi, %ebp
leaq 0x28(%rsp), %r14
leaq 0x60(%rsp), %r15
leaq 0x20(%rsp), %r12
movq 0x10(%r13), %rax
movq %rax, 0x20(%rsp)
movq 0x18(%r13), %rcx
movq %rcx, 0x28(%rsp)
testq %rcx, %rcx
je 0xefc9
lock
incl 0x8(%rcx)
testq %rax, %rax
je 0xf466
cmpl %ebp, 0x14(%rax)
jg 0xefe5
movq %r15, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1195c
movq (%r13), %r13
movq %r14, %rdi
callq 0x10dec
cmpq 0x10(%rbx), %r13
jne 0xefae
leaq 0x60(%rsp), %r13
movq %r13, %rdi
callq 0x10b84
leaq 0x18(%rsp), %r14
leaq 0x28(%rsp), %r12
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movq 0x60(%rsp), %rbp
cmpq %r13, %rbp
je 0xf443
xorl %r15d, %r15d
movq 0x10(%rbp), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rbp), %rcx
movq %rcx, 0x18(%rsp)
testq %rcx, %rcx
je 0xf044
lock
incl 0x8(%rcx)
testq %rax, %rax
je 0xf466
cmpb $0x0, 0x10(%rax)
jne 0xf0a6
movq 0x20(%rax), %rcx
testq %rcx, %rcx
je 0xf485
cmpl $0x1, 0x64(%rcx)
jne 0xf0a6
movq %rax, 0x20(%rsp)
movq 0x18(%rsp), %rcx
movq %rcx, 0x28(%rsp)
testq %rcx, %rcx
je 0xf07e
lock
incl 0x8(%rcx)
movapd 0x40(%rsp), %xmm0
movq 0x28(%rsp), %rcx
movupd %xmm0, 0x20(%rsp)
movq %rax, 0x40(%rsp)
movq %rcx, 0x48(%rsp)
movq %r12, %rdi
callq 0x10dec
movb $0x1, %r15b
jmp 0xf0aa
movq (%rbp), %rbp
movq %r14, %rdi
callq 0x10dec
testb $0x1, %r15b
jne 0xf0cb
cmpq %r13, %rbp
jne 0xf029
testb $0x1, %r15b
je 0xf443
movq 0x40(%rsp), %rbp
testq %rbp, %rbp
je 0xf466
movq 0x20(%rbp), %rcx
testq %rcx, %rcx
je 0xf485
movq $0x0, 0x10(%rsp)
movq 0x28(%rcx), %rdx
movq %rdx, 0x18(%rsp)
testq %rdx, %rdx
leaq 0x38(%rsp), %r15
je 0xf124
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0xf115
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0xf105
jmp 0xf117
xorl %eax, %eax
testl %eax, %eax
jne 0xf124
movq $0x0, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0xf135
movq 0x20(%rcx), %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rbp), %rcx
testq %rcx, %rcx
je 0xf485
movq $0x0, 0x30(%rsp)
movq 0x38(%rcx), %rdx
movq %rdx, 0x38(%rsp)
testq %rdx, %rdx
je 0xf17b
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0xf16c
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0xf15c
jmp 0xf16e
xorl %eax, %eax
testl %eax, %eax
jne 0xf17b
movq $0x0, 0x38(%rsp)
cmpq $0x0, 0x38(%rsp)
je 0xf18c
movq 0x30(%rcx), %rax
movq %rax, 0x30(%rsp)
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0xf466
movq 0x30(%rsp), %rcx
testq %rcx, %rcx
je 0xf466
movl 0x14(%rax), %eax
cmpl 0x14(%rcx), %eax
leaq 0x30(%rsp), %rax
leaq 0x10(%rsp), %rcx
cmovlq %rcx, %rax
movq (%rax), %rax
movq %r15, %rcx
cmovlq %r14, %rcx
movq %rax, 0x50(%rsp)
movq (%rcx), %rax
movq %rax, 0x58(%rsp)
testq %rax, %rax
je 0xf1dc
lock
incl 0x8(%rax)
movq %rbx, %rdi
leaq 0x50(%rsp), %rsi
callq 0xa7b6
movq 0x20(%rbp), %rcx
testq %rcx, %rcx
je 0xf485
movq $0x0, (%rsp)
movq 0x28(%rcx), %rdx
movq %rdx, 0x8(%rsp)
testq %rdx, %rdx
je 0xf22e
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0xf21f
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0xf20f
jmp 0xf221
xorl %eax, %eax
testl %eax, %eax
jne 0xf22e
movq $0x0, 0x8(%rsp)
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0xf240
movq 0x20(%rcx), %rcx
movq %rcx, (%rsp)
movq (%rsp), %rcx
xorpd %xmm0, %xmm0
movupd %xmm0, (%rsp)
movupd 0x10(%rsp), %xmm0
movupd %xmm0, 0x20(%rsp)
movq %rcx, 0x10(%rsp)
movq %rax, 0x18(%rsp)
leaq 0x28(%rsp), %rdi
callq 0x10dec
leaq 0x8(%rsp), %rdi
callq 0x10dec
movq 0x20(%rbp), %rcx
testq %rcx, %rcx
je 0xf485
movq $0x0, (%rsp)
movq 0x38(%rcx), %rdx
movq %rdx, 0x8(%rsp)
testq %rdx, %rdx
je 0xf2bc
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0xf2ad
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0xf29d
jmp 0xf2af
xorl %eax, %eax
testl %eax, %eax
jne 0xf2bc
movq $0x0, 0x8(%rsp)
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0xf2ce
movq 0x30(%rcx), %rcx
movq %rcx, (%rsp)
movq (%rsp), %rcx
xorpd %xmm0, %xmm0
movupd %xmm0, (%rsp)
movupd 0x30(%rsp), %xmm0
movupd %xmm0, 0x20(%rsp)
movq %rcx, 0x30(%rsp)
movq %rax, 0x38(%rsp)
leaq 0x28(%rsp), %rdi
callq 0x10dec
leaq 0x8(%rsp), %rdi
callq 0x10dec
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0xf466
movq 0x30(%rsp), %rcx
testq %rcx, %rcx
je 0xf466
movl 0x14(%rax), %eax
cmpl 0x14(%rcx), %eax
leaq 0x30(%rsp), %rax
leaq 0x10(%rsp), %rcx
cmovgq %rcx, %rax
movq (%rax), %rax
movq %r15, %rcx
cmovgq %r14, %rcx
movq %rax, 0x20(%rsp)
movq (%rcx), %rax
movq %rax, 0x28(%rsp)
testq %rax, %rax
je 0xf355
lock
incl 0x8(%rax)
movq 0x20(%rbp), %rcx
testq %rcx, %rcx
je 0xf485
movq $0x0, (%rsp)
movq 0x48(%rcx), %rdx
movq %rdx, 0x8(%rsp)
testq %rdx, %rdx
je 0xf39a
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0xf38b
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0xf37b
jmp 0xf38d
xorl %eax, %eax
testl %eax, %eax
jne 0xf39a
movq $0x0, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0xf3aa
movq 0x40(%rcx), %rax
movq %rax, (%rsp)
movq 0x38(%rbx), %rax
testq %rax, %rax
je 0xf485
movq 0x20(%rbp), %rcx
testq %rcx, %rcx
je 0xf485
movsd 0x70(%rax), %xmm0
ucomisd 0x70(%rcx), %xmm0
jbe 0xf404
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
callq 0x13e00
movq 0x20(%rbp), %rax
testq %rax, %rax
je 0xf485
cmpb $0x1, 0x60(%rax)
jne 0xf404
movq 0x18(%rax), %rax
testq %rax, %rax
je 0xf4a4
movb $0x1, 0x10(%rax)
leaq 0x8(%rsp), %rdi
callq 0x10dec
leaq 0x28(%rsp), %rdi
callq 0x10dec
leaq 0x58(%rsp), %rdi
callq 0x10dec
movq %r15, %rdi
callq 0x10dec
leaq 0x18(%rsp), %rdi
callq 0x10dec
leaq 0x48(%rsp), %rdi
callq 0x10dec
jmp 0xf00e
leaq 0x48(%rsp), %rdi
callq 0x10dec
leaq 0x60(%rsp), %rdi
callq 0x1109a
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x968b(%rip), %rdi      # 0x18af8
leaq 0x9f92(%rip), %rsi      # 0x19406
leaq 0x9fb7(%rip), %rcx      # 0x19432
movl $0x2d8, %edx            # imm = 0x2D8
callq 0x3170
leaq 0x966c(%rip), %rdi      # 0x18af8
leaq 0x966d(%rip), %rsi      # 0x18b00
leaq 0xa001(%rip), %rcx      # 0x1949b
movl $0xc7, %edx
callq 0x3170
leaq 0x964d(%rip), %rdi      # 0x18af8
leaq 0x964e(%rip), %rsi      # 0x18b00
leaq 0x9676(%rip), %rcx      # 0x18b2f
jmp 0xf49a
movq %rax, %rbx
jmp 0xf50c
movq %rax, %rbx
movq %r14, %rdi
jmp 0xf507
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x10dec
leaq 0x28(%rsp), %rdi
callq 0x10dec
jmp 0xf4e4
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x10dec
leaq 0x38(%rsp), %rdi
callq 0x10dec
leaq 0x18(%rsp), %rdi
callq 0x10dec
leaq 0x48(%rsp), %rdi
callq 0x10dec
leaq 0x60(%rsp), %rdi
callq 0x1109a
movq %rbx, %rdi
callq 0x33f0