// File: aalto-speech[P]ftk/src/EM.cc
// Function: forward_backward(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>>, 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>>>&, bool)
flt_type forward_backward(const StringSet &vocab,
                          const string &text,
                          map<string, flt_type> &stats,
                          bool utf8)
{
    int len = text.length();
    if (len == 0) return MIN_FLOAT;

    stats.clear();
    vector<vector<Token> > search(len);
    vector<flt_type> fw(len, SMALL_LP); fw[0] = 0.0;
    vector<flt_type> bw(len, SMALL_LP); bw.back() = 0.0;

    forward(vocab, text, search, fw, utf8);
    backward(vocab, text, search, fw, bw, stats);

    if (search[len-1].size() == 0) return MIN_FLOAT;
    return fw.back();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movb %cl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
andb $0x1, %al
movb %al, -0x21(%rbp)
movq -0x18(%rbp), %rdi
callq 0x45e0
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0x41726
callq 0x47bf0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x4198b
movq -0x20(%rbp), %rdi
callq 0x47d90
movslq -0x28(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x48170
movq -0xb8(%rbp), %rsi
movq -0xb0(%rbp), %rdx
leaq -0x40(%rbp), %rdi
callq 0x48190
jmp 0x41763
leaq -0x41(%rbp), %rdi
callq 0x48200
movslq -0x28(%rbp), %rax
movq %rax, -0xc8(%rbp)
movabsq $-0x3fa7000000000000, %rax # imm = 0xC059000000000000
movq %rax, -0x78(%rbp)
leaq -0x79(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x48220
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rcx
leaq -0x70(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0x48240
jmp 0x417b2
leaq -0x79(%rbp), %rdi
callq 0x482c0
xorl %eax, %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
callq 0x47eb0
movq $0x0, (%rax)
movslq -0x28(%rbp), %rax
movq %rax, -0xd8(%rbp)
movabsq $-0x3fa7000000000000, %rax # imm = 0xC059000000000000
movq %rax, -0xa0(%rbp)
leaq -0xa1(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x48220
movq -0xd8(%rbp), %rsi
movq -0xd0(%rbp), %rcx
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0x48240
jmp 0x41821
leaq -0xa1(%rbp), %rdi
callq 0x482c0
leaq -0x98(%rbp), %rdi
callq 0x482e0
movq $0x0, (%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movzbl -0x21(%rbp), %r8d
andl $0x1, %r8d
leaq -0x40(%rbp), %rdx
leaq -0x70(%rbp), %rcx
callq 0x40e50
jmp 0x41860
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %r9
leaq -0x40(%rbp), %rdx
leaq -0x70(%rbp), %rcx
leaq -0x98(%rbp), %r8
callq 0x41370
jmp 0x41882
movl -0x28(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq -0x40(%rbp), %rdi
callq 0x47e90
movq %rax, %rdi
callq 0x47cd0
cmpq $0x0, %rax
jne 0x4193b
callq 0x47bf0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x8(%rbp)
movl $0x1, -0xa8(%rbp)
jmp 0x41957
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x41(%rbp), %rdi
callq 0x48200
jmp 0x41999
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x79(%rbp), %rdi
callq 0x482c0
jmp 0x41980
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xa1(%rbp), %rdi
callq 0x482c0
jmp 0x41977
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x48320
jmp 0x41977
leaq -0x70(%rbp), %rdi
callq 0x482e0
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
movl $0x1, -0xa8(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x48320
leaq -0x70(%rbp), %rdi
callq 0x48320
leaq -0x40(%rbp), %rdi
callq 0x48380
jmp 0x4198b
leaq -0x70(%rbp), %rdi
callq 0x48320
leaq -0x40(%rbp), %rdi
callq 0x48380
jmp 0x41999
movsd -0x8(%rbp), %xmm0
addq $0xe0, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x46e0
nopw %cs:(%rax,%rax)