// File: aalto-speech[P]ftk/src/EM.cc
// Function: viterbi(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>>>>>> const&, FactorGraph&, 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>>>>>>&, double)
flt_type viterbi(const transitions_t &transitions,
                 FactorGraph &text,
                 transitions_t &stats,
                 flt_type multiplier)
{
    vector<string> best_path;
    flt_type lp = viterbi(transitions, text, best_path, true);
    if (best_path.size() < 2) return MIN_FLOAT;
    for (unsigned int i=1; i<best_path.size(); i++)
        stats[best_path[i-1]][best_path[i]] += multiplier;
    return lp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movsd %xmm0, -0x28(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0xa160
movq -0x70(%rbp), %rdx
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x1, %ecx
callq 0x41ec0
movsd %xmm0, -0x68(%rbp)
jmp 0x424f6
movsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x5f70
cmpq $0x2, %rax
jae 0x42556
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 0x42613
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x6970
jmp 0x4262a
movl $0x1, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movq %rax, -0x78(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x5f70
movq %rax, %rcx
movq -0x78(%rbp), %rax
cmpq %rcx, %rax
jae 0x42602
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
movl -0x5c(%rbp), %eax
decl %eax
movl %eax, %esi
leaq -0x40(%rbp), %rdi
callq 0x5f90
movq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x48700
movq %rax, -0x80(%rbp)
jmp 0x425ba
movl -0x5c(%rbp), %eax
movl %eax, %esi
leaq -0x40(%rbp), %rdi
callq 0x5f90
movq -0x80(%rbp), %rdi
movq %rax, %rsi
callq 0x47db0
movq %rax, -0x98(%rbp)
jmp 0x425dd
movq -0x98(%rbp), %rax
movsd -0x90(%rbp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x4255d
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movl $0x1, -0x58(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x6970
movsd -0x8(%rbp), %xmm0
addq $0xa0, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x46e0
nopw %cs:(%rax,%rax)