// File: /workspace/github_cpp_makefile_star2_O1/gchen98[P]macs/datastructures.cpp
// Function: GraphBuilder::getNewickTree[abi:cxx11](double, boost::intrusive_ptr<Node>&)
string GraphBuilder::getNewickTree(double lastCoalHeight,NodePtr & curNode){
    ostringstream oss;
    if (curNode->getType()==Node::SAMPLE){
        // print the Newick format with the Sample ID followed by length
        SampleNode * pSampleNode = static_cast<SampleNode *>(curNode.get());
        oss<<pSampleNode->iId<<":"<<lastCoalHeight-curNode->getHeight();
    }else if (curNode->getType()==Node::COAL){
        // if the two lower branches are in the current tree, then print the
        // Newick format, and recursively repeat
        if (iGraphIteration==curNode->getBottomEdgeByIndex(0)->iGraphIteration &&
        iGraphIteration==curNode->getBottomEdgeByIndex(1)->iGraphIteration){
            oss<<"("<<getNewickTree(curNode->getHeight(),
            curNode->getBottomEdgeByIndex(0)->getBottomNodeRef())
            <<","<<getNewickTree(curNode->getHeight(),
            curNode->getBottomEdgeByIndex(1)->getBottomNodeRef())
            <<")";
            // if we are at the MRCA we don't need to output the branch length since
            // it is obviously 0 length
            if (curNode!=localMRCA) oss<<":"<<lastCoalHeight-curNode->getHeight();
//            cout<<"got here\n";
        }else{
            for(int i=0;i<2;++i){
                if (curNode->getBottomEdgeByIndex(i)->iGraphIteration==iGraphIteration){
                    oss<<getNewickTree(lastCoalHeight,
                    curNode->getBottomEdgeByIndex(i)->getBottomNodeRef());
                }
            }
        }
    }else {
        // this is for everything else(e.g. migration, xover nodes),
        // don't print anything, but recursively
        // descend down the graph
        oss<<getNewickTree(lastCoalHeight,
        curNode->getBottomEdgeByIndex(0)->getBottomNodeRef());
    }
    return oss.str();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rdx, %r15
movsd %xmm0, 0x40(%rsp)
movq %rsi, %r14
movq %rdi, 0x78(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x32f0
movq (%r15), %rdx
testq %rdx, %rdx
je 0x150a6
movl 0x64(%rdx), %eax
testl %eax, %eax
je 0x14aca
cmpl $0x3, %eax
jne 0x14afa
movl 0x78(%rdx), %esi
leaq 0x80(%rsp), %rdi
callq 0x33e0
movq %rax, %rbx
leaq 0x491e(%rip), %rsi      # 0x193b7
movl $0x1, %edx
movq %rax, %rdi
callq 0x32a0
movq (%r15), %rax
testq %rax, %rax
je 0x150a6
movsd 0x40(%rsp), %xmm0
subsd 0x70(%rax), %xmm0
movq %rbx, %rdi
callq 0x3360
jmp 0x1505c
movl 0xd0(%r14), %ecx
movq $0x0, (%rsp)
movq 0x48(%rdx), %rsi
movq %rsi, 0x8(%rsp)
testq %rsi, %rsi
je 0x14b3e
movl 0x8(%rsi), %eax
testl %eax, %eax
je 0x14b2f
leal 0x1(%rax), %edi
lock
cmpxchgl %edi, 0x8(%rsi)
jne 0x14aea
jmp 0x14b31
movq $0x0, 0x20(%rsp)
movq 0x48(%rdx), %rcx
movq %rcx, 0x28(%rsp)
testq %rcx, %rcx
je 0x14bc3
movl 0x8(%rcx), %eax
testl %eax, %eax
je 0x14bb4
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rcx)
jne 0x14b18
jmp 0x14bb6
xorl %eax, %eax
testl %eax, %eax
jne 0x14b3e
movq $0x0, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x14b4e
movq 0x40(%rdx), %rax
movq %rax, (%rsp)
movq (%rsp), %rax
testq %rax, %rax
je 0x150c5
movl 0x14(%rax), %edx
cmpl %edx, %ecx
jne 0x14bad
movq (%r15), %rdi
testq %rdi, %rdi
je 0x150a6
movl 0xd0(%r14), %esi
movq $0x0, 0x68(%rsp)
movq 0x58(%rdi), %r8
movq %r8, 0x70(%rsp)
testq %r8, %r8
je 0x14c49
movl 0x8(%r8), %eax
testl %eax, %eax
je 0x14c3a
leal 0x1(%rax), %r9d
lock
cmpxchgl %r9d, 0x8(%r8)
jne 0x14b94
jmp 0x14c3c
xorl %ebp, %ebp
jmp 0x14c6f
xorl %eax, %eax
testl %eax, %eax
jne 0x14bc3
movq $0x0, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0x14bd4
movq 0x40(%rdx), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdx
testq %rdx, %rdx
je 0x150c5
leaq 0x28(%rsp), %rbx
addq $0x20, %rdx
movq %rsp, %rdi
movq %r14, %rsi
movsd 0x40(%rsp), %xmm0
callq 0x14a38
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x80(%rsp), %rdi
callq 0x32a0
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x14c2d
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3270
movq %rbx, %rdi
callq 0x10dec
jmp 0x1505c
xorl %eax, %eax
testl %eax, %eax
jne 0x14c49
movq $0x0, 0x70(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x14c5a
movq 0x50(%rdi), %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
testq %rax, %rax
je 0x150c5
cmpl 0x14(%rax), %esi
sete %bpl
leaq 0x8(%rsp), %rbx
cmpl %edx, %ecx
jne 0x14c82
leaq 0x70(%rsp), %rdi
callq 0x10dec
movq %rbx, %rdi
callq 0x10dec
testb %bpl, %bpl
je 0x14cee
leaq 0x4c86(%rip), %rsi      # 0x1991c
leaq 0x80(%rsp), %rdi
movl $0x1, %edx
callq 0x32a0
movq (%r15), %rcx
testq %rcx, %rcx
je 0x150a6
movsd 0x70(%rcx), %xmm0
movq $0x0, 0x58(%rsp)
movq 0x48(%rcx), %rdx
movq %rdx, 0x60(%rsp)
testq %rdx, %rdx
je 0x14ecf
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0x14ec0
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0x14cd7
jmp 0x14ec2
leaq 0x8(%rsp), %r12
xorl %r13d, %r13d
movq (%r15), %rcx
testq %rcx, %rcx
je 0x150a6
movq $0x0, (%rsp)
testl %r13d, %r13d
je 0x14d30
movq 0x58(%rcx), %rdx
movq %rdx, 0x8(%rsp)
testq %rdx, %rdx
je 0x14d60
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0x14d51
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0x14d20
jmp 0x14d53
movq 0x48(%rcx), %rdx
movq %rdx, 0x8(%rsp)
testq %rdx, %rdx
je 0x14d7d
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0x14d6e
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0x14d41
jmp 0x14d70
xorl %eax, %eax
testl %eax, %eax
jne 0x14d60
movq $0x0, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x14d8d
movq 0x50(%rcx), %rax
jmp 0x14d89
xorl %eax, %eax
testl %eax, %eax
jne 0x14d7d
movq $0x0, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x14d8d
movq 0x40(%rcx), %rax
movq %rax, (%rsp)
movq (%rsp), %rax
testq %rax, %rax
je 0x150c5
movl 0x14(%rax), %ebp
movl 0xd0(%r14), %ebx
movq %r12, %rdi
callq 0x10dec
cmpl %ebx, %ebp
jne 0x14eab
movq (%r15), %rcx
testq %rcx, %rcx
je 0x150a6
movq $0x0, 0x20(%rsp)
testl %r13d, %r13d
je 0x14def
movq 0x58(%rcx), %rdx
movq %rdx, 0x28(%rsp)
testq %rdx, %rdx
je 0x14e1f
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0x14e10
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0x14ddf
jmp 0x14e12
movq 0x48(%rcx), %rdx
movq %rdx, 0x28(%rsp)
testq %rdx, %rdx
je 0x14e3c
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0x14e2d
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0x14e00
jmp 0x14e2f
xorl %eax, %eax
testl %eax, %eax
jne 0x14e1f
movq $0x0, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0x14e4d
movq 0x50(%rcx), %rax
jmp 0x14e48
xorl %eax, %eax
testl %eax, %eax
jne 0x14e3c
movq $0x0, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0x14e4d
movq 0x40(%rcx), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdx
testq %rdx, %rdx
je 0x150c5
addq $0x20, %rdx
movq %rsp, %rdi
movq %r14, %rsi
movsd 0x40(%rsp), %xmm0
callq 0x14a38
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x80(%rsp), %rdi
callq 0x32a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x14ea1
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3270
leaq 0x28(%rsp), %rdi
callq 0x10dec
leal 0x1(%r13), %eax
testl %r13d, %r13d
movl %eax, %r13d
je 0x14cf6
jmp 0x1505c
xorl %eax, %eax
testl %eax, %eax
jne 0x14ecf
movq $0x0, 0x60(%rsp)
cmpq $0x0, 0x60(%rsp)
je 0x14ee0
movq 0x40(%rcx), %rax
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rdx
testq %rdx, %rdx
je 0x150c5
leaq 0x60(%rsp), %rbx
addq $0x20, %rdx
movq %rsp, %rdi
movq %r14, %rsi
callq 0x14a38
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x80(%rsp), %rdi
callq 0x32a0
movq %rax, %r12
leaq 0x3f4e(%rip), %rsi      # 0x18e70
movl $0x1, %edx
movq %rax, %rdi
callq 0x32a0
movq (%r15), %rcx
testq %rcx, %rcx
je 0x150a6
movsd 0x70(%rcx), %xmm0
movq $0x0, 0x48(%rsp)
movq 0x58(%rcx), %rdx
movq %rdx, 0x50(%rsp)
testq %rdx, %rdx
je 0x14f79
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0x14f6a
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0x14f5a
jmp 0x14f6c
xorl %eax, %eax
testl %eax, %eax
jne 0x14f79
movq $0x0, 0x50(%rsp)
cmpq $0x0, 0x50(%rsp)
je 0x14f8a
movq 0x50(%rcx), %rax
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rdx
testq %rdx, %rdx
je 0x150c5
leaq 0x50(%rsp), %r13
addq $0x20, %rdx
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x14a38
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %r12, %rdi
callq 0x32a0
leaq 0x2899(%rip), %rsi      # 0x17860
movl $0x1, %edx
movq %rax, %rdi
callq 0x32a0
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x14fef
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3270
movq %r13, %rdi
callq 0x10dec
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x15012
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3270
movq %rbx, %rdi
callq 0x10dec
movq (%r15), %rax
cmpq 0x40(%r14), %rax
je 0x1505c
leaq 0x438d(%rip), %rsi      # 0x193b7
leaq 0x80(%rsp), %rdi
movl $0x1, %edx
callq 0x32a0
movq (%r15), %rax
testq %rax, %rax
je 0x150a6
movsd 0x40(%rsp), %xmm0
subsd 0x70(%rax), %xmm0
leaq 0x80(%rsp), %rdi
callq 0x3360
leaq 0x88(%rsp), %rsi
movq 0x78(%rsp), %rdi
callq 0x3350
movq 0xaf53(%rip), %rsi      # 0x1ffc8
leaq 0x80(%rsp), %rdi
callq 0x3130
leaq 0xf0(%rsp), %rdi
callq 0x30b0
movq 0x78(%rsp), %rax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3a4b(%rip), %rdi      # 0x18af8
leaq 0x3a4c(%rip), %rsi      # 0x18b00
leaq 0x43e0(%rip), %rcx      # 0x1949b
movl $0xc7, %edx
callq 0x3170
leaq 0x3a2c(%rip), %rdi      # 0x18af8
leaq 0x4333(%rip), %rsi      # 0x19406
leaq 0x4358(%rip), %rcx      # 0x19432
movl $0x2d8, %edx            # imm = 0x2D8
callq 0x3170
movq %rax, %r14
jmp 0x15109
jmp 0x15135
movq %rax, %r14
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x15109
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3270
movq %r13, %rdi
callq 0x10dec
jmp 0x15118
jmp 0x15115
movq %rax, %r14
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x15138
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3270
jmp 0x15138
movq %rax, %r14
movq %rbx, %rdi
jmp 0x1516c
jmp 0x1513f
movq %rax, %r14
jmp 0x15171
movq %rax, %r14
jmp 0x15167
movq %rax, %r14
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x15167
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3270
leaq 0x28(%rsp), %rdi
callq 0x10dec
movq 0xae50(%rip), %rsi      # 0x1ffc8
leaq 0x80(%rsp), %rdi
callq 0x3130
leaq 0xf0(%rsp), %rdi
callq 0x30b0
movq %r14, %rdi
callq 0x33f0