// File: /workspace/github_cpp_makefile_star2_O1/aalto-speech[P]ftk/src/MSFG.cc
// Function: MultiStringFactorGraph::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) const
void
MultiStringFactorGraph::write(const std::string &filename) const
{
    ofstream outfile(filename);
    if (!outfile) return;

    vector<Arc*> arcs; collect_arcs(arcs);

    outfile << nodes.size() << " " << arcs.size() << " " << string_end_nodes.size() << endl;
    for (unsigned int i=0; i<nodes.size(); i++)
        outfile << "n " << i << " " << nodes[i].factor << endl;
    for (auto it = arcs.begin(); it != arcs.end(); ++it)
        outfile << "a " << (**it).source_node << " " << (**it).target_node << endl;
    for (auto it = string_end_nodes.cbegin(); it != string_end_nodes.cend(); ++it)
        outfile << "e " << it->first << " " << it->second << endl;
    outfile.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rdi, %rbx
leaq -0x240(%rbp), %r14
movq %r14, %rdi
movl $0x10, %edx
callq 0x46c0
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x220(%rbp,%rax)
jne 0x1289a
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rsi
movaps %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
movq %rbx, %rdi
callq 0x1181a
movq 0x28(%rbx), %rsi
subq 0x20(%rbx), %rsi
sarq $0x7, %rsi
leaq -0x240(%rbp), %rdi
callq 0x4250
movq %rax, %r14
leaq 0x13d5e(%rip), %rsi     # 0x26390
movl $0x1, %edx
movq %rax, %rdi
callq 0x4400
movq -0x38(%rbp), %rsi
subq -0x40(%rbp), %rsi
sarq $0x3, %rsi
movq %r14, %rdi
callq 0x4250
movq %rax, %r14
leaq 0x13d33(%rip), %rsi     # 0x26390
movl $0x1, %edx
movq %rax, %rdi
callq 0x4400
movq 0x60(%rbx), %rsi
movq %r14, %rdi
callq 0x4250
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4370
movsbl %al, %esi
movq %r14, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4260
movq 0x28(%rbx), %rax
cmpq 0x20(%rbx), %rax
je 0x12752
movl $0x1, %r12d
xorl %r13d, %r13d
leaq -0x240(%rbp), %r15
movl $0x2, %edx
movq %r15, %rdi
leaq 0x140dc(%rip), %rsi     # 0x267a9
callq 0x4400
movq %r15, %rdi
movq %r13, %rsi
callq 0x4250
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x13ca1(%rip), %rsi     # 0x26390
callq 0x4400
movq 0x20(%rbx), %rax
shlq $0x7, %r13
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq %r14, %rdi
callq 0x4400
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4370
movsbl %al, %esi
movq %r14, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4260
movq 0x28(%rbx), %rax
subq 0x20(%rbx), %rax
movl %r12d, %r13d
sarq $0x7, %rax
incl %r12d
cmpq %r13, %rax
ja 0x126be
movq -0x40(%rbp), %r14
cmpq -0x38(%rbp), %r14
je 0x127e4
leaq -0x240(%rbp), %r15
leaq 0x13c22(%rip), %r12     # 0x26390
movl $0x2, %edx
movq %r15, %rdi
leaq 0x1402f(%rip), %rsi     # 0x267ac
callq 0x4400
movq (%r14), %rax
movl (%rax), %esi
movq %r15, %rdi
callq 0x4250
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x4400
movq (%r14), %rax
movl 0x4(%rax), %esi
movq %r13, %rdi
callq 0x4250
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x4370
movsbl %al, %esi
movq %r13, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4260
addq $0x8, %r14
cmpq -0x38(%rbp), %r14
jne 0x1276e
movq 0x50(%rbx), %r14
addq $0x40, %rbx
cmpq %rbx, %r14
je 0x12880
leaq -0x240(%rbp), %r12
leaq 0x13b8d(%rip), %r13     # 0x26390
movl $0x2, %edx
movq %r12, %rdi
leaq 0x13f9d(%rip), %rsi     # 0x267af
callq 0x4400
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
movq %r12, %rdi
callq 0x4400
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x4400
movl 0x40(%r14), %esi
movq %r15, %rdi
callq 0x4250
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4370
movsbl %al, %esi
movq %r15, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4260
movq %r14, %rdi
callq 0x4410
movq %rax, %r14
cmpq %rbx, %rax
jne 0x12803
leaq -0x240(%rbp), %rdi
callq 0x44c0
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x1289a
callq 0x4350
movq 0x2170f(%rip), %rax     # 0x33fb0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x238(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x240(%rbp,%rcx)
callq 0x4310
leaq -0x148(%rbp), %rdi
callq 0x4110
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x128e8
jmp 0x128e8
jmp 0x128e8
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x128f9
callq 0x4350
leaq -0x240(%rbp), %rdi
callq 0x4510
movq %rbx, %rdi
callq 0x4650
nop