// File: aalto-speech[P]ftk/src/Unigrams.cc
// Function: Unigrams::write_vocab(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, double, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, double>>> const&, bool, int)
int
Unigrams::write_vocab(string fname,
                      const map<string, flt_type> &vocab,
                      bool count_style,
                      int num_decimals)
{
    SimpleFileOutput vocabfile(fname);

    vector<pair<string, flt_type> > sorted_vocab;
    sort_vocab(vocab, sorted_vocab);
    for (unsigned int i=0; i<sorted_vocab.size(); i++)
        if (count_style)
            vocabfile << sorted_vocab[i].first << "\t" << sorted_vocab[i].second << "\n";
        else
            vocabfile << sorted_vocab[i].second << " " << sorted_vocab[i].first << "\n";
    vocabfile.close();

    return vocab.size();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movl %edx, %eax
movq %rsi, %rdx
movq %rdi, %rsi
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movl %ecx, -0x18(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x41a0
movq -0x118(%rbp), %rsi
leaq -0x20(%rbp), %rdi
callq 0x7960
jmp 0x551a5
leaq -0x40(%rbp), %rdi
callq 0x4828
leaq -0x68(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x587e0
movq -0x120(%rbp), %rsi
movq -0x10(%rbp), %rdi
movl $0x1, %edx
callq 0x55590
jmp 0x551d5
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq %rax, -0x128(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x58800
movq %rax, %rcx
movq -0x128(%rbp), %rax
cmpq %rcx, %rax
jae 0x55535
testb $0x1, -0x11(%rbp)
je 0x553b1
movl -0x6c(%rbp), %eax
movl %eax, %esi
leaq -0x68(%rbp), %rdi
callq 0x58830
movq %rax, %rsi
leaq -0x20(%rbp), %rdi
callq 0x7c00
movq %rax, -0x130(%rbp)
jmp 0x5522f
leaq -0x91(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x46f0
movq -0x138(%rbp), %rdx
leaq 0x112a6(%rip), %rsi     # 0x664f6
leaq -0x90(%rbp), %rdi
callq 0x4550
jmp 0x5525e
movq -0x130(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x7c00
movq %rax, -0x140(%rbp)
jmp 0x5527a
movl -0x6c(%rbp), %eax
movl %eax, %esi
leaq -0x68(%rbp), %rdi
callq 0x58830
movq -0x140(%rbp), %rdi
movsd 0x20(%rax), %xmm0
callq 0x7d30
movq %rax, -0x148(%rbp)
jmp 0x552a2
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x46f0
movq -0x150(%rbp), %rdx
leaq 0x1108f(%rip), %rsi     # 0x66352
leaq -0xb8(%rbp), %rdi
callq 0x4550
jmp 0x552d1
movq -0x148(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x7c00
jmp 0x552e6
leaq -0xb8(%rbp), %rdi
callq 0x4828
leaq -0xb9(%rbp), %rdi
callq 0x4420
leaq -0x90(%rbp), %rdi
callq 0x4828
leaq -0x91(%rbp), %rdi
callq 0x4420
jmp 0x55525
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x4828
jmp 0x55582
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x55570
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x553a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x55394
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x55388
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x4828
leaq -0xb9(%rbp), %rdi
callq 0x4420
leaq -0x90(%rbp), %rdi
callq 0x4828
leaq -0x91(%rbp), %rdi
callq 0x4420
jmp 0x55570
movl -0x6c(%rbp), %eax
movl %eax, %esi
leaq -0x68(%rbp), %rdi
callq 0x58830
movsd 0x20(%rax), %xmm0
leaq -0x20(%rbp), %rdi
callq 0x7d30
movq %rax, -0x158(%rbp)
jmp 0x553d6
leaq -0xe1(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0x46f0
movq -0x160(%rbp), %rdx
leaq 0x10f71(%rip), %rsi     # 0x66368
leaq -0xe0(%rbp), %rdi
callq 0x4550
jmp 0x55405
movq -0x158(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x7c00
movq %rax, -0x168(%rbp)
jmp 0x55421
movl -0x6c(%rbp), %eax
movl %eax, %esi
leaq -0x68(%rbp), %rdi
callq 0x58830
movq -0x168(%rbp), %rdi
movq %rax, %rsi
callq 0x7c00
movq %rax, -0x170(%rbp)
jmp 0x55447
leaq -0x109(%rbp), %rdi
movq %rdi, -0x178(%rbp)
callq 0x46f0
movq -0x178(%rbp), %rdx
leaq 0x10eea(%rip), %rsi     # 0x66352
leaq -0x108(%rbp), %rdi
callq 0x4550
jmp 0x55476
movq -0x170(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x7c00
jmp 0x5548b
leaq -0x108(%rbp), %rdi
callq 0x4828
leaq -0x109(%rbp), %rdi
callq 0x4420
leaq -0xe0(%rbp), %rdi
callq 0x4828
leaq -0xe1(%rbp), %rdi
callq 0x4420
jmp 0x55525
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x55517
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5550b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x554ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x4828
leaq -0x109(%rbp), %rdi
callq 0x4420
leaq -0xe0(%rbp), %rdi
callq 0x4828
leaq -0xe1(%rbp), %rdi
callq 0x4420
jmp 0x55570
jmp 0x55527
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x551dc
leaq -0x20(%rbp), %rdi
callq 0x7ba0
jmp 0x55540
movq -0x10(%rbp), %rdi
callq 0x5fd0
movl %eax, -0x17c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x58850
leaq -0x20(%rbp), %rdi
callq 0x7b70
movl -0x17c(%rbp), %eax
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
leaq -0x68(%rbp), %rdi
callq 0x58850
leaq -0x20(%rbp), %rdi
callq 0x7b70
movq -0x48(%rbp), %rdi
callq 0x46e0
nopl (%rax,%rax)