// File: /workspace/github_cpp_makefile_star2_O3/marknelson[P]LZW/./lzw.h
// Function: void lzw::decompress<std::istream, std::ostream>(std::istream&, std::ostream&, unsigned int)
void decompress( INPUT &input, OUTPUT &output, const unsigned int max_code = 32767  )
{
    input_code_stream<INPUT> in( input, max_code );
    output_symbol_stream<OUTPUT> out( output );

    std::unordered_map<unsigned int,std::string> strings( (max_code * 11) / 10 );
    for ( int unsigned i = 0 ; i < 256 ; i++ )
        strings[i] = std::string(1,i);
    std::string previous_string;
    unsigned int code;
    unsigned int next_code = 257;
    while ( in >> code ) {
        if ( strings.find( code ) == strings.end() ) 
            strings[ code ] = previous_string + previous_string[0];
        out << strings[code];
        if ( previous_string.size() && next_code <= max_code )
            strings[next_code++] = previous_string + strings[code][0];
        previous_string = strings[code];
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, -0x88(%rbp)
movl $0x9, -0xb0(%rbp)
movq %rdi, -0xa8(%rbp)
movaps 0x16fe(%rip), %xmm0     # 0x4010
movups %xmm0, -0xa0(%rbp)
movl %edx, -0x90(%rbp)
leal (%rdx,%rdx,4), %eax
movq %rdx, -0x80(%rbp)
leal (%rdx,%rax,2), %eax
movl $0xcccccccd, %esi       # imm = 0xCCCCCCCD
imulq %rax, %rsi
shrq $0x23, %rsi
leaq -0xe8(%rbp), %r15
leaq -0x70(%rbp), %r12
leaq -0x50(%rbp), %r13
leaq -0x2c(%rbp), %r8
movq %r15, %rdi
movq %r12, %rdx
movq %r13, %rcx
callq 0x3584
leaq -0x60(%rbp), %rbx
movl $0x0, (%r13)
xorl %eax, %eax
movq %rbx, -0x70(%rbp)
movsbl %al, %edx
movl $0x1, %esi
movq %r12, %rdi
callq 0x2170
movq %r15, %rdi
movq %r13, %rsi
callq 0x3692
movq %rax, %rdi
movq %r12, %rsi
callq 0x2190
movq -0x70(%rbp), %rdi
cmpq %rbx, %rdi
je 0x299d
callq 0x2100
movl -0x50(%rbp), %eax
incl %eax
movl %eax, -0x50(%rbp)
cmpl $0x100, %eax            # imm = 0x100
jb 0x2965
leaq -0x70(%rbp), %rax
movq %rbx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl $0x101, %ebx            # imm = 0x101
leaq -0x2c(%rbp), %r13
leaq -0x50(%rbp), %r12
leaq -0xe8(%rbp), %r15
leaq -0xb0(%rbp), %rdi
movq %r13, %rsi
callq 0x34d6
testb %al, %al
je 0x2b51
movl -0x2c(%rbp), %ecx
movq -0xe8(%rbp), %rdi
movq -0xe0(%rbp), %r8
movq %rcx, %rax
xorl %edx, %edx
divq %r8
movq (%rdi,%rdx,8), %rax
testq %rax, %rax
je 0x2a37
movq %rdx, %rsi
movq (%rax), %r9
cmpl 0x8(%r9), %ecx
je 0x2a94
movq (%r9), %r9
testq %r9, %r9
je 0x2a37
movl 0x8(%r9), %edi
movq %rdi, %rax
xorl %edx, %edx
divq %r8
cmpq %rsi, %rdx
jne 0x2a37
cmpl %edi, %ecx
jne 0x2a18
jmp 0x2a94
movq -0x70(%rbp), %rsi
movb (%rsi), %r14b
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x3256
movq -0x48(%rbp), %rsi
movsbl %r14b, %r8d
movl $0x1, %ecx
movq %r12, %rdi
xorl %edx, %edx
callq 0x2240
movq %r15, %rdi
movq %r13, %rsi
callq 0x3692
movq %rax, %rdi
movq %r12, %rsi
callq 0x2190
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2a94
callq 0x2100
movq %r15, %rdi
movq %r13, %rsi
callq 0x3692
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq -0x88(%rbp), %rdi
callq 0x2160
cmpq $0x0, -0x68(%rbp)
sete %al
cmpl -0x80(%rbp), %ebx
seta %cl
orb %al, %cl
jne 0x2b35
movq %r15, %rdi
movq %r13, %rsi
callq 0x3692
movq (%rax), %rax
movb (%rax), %r14b
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x3256
movq -0x48(%rbp), %rsi
movsbl %r14b, %r8d
movl $0x1, %ecx
movq %r12, %rdi
xorl %edx, %edx
callq 0x2240
movl %ebx, -0x74(%rbp)
movq %r15, %rdi
leaq -0x74(%rbp), %rsi
callq 0x398a
movq %rax, %rdi
movq %r12, %rsi
callq 0x2190
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2b33
callq 0x2100
incl %ebx
movq %r15, %rdi
movq %r13, %rsi
callq 0x3692
leaq -0x70(%rbp), %rdi
movq %rax, %rsi
callq 0x2090
jmp 0x29d3
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x2b63
callq 0x2100
leaq -0xe8(%rbp), %rdi
callq 0x3a6a
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2b89
jmp 0x2b89
jmp 0x2bb8
jmp 0x2b89
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2bbb
callq 0x2100
jmp 0x2bbb
jmp 0x2bb8
movq %rax, %rbx
jmp 0x2bcd
movq %rbx, %rcx
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %rcx, %rdi
jne 0x2bc8
jmp 0x2bcd
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x2bcd
callq 0x2100
leaq -0xe8(%rbp), %rdi
callq 0x3a6a
movq %rbx, %rdi
callq 0x2210