// File: /workspace/github_cpp_makefile_star2_O1/aalto-speech[P]ftk/src/StringSet.cc
// Function: StringSet::learn_map(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&)
void
StringSet::learn_map(const map<string, flt_type> &vocab)
{
    for (int i=0; i<256; i++) charmap[i] = 255;

    map<unsigned char, int> charcounts;
    for (auto it = vocab.begin(); it != vocab.end(); ++it) {
        for (const char &chr : it->first) charcounts[(unsigned char)chr]++;
    }

    vector<pair<unsigned char, int> > sorted_charcounts;
    for (auto it = charcounts.begin(); it != charcounts.end(); ++it) {
        pair<unsigned char, int> ccount = make_pair(it->first, it->second);
        sorted_charcounts.push_back(ccount);
    }
    sort(sorted_charcounts.begin(), sorted_charcounts.end(), rank_desc_sort);

    unsigned char idx = 0;
    character_count = charcounts.size();
    for (auto it = sorted_charcounts.begin(); it != sorted_charcounts.end(); ++it) {
        charmap[it->first] = idx;
        idx++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %rbx
movq %rdi, -0x50(%rbp)
addq $0x1c, %rdi
movl $0x100, %edx            # imm = 0x100
movl $0xff, %esi
callq 0x41d0
leaq -0x88(%rbp), %rcx
movl $0x0, (%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movq 0x18(%rbx), %rax
addq $0x8, %rbx
movq %rbx, -0x58(%rbp)
cmpq %rbx, %rax
je 0xc993
leaq -0x90(%rbp), %r12
leaq -0x40(%rbp), %r13
movq %rax, -0x48(%rbp)
movq 0x28(%rax), %rbx
testq %rbx, %rbx
je 0xc984
movq -0x48(%rbp), %rax
movq 0x20(%rax), %r14
xorl %r15d, %r15d
movb (%r14,%r15), %al
movb %al, -0x40(%rbp)
movq %r12, %rdi
movq %r13, %rsi
callq 0xd47a
incl (%rax)
incq %r15
cmpq %r15, %rbx
jne 0xc968
movq -0x48(%rbp), %rdi
callq 0x4410
cmpq -0x58(%rbp), %rax
jne 0xc950
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x78(%rbp), %r14
leaq -0x88(%rbp), %rbx
cmpq %rbx, %r14
je 0xc9fd
leaq -0x40(%rbp), %r15
leaq -0x60(%rbp), %r12
movzbl 0x20(%r14), %ecx
movl 0x24(%r14), %eax
shlq $0x20, %rax
orq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
je 0xc9e2
movq %rax, (%rsi)
addq $0x8, -0x38(%rbp)
jmp 0xc9ed
movq %r15, %rdi
movq %r12, %rdx
callq 0xdb20
movq %r14, %rdi
callq 0x4280
movq %rax, %r14
cmpq %rbx, %rax
jne 0xc9ba
movq -0x40(%rbp), %r14
movq -0x38(%rbp), %r15
cmpq %r15, %r14
movq -0x50(%rbp), %rbx
je 0xca49
movq %r15, %rax
subq %r14, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq 0x9b7(%rip), %rcx       # 0xd3e3
movq %r14, %rdi
movq %r15, %rsi
callq 0xdc5c
leaq 0x9a5(%rip), %rdx       # 0xd3e3
movq %r14, %rdi
movq %r15, %rsi
callq 0xdd2f
movl -0x68(%rbp), %eax
movl %eax, 0x11c(%rbx)
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xca76
xorl %ecx, %ecx
movq %rdi, %rdx
movzbl (%rdx), %esi
movb %cl, 0x1c(%rbx,%rsi)
incb %cl
addq $0x8, %rdx
cmpq %rax, %rdx
jne 0xca64
testq %rdi, %rdi
je 0xca80
callq 0x4350
leaq -0x90(%rbp), %rdi
callq 0x5e40
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xca9d
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xcab3
callq 0x4350
jmp 0xcab3
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x5e40
movq %rbx, %rdi
callq 0x4650
nop