// File: /workspace/github_cpp_makefile_star2_O1/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 0x1724(%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 0x357a
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 0x3688
movq %rax, %rdi
movq %r12, %rsi
callq 0x2190
movq -0x70(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2977
callq 0x2100
movl -0x50(%rbp), %eax
incl %eax
movl %eax, -0x50(%rbp)
cmpl $0x100, %eax            # imm = 0x100
jb 0x293f
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 0x34d2
testb %al, %al
je 0x2b4b
movl -0x2c(%rbp), %ecx
movq -0xe8(%rbp), %rdi
movq -0xe0(%rbp), %r8
movq %rcx, %rax
xorl %edx, %edx
divq %r8
movq %rdx, %rsi
movq (%rdi,%rdx,8), %rdx
movl $0x0, %eax
testq %rdx, %rdx
je 0x2a26
movq (%rdx), %r9
movq %rdx, %rax
cmpl 0x8(%r9), %ecx
je 0x2a26
movq %r9, %r10
movq (%r9), %r9
testq %r9, %r9
je 0x2a24
movl 0x8(%r9), %edi
movq %rdi, %rax
xorl %edx, %edx
divq %r8
movl $0x0, %eax
cmpq %rsi, %rdx
jne 0x2a26
movq %r10, %rax
cmpl %edi, %ecx
jne 0x29fa
jmp 0x2a26
xorl %eax, %eax
testq %rax, %rax
je 0x2a31
cmpq $0x0, (%rax)
jne 0x2a8e
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 0x3688
movq %rax, %rdi
movq %r12, %rsi
callq 0x2190
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2a8e
callq 0x2100
movq %r15, %rdi
movq %r13, %rsi
callq 0x3688
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 0x2b2f
movq %r15, %rdi
movq %r13, %rsi
callq 0x3688
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 0x39b8
movq %rax, %rdi
movq %r12, %rsi
callq 0x2190
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2b2d
callq 0x2100
incl %ebx
movq %r15, %rdi
movq %r13, %rsi
callq 0x3688
leaq -0x70(%rbp), %rdi
movq %rax, %rsi
callq 0x2090
jmp 0x29ad
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x2b5d
callq 0x2100
leaq -0xe8(%rbp), %rdi
callq 0x3a84
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2b83
jmp 0x2b83
jmp 0x2b83
jmp 0x2bb2
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2bb5
callq 0x2100
jmp 0x2bb5
jmp 0x2bb2
movq %rax, %rbx
jmp 0x2bc7
movq %rbx, %rcx
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %rcx, %rdi
jne 0x2bc2
jmp 0x2bc7
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x2bc7
callq 0x2100
leaq -0xe8(%rbp), %rdi
callq 0x3a84
movq %rbx, %rdi
callq 0x2210