// File: Albuso0[P]entropy/entropy.cpp
// Function: Entropy::setHist(std::vector<int, std::allocator<int>> const&)
void Entropy::setHist( const std::vector<int> &hist )
{
    fin.clear();
    n = 0;
    
    std::map<int, int> fin_map;
    for ( const auto & freq : hist )
    {
        auto iter = fin_map.find( freq );
        if ( iter == fin_map.end() )
            fin_map.insert( std::make_pair( freq,1 ) );
        else
            ++(iter->second);
    }
    
    for ( auto it = fin_map.begin(); it != fin_map.end(); ++it )
    {
        int freq = it->first, cnt = it->second;
        fin.push_back( std::make_pair( freq, cnt ) );
        n += (freq * cnt);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
addq $0x28, %rdi
callq 0x3870
movq -0xc8(%rbp), %rax
movl $0x0, 0x1c(%rax)
leaq -0x40(%rbp), %rdi
callq 0x3a40
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x3a60
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdi
callq 0x3a90
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x3ac0
testb $0x1, %al
jne 0x3006
jmp 0x30ff
leaq -0x50(%rbp), %rdi
callq 0x3b00
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x3b20
movq %rax, -0xd0(%rbp)
jmp 0x3029
movq -0xd0(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3b80
movq %rax, -0x80(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x3b50
testb $0x1, %al
jne 0x3057
jmp 0x30dd
movq -0x60(%rbp), %rdi
movl $0x1, -0x8c(%rbp)
leaq -0x8c(%rbp), %rsi
callq 0x3bf0
movq %rax, -0xd8(%rbp)
jmp 0x307a
movq -0xd8(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x3bb0
movb %dl, -0xe1(%rbp)
movq %rax, -0xe0(%rbp)
jmp 0x30a7
movb -0xe1(%rbp), %al
movq -0xe0(%rbp), %rcx
movq %rcx, -0xa0(%rbp)
movb %al, -0x98(%rbp)
jmp 0x30ef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3cf0
jmp 0x31fc
leaq -0x68(%rbp), %rdi
callq 0x3c20
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
jmp 0x30f1
leaq -0x50(%rbp), %rdi
callq 0x3c40
jmp 0x2ff0
leaq -0x40(%rbp), %rdi
callq 0x3c60
movq %rax, -0xa8(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3b80
movq %rax, -0xb0(%rbp)
leaq -0xa8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x3c90
testb $0x1, %al
jne 0x313b
jmp 0x31ea
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x3c20
movq -0x100(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0xb4(%rbp)
callq 0x3c20
movq %rax, %rcx
movq -0xc8(%rbp), %rax
movl 0x4(%rcx), %ecx
movl %ecx, -0xb8(%rbp)
addq $0x28, %rax
movq %rax, -0xf8(%rbp)
leaq -0xb4(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x39a0
movq %rax, -0xf0(%rbp)
jmp 0x319c
movq -0xf8(%rbp), %rdi
movq -0xf0(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq -0xc0(%rbp), %rsi
callq 0x3970
jmp 0x31bf
movq -0xc8(%rbp), %rax
movl -0xb4(%rbp), %ecx
imull -0xb8(%rbp), %ecx
addl 0x1c(%rax), %ecx
movl %ecx, 0x1c(%rax)
leaq -0xa8(%rbp), %rdi
callq 0x3cc0
jmp 0x310f
leaq -0x40(%rbp), %rdi
callq 0x3cf0
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x2330
nopw %cs:(%rax,%rax)