// File: /workspace/github_cpp_makefile_star2_O3/ivan-tkatchev[P]yalz77/./lz77.h
// Function: lz77::compress_t::feed[abi:cxx11](unsigned char const*, unsigned char const*)
std::string feed(const unsigned char* i, const unsigned char* e) {

        const unsigned char* i0 = i;

        std::string ret;
        
        std::string unc;

        push_vlq_uint(e - i, ret);

        offsets.clear();

        size_t blocksize = offsets.blocksize;

        while (i != e) {

            unsigned char c = *i;

            // The last MIN_RUN-1 bytes are uncompressable. (At least MIN_RUN bytes
            // are needed to calculate a prefix hash.)

            if (i > e - MIN_RUN) {

                unc +=c;
                ++i;
                continue;
            }

            size_t maxrun = 0;
            size_t maxoffset = 0;
            size_t maxgain = 0;

            uint16_t packed;

            // The MIN_RUN prefix length was chosen empirically, based on a series
            // of unscientific tests.

            pack_bytes(i, packed, blocksize);

            offsets(packed, i0, i, e, maxrun, maxoffset, maxgain);

            if (maxrun < MIN_RUN) {
                unc += c;
                ++i;
                continue;
            }

            if (unc.size() > 0) {
                // Write a packet of uncompressed data.

                size_t msg = (unc.size() << 1) | 1;
                push_vlq_uint(msg, ret);
                ret += unc;
                unc.clear();
            }

            // A compressed string is a length and an offset.
            // First subtract the minimum length (smaller lengths don't exist).
            // Then check if the length fits in SHORTRUN_BITS bits; if it does, then
            // tack it on to the offset. Otherwise write length and offset separately.
            // The rightmost bit is a zero to differentiate from packets of
            // uncompressed data.

            i += maxrun;
            maxrun = maxrun - MIN_RUN + 1;

            if (maxrun < SHORTRUN_MAX) {

                size_t msg = ((maxoffset << SHORTRUN_BITS) | maxrun) << 1;
                push_vlq_uint(msg, ret);

            } else {

                size_t msg = (maxoffset << (SHORTRUN_BITS + 1));
                push_vlq_uint(msg, ret);
                push_vlq_uint(maxrun, ret);
            }
        }

        if (unc.size() > 0) {

            size_t msg = (unc.size() << 1) | 1;
            push_vlq_uint(msg, ret);
            ret += unc;
            unc.clear();
        }

        return ret;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %r14
movq %rsi, 0x38(%rsp)
movq %rdi, %rbx
leaq 0x10(%rdi), %r12
movq %r12, (%rdi)
xorl %eax, %eax
movq %rax, 0x8(%rdi)
movb %al, 0x10(%rdi)
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
movq %rcx, %r15
movq %rdx, 0x30(%rsp)
subq %rdx, %r15
cmpq $0x80, %r15
jae 0x2d27
movq %r15, %rax
jmp 0x2d4a
movl %r15d, %eax
orb $-0x80, %al
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
movq %r15, %rax
shrq $0x7, %rax
cmpq $0x3fff, %r15           # imm = 0x3FFF
movq %rax, %r15
ja 0x2d27
movq %r12, (%rsp)
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
movq 0x38(%rsp), %rdi
movq 0x18(%rdi), %rsi
incq %rsi
imulq 0x20(%rdi), %rsi
leaq 0x28(%rsp), %rdx
movq $0x0, (%rdx)
callq 0x31ec
cmpq %r14, 0x30(%rsp)
je 0x2fa0
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x48(%rsp)
leaq -0x5(%r14), %r13
xorl %ebp, %ebp
movq 0x30(%rsp), %r15
movb (%r15), %r12b
cmpq %r13, %r15
jbe 0x2db7
movsbl %r12b, %esi
leaq 0x8(%rsp), %rdi
callq 0x2100
jmp 0x2e34
movq %rbp, 0x28(%rsp)
movq %rbp, 0x40(%rsp)
movq %rbp, 0x50(%rsp)
movl $0x811c9dc5, %eax       # imm = 0x811C9DC5
movq $-0x5, %rcx
movzbl 0x5(%r15,%rcx), %edx
xorl %eax, %edx
imull $0x1000193, %edx, %eax  # imm = 0x1000193
incq %rcx
jne 0x2dd2
movl %eax, %eax
xorl %edx, %edx
divq 0x48(%rsp)
movzwl %dx, %esi
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rdx
movq %r15, %rcx
movq %r14, %r8
leaq 0x28(%rsp), %r9
leaq 0x50(%rsp), %rax
pushq %rax
leaq 0x48(%rsp), %rax
pushq %rax
callq 0x30a2
addq $0x10, %rsp
movq 0x28(%rsp), %rax
cmpq $0x4, %rax
ja 0x2e45
movsbl %r12b, %esi
leaq 0x8(%rsp), %rdi
callq 0x2100
incq %r15
cmpq %r14, %r15
jne 0x2d9f
jmp 0x2fa0
movq 0x10(%rsp), %rcx
testq %rcx, %rcx
je 0x2ebe
leaq 0x1(,%rcx,2), %r12
addq %rcx, %rcx
cmpq $0x80, %rcx
jae 0x2e68
movq %r12, %rax
jmp 0x2e8b
movl %r12d, %eax
orb $-0x80, %al
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
movq %r12, %rax
shrq $0x7, %rax
cmpq $0x3fff, %r12           # imm = 0x3FFF
movq %rax, %r12
ja 0x2e68
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x2050
movq $0x0, 0x10(%rsp)
movq 0x8(%rsp), %rax
movb $0x0, (%rax)
movq 0x28(%rsp), %rax
addq %rax, %r15
addq $-0x4, %rax
movq %rax, 0x28(%rsp)
movq 0x40(%rsp), %r12
shlq $0x4, %r12
cmpq $0x7, %rax
ja 0x2f1e
leaq (%r12,%rax,2), %r12
cmpq $0x80, %r12
jae 0x2eeb
movq %r12, %rax
jmp 0x2f0e
movl %r12d, %eax
orb $-0x80, %al
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
movq %r12, %rax
shrq $0x7, %rax
cmpq $0x3fff, %r12           # imm = 0x3FFF
movq %rax, %r12
ja 0x2eeb
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
jmp 0x2e37
cmpq $0x80, %r12
jae 0x2f2c
movq %r12, %rax
jmp 0x2f4f
movl %r12d, %eax
orb $-0x80, %al
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
movq %r12, %rax
shrq $0x7, %rax
cmpq $0x3fff, %r12           # imm = 0x3FFF
movq %rax, %r12
ja 0x2f2c
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
movq 0x28(%rsp), %r12
cmpq $0x80, %r12
jae 0x2f6d
movq %r12, %rax
jmp 0x2f90
movl %r12d, %eax
orb $-0x80, %al
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
movq %r12, %rax
shrq $0x7, %rax
cmpq $0x3fff, %r12           # imm = 0x3FFF
movq %rax, %r12
ja 0x2f6d
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
jmp 0x2e37
movq 0x10(%rsp), %rax
testq %rax, %rax
leaq 0x18(%rsp), %r13
je 0x3018
leaq 0x1(,%rax,2), %r14
addq %rax, %rax
cmpq $0x80, %rax
jae 0x2fc7
movq %r14, %rax
jmp 0x2fea
movl %r14d, %eax
orb $-0x80, %al
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
movq %r14, %rax
shrq $0x7, %rax
cmpq $0x3fff, %r14           # imm = 0x3FFF
movq %rax, %r14
ja 0x2fc7
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x2050
movq $0x0, 0x10(%rsp)
movq 0x8(%rsp), %rax
movb $0x0, (%rax)
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x302f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2130
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x304d
jmp 0x3063
jmp 0x3063
jmp 0x3063
jmp 0x3063
jmp 0x3063
movq %rax, %r14
movq (%rsp), %r12
jmp 0x306f
jmp 0x3063
movq %rax, %r14
jmp 0x306f
jmp 0x3063
jmp 0x3063
jmp 0x3063
movq %rax, %r14
movq (%rsp), %r12
leaq 0x18(%rsp), %r13
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x3086
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2130
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x309a
movq (%r12), %rsi
incq %rsi
callq 0x2130
movq %r14, %rdi
callq 0x21b0