// File: /workspace/github_cpp_makefile_star2_O2/cristian-bicheru[P]arith/./huffman.h
// Function: huffman::HuffmanTree<unsigned char, unsigned long>::HuffmanTree(std::map<unsigned char, unsigned long, std::less<unsigned char>, std::allocator<std::pair<unsigned char const, unsigned long>>> const&)
explicit HuffmanTree(const std::map<SymbolType, ValueType>& SortedFrequencyTable) {
            std::deque<HuffmanNode<SymbolType, ValueType>*> SymbolQueue;
            HuffmanNode<SymbolType, ValueType>* NodePtr;

            for (auto SymbolFrequency : SortedFrequencyTable) {
                AllNodes.push_back(new HuffmanNode<SymbolType, ValueType>(std::get<1>(SymbolFrequency), std::get<0>(SymbolFrequency)));
                SymbolQueue.push_front(AllNodes.back());
            }

            while (SymbolQueue.size() > 1) {
                std::sort(SymbolQueue.rbegin(), SymbolQueue.rend(), ComparePointerObjects<HuffmanNode<SymbolType, ValueType>>);
                //std::cout << SymbolQueue.back()->GetValue() << std::endl;
                NodePtr = SymbolQueue.back();
                SymbolQueue.pop_back();
                AllNodes.push_back(new HuffmanNode<SymbolType, ValueType>(NodePtr, SymbolQueue.back()));
                SymbolQueue.push_front(AllNodes.back());
                SymbolQueue.pop_back();
            }

            ParentNode = SymbolQueue[0];
        }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
andl $0x0, 0x10(%rdi)
andq $0x0, 0x18(%rdi)
movq %rsi, %r15
leaq 0x10(%rdi), %rax
movq %rax, 0x20(%rdi)
movq %rax, 0x28(%rdi)
leaq 0x38(%rdi), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x40(%rdi)
leaq 0x10(%rsp), %rdi
callq 0x4fb2
movq 0x18(%r15), %r13
addq $0x8, %r15
cmpq %r15, %r13
je 0x45f1
movb 0x20(%r13), %bpl
movq 0x28(%r13), %r12
pushq $0x20
popq %rdi
callq 0x21c0
movq %r12, 0x18(%rax)
movb $0x1, 0x10(%rax)
movb %bpl, 0x11(%rax)
movq %rax, 0x8(%rsp)
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
callq 0x51ae
movq 0x40(%rbx), %rsi
addq $-0x8, %rsi
leaq 0x10(%rsp), %rdi
callq 0x4f2a
movq %r13, %rdi
callq 0x21f0
movq %rax, %r13
jmp 0x459f
leaq 0x10(%rsp), %r12
pushq $0x20
popq %r13
leaq 0x8(%rsp), %rbp
movq %r12, %rdi
callq 0x4f46
cmpq $0x2, %rax
jb 0x46f3
movups 0x20(%rsp), %xmm0
movups 0x30(%rsp), %xmm1
movups 0x40(%rsp), %xmm2
movups 0x50(%rsp), %xmm3
movaps %xmm2, 0x80(%rsp)
movaps %xmm3, 0x90(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm1, 0x70(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0x93b(%rip), %rdx       # 0x4f8e
callq 0x4f56
movq 0x40(%rsp), %rax
cmpq 0x48(%rsp), %rax
jne 0x4675
movq 0x58(%rsp), %rax
movq -0x8(%rax), %rax
movl $0x200, %ecx            # imm = 0x200
addq %rcx, %rax
movq -0x8(%rax), %r15
movq %r12, %rdi
callq 0x4f9a
movq %r13, %rdi
callq 0x21c0
movq 0x40(%rsp), %rcx
cmpq 0x48(%rsp), %rcx
jne 0x46a6
movq 0x58(%rsp), %rcx
movq -0x8(%rcx), %rcx
movl $0x200, %edx            # imm = 0x200
addq %rdx, %rcx
movq -0x8(%rcx), %rcx
andq $0x0, 0x18(%rax)
movq %r15, (%rax)
movq %rcx, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x18(%rcx), %rcx
addq 0x18(%r15), %rcx
movq %rcx, 0x18(%rax)
movq %rax, 0x8(%rsp)
movq %r14, %rdi
movq %rbp, %rsi
callq 0x51ae
movq 0x40(%rbx), %rsi
addq $-0x8, %rsi
movq %r12, %rdi
callq 0x4f2a
movq %r12, %rdi
callq 0x4f9a
jmp 0x45ff
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
callq 0x6b4e
movq (%rax), %rax
movq %rax, (%rbx)
leaq 0x10(%rsp), %rdi
callq 0x6b6e
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
jmp 0x4739
jmp 0x472c
jmp 0x472c
jmp 0x472c
movq %rax, %r15
leaq 0x10(%rsp), %rdi
callq 0x6b6e
addq $0x8, %rbx
movq %r14, %rdi
callq 0x6b94
movq %rbx, %rdi
callq 0x7f52
movq %r15, %rdi
callq 0x22e0
nop