// File: aalto-speech[P]ftk/src/FactorGraph.cc
// Function: FactorGraph::print_dot_digraph(std::ostream&)
void FactorGraph::print_dot_digraph(ostream &fstr)
{
    fstr << "digraph {" << endl << endl;
    fstr << "\tnode [shape=ellipse,fontsize=30,fixedsize=false,width=0.95];" << endl;
    fstr << "\tedge [fontsize=12];" << endl;
    fstr << "\trankdir=LR;" << endl << endl;

    for (fg_node_idx_t ni=0; ni<nodes.size(); ++ni) {
        fstr << "\t" << ni;
        fstr << " [label=\"" << get_factor(ni) << "\"]" << endl;
    }
    fstr << endl;

    for (fg_node_idx_t ni=0; ni<nodes.size(); ++ni) {
        Node &nd = nodes[ni];
        for (auto ait = nd.outgoing.begin(); ait != nd.outgoing.end(); ++ait) {
            fstr << "\t" << (*ait)->source_node << " -> " << (*ait)->target_node;
            fstr << "[label=\"" << (*ait)->cost << "\"];" << endl;
        }
    }
    fstr << "}" << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x438ba(%rip), %rsi     # 0x66620
callq 0x43c0
movq %rax, %rdi
movq 0x71223(%rip), %rsi     # 0x93f98
callq 0x4400
movq %rax, %rdi
movq 0x71214(%rip), %rsi     # 0x93f98
callq 0x4400
movq -0x10(%rbp), %rdi
leaq 0x43896(%rip), %rsi     # 0x6662a
callq 0x43c0
movq %rax, %rdi
movq 0x711f5(%rip), %rsi     # 0x93f98
callq 0x4400
movq -0x10(%rbp), %rdi
leaq 0x438b5(%rip), %rsi     # 0x66668
callq 0x43c0
movq %rax, %rdi
movq 0x711d6(%rip), %rsi     # 0x93f98
callq 0x4400
movq -0x10(%rbp), %rdi
leaq 0x438ab(%rip), %rsi     # 0x6667d
callq 0x43c0
movq %rax, %rdi
movq 0x711b7(%rip), %rsi     # 0x93f98
callq 0x4400
movq %rax, %rdi
movq 0x711a8(%rip), %rsi     # 0x93f98
callq 0x4400
movw $0x0, -0x12(%rbp)
movq -0x68(%rbp), %rdi
movzwl -0x12(%rbp), %eax
movq %rax, -0x70(%rbp)
addq $0x40, %rdi
callq 0x23a90
movq %rax, %rcx
movq -0x70(%rbp), %rax
cmpq %rcx, %rax
jae 0x22ee0
movq -0x10(%rbp), %rdi
leaq 0x436cb(%rip), %rsi     # 0x664f6
callq 0x43c0
movq %rax, %rdi
movzwl -0x12(%rbp), %esi
callq 0x4670
movq -0x10(%rbp), %rdi
leaq 0x43843(%rip), %rsi     # 0x6668a
callq 0x43c0
movq -0x68(%rbp), %rsi
movq %rax, -0x88(%rbp)
movzwl -0x12(%rbp), %edx
leaq -0x38(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x24510
movq -0x88(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x4380
movq %rax, -0x78(%rbp)
jmp 0x22e7e
movq -0x78(%rbp), %rdi
leaq 0x4380b(%rip), %rsi     # 0x66694
callq 0x43c0
movq %rax, -0x90(%rbp)
jmp 0x22e97
movq -0x90(%rbp), %rdi
movq 0x710f3(%rip), %rsi     # 0x93f98
callq 0x4400
jmp 0x22eac
leaq -0x38(%rbp), %rdi
callq 0x4828
movw -0x12(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x12(%rbp)
jmp 0x22dfb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x4828
jmp 0x2306f
movq -0x10(%rbp), %rdi
movq 0x710ad(%rip), %rsi     # 0x93f98
callq 0x4400
movw $0x0, -0x46(%rbp)
movq -0x68(%rbp), %rdi
movzwl -0x46(%rbp), %eax
movq %rax, -0x98(%rbp)
addq $0x40, %rdi
callq 0x23a90
movq %rax, %rcx
movq -0x98(%rbp), %rax
cmpq %rcx, %rax
jae 0x23047
movq -0x68(%rbp), %rdi
addq $0x40, %rdi
movzwl -0x46(%rbp), %eax
movl %eax, %esi
callq 0x23ae0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
addq $0x20, %rdi
callq 0x24310
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
addq $0x20, %rdi
callq 0x24340
movq %rax, -0x60(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x245f0
testb $0x1, %al
jne 0x22f70
jmp 0x23034
movq -0x10(%rbp), %rdi
leaq 0x4357b(%rip), %rsi     # 0x664f6
callq 0x43c0
movq %rax, -0xb0(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x24630
movq -0xb0(%rbp), %rdi
movq (%rax), %rax
movzwl (%rax), %esi
callq 0x4670
movq %rax, %rdi
leaq 0x436eb(%rip), %rsi     # 0x66697
callq 0x43c0
movq %rax, -0xa8(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x24630
movq -0xa8(%rbp), %rdi
movq (%rax), %rax
movzwl 0x2(%rax), %esi
callq 0x4670
movq -0x10(%rbp), %rdi
leaq 0x436ac(%rip), %rsi     # 0x6668b
callq 0x43c0
movq %rax, -0xa0(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x24630
movq -0xa0(%rbp), %rdi
movq (%rax), %rax
movsd 0x8(%rax), %xmm0
callq 0x4780
movq %rax, %rdi
leaq 0x4368a(%rip), %rsi     # 0x6669c
callq 0x43c0
movq %rax, %rdi
movq 0x70f77(%rip), %rsi     # 0x93f98
callq 0x4400
leaq -0x58(%rbp), %rdi
callq 0x24650
jmp 0x22f49
jmp 0x23036
movw -0x46(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x46(%rbp)
jmp 0x22ef6
movq -0x10(%rbp), %rdi
leaq 0x4364e(%rip), %rsi     # 0x666a0
callq 0x43c0
movq %rax, %rdi
movq 0x70f37(%rip), %rsi     # 0x93f98
callq 0x4400
addq $0xb0, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x46e0
nopl (%rax,%rax)