// File: /workspace/github_cpp_makefile_star2_O1/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 $0xd8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x60(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq (%rsi), %rax
movzwl (%rax), %r13d
movq 0x2(%rax), %rax
movq %rax, 0x38(%rsp)
movl $0xa, %ebp
cmpw $0xb, %r13w
jb 0x4273
movw $0xa, %bp
leaq 0xf(%rsp), %r12
movzwl %bp, %eax
movq (%r14), %rcx
movb (%rcx,%rax), %al
movb %al, 0xf(%rsp)
leal 0x1(%rbp), %eax
movzwl %ax, %eax
movq (%rcx,%rax), %r15
leaq 0x58(%rsp), %rdi
movq %r12, %rsi
callq 0x5134
addl $0x9, %ebp
movq %r15, (%rax)
cmpw %r13w, %bp
jb 0x4240
movzwl %bp, %ebp
leaq 0x88(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x4a4e
leaq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0x3c64
movq 0x40(%rsp), %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
xorl %r12d, %r12d
movq %r12, 0x50(%rsp)
movq %r12, 0x10(%rsp)
movl %r12d, 0x18(%rsp)
movq %r12, 0x20(%rsp)
movl %r12d, 0x28(%rsp)
movq %r12, 0x30(%rsp)
movq 0x8(%rbx), %rax
subq (%rbx), %rax
cmpq 0x38(%rsp), %rax
jae 0x4405
movl $0x7, %r15d
movq %r15, %rax
movzbl (%r14,%rbp), %ecx
subq $0x1, %r15
movl $0x7, %edx
cmovbq %rdx, %r15
adcq $0x0, %rbp
xorl %esi, %esi
btl %eax, %ecx
setb %sil
leaq 0x10(%rsp), %rdi
callq 0x74e8
movq 0x10(%rsp), %rcx
movq 0x20(%rsp), %rdx
movl 0x28(%rsp), %esi
movq 0x88(%rsp), %rax
cmpq %rdx, %rcx
setne %r8b
testl %esi, %esi
setne %dil
orb %r8b, %dil
movq %rax, %r8
cmpb $0x1, %dil
jne 0x4378
xorl %r10d, %r10d
movq %rax, %r8
movq %rcx, %r9
movq (%r9), %r11
xorl %r13d, %r13d
btq %r10, %r11
setb %r13b
xorl %r11d, %r11d
cmpl $0x3f, %r10d
leal 0x1(%r10), %r10d
sete %r11b
cmovel %r12d, %r10d
leaq (%r9,%r11,8), %r9
movq (%r8,%r13,8), %r8
cmpq %rdx, %r9
setne %r11b
cmpl %esi, %r10d
setne %r13b
orb %r11b, %r13b
jne 0x433c
cmpb $0x1, 0x10(%r8)
jne 0x43f3
testb %dil, %dil
je 0x43bf
xorl %edi, %edi
movq (%rcx), %r8
xorl %r9d, %r9d
btq %rdi, %r8
setb %r9b
xorl %r8d, %r8d
cmpl $0x3f, %edi
leal 0x1(%rdi), %edi
sete %r8b
cmovel %r12d, %edi
leaq (%rcx,%r8,8), %rcx
movq (%rax,%r9,8), %rax
cmpq %rdx, %rcx
setne %r8b
cmpl %esi, %edi
setne %r9b
orb %r8b, %r9b
jne 0x4386
movb 0x11(%rax), %al
movb %al, 0xe(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x43d8
movb %al, (%rsi)
incq 0x8(%rbx)
jmp 0x43e5
movq %rbx, %rdi
leaq 0xe(%rsp), %rdx
callq 0x45ba
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x7c96
movq 0x8(%rbx), %rax
subq (%rbx), %rax
cmpq 0x38(%rsp), %rax
jb 0x42d8
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x442d
callq 0x21c0
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movl %eax, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movl %eax, 0x28(%rsp)
movq %rax, 0x30(%rsp)
testq %r14, %r14
je 0x443a
movq %r14, %rdi
callq 0x21c0
leaq 0x88(%rsp), %rdi
callq 0x50ec
leaq 0x58(%rsp), %rdi
callq 0x863e
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x44a9
jmp 0x446c
jmp 0x4471
movq %rax, %rbx
jmp 0x44b6
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x449c
callq 0x21c0
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movl %eax, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movl %eax, 0x28(%rsp)
movq %rax, 0x30(%rsp)
testq %r14, %r14
je 0x44a9
movq %r14, %rdi
callq 0x21c0
leaq 0x88(%rsp), %rdi
callq 0x50ec
leaq 0x58(%rsp), %rdi
callq 0x863e
movq %rbx, %rdi
callq 0x2320