// File: /workspace/github_cpp_makefile_star2_O1/aalto-speech[P]ftk/src/Unigrams.cc
// Function: Unigrams::resegment_words(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&, StringSet 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::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>)
flt_type
Unigrams::resegment_words(const map<string, flt_type> &words,
                          const StringSet &vocab,
                          map<string, flt_type> &new_freqs,
                          set<string> special_words)
{
    new_freqs.clear();
    flt_type ll = 0.0;

    for (auto worditer = words.cbegin(); worditer != words.cend(); ++worditer) {

        // Special symbols like 
 
 etc. which should not be segmented
        if (special_words.size() > 0 && special_words.find(worditer->first) != special_words.end()) {
            new_freqs[worditer->first] += worditer->second;
            continue;
        }

        map<string, flt_type> stats;
        flt_type curr_ll = worditer->second * segf(vocab, worditer->first, stats, this->utf8);

        if (stats.size() == 0) {
            cerr << "warning, no segmentation for word: " << worditer->first << endl;
            continue;
        }

        ll += curr_ll;

        // Update statistics
        for (auto it = stats.begin(); it != stats.end(); ++it)
            new_freqs[it->first] += worditer->second * it->second;
    }

    return ll;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, -0x50(%rbp)
movq %rsi, %r12
movq %rdi, -0x48(%rbp)
movq %rcx, %rdi
callq 0x1c04a
movq 0x18(%r12), %r15
addq $0x8, %r12
movq %r12, -0x58(%rbp)
cmpq %r12, %r15
je 0x1e53c
leaq 0x8(%rbx), %rax
movq %rax, -0x40(%rbp)
xorpd %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
leaq -0x88(%rbp), %r13
cmpq $0x0, 0x28(%rbx)
je 0x1e410
leaq 0x20(%r15), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x21436
cmpq -0x40(%rbp), %rax
je 0x1e410
movsd 0x40(%r15), %xmm0
movsd %xmm0, -0x30(%rbp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x1b05e
movsd -0x30(%rbp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0x1e525
movl $0x0, -0x88(%rbp)
xorl %eax, %eax
movq %rax, -0x80(%rbp)
movq %r13, -0x78(%rbp)
movq %r13, -0x70(%rbp)
movq %rax, -0x68(%rbp)
leaq 0x20(%r15), %rsi
movsd 0x40(%r15), %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x48(%rbp), %rax
movzbl 0x8(%rax), %ecx
movq -0x50(%rbp), %rdi
leaq -0x90(%rbp), %rdx
callq *(%rax)
cmpq $0x0, -0x68(%rbp)
je 0x1e4c3
movsd -0x30(%rbp), %xmm1
mulsd %xmm0, %xmm1
movsd -0x38(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x78(%rbp), %r12
cmpq %r13, %r12
je 0x1e519
movsd 0x40(%r15), %xmm0
movsd %xmm0, -0x30(%rbp)
leaq 0x20(%r12), %rsi
movsd 0x40(%r12), %xmm0
movsd %xmm0, -0x60(%rbp)
movq %r14, %rdi
callq 0x1b05e
movsd -0x30(%rbp), %xmm0
mulsd -0x60(%rbp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq %r12, %rdi
callq 0x4280
movq %rax, %r12
cmpq %r13, %rax
jne 0x1e47b
jmp 0x1e519
movl $0x23, %edx
movq 0x15b19(%rip), %rdi     # 0x33fe8
leaq 0x83fa(%rip), %rsi      # 0x268d0
callq 0x4400
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
movq 0x15afe(%rip), %rdi     # 0x33fe8
callq 0x4400
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4370
movsbl %al, %esi
movq %r12, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4260
leaq -0x90(%rbp), %rdi
callq 0x5cea
movq %r15, %rdi
callq 0x4410
movq %rax, %r15
cmpq -0x58(%rbp), %rax
jne 0x1e3cc
jmp 0x1e545
xorpd %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1e55b
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x5cea
movq %rbx, %rdi
callq 0x4650