// File: /workspace/github_cpp_makefile_star2_O2/cristian-bicheru[P]arith/./huffman.h
// Function: void huffman::UncompressBuffer<unsigned char, unsigned long>(std::vector<unsigned char, std::allocator<unsigned char>>&, std::vector<unsigned char, std::allocator<unsigned char>>&)
void UncompressBuffer(std::vector<SymbolType>& UncompressedBuffer, std::vector<unsigned char>& CompressedBuffer) {
        std::map<SymbolType, ValueType> SortedFrequencyTable;
        uint16_t mindex;
        uint64_t UncompressedSize;
        buffer::DecodeTypeFromBuffer<uint16_t>(CompressedBuffer, 0, &mindex);
        buffer::DecodeTypeFromBuffer<uint64_t>(CompressedBuffer, sizeof(uint16_t), &UncompressedSize);
        uint16_t index = sizeof(uint16_t)+sizeof(uint64_t);
        SymbolType key;
        ValueType val;

        while (index < mindex) {
            buffer::DecodeTypeFromBuffer<SymbolType>(CompressedBuffer, index, &key);
            index += sizeof(SymbolType);
            buffer::DecodeTypeFromBuffer<ValueType>(CompressedBuffer, index, &val);
            index += sizeof(ValueType);
            SortedFrequencyTable[key] = val;
        }

        HuffmanTree<SymbolType, ValueType> HuffTree(SortedFrequencyTable);

        buffer::CodecBitIterator BitStream(CompressedBuffer, index);
        std::vector<bool> TreeIndex;

        while (UncompressedBuffer.size() < UncompressedSize) {
            TreeIndex.push_back(BitStream.ReadBit());
            if (HuffTree[TreeIndex].IsRoot()) {
                UncompressedBuffer.push_back(HuffTree[TreeIndex].GetSymbol());
                TreeIndex.resize(0);
            }
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x50(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0xe(%rsp), %rdx
movq %rsi, %rdi
xorl %esi, %esi
callq 0x7fad
pushq $0x2
popq %rsi
leaq 0x18(%rsp), %rdx
movq %r14, %rdi
callq 0x393d
movw $0xa, %r15w
leaq 0x48(%rsp), %r12
leaq 0xd(%rsp), %r13
movzwl %r15w, %ebp
cmpw 0xe(%rsp), %r15w
jae 0x3cd2
movq (%r14), %rax
movb (%rax,%rbp), %al
movb %al, 0xd(%rsp)
leal 0x1(%rbp), %eax
movzwl %ax, %esi
movq %r14, %rdi
leaq 0x10(%rsp), %rdx
callq 0x393d
movq 0x10(%rsp), %rbp
movq %r12, %rdi
movq %r13, %rsi
callq 0x4968
addl $0x9, %r15d
movq %rbp, (%rax)
jmp 0x3c90
leaq 0xb8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x4552
leaq 0x78(%rsp), %rdi
movq %r14, %rsi
callq 0x36a0
leaq 0x20(%rsp), %rdi
leaq 0x78(%rsp), %r14
movq %r14, %rsi
movq %rbp, %rdx
callq 0x36ea
movq %r14, %rdi
callq 0x44a6
leaq 0x90(%rsp), %r14
andq $0x0, (%r14)
andl $0x0, 0x8(%r14)
andq $0x0, 0x10(%r14)
andl $0x0, 0x18(%r14)
andq $0x0, 0x20(%r14)
pushq $0x7
popq %r13
leaq 0xb8(%rsp), %r15
leaq 0xc(%rsp), %r12
movq 0x8(%rbx), %rax
subq (%rbx), %rax
cmpq 0x18(%rsp), %rax
jae 0x3dcb
movq 0x20(%rsp), %rax
movq 0x38(%rsp), %rdx
movzbl (%rax,%rdx), %eax
movq 0x40(%rsp), %rcx
testq %rcx, %rcx
je 0x3d6b
leaq -0x1(%rcx), %rdx
jmp 0x3d76
incq %rdx
movq %rdx, 0x38(%rsp)
movq %r13, %rdx
movq %rdx, 0x40(%rsp)
xorl %esi, %esi
btl %ecx, %eax
setb %sil
movq %r14, %rdi
callq 0x6d84
movq %r15, %rdi
movq %r14, %rsi
callq 0x6dc2
cmpb $0x1, 0x10(%rax)
jne 0x3d3f
movq %r15, %rdi
movq %r14, %rsi
callq 0x6dc2
movb 0x11(%rax), %al
movb %al, 0xc(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3f6a
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x76d4
jmp 0x3d3f
leaq 0x90(%rsp), %rdi
callq 0x490e
leaq 0x20(%rsp), %rdi
callq 0x44a6
leaq 0xb8(%rsp), %rdi
callq 0x491e
leaq 0x48(%rsp), %rdi
callq 0x7f66
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3e33
jmp 0x3e14
jmp 0x3e19
movq %rax, %rbx
jmp 0x3e40
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x490e
leaq 0x20(%rsp), %rdi
callq 0x44a6
leaq 0xb8(%rsp), %rdi
callq 0x491e
leaq 0x48(%rsp), %rdi
callq 0x7f66
movq %rbx, %rdi
callq 0x22e0