// File: /workspace/github_cpp_makefile_star2_O3/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
movq 0x2(%rax), %rcx
movq %rcx, 0x38(%rsp)
movzwl (%rax), %r13d
movl $0xa, %ebp
cmpw $0xb, %r13w
jb 0x41ff
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 0x50e2
addl $0x9, %ebp
movq %r15, (%rax)
cmpw %r13w, %bp
jb 0x41cc
movzwl %bp, %ebp
leaq 0x88(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x49da
leaq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0x3c38
movq 0x38(%rsp), %r13
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 %r13, %rax
jae 0x43ab
movl $0x7, %r15d
movq %r15, %rax
movq %rbp, %rcx
cmpq $0x1, %r15
adcq $0x0, %rbp
subq $0x1, %r15
movl $0x7, %edx
cmovbq %rdx, %r15
movzbl (%r14,%rcx), %ecx
xorl %esi, %esi
btl %eax, %ecx
setb %sil
leaq 0x10(%rsp), %rdi
callq 0x73ee
movq 0x10(%rsp), %rcx
movq 0x20(%rsp), %rdx
movl 0x28(%rsp), %esi
movq 0x88(%rsp), %rax
cmpq %rdx, %rcx
setne %dil
testl %esi, %esi
setne %r8b
orb %dil, %r8b
cmpb $0x1, %r8b
jne 0x4352
xorl %r9d, %r9d
movq %rax, %rdi
movq %rcx, %r8
movq (%r8), %r10
xorl %r11d, %r11d
btq %r9, %r10
setb %r11b
xorl %r10d, %r10d
cmpl $0x3f, %r9d
leal 0x1(%r9), %r9d
sete %r10b
cmovel %r12d, %r9d
leaq (%r8,%r10,8), %r8
movq (%rdi,%r11,8), %rdi
cmpq %rdx, %r8
setne %r10b
cmpl %esi, %r9d
setne %r11b
orb %r10b, %r11b
jne 0x42d3
cmpb $0x0, 0x10(%rdi)
je 0x438c
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 0x4317
jmp 0x4358
cmpb $0x1, 0x10(%rax)
jne 0x438c
movb 0x11(%rax), %al
movb %al, 0xe(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x4371
movb %al, (%rsi)
incq 0x8(%rbx)
jmp 0x437e
movq %rbx, %rdi
leaq 0xe(%rsp), %rdx
callq 0x4530
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x7b9a
movq 0x8(%rbx), %rax
subq (%rbx), %rax
cmpq %r13, %rax
jb 0x4267
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x43ab
callq 0x21c0
testq %r14, %r14
je 0x43b8
movq %r14, %rdi
callq 0x21c0
leaq 0x88(%rsp), %rdi
callq 0x509a
leaq 0x58(%rsp), %rdi
callq 0x856c
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x440e
jmp 0x43ea
jmp 0x43ef
movq %rax, %rbx
jmp 0x441b
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x4401
callq 0x21c0
testq %r14, %r14
je 0x440e
movq %r14, %rdi
callq 0x21c0
leaq 0x88(%rsp), %rdi
callq 0x509a
leaq 0x58(%rsp), %rdi
callq 0x856c
movq %rbx, %rdi
callq 0x2320
nop