// File: /workspace/github_cpp_makefile_star2_O1/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), %rax
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testb $0x5, -0x260(%rbp,%rax)
jne 0x1da58
movl %r15d, -0x34(%rbp)
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq %r13, -0x30(%rbp)
movl $0xffffffff, (%r13)     # imm = 0xFFFFFFFF
leaq -0x78(%rbp), %r13
leaq -0x58(%rbp), %r15
movq -0x280(%rbp), %rax
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 0x1d9b1
movq %r15, %rdi
movq %r13, %rsi
leaq 0x8c57(%rip), %rdx      # 0x26594
callq 0x1fc6a
movq %r13, %rdi
movq %r15, %rsi
callq 0x4430
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x1d95f
callq 0x4350
movq %r15, %rdi
movq %r13, %rsi
leaq 0x892c(%rip), %rdx      # 0x26298
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x7b7b
movq -0x58(%rbp), %rbx
cmpq -0x50(%rbp), %rbx
je 0x1d9a4
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1b05e
movsd (%rax), %xmm0
addsd 0x8e6e(%rip), %xmm0     # 0x26808
movsd %xmm0, (%rax)
addq $0x20, %rbx
jmp 0x1d97d
movq %r15, %rdi
callq 0x5d54
jmp 0x1d8f8
leaq -0x280(%rbp), %rdi
callq 0x40a0
movq 0x18(%r14), %rax
leaq 0x8(%r14), %rbx
cmpq %rbx, %rax
je 0x1da42
movq -0x30(%rbp), %rcx
movl (%rcx), %r15d
movq 0x28(%rax), %rcx
cmpb $0x0, -0x34(%rbp)
je 0x1da21
testq %rcx, %rcx
movq -0x30(%rbp), %r10
je 0x1da29
movq 0x20(%rax), %rsi
xorl %edi, %edi
xorl %edx, %edx
movb (%rsi,%rdi), %r9b
movl $0x1, %r8d
testb %r9b, %r9b
jns 0x1da15
movl $0x4, %r8d
cmpb $-0x11, %r9b
ja 0x1da15
cmpb $-0x20, %r9b
movl $0x2, %r8d
sbbl $-0x1, %r8d
addl %r8d, %edi
incl %edx
cmpq %rdi, %rcx
ja 0x1d9ec
jmp 0x1da2b
movl %ecx, %edx
movq -0x30(%rbp), %r10
jmp 0x1da2b
xorl %edx, %edx
cmpl %edx, %r15d
cmovlel %edx, %r15d
movl %r15d, (%r10)
movq %rax, %rdi
callq 0x4280
cmpq %rbx, %rax
jne 0x1d9d1
movl 0x28(%r14), %ebx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x1da58
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 0x1da7e
jmp 0x1da7e
jmp 0x1da7e
movq %rax, %rbx
jmp 0x1da8f
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x5d54
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x1daa1
callq 0x4350
leaq -0x280(%rbp), %rdi
callq 0x40c0
movq %rbx, %rdi
callq 0x4650
nop