// File: /workspace/github_cpp_makefile_star2_O3/aalto-speech[P]ftk/src/Unigrams.cc
// Function: Unigrams::read_corpus(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>>>&, int&, bool)
int
Unigrams::read_corpus(string fname,
                      map<string, flt_type> &vocab,
                      int &maxlen,
                      bool utf8)
{
    ifstream vocabfile(fname);
    if (!vocabfile) return -1;

    string line;
    maxlen = -1;
    while (getline(vocabfile, line)) {
        line = str::cleaned(line);
        vector<string> words = str::split(line, " \t", true);
        for (auto wit = words.begin(); wit != words.end(); ++wit)
            vocab[*wit] += 1.0;
    }
    vocabfile.close();

    for (auto wit = vocab.begin(); wit != vocab.end(); ++wit)
        maxlen = max(maxlen, (int)get_factor_length(wit->first, utf8));

    return vocab.size();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movl %ecx, %r15d
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %rsi
leaq -0x280(%rbp), %r12
movq %r12, %rdi
movl $0x8, %edx
callq 0x45a0
movq (%r12), %rax
movq -0x18(%rax), %rcx
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testb $0x5, -0x260(%rbp,%rcx)
jne 0x1d920
movl %r15d, -0x34(%rbp)
leaq -0x68(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
movq %r13, -0x30(%rbp)
movl $0xffffffff, (%r13)     # imm = 0xFFFFFFFF
leaq -0x78(%rbp), %r13
leaq -0x58(%rbp), %r15
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4370
movsbl %al, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x4680
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1d879
movq %r15, %rdi
movq %r13, %rsi
leaq 0x8d96(%rip), %rdx      # 0x26594
callq 0x1fad5
movq %r13, %rdi
movq %r15, %rsi
callq 0x4430
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x1d820
callq 0x4350
movq %r15, %rdi
movq %r13, %rsi
leaq 0x8a6b(%rip), %rdx      # 0x26298
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x7b51
movq -0x58(%rbp), %rbx
cmpq -0x50(%rbp), %rbx
je 0x1d865
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1af86
movsd (%rax), %xmm0
addsd 0x8fad(%rip), %xmm0     # 0x26808
movsd %xmm0, (%rax)
addq $0x20, %rbx
jmp 0x1d83e
movq %r15, %rdi
callq 0x5d4e
movq -0x280(%rbp), %rax
jmp 0x1d7c0
leaq -0x280(%rbp), %rdi
callq 0x40a0
movq 0x18(%r14), %rax
leaq 0x8(%r14), %rbx
cmpq %rbx, %rax
je 0x1d90a
movq -0x30(%rbp), %rcx
movl (%rcx), %r15d
movq 0x28(%rax), %rcx
cmpb $0x0, -0x34(%rbp)
je 0x1d8e9
testq %rcx, %rcx
movq -0x30(%rbp), %r10
je 0x1d8f1
movq 0x20(%rax), %rsi
xorl %edi, %edi
xorl %edx, %edx
movb (%rsi,%rdi), %r9b
movl $0x1, %r8d
testb %r9b, %r9b
jns 0x1d8dd
movl $0x4, %r8d
cmpb $-0x11, %r9b
ja 0x1d8dd
cmpb $-0x20, %r9b
movl $0x2, %r8d
sbbl $-0x1, %r8d
addl %r8d, %edi
incl %edx
cmpq %rdi, %rcx
ja 0x1d8b4
jmp 0x1d8f3
movl %ecx, %edx
movq -0x30(%rbp), %r10
jmp 0x1d8f3
xorl %edx, %edx
cmpl %edx, %r15d
cmovlel %edx, %r15d
movl %r15d, (%r10)
movq %rax, %rdi
callq 0x4280
cmpq %rbx, %rax
jne 0x1d899
movl 0x28(%r14), %ebx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x1d920
callq 0x4350
leaq -0x280(%rbp), %rdi
callq 0x40c0
movl %ebx, %eax
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1d946
jmp 0x1d946
jmp 0x1d946
movq %rax, %rbx
jmp 0x1d957
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x5d4e
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x1d969
callq 0x4350
leaq -0x280(%rbp), %rdi
callq 0x40c0
movq %rbx, %rdi
callq 0x4650
nop