// File: /workspace/github_cpp_makefile_star2_O3/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 $0x1e8, %rsp            # imm = 0x1E8
movq %rdx, %r14
movsd %xmm0, 0x40(%rsp)
movq %rsi, %r15
movq %rdi, 0x48(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x32f0
movq (%r14), %rcx
testq %rcx, %rcx
je 0x14f18
movl 0x64(%rcx), %eax
testl %eax, %eax
je 0x149de
cmpl $0x3, %eax
jne 0x14c6c
movl 0x78(%rcx), %esi
leaq 0x70(%rsp), %rdi
callq 0x33e0
movq %rax, %rbx
leaq 0x4a6a(%rip), %rsi      # 0x19417
movl $0x1, %edx
movq %rax, %rdi
callq 0x32a0
movq (%r14), %rax
testq %rax, %rax
je 0x14f18
movsd 0x40(%rsp), %xmm0
subsd 0x70(%rax), %xmm0
movq %rbx, %rdi
callq 0x3360
jmp 0x14ea1
movl 0xd0(%r15), %edx
movq $0x0, (%rsp)
movq 0x48(%rcx), %rsi
movq %rsi, 0x8(%rsp)
testq %rsi, %rsi
je 0x14ef9
leaq 0x8(%rsp), %rbx
movl 0x8(%rsi), %eax
testl %eax, %eax
je 0x14ee5
leal 0x1(%rax), %edi
lock
cmpxchgl %edi, 0x8(%rsi)
jne 0x14a07
movq 0x40(%rcx), %rax
movq %rax, (%rsp)
testq %rax, %rax
je 0x14ef9
cmpl 0x14(%rax), %edx
jne 0x14d03
movq (%r14), %rcx
testq %rcx, %rcx
je 0x14f18
movl 0xd0(%r15), %ebp
movq $0x0, 0x20(%rsp)
movq 0x58(%rcx), %rdx
movq %rdx, 0x28(%rsp)
testq %rdx, %rdx
je 0x14ef9
leaq 0x28(%rsp), %rdi
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0x14ef0
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0x14a69
movq 0x50(%rcx), %rax
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x14ef9
movl 0x14(%rax), %r12d
callq 0x10d5e
movq %rbx, %rdi
callq 0x10d5e
cmpl %r12d, %ebp
jne 0x14d0b
leaq 0x4ece(%rip), %rsi      # 0x1997c
leaq 0x70(%rsp), %rdi
movl $0x1, %edx
callq 0x32a0
movq (%r14), %rcx
testq %rcx, %rcx
je 0x14f18
movsd 0x70(%rcx), %xmm0
movq $0x0, 0x50(%rsp)
movq 0x48(%rcx), %rdx
movq %rdx, 0x58(%rsp)
testq %rdx, %rdx
je 0x14ef9
leaq 0x58(%rsp), %r12
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0x14f37
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0x14af1
movq 0x40(%rcx), %rdx
movq %rdx, 0x50(%rsp)
testq %rdx, %rdx
je 0x14ef9
addq $0x20, %rdx
movq %rsp, %rdi
movq %r15, %rsi
callq 0x1494e
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x70(%rsp), %rdi
callq 0x32a0
movq %rax, %rbx
leaq 0x438f(%rip), %rsi      # 0x18ed0
movl $0x1, %edx
movq %rax, %rdi
callq 0x32a0
movq (%r14), %rcx
testq %rcx, %rcx
je 0x14f18
movsd 0x70(%rcx), %xmm0
movq $0x0, 0x60(%rsp)
movq 0x58(%rcx), %rdx
movq %rdx, 0x68(%rsp)
testq %rdx, %rdx
je 0x14ef9
leaq 0x68(%rsp), %r13
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0x14ef9
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0x14b82
movq 0x50(%rcx), %rdx
movq %rdx, 0x60(%rsp)
testq %rdx, %rdx
je 0x14ef9
addq $0x20, %rdx
leaq 0x20(%rsp), %rdi
movq %r15, %rsi
callq 0x1494e
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x32a0
leaq 0x2c90(%rip), %rsi      # 0x17860
movl $0x1, %edx
movq %rax, %rdi
callq 0x32a0
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x14bf8
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3270
movq %r13, %rdi
callq 0x10d5e
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x14c1b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3270
movq %r12, %rdi
callq 0x10d5e
movq (%r14), %rax
cmpq 0x40(%r15), %rax
je 0x14ea1
leaq 0x47e0(%rip), %rsi      # 0x19417
leaq 0x70(%rsp), %rdi
movl $0x1, %edx
callq 0x32a0
movq (%r14), %rax
testq %rax, %rax
je 0x14f18
movsd 0x40(%rsp), %xmm0
subsd 0x70(%rax), %xmm0
leaq 0x70(%rsp), %rdi
callq 0x3360
jmp 0x14ea1
movq $0x0, 0x20(%rsp)
movq 0x48(%rcx), %rdx
movq %rdx, 0x28(%rsp)
testq %rdx, %rdx
je 0x14ef9
leaq 0x28(%rsp), %r14
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0x14ef9
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0x14c8f
movq 0x40(%rcx), %rdx
movq %rdx, 0x20(%rsp)
testq %rdx, %rdx
je 0x14ef9
addq $0x20, %rdx
movq %rsp, %rdi
movq %r15, %rsi
movsd 0x40(%rsp), %xmm0
callq 0x1494e
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x70(%rsp), %rdi
callq 0x32a0
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x14cf6
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3270
movq %r14, %rdi
callq 0x10d5e
jmp 0x14ea1
movq %rbx, %rdi
callq 0x10d5e
leaq 0x8(%rsp), %r13
movb $0x1, %r12b
movq (%r14), %rcx
testq %rcx, %rcx
je 0x14f18
testb $0x1, %r12b
je 0x14d5a
movq $0x0, (%rsp)
movq 0x48(%rcx), %rdx
movq %rdx, 0x8(%rsp)
testq %rdx, %rdx
je 0x14ef9
addq $0x40, %rcx
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0x14ee5
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0x14d46
jmp 0x14d8d
movq $0x0, (%rsp)
movq 0x58(%rcx), %rdx
movq %rdx, 0x8(%rsp)
testq %rdx, %rdx
je 0x14ef9
addq $0x50, %rcx
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0x14ee5
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0x14d7b
movq (%rcx), %rax
movq %rax, (%rsp)
testq %rax, %rax
je 0x14ef9
movl 0x14(%rax), %ebp
movl 0xd0(%r15), %ebx
movq %r13, %rdi
callq 0x10d5e
cmpl %ebx, %ebp
jne 0x14e91
movq (%r14), %rcx
testq %rcx, %rcx
je 0x14f18
testb $0x1, %r12b
je 0x14dff
movq $0x0, 0x20(%rsp)
movq 0x48(%rcx), %rdx
movq %rdx, 0x28(%rsp)
testq %rdx, %rdx
je 0x14ef9
addq $0x40, %rcx
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0x14ef0
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0x14deb
jmp 0x14e33
movq $0x0, 0x20(%rsp)
movq 0x58(%rcx), %rdx
movq %rdx, 0x28(%rsp)
testq %rdx, %rdx
je 0x14ef9
addq $0x50, %rcx
movl 0x8(%rdx), %eax
testl %eax, %eax
je 0x14ef0
leal 0x1(%rax), %esi
lock
cmpxchgl %esi, 0x8(%rdx)
jne 0x14e21
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
testq %rdx, %rdx
je 0x14ef9
addq $0x20, %rdx
movq %rsp, %rdi
movq %r15, %rsi
movsd 0x40(%rsp), %xmm0
callq 0x1494e
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x70(%rsp), %rdi
callq 0x32a0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x14e87
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3270
leaq 0x28(%rsp), %rdi
callq 0x10d5e
testb $0x1, %r12b
movl $0x0, %r12d
jne 0x14d13
leaq 0x78(%rsp), %rsi
movq 0x48(%rsp), %rdi
callq 0x3350
movq 0xb111(%rip), %rsi      # 0x1ffc8
leaq 0x70(%rsp), %rdi
callq 0x3130
leaq 0xe0(%rsp), %rdi
callq 0x30b0
movq 0x48(%rsp), %rax
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $0x0, 0x8(%rsp)
jmp 0x14ef9
movq $0x0, 0x28(%rsp)
leaq 0x3bf8(%rip), %rdi      # 0x18af8
leaq 0x455f(%rip), %rsi      # 0x19466
leaq 0x4584(%rip), %rcx      # 0x19492
movl $0x2d8, %edx            # imm = 0x2D8
callq 0x3170
leaq 0x3bd9(%rip), %rdi      # 0x18af8
leaq 0x3bda(%rip), %rsi      # 0x18b00
leaq 0x45ce(%rip), %rcx      # 0x194fb
movl $0xc7, %edx
callq 0x3170
movq $0x0, 0x58(%rsp)
jmp 0x14ef9
movq %rax, %rbx
jmp 0x14f6a
movq %rax, %rbx
jmp 0x14f92
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x14f6a
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3270
movq %r13, %rdi
callq 0x10d5e
jmp 0x14f77
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x14f92
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3270
movq %r12, %rdi
jmp 0x14fee
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x14fba
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3270
jmp 0x14fba
movq %rax, %rbx
movq %r14, %rdi
jmp 0x14fee
jmp 0x14fc1
movq %rax, %rbx
jmp 0x14ff3
movq %rax, %rbx
jmp 0x14fe9
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x14fe9
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3270
leaq 0x28(%rsp), %rdi
callq 0x10d5e
movq 0xafce(%rip), %rsi      # 0x1ffc8
leaq 0x70(%rsp), %rdi
callq 0x3130
leaq 0xe0(%rsp), %rdi
callq 0x30b0
movq %rbx, %rdi
callq 0x33f0
nop