// File: /workspace/github_cpp_makefile_star2_O2/night-shift[P]Srl/include/Srl/In.hpp
// Function: unsigned long Srl::Lib::In::read_substitue<char, std::array<char const, 2ul>, char, std::array<char const, 2ul>, char, std::array<char const, 2ul>, char, std::array<char const, 2ul>, char, std::array<char const, 2ul>, char, std::array<char const, 2ul>, char, std::array<char const, 2ul>, char, std::array<char const, 2ul>, char, std::array<char const, 2ul>, std::function<unsigned long (Srl::Lib::In&, std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long)>, std::array<char const, 2ul>>(std::function<void ()> const&, unsigned char, std::vector<unsigned char, std::allocator<unsigned char>>&, char const&, std::array<char const, 2ul> const&, char const&, std::array<char const, 2ul> const&, char const&, std::array<char const, 2ul> const&, char const&, std::array<char const, 2ul> const&, char const&, std::array<char const, 2ul> const&, char const&, std::array<char const, 2ul> const&, char const&, std::array<char const, 2ul> const&, char const&, std::array<char const, 2ul> const&, char const&, std::array<char const, 2ul> const&, std::function<unsigned long (Srl::Lib::In&, std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long)> const&, std::array<char const, 2ul> const&)
size_t In::read_substitue(const Error& error, uint8_t delimiter,
                              std::vector<uint8_t>& buf, const Tokens&... tokens)
    {
        const size_t max = Aux::max_len<Tokens...>();

        auto steps = 0U;
        auto bufsz = buf.size();

        while(*this->peek(0, error) != delimiter) {

            if(steps + 1 > bufsz) {
                bufsz += steps + 10;
                buf.resize(bufsz);
            }

            auto left = this->try_peek(max) ? max : this->end - this->pos - 1;
            steps += this->substitute_token(buf, steps, left, tokens...);
        }

        return steps;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, 0x18(%rsp)
movq %r8, 0x10(%rsp)
movq %rcx, %r15
movl %edx, 0xc(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdi, %r13
movq 0x8(%rcx), %rbx
subq (%rcx), %rbx
xorl %r12d, %r12d
pushq $0x2
popq %r14
movq %r13, %rdi
xorl %esi, %esi
movq 0x20(%rsp), %rdx
callq 0x121e0
movl %r12d, %ebp
movl 0xc(%rsp), %ecx
cmpb %cl, (%rax)
je 0x1b201
leal 0x1(%r12), %eax
cmpq %rax, %rbx
jae 0x1b140
leal 0xa(%r12), %eax
addq %rax, %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x11f70
movq %r13, %rdi
movq %r14, %rsi
callq 0x112d0
movq 0x10(%r13), %rcx
notq %rcx
addq 0x8(%r13), %rcx
testb %al, %al
cmovneq %r14, %rcx
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq 0x10(%rsp), %r8
movq 0x18(%rsp), %r9
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
callq 0x11600
addq $0x90, %rsp
addl %eax, %r12d
jmp 0x1b105
movq %rbp, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop