// File: /workspace/github_cpp_makefile_star2_O3/nurseiit[P]cpp-server/./include/asio/impl/read_until.hpp
// Function: unsigned long asio::read_until<asio::basic_stream_socket<asio::ip::tcp, asio::executor>, asio::basic_streambuf_ref<std::allocator<char>>>(asio::basic_stream_socket<asio::ip::tcp, asio::executor>&, asio::basic_streambuf_ref<std::allocator<char>>&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::error_code&, std::enable_if<is_dynamic_buffer_v1<std::decay<asio::basic_streambuf_ref<std::allocator<char>>>::type>::value && !is_dynamic_buffer_v2<std::decay<asio::basic_streambuf_ref<std::allocator<char>>>::type>::value, void>::type*)
std::size_t read_until(SyncReadStream& s,
    ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
    ASIO_STRING_VIEW_PARAM delim, asio::error_code& ec,
    typename enable_if<
      is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
        && !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
    >::type*)
{
  typename decay<DynamicBuffer_v1>::type b(
      ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers));

  std::size_t search_position = 0;
  for (;;)
  {
    // Determine the range of the data to be searched.
    typedef typename DynamicBuffer_v1::const_buffers_type buffers_type;
    typedef buffers_iterator<buffers_type> iterator;
    buffers_type data_buffers = b.data();
    iterator begin = iterator::begin(data_buffers);
    iterator start_pos = begin + search_position;
    iterator end = iterator::end(data_buffers);

    // Look for a match.
    std::pair<iterator, bool> result = detail::partial_search(
        start_pos, end, delim.begin(), delim.end());
    if (result.first != end)
    {
      if (result.second)
      {
        // Full match. We're done.
        ec = asio::error_code();
        return result.first - begin + delim.length();
      }
      else
      {
        // Partial match. Next search needs to start from beginning of match.
        search_position = result.first - begin;
      }
    }
    else
    {
      // No match. Next search can start with the new data.
      search_position = end - begin;
    }

    // Check if buffer is full.
    if (b.size() == b.max_size())
    {
      ec = error::not_found;
      return 0;
    }

    // Need more data.
    std::size_t bytes_to_read = std::min<std::size_t>(
          std::max<std::size_t>(512, b.capacity() - b.size()),
          std::min<std::size_t>(65536, b.max_size() - b.size()));
    b.commit(s.read_some(b.prepare(bytes_to_read), ec));
    if (ec)
      return 0;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rcx, 0x8(%rsp)
movq %rdx, 0x18(%rsp)
movq %rdi, 0x70(%rsp)
movq (%rsi), %r12
movq 0x28(%r12), %rax
leaq 0xb0(%rsp), %r13
xorl %ebp, %ebp
movq 0x10(%r12), %rcx
movq %rcx, 0x20(%rsp)
subq %rcx, %rax
leaq 0x20(%rsp), %rdi
movq %rdi, %rdx
leaq 0x30(%rsp), %rsi
cmoveq %rsi, %rdx
movq %rax, 0x28(%rsp)
movq %rcx, 0x78(%rsp)
movq %rax, 0x80(%rsp)
xorl %eax, %eax
movq %rax, 0x88(%rsp)
movq %rdi, 0x90(%rsp)
movq %rdx, 0x98(%rsp)
movq %rsi, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
leaq 0x78(%rsp), %rdi
movq %rbp, %rsi
callq 0xd0a2
movq 0x28(%rsp), %rbp
movq 0xa8(%rsp), %rax
movq %rax, 0x60(%rsp)
movups 0x78(%rsp), %xmm0
movups 0x88(%rsp), %xmm1
movups 0x98(%rsp), %xmm2
movaps %xmm2, 0x50(%rsp)
movaps %xmm1, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
cmpq %rbp, %rax
je 0xcf92
movq 0x18(%rsp), %rax
movq (%rax), %r14
movq 0x8(%rax), %r15
testq %r15, %r15
setne %al
movl %eax, 0x14(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0xe0(%rsp)
movaps 0x30(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
movaps 0x50(%rsp), %xmm2
movaps %xmm2, 0xd0(%rsp)
movaps %xmm1, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
testq %r15, %r15
je 0xcf7a
xorl %ebx, %ebx
cmpq %rbp, 0xe0(%rsp)
je 0xcf5a
movq 0xb0(%rsp), %rax
movq 0xc0(%rsp), %rcx
movb (%rax,%rcx), %al
cmpb (%r14,%rbx), %al
jne 0xcf63
movq %r13, %rdi
callq 0xd236
incq %rbx
cmpq %rbx, %r15
jne 0xcf25
jmp 0xcf7a
testq %rbx, %rbx
jne 0xd052
leaq 0x30(%rsp), %rdi
callq 0xd236
cmpq %rbp, 0x60(%rsp)
jne 0xceea
jmp 0xcf92
xorl %ecx, %ecx
movq 0x60(%rsp), %r14
cmpq %rbp, %r14
sete %al
orb %cl, %al
je 0xd082
movq %r14, %rbp
movq 0x28(%r12), %rcx
movq 0x40(%r12), %rax
subq 0x10(%r12), %rcx
subq %rcx, %rax
je 0xd05b
movq 0x58(%r12), %r14
addq 0x48(%r12), %rcx
subq %rcx, %r14
cmpq $0x201, %r14            # imm = 0x201
movl $0x200, %ecx            # imm = 0x200
cmovbq %rcx, %r14
cmpq %r14, %rax
cmovbq %rax, %r14
movl $0x10000, %eax          # imm = 0x10000
cmpq %rax, %r14
cmovaeq %rax, %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0x8a40
movq 0x28(%r12), %rax
movq %rax, 0x30(%rsp)
movq %r14, 0x38(%rsp)
movq %r14, 0x40(%rsp)
movq 0x70(%rsp), %rax
movl 0x8(%rax), %edi
movzbl 0xc(%rax), %esi
movq 0x8(%rsp), %rbx
movq %rbx, (%rsp)
movl $0x1, %ecx
leaq 0x30(%rsp), %rdx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xd2a6
movq 0x28(%r12), %rcx
movq 0x30(%r12), %rdx
subq %rcx, %rdx
cmpq %rax, %rdx
cmovaeq %rax, %rdx
movslq %edx, %rax
addq %rcx, %rax
movq %rax, 0x28(%r12)
movq %rax, 0x18(%r12)
cmpl $0x0, (%rbx)
je 0xce2e
jmp 0xd06a
movl 0x14(%rsp), %ecx
jmp 0xcf7c
movq 0x8(%rsp), %rdi
movl $0x3, %esi
callq 0xc112
xorl %r14d, %r14d
movq %r14, %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x51d0
movq 0x8(%rsp), %rcx
movl $0x0, (%rcx)
movq %rax, 0x8(%rcx)
movq 0x18(%rsp), %rax
addq 0x8(%rax), %r14
jmp 0xd06d
nop