// File: /workspace/github_cpp_makefile_star2_O1/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 $0x48, %rsp
movq %rsi, 0x30(%rsp)
movq 0xf0(%rdi), %rax
movq 0x18(%rax), %rbx
leaq 0x100(%rdi), %rax
movq %rax, 0x40(%rsp)
leaq 0x110(%rdi), %rax
movq %rax, 0x38(%rsp)
xorl %ebp, %ebp
xorl %r14d, %r14d
movq %rdi, 0x18(%rsp)
movq 0xf0(%rdi), %rax
addq $0x8, %rax
cmpq %rax, %rbx
je 0xfb65
movq 0x20(%rbx), %r13
movq 0x30(%rsp), %rax
movsd (%rax), %xmm0
movb $0x1, %r12b
ucomisd 0x18(%r13), %xmm0
jbe 0xfb6d
movq 0x10(%r13), %rcx
testq %rcx, %rcx
je 0xfeee
movq $0x0, 0x20(%rsp)
movq 0x28(%rcx), %rdx
movq %rdx, 0x28(%rsp)
testq %rdx, %rdx
je 0xfb84
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0xfb75
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0xfb55
jmp 0xfb77
movb $0x1, %r14b
jmp 0xfec9
movb $0x1, %r14b
jmp 0xfec4
xorl %eax, %eax
testl %eax, %eax
jne 0xfb84
movq $0x0, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0xfb95
movq 0x20(%rcx), %rax
movq %rax, 0x20(%rsp)
movq 0x10(%r13), %rcx
testq %rcx, %rcx
je 0xfeee
movq $0x0, 0x8(%rsp)
movq 0x38(%rcx), %rdx
movq %rdx, 0x10(%rsp)
testq %rdx, %rdx
je 0xfbdb
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0xfbcc
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0xfbbc
jmp 0xfbce
xorl %eax, %eax
testl %eax, %eax
jne 0xfbdb
movq $0x0, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0xfbec
movq 0x30(%rcx), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%r13), %rax
testq %rax, %rax
je 0xfeee
cmpb $0x0, 0x10(%rax)
jne 0xfd3c
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0xff0d
movl 0x14(%rax), %eax
cmpl 0xd0(%rdi), %eax
jne 0xfd3c
movq 0x8(%rdi), %rax
cmpb $0x1, 0x48(%rax)
jne 0xfcc2
movl $0x1b, %edx
movq 0x103b6(%rip), %rdi     # 0x1fff0
leaq 0x96b9(%rip), %rsi      # 0x192fa
callq 0x32a0
movl $0x1b, %edx
movq 0x1039e(%rip), %rdi     # 0x1fff0
leaq 0x96bd(%rip), %rsi      # 0x19316
callq 0x32a0
movq 0x30(%rsp), %rax
movsd (%rax), %xmm0
movq 0x10382(%rip), %rdi     # 0x1fff0
callq 0x3360
movq %rax, %r15
movl $0x4, %edx
movq %rax, %rdi
leaq 0x840b(%rip), %rsi      # 0x18090
callq 0x32a0
movsd 0x18(%r13), %xmm0
movq %r15, %rdi
callq 0x3360
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
movsd 0x18(%r13), %xmm0
movq 0x30(%rsp), %rax
movsd %xmm0, (%rax)
movq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x107c0
movq 0x38(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x107c0
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0xfcfe
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x18(%rsp), %rax
movq 0xf0(%rax), %r13
movq %rbx, %rdi
callq 0x32b0
movq %rax, %r15
movq %r13, %rdi
movq %rbx, %rsi
callq 0x11cae
leaq 0x10(%rsp), %rdi
callq 0x10dec
leaq 0x28(%rsp), %rdi
callq 0x10dec
xorl %r12d, %r12d
jmp 0xfebc
movq 0x8(%rdi), %rax
cmpb $0x1, 0x48(%rax)
jne 0xfe77
movl $0x21, %edx
movq 0x1029a(%rip), %rdi     # 0x1fff0
leaq 0x9545(%rip), %rsi      # 0x192a2
callq 0x32a0
movq 0x10287(%rip), %rcx     # 0x1fff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq 0x10269(%rip), %rdi     # 0x1fff0
callq 0x3040
movq %rax, %rdi
callq 0x31b0
movq 0x10(%r13), %rax
testq %rax, %rax
je 0xfeee
movl $0x17, %edx
cmpb $0x0, 0x10(%rax)
movq 0x1023f(%rip), %rdi     # 0x1fff0
leaq 0x950c(%rip), %rsi      # 0x192c4
jne 0xfe72
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0xff0d
movl 0x14(%rax), %eax
movq 0x18(%rsp), %rcx
cmpl 0xd0(%rcx), %eax
je 0xfe77
movl $0x9, %edx
movq 0x10204(%rip), %rdi     # 0x1fff0
leaq 0x94e9(%rip), %rsi      # 0x192dc
callq 0x32a0
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0xff0d
movq 0x20(%rax), %rax
testq %rax, %rax
je 0xfeee
movsd 0x70(%rax), %xmm0
movq 0x101d1(%rip), %rdi     # 0x1fff0
callq 0x3360
movq %rax, %r15
movl $0x4, %edx
movq %rax, %rdi
leaq 0x825a(%rip), %rsi      # 0x18090
callq 0x32a0
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0xff0d
movq 0x18(%rax), %rax
testq %rax, %rax
je 0xfeee
movsd 0x70(%rax), %xmm0
movq %r15, %rdi
callq 0x3360
movq %rax, %rdi
movl $0x13, %edx
leaq 0x9474(%rip), %rsi      # 0x192e6
callq 0x32a0
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0xfe86
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x18(%rsp), %rax
movq 0xf0(%rax), %r13
movq %rbx, %rdi
callq 0x32b0
movq %rax, %r15
movq %r13, %rdi
movq %rbx, %rsi
callq 0x11cae
leaq 0x10(%rsp), %rdi
callq 0x10dec
leaq 0x28(%rsp), %rdi
callq 0x10dec
movq %r15, %rbx
movq 0x18(%rsp), %rdi
testb %r12b, %r12b
je 0xfed6
movl %r14d, %ebp
testb $0x1, %r14b
je 0xfb06
notb %bpl
andb $0x1, %bpl
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8c03(%rip), %rdi      # 0x18af8
leaq 0x8c04(%rip), %rsi      # 0x18b00
leaq 0x9598(%rip), %rcx      # 0x1949b
movl $0xc7, %edx
callq 0x3170
leaq 0x8be4(%rip), %rdi      # 0x18af8
leaq 0x94eb(%rip), %rsi      # 0x19406
leaq 0x9510(%rip), %rcx      # 0x19432
movl $0x2d8, %edx            # imm = 0x2D8
callq 0x3170
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x10dec
leaq 0x28(%rsp), %rdi
callq 0x10dec
movq %rbx, %rdi
callq 0x33f0
nop