// File: 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
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rsi
movl -0x14(%rbp), %edx
leaq -0x40(%rbp), %rdi
callq 0x5660
movq -0x10(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x56b0
movl -0x14(%rbp), %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %edx
movl %edx, %ecx
leal (%rax,%rcx,2), %eax
movl $0xcccccccd, %ecx       # imm = 0xCCCCCCCD
imulq %rcx, %rax
shrq $0x23, %rax
movq %rax, -0x150(%rbp)
leaq -0x83(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0x56d0
movq -0x150(%rbp), %rsi
movq -0x148(%rbp), %r8
leaq -0x80(%rbp), %rdi
leaq -0x81(%rbp), %rdx
leaq -0x82(%rbp), %rcx
callq 0x56f0
jmp 0x2d8e
leaq -0x83(%rbp), %rdi
callq 0x5730
movl $0x0, -0x98(%rbp)
cmpl $0x100, -0x98(%rbp)     # imm = 0x100
jae 0x2eb2
movsbl -0x98(%rbp), %eax
movl %eax, -0x15c(%rbp)
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0x22c0
movl -0x15c(%rbp), %edx
movq -0x158(%rbp), %rcx
leaq -0xb8(%rbp), %rdi
movl $0x1, %esi
callq 0x2110
jmp 0x2df4
leaq -0x80(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x5750
movq %rax, -0x168(%rbp)
jmp 0x2e0d
movq -0x168(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x21f0
leaq -0xb8(%rbp), %rdi
callq 0x2100
leaq -0xb9(%rbp), %rdi
callq 0x21c0
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x2da4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x83(%rbp), %rdi
callq 0x5730
jmp 0x3165
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x2ea1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x2100
leaq -0xb9(%rbp), %rdi
callq 0x21c0
jmp 0x315c
leaq -0xe0(%rbp), %rdi
callq 0x2240
movl $0x101, -0xe8(%rbp)     # imm = 0x101
leaq -0x40(%rbp), %rdi
leaq -0xe4(%rbp), %rsi
callq 0x5780
movb %al, -0x169(%rbp)
jmp 0x2ee0
movb -0x169(%rbp), %al
testb $0x1, %al
jne 0x2eef
jmp 0x3132
leaq -0x80(%rbp), %rdi
leaq -0xe4(%rbp), %rsi
callq 0x58b0
movq %rax, -0x178(%rbp)
jmp 0x2f08
movq -0x178(%rbp), %rax
movq %rax, -0xf0(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x58e0
movq %rax, -0xf8(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x5880
testb $0x1, %al
jne 0x2f42
jmp 0x2fee
xorl %eax, %eax
movl %eax, %esi
leaq -0xe0(%rbp), %rdi
callq 0x22e0
movq %rax, -0x180(%rbp)
jmp 0x2f5b
movq -0x180(%rbp), %rax
movsbl (%rax), %edx
leaq -0x118(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x32f0
jmp 0x2f7a
leaq -0x80(%rbp), %rdi
leaq -0xe4(%rbp), %rsi
callq 0x5750
movq %rax, -0x188(%rbp)
jmp 0x2f93
movq -0x188(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x21f0
leaq -0x118(%rbp), %rdi
callq 0x2100
jmp 0x2fee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x3150
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x2100
jmp 0x3150
leaq -0x80(%rbp), %rdi
leaq -0xe4(%rbp), %rsi
callq 0x5750
movq %rax, -0x190(%rbp)
jmp 0x3007
movq -0x190(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x5910
jmp 0x3019
leaq -0xe0(%rbp), %rdi
callq 0x2120
cmpq $0x0, %rax
je 0x30ff
movl -0xe8(%rbp), %eax
cmpl -0x14(%rbp), %eax
ja 0x30ff
leaq -0x80(%rbp), %rdi
leaq -0xe4(%rbp), %rsi
callq 0x5750
movq %rax, -0x198(%rbp)
jmp 0x3057
movq -0x198(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x22e0
movq %rax, -0x1a0(%rbp)
jmp 0x3070
movq -0x1a0(%rbp), %rax
movsbl (%rax), %edx
leaq -0x138(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x32f0
jmp 0x308f
movl -0xe8(%rbp), %eax
movl %eax, %ecx
incl %ecx
movl %ecx, -0xe8(%rbp)
movl %eax, -0x13c(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x13c(%rbp), %rsi
callq 0x5940
movq %rax, -0x1a8(%rbp)
jmp 0x30be
movq -0x1a8(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x21f0
leaq -0x138(%rbp), %rdi
callq 0x2100
jmp 0x30ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x2100
jmp 0x3150
leaq -0x80(%rbp), %rdi
leaq -0xe4(%rbp), %rsi
callq 0x5750
movq %rax, -0x1b0(%rbp)
jmp 0x3118
movq -0x1b0(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x2040
jmp 0x312d
jmp 0x2ec8
leaq -0xe0(%rbp), %rdi
callq 0x2100
leaq -0x80(%rbp), %rdi
callq 0x5970
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
leaq -0xe0(%rbp), %rdi
callq 0x2100
leaq -0x80(%rbp), %rdi
callq 0x5970
movq -0x90(%rbp), %rdi
callq 0x22b0
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)