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

    std::unordered_map<std::string, unsigned int> codes( (max_code * 11)/10 );
    for ( unsigned int i = 0 ; i < 256 ; i++ )
        codes[std::string(1,i)] = i;
    unsigned int next_code = 257;
    std::string current_string;
    char c;
    while ( in >> c ) {
        current_string = current_string + c;
        if ( codes.find(current_string) == codes.end() ) {
            if ( next_code <= max_code )
                codes[ current_string ] = next_code++;
            current_string.erase(current_string.size()-1);
            out << codes[current_string];
            current_string = c;
        }
    }
    if ( current_string.size() )
        out << codes[current_string];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, -0x60(%rbp)
movl $0x9, -0x88(%rbp)
movq %rsi, -0x80(%rbp)
movaps 0x1a03(%rip), %xmm0     # 0x4010
movups %xmm0, -0x78(%rbp)
movl %edx, -0x68(%rbp)
movl %edx, -0x34(%rbp)
imull $0xb, %edx, %eax
xorl %r12d, %r12d
pushq $0xa
popq %rcx
xorl %edx, %edx
divl %ecx
leaq -0xc0(%rbp), %rdi
leaq -0x58(%rbp), %rdx
leaq -0xe0(%rbp), %rcx
leaq -0x29(%rbp), %r8
movq %rax, %rsi
callq 0x2aec
leaq -0x48(%rbp), %r13
leaq -0x58(%rbp), %rbx
pushq $0x1
popq %r14
leaq -0xc0(%rbp), %r15
cmpl $0x100, %r12d           # imm = 0x100
je 0x268c
movq %r13, -0x58(%rbp)
movsbl %r12b, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2190
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2c7e
movl %r12d, (%rax)
movq %rbx, %rdi
callq 0x20c0
incl %r12d
jmp 0x2655
leaq -0x58(%rbp), %r14
movq %r13, (%r14)
andq $0x0, 0x8(%r14)
movb $0x0, 0x10(%r14)
movl $0x101, -0x30(%rbp)     # imm = 0x101
leaq -0x60(%rbp), %r15
leaq -0x29(%rbp), %r12
leaq -0xe0(%rbp), %r13
leaq -0xc0(%rbp), %rbx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2a26
testb %al, %al
je 0x2759
movsbl -0x29(%rbp), %edx
movq %r13, %rdi
movq %r14, %rsi
callq 0x2a43
movq %r14, %rdi
movq %r13, %rsi
callq 0x21b0
movq %r13, %rdi
callq 0x20c0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x30da
testq %rax, %rax
jne 0x26ba
movl -0x30(%rbp), %eax
cmpl -0x34(%rbp), %eax
ja 0x271c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3108
movl -0x30(%rbp), %ecx
movl %ecx, (%rax)
incl %ecx
movl %ecx, -0x30(%rbp)
movq -0x50(%rbp), %rsi
decq %rsi
movq %r14, %rdi
pushq $-0x1
popq %rdx
callq 0x2050
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3108
leaq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x2a7e
movsbl -0x29(%rbp), %esi
movq %r14, %rdi
callq 0x2240
jmp 0x26ba
cmpq $0x0, -0x50(%rbp)
je 0x277f
leaq -0xc0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x3108
leaq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x2a7e
leaq -0x58(%rbp), %rdi
callq 0x20c0
leaq -0xc0(%rbp), %rdi
callq 0x3292
leaq -0x88(%rbp), %rdi
callq 0x2abe
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x27de
jmp 0x27c6
jmp 0x27c6
jmp 0x27c6
jmp 0x27c6
movq %rax, %rbx
jmp 0x27d2
jmp 0x27c6
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x20c0
leaq -0xc0(%rbp), %rdi
callq 0x3292
leaq -0x88(%rbp), %rdi
callq 0x2abe
movq %rbx, %rdi
callq 0x2250