// File: /workspace/github_cpp_makefile_star2_O3/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 0xeffd
movl %esi, %ebp
leaq 0x18(%rsp), %r14
leaq 0x60(%rsp), %r15
leaq 0x10(%rsp), %r12
movq 0x10(%r13), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%r13), %rcx
movq %rcx, 0x18(%rsp)
testq %rcx, %rcx
je 0xefcf
lock
incl 0x8(%rcx)
testq %rax, %rax
je 0xf3ed
cmpl %ebp, 0x14(%rax)
jg 0xefeb
movq %r15, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x118f0
movq (%r13), %r13
movq %r14, %rdi
callq 0x10d5e
cmpq 0x10(%rbx), %r13
jne 0xefb4
leaq 0x60(%rsp), %rbp
movq %rbp, %rdi
callq 0x10b10
leaq 0x48(%rsp), %rax
xorpd %xmm0, %xmm0
movapd %xmm0, -0x8(%rax)
movq 0x60(%rsp), %r14
cmpq %rbp, %r14
je 0xf3ca
leaq 0x28(%rsp), %r13
leaq 0x28(%rsp), %r15
leaq 0x38(%rsp), %r12
movq 0x10(%r14), %rax
movq %rax, 0x20(%rsp)
movq 0x18(%r14), %rcx
movq %rcx, 0x28(%rsp)
testq %rcx, %rcx
je 0xf050
lock
incl 0x8(%rcx)
testq %rax, %rax
je 0xf3ed
cmpb $0x0, 0x10(%rax)
jne 0xf0fe
movq 0x20(%rax), %rcx
testq %rcx, %rcx
je 0xf40c
cmpl $0x1, 0x64(%rcx)
jne 0xf0fe
movq 0x28(%rsp), %rcx
testq %rcx, %rcx
je 0xf088
lock
incl 0x8(%rcx)
movapd 0x40(%rsp), %xmm0
movq %rax, 0x40(%rsp)
movq %rcx, 0x48(%rsp)
movapd %xmm0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
callq 0x10d5e
movq %r13, %rdi
callq 0x10d5e
movq 0x40(%rsp), %r14
testq %r14, %r14
je 0xf3ed
movq 0x20(%r14), %rcx
testq %rcx, %rcx
je 0xf40c
movq $0x0, 0x20(%rsp)
movq 0x28(%rcx), %rdx
movq %rdx, 0x28(%rsp)
testq %rdx, %rdx
je 0xf117
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0xf10e
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0xf0e5
movq 0x20(%rcx), %rcx
movq %rcx, 0x20(%rsp)
jmp 0xf119
movq (%r14), %r14
movq %r13, %rdi
callq 0x10d5e
jmp 0xf3c1
movq $0x0, 0x28(%rsp)
xorl %ecx, %ecx
movq 0x20(%r14), %rdx
testq %rdx, %rdx
je 0xf40c
movq $0x0, 0x30(%rsp)
movq 0x38(%rdx), %rsi
movq %rsi, 0x38(%rsp)
testq %rsi, %rsi
je 0xf162
movl 0x8(%rsi), %eax
testl %eax, %eax
je 0xf159
leal 0x1(%rax), %edi
lock
cmpxchgl %edi, 0x8(%rsi)
jne 0xf140
movq 0x30(%rdx), %rax
movq %rax, 0x30(%rsp)
jmp 0xf164
movq $0x0, 0x38(%rsp)
xorl %eax, %eax
testq %rcx, %rcx
je 0xf3ed
testq %rax, %rax
je 0xf3ed
movl 0x14(%rcx), %edx
cmpl 0x14(%rax), %edx
cmovlq %rcx, %rax
movq %r12, %rcx
cmovlq %r15, %rcx
movq %rax, 0x50(%rsp)
movq (%rcx), %rax
movq %rax, 0x58(%rsp)
testq %rax, %rax
je 0xf19d
lock
incl 0x8(%rax)
movq %rbx, %rdi
leaq 0x50(%rsp), %rsi
callq 0xa700
movq 0x20(%r14), %rcx
testq %rcx, %rcx
je 0xf40c
movq $0x0, (%rsp)
movq 0x28(%rcx), %rdx
movq %rdx, 0x8(%rsp)
testq %rdx, %rdx
je 0xf1e9
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0xf1e9
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0xf1d0
movq 0x20(%rcx), %rcx
movq 0x8(%rsp), %rax
jmp 0xf1ed
xorl %eax, %eax
xorl %ecx, %ecx
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
movapd 0x20(%rsp), %xmm0
movq %rcx, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movapd %xmm0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
callq 0x10d5e
leaq 0x8(%rsp), %rdi
callq 0x10d5e
movq 0x20(%r14), %rcx
testq %rcx, %rcx
je 0xf40c
movq $0x0, (%rsp)
movq 0x38(%rcx), %rdx
movq %rdx, 0x8(%rsp)
testq %rdx, %rdx
je 0xf25f
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0xf25f
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0xf246
movq 0x30(%rcx), %rcx
movq 0x8(%rsp), %rax
jmp 0xf263
xorl %eax, %eax
xorl %ecx, %ecx
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
movapd 0x30(%rsp), %xmm0
movq %rcx, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movapd %xmm0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
callq 0x10d5e
leaq 0x8(%rsp), %rdi
callq 0x10d5e
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0xf3ed
movq 0x30(%rsp), %rcx
testq %rcx, %rcx
je 0xf3ed
movl 0x14(%rax), %edx
cmpl 0x14(%rcx), %edx
cmovgq %rax, %rcx
movq %r12, %rax
cmovgq %r15, %rax
movq %rcx, 0x10(%rsp)
movq (%rax), %rax
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0xf2d9
lock
incl 0x8(%rax)
movq 0x20(%r14), %rcx
testq %rcx, %rcx
je 0xf40c
movq $0x0, (%rsp)
movq 0x48(%rcx), %rdx
movq %rdx, 0x8(%rsp)
testq %rdx, %rdx
je 0xf320
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0xf317
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0xf2ff
movq 0x40(%rcx), %rax
movq %rax, (%rsp)
jmp 0xf320
movq $0x0, 0x8(%rsp)
movq 0x38(%rbx), %rax
testq %rax, %rax
je 0xf40c
movq 0x20(%r14), %rcx
testq %rcx, %rcx
je 0xf40c
movsd 0x70(%rax), %xmm0
ucomisd 0x70(%rcx), %xmm0
jbe 0xf37a
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
movq %rsp, %rdx
callq 0x13d00
movq 0x20(%r14), %rax
testq %rax, %rax
je 0xf40c
cmpb $0x1, 0x60(%rax)
jne 0xf37a
movq 0x18(%rax), %rax
testq %rax, %rax
je 0xf42b
movb $0x1, 0x10(%rax)
leaq 0x8(%rsp), %rdi
callq 0x10d5e
leaq 0x18(%rsp), %rdi
callq 0x10d5e
leaq 0x58(%rsp), %rdi
callq 0x10d5e
movq %r12, %rdi
callq 0x10d5e
movq %r15, %rdi
callq 0x10d5e
leaq 0x48(%rsp), %rdi
callq 0x10d5e
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movq 0x60(%rsp), %r14
cmpq %rbp, %r14
jne 0xf035
leaq 0x48(%rsp), %rdi
callq 0x10d5e
leaq 0x60(%rsp), %rdi
callq 0x1101a
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9704(%rip), %rdi      # 0x18af8
leaq 0xa06b(%rip), %rsi      # 0x19466
leaq 0xa090(%rip), %rcx      # 0x19492
movl $0x2d8, %edx            # imm = 0x2D8
callq 0x3170
leaq 0x96e5(%rip), %rdi      # 0x18af8
leaq 0x96e6(%rip), %rsi      # 0x18b00
leaq 0xa0da(%rip), %rcx      # 0x194fb
movl $0xc7, %edx
callq 0x3170
leaq 0x96c6(%rip), %rdi      # 0x18af8
leaq 0x96c7(%rip), %rsi      # 0x18b00
leaq 0x96ef(%rip), %rcx      # 0x18b2f
jmp 0xf421
movq %rax, %rbx
jmp 0xf48f
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x10d5e
leaq 0x18(%rsp), %rdi
callq 0x10d5e
jmp 0xf463
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x10d5e
movq %r12, %rdi
callq 0x10d5e
movq %r15, %rdi
callq 0x10d5e
leaq 0x48(%rsp), %rdi
jmp 0xf48a
movq %rax, %rbx
movq %r14, %rdi
callq 0x10d5e
leaq 0x60(%rsp), %rdi
callq 0x1101a
movq %rbx, %rdi
callq 0x33f0
nop