// File: aalto-speech[P]ftk/src/EM.cc
// Function: viterbi(StringSet const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::map<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>>>, 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, 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>>>>>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
flt_type viterbi(const StringSet &vocab,
                 const string &text,
                 transitions_t &stats,
                 const string &start_end_symbol)
{
    stats.clear();
    vector<string> best_path;
    flt_type lp = viterbi(vocab, text, best_path, true);
    if (best_path.size() == 0) return MIN_FLOAT;
    best_path.insert(best_path.begin(), start_end_symbol);
    best_path.push_back(start_end_symbol);
    for (unsigned int i=1; i<best_path.size(); i++)
        stats[best_path[i-1]][best_path[i]] += 1.0;
    return lp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x48490
leaq -0x40(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0xa160
movq -0x88(%rbp), %rdx
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x40860
movsd %xmm0, -0x80(%rbp)
jmp 0x41d27
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x5f70
cmpq $0x0, %rax
jne 0x41d87
callq 0x47bf0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x8(%rbp)
movl $0x1, -0x58(%rbp)
jmp 0x41e97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x6970
jmp 0x41eae
leaq -0x40(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0xb2f0
movq %rax, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x486c0
movq -0x98(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x60(%rbp), %rsi
callq 0x484b0
movq %rax, -0x90(%rbp)
jmp 0x41dc5
movq -0x90(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0xabb0
jmp 0x41ddf
movl $0x1, -0x74(%rbp)
movl -0x74(%rbp), %eax
movq %rax, -0xa0(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x5f70
movq %rax, %rcx
movq -0xa0(%rbp), %rax
cmpq %rcx, %rax
jae 0x41e86
movq -0x20(%rbp), %rax
movq %rax, -0xb0(%rbp)
movl -0x74(%rbp), %eax
decl %eax
movl %eax, %esi
leaq -0x40(%rbp), %rdi
callq 0x5f90
movq -0xb0(%rbp), %rdi
movq %rax, %rsi
callq 0x48700
movq %rax, -0xa8(%rbp)
jmp 0x41e3b
movl -0x74(%rbp), %eax
movl %eax, %esi
leaq -0x40(%rbp), %rdi
callq 0x5f90
movq -0xa8(%rbp), %rdi
movq %rax, %rsi
callq 0x47db0
movq %rax, -0xb8(%rbp)
jmp 0x41e61
movq -0xb8(%rbp), %rax
movsd 0x24910(%rip), %xmm0    # 0x66780
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x41de6
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movl $0x1, -0x58(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x6970
movsd -0x8(%rbp), %xmm0
addq $0xc0, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x46e0
nopw (%rax,%rax)