// File: /workspace/github_cpp_makefile_star2_O2/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, %r12d
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %rsi
leaq -0x280(%rbp), %r15
pushq $0x8
popq %rdx
movq %r15, %rdi
callq 0x4540
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x260(%rbp,%rax)
je 0x1bc31
pushq $-0x1
popq %rbx
jmp 0x1bd3c
movl %r12d, -0x2c(%rbp)
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
orl $-0x1, (%r14)
leaq -0x78(%rbp), %r13
leaq -0x58(%rbp), %r15
leaq -0x280(%rbp), %rdi
movq %r13, %rsi
callq 0x4090
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1bce3
movq %r15, %rdi
movq %r13, %rsi
leaq 0x78a9(%rip), %rdx      # 0x23524
callq 0x1d99a
movq %r13, %rdi
movq %r15, %rsi
callq 0x43d0
movq %r15, %rdi
callq 0x46b8
movq %r15, %rdi
movq %r13, %rsi
leaq 0x75d0(%rip), %rdx      # 0x23270
pushq $0x1
popq %rcx
xorl %r8d, %r8d
callq 0x6e3a
movq -0x58(%rbp), %r12
cmpq -0x50(%rbp), %r12
je 0x1bcd6
movq %rbx, %rdi
movq %r12, %rsi
callq 0x18d90
movsd (%rax), %xmm0
addsd 0x7acc(%rip), %xmm0     # 0x23798
movsd %xmm0, (%rax)
addq $0x20, %r12
jmp 0x1bcaf
movq %r15, %rdi
callq 0x54b6
jmp 0x1bc51
leaq -0x280(%rbp), %rdi
callq 0x40a0
movq 0x18(%rbx), %r12
leaq 0x8(%rbx), %r13
movq %r14, -0x38(%rbp)
movl (%r14), %r14d
movzbl -0x2c(%rbp), %r15d
cmpq %r13, %r12
je 0x1bd30
leaq 0x20(%r12), %rdi
movl %r15d, %esi
callq 0x1bb8e
cmpl %eax, %r14d
cmovlel %eax, %r14d
movq -0x38(%rbp), %rax
movl %r14d, (%rax)
movq %r12, %rdi
callq 0x4270
movq %rax, %r12
jmp 0x1bd03
movl 0x28(%rbx), %ebx
leaq -0x78(%rbp), %rdi
callq 0x46b8
leaq -0x280(%rbp), %rdi
callq 0x40d0
movl %ebx, %eax
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1bd62
jmp 0x1bd62
jmp 0x1bd62
movq %rax, %rbx
jmp 0x1bd73
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x54b6
leaq -0x78(%rbp), %rdi
callq 0x46b8
leaq -0x280(%rbp), %rdi
callq 0x40d0
movq %rbx, %rdi
callq 0x45f0