// File: /workspace/github_cpp_makefile_star2_O3/gchen98[P]macs/algorithm.cpp
// Function: GraphBuilder::checkPendingGeneConversions(double&)
bool GraphBuilder::checkPendingGeneConversions(double & curPos){
    bool found = false;
    GeneConversionPtrSet::iterator it = pGeneConversionPtrSet->begin();
    while(!found){
        if (it!=pGeneConversionPtrSet->end()){
            GeneConversionPtr gc= *it;
            if (gc->dEndPos<curPos){
                EdgePtr edge0 = gc->xOverNode->getTopEdgeByIndex(0);
                EdgePtr edge1 = gc->xOverNode->getTopEdgeByIndex(1);
                if (gc->xOverNode->bDeleted ||
                edge1->iGraphIteration!=iGraphIteration){
                    if (pConfig->bDebug){
                        cerr<<"Deleting gene conversion because:"<<endl;
                        if (gc->xOverNode->bDeleted)
                          cerr<<"xover node was deleted\n";
                        else if (edge1->iGraphIteration!=iGraphIteration)
                          cerr<<"new edge "<<edge1->getBottomNodeRef()->getHeight()<<" to "<<
                          edge1->getTopNodeRef()->getHeight()<<" was not ancestral\n";
                    }
                    delete(*it);
                    pGeneConversionPtrSet->erase(it++);
                }else{
                    if (pConfig->bDebug){
                        cerr<<"Closing a gene conversion: "<<
                        "Backtracking position from "<<curPos<<" to "<<
                        gc->dEndPos<<endl;
                    }
                    curPos = gc->dEndPos;
                    this->gcOldEdge = edge0;
                    this->gcNewEdge = edge1;
                    delete(*it);
                    pGeneConversionPtrSet->erase(it++);
                    return true;
                }
            }else{
                found = true;
            }
        }else found = true;
    }
    return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq 0xf0(%rdi), %rax
movq 0x18(%rax), %r12
addq $0x8, %rax
cmpq %rax, %r12
je 0xfcec
movq %rsi, %r13
movq %rdi, %r15
movq 0x1054d(%rip), %rbp     # 0x1fff0
movq 0x20(%r12), %r14
movsd (%r13), %xmm0
ucomisd 0x18(%r14), %xmm0
jbe 0xfcec
movq 0x10(%r14), %rcx
testq %rcx, %rcx
je 0xfe51
movq $0x0, 0x10(%rsp)
movq 0x28(%rcx), %rdx
movq %rdx, 0x18(%rsp)
testq %rdx, %rdx
je 0xfb03
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0xfafa
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0xfae1
movq 0x20(%rcx), %rcx
movq %rcx, 0x10(%rsp)
jmp 0xfb05
movq $0x0, 0x18(%rsp)
xorl %ecx, %ecx
movq 0x10(%r14), %rdx
testq %rdx, %rdx
je 0xfe51
movq $0x0, (%rsp)
movq 0x38(%rdx), %rsi
movq %rsi, 0x8(%rsp)
testq %rsi, %rsi
je 0xfb4c
movl 0x8(%rsi), %eax
testl %eax, %eax
je 0xfb43
leal 0x1(%rax), %edi
lock
cmpxchgl %edi, 0x8(%rsi)
jne 0xfb2b
movq 0x30(%rdx), %rax
movq %rax, (%rsp)
jmp 0xfb4e
movq $0x0, 0x8(%rsp)
xorl %eax, %eax
movq 0x10(%r14), %rdx
testq %rdx, %rdx
je 0xfe51
cmpb $0x0, 0x10(%rdx)
jne 0xfb7a
testq %rax, %rax
je 0xfe70
movl 0x14(%rax), %eax
cmpl 0xd0(%r15), %eax
je 0xfcfd
movq 0x8(%r15), %rax
cmpb $0x1, 0x48(%rax)
jne 0xfc94
movl $0x21, %edx
movq %rbp, %rdi
leaq 0x976b(%rip), %rsi      # 0x19302
callq 0x32a0
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %rbp, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
movq 0x10(%r14), %rax
testq %rax, %rax
je 0xfe51
movl $0x17, %edx
cmpb $0x1, 0x10(%rax)
movq %rbp, %rdi
leaq 0x9740(%rip), %rsi      # 0x19324
je 0xfc8f
movq (%rsp), %rax
testq %rax, %rax
je 0xfe70
movl 0x14(%rax), %eax
cmpl 0xd0(%r15), %eax
je 0xfc94
movl $0x9, %edx
movq %rbp, %rdi
leaq 0x9726(%rip), %rsi      # 0x1933c
callq 0x32a0
movq (%rsp), %rax
testq %rax, %rax
je 0xfe70
movq 0x20(%rax), %rax
testq %rax, %rax
je 0xfe51
movsd 0x70(%rax), %xmm0
movq %rbp, %rdi
callq 0x3360
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0x843c(%rip), %rsi      # 0x18090
callq 0x32a0
movq (%rsp), %rax
testq %rax, %rax
je 0xfe70
movq 0x18(%rax), %rax
testq %rax, %rax
je 0xfe51
movsd 0x70(%rax), %xmm0
movq %rbx, %rdi
callq 0x3360
movq %rax, %rdi
movl $0x13, %edx
leaq 0x96b7(%rip), %rsi      # 0x19346
callq 0x32a0
movq 0x20(%r12), %rdi
testq %rdi, %rdi
je 0xfca4
movq (%rdi), %rax
callq *0x8(%rax)
movq 0xf0(%r15), %r14
movq %r12, %rdi
callq 0x32b0
movq %rax, %rbx
movq %r14, %rdi
movq %r12, %rsi
callq 0x11c42
leaq 0x8(%rsp), %rdi
callq 0x10d5e
leaq 0x18(%rsp), %rdi
callq 0x10d5e
movq 0xf0(%r15), %rax
addq $0x8, %rax
movq %rbx, %r12
cmpq %rax, %rbx
jne 0xfaa3
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r15), %rax
cmpb $0x1, 0x48(%rax)
jne 0xfda1
movq 0x102de(%rip), %rdi     # 0x1fff0
leaq 0x9641(%rip), %rsi      # 0x1935a
movl $0x1b, %edx
callq 0x32a0
movq 0x102c6(%rip), %rdi     # 0x1fff0
leaq 0x9645(%rip), %rsi      # 0x19376
movl $0x1b, %edx
callq 0x32a0
movsd (%r13), %xmm0
movq 0x102a8(%rip), %rdi     # 0x1fff0
callq 0x3360
movq %rax, %rbx
leaq 0x8339(%rip), %rsi      # 0x18090
movl $0x4, %edx
movq %rax, %rdi
callq 0x32a0
movsd 0x18(%r14), %xmm0
movq %rbx, %rdi
callq 0x3360
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
movq 0x10(%rsp), %rcx
movsd 0x18(%r14), %xmm0
movsd %xmm0, (%r13)
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0xfdbb
lock
incl 0x8(%rax)
leaq 0x28(%rsp), %rdi
movups 0x100(%r15), %xmm0
movq %rcx, 0x100(%r15)
movq %rax, 0x108(%r15)
movaps %xmm0, -0x8(%rdi)
callq 0x10d5e
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
testq %rcx, %rcx
je 0xfdf1
lock
incl 0x8(%rcx)
leaq 0x28(%rsp), %rdi
movupd 0x110(%r15), %xmm0
movq %rax, 0x110(%r15)
movq %rcx, 0x118(%r15)
movapd %xmm0, -0x8(%rdi)
callq 0x10d5e
movq 0x20(%r12), %rdi
testq %rdi, %rdi
je 0xfe27
movq (%rdi), %rax
callq *0x8(%rax)
movq 0xf0(%r15), %rdi
movq %r12, %rsi
callq 0x11c42
leaq 0x8(%rsp), %rdi
callq 0x10d5e
leaq 0x18(%rsp), %rdi
callq 0x10d5e
movb $0x1, %al
jmp 0xfcee
leaq 0x8ca0(%rip), %rdi      # 0x18af8
leaq 0x8ca1(%rip), %rsi      # 0x18b00
leaq 0x9695(%rip), %rcx      # 0x194fb
movl $0xc7, %edx
callq 0x3170
leaq 0x8c81(%rip), %rdi      # 0x18af8
leaq 0x95e8(%rip), %rsi      # 0x19466
leaq 0x960d(%rip), %rcx      # 0x19492
movl $0x2d8, %edx            # imm = 0x2D8
callq 0x3170
jmp 0xfe91
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x10d5e
leaq 0x18(%rsp), %rdi
callq 0x10d5e
movq %rbx, %rdi
callq 0x33f0