// File: /workspace/github_cpp_makefile_star2_O1/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 0x20(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
movq %rcx, %r15
movq %rdx, 0x30(%rsp)
subq %rdx, %r15
cmpq $0x7f, %r15
jbe 0x2d6c
movl %r15d, %eax
orb $-0x80, %al
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
movq %r15, %rax
shrq $0x7, %rax
jmp 0x2d7b
movsbl %r15b, %esi
movq %rbx, %rdi
callq 0x2100
movq %r15, %rax
cmpq $0x7f, %r15
movq %rax, %r15
ja 0x2d4d
movq %r12, (%rsp)
movq 0x38(%rsp), %rdi
movq 0x18(%rdi), %rsi
incq %rsi
imulq 0x20(%rdi), %rsi
leaq 0x8(%rsp), %rdx
movq $0x0, (%rdx)
callq 0x31f6
cmpq %r14, 0x30(%rsp)
je 0x2fb5
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 0x2de6
movsbl %r12b, %esi
leaq 0x10(%rsp), %rdi
callq 0x2100
jmp 0x2e60
movq %rbp, 0x8(%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 0x2e01
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 0x8(%rsp), %r9
leaq 0x50(%rsp), %rax
pushq %rax
leaq 0x48(%rsp), %rax
pushq %rax
callq 0x30ac
addq $0x10, %rsp
cmpq $0x4, 0x8(%rsp)
ja 0x2e71
movsbl %r12b, %esi
leaq 0x10(%rsp), %rdi
callq 0x2100
incq %r15
cmpq %r14, %r15
jne 0x2dce
jmp 0x2fb5
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x2edd
leaq 0x1(,%rax,2), %r12
cmpq $0x7f, %r12
jbe 0x2ea2
movl %r12d, %eax
orb $-0x80, %al
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
movq %r12, %rax
shrq $0x7, %rax
jmp 0x2eb1
movsbl %r12b, %esi
movq %rbx, %rdi
callq 0x2100
movq %r12, %rax
cmpq $0x7f, %r12
movq %rax, %r12
ja 0x2e83
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %rbx, %rdi
callq 0x2050
movq $0x0, 0x18(%rsp)
movq 0x10(%rsp), %rax
movb $0x0, (%rax)
movq 0x8(%rsp), %rax
addq %rax, %r15
addq $-0x4, %rax
movq %rax, 0x8(%rsp)
movq 0x40(%rsp), %r12
shlq $0x4, %r12
cmpq $0x8, %rax
jae 0x2f3d
leaq (%r12,%rax,2), %r12
cmpq $0x7f, %r12
jbe 0x2f20
movl %r12d, %eax
orb $-0x80, %al
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
movq %r12, %rax
shrq $0x7, %rax
jmp 0x2f2f
movsbl %r12b, %esi
movq %rbx, %rdi
callq 0x2100
movq %r12, %rax
cmpq $0x7f, %r12
movq %rax, %r12
ja 0x2f01
jmp 0x2e63
cmpq $0x7f, %r12
jbe 0x2f5c
movl %r12d, %eax
orb $-0x80, %al
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
movq %r12, %rax
shrq $0x7, %rax
jmp 0x2f6b
movsbl %r12b, %esi
movq %rbx, %rdi
callq 0x2100
movq %r12, %rax
cmpq $0x7f, %r12
movq %rax, %r12
ja 0x2f3d
movq 0x8(%rsp), %r12
cmpq $0x7f, %r12
jbe 0x2f98
movl %r12d, %eax
orb $-0x80, %al
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
movq %r12, %rax
shrq $0x7, %rax
jmp 0x2fa7
movsbl %r12b, %esi
movq %rbx, %rdi
callq 0x2100
movq %r12, %rax
cmpq $0x7f, %r12
movq %rax, %r12
ja 0x2f79
jmp 0x2e63
movq 0x18(%rsp), %rax
testq %rax, %rax
leaq 0x20(%rsp), %r13
je 0x3026
leaq 0x1(,%rax,2), %r14
cmpq $0x7f, %r14
jbe 0x2feb
movl %r14d, %eax
orb $-0x80, %al
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2100
movq %r14, %rax
shrq $0x7, %rax
jmp 0x2ffa
movsbl %r14b, %esi
movq %rbx, %rdi
callq 0x2100
movq %r14, %rax
cmpq $0x7f, %r14
movq %rax, %r14
ja 0x2fcc
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %rbx, %rdi
callq 0x2050
movq $0x0, 0x18(%rsp)
movq 0x10(%rsp), %rax
movb $0x0, (%rax)
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x303d
movq 0x20(%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 0x3059
jmp 0x306d
jmp 0x306d
jmp 0x306d
jmp 0x306d
movq %rax, %r14
movq (%rsp), %r12
jmp 0x3079
movq %rax, %r14
jmp 0x3079
jmp 0x306d
jmp 0x306d
jmp 0x306d
movq %rax, %r14
movq (%rsp), %r12
leaq 0x20(%rsp), %r13
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x3090
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2130
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x30a4
movq (%r12), %rsi
incq %rsi
callq 0x2130
movq %r14, %rdi
callq 0x21b0