// File: demon386[P]git-store/./libs/filesystem/src/path.cpp
// Function: (anonymous namespace)::first_element(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long&, unsigned long&, unsigned long)
void first_element(
      const string_type & src,
      size_type & element_pos,
      size_type & element_size,
      size_type size
)
  {
    if (size == string_type::npos) size = src.size();
    element_pos = 0;
    element_size = 0;
    if (src.empty()) return;

    string_type::size_type cur(0);
    
    // deal with // [network]
    if (size >= 2 && is_separator(src[0])
      && is_separator(src[1])
      && (size == 2
        || !is_separator(src[2])))
    { 
      cur += 2;
      element_size += 2;
    }

    // leading (not non-network) separator
    else if (is_separator(src[0]))
    {
      ++element_size;
      // bypass extra leading separators
      while (cur+1 < size
        && is_separator(src[cur+1]))
      {
        ++cur;
        ++element_pos;
      }
      return;
    }

    // at this point, we have either a plain name, a network name,
    // or (on Windows only) a device name

    // find the end
    while (cur < size
#     ifdef BOOST_WINDOWS_API
      && src[cur] != colon
#     endif
      && !is_separator(src[cur]))
    {
      ++cur;
      ++element_size;
    }

#   ifdef BOOST_WINDOWS_API
    if (cur == size) return;
    // include device delimiter
    if (src[cur] == colon)
      { ++element_size; }
#   endif

    return;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
cmpq $-0x1, -0x20(%rbp)
jne 0x517ac
movq -0x8(%rbp), %rdi
callq 0xd430
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rdi
callq 0xdab0
testb $0x1, %al
jne 0x517d1
jmp 0x517d6
jmp 0x5192f
movq $0x0, -0x28(%rbp)
cmpq $0x2, -0x20(%rbp)
jb 0x5185c
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xd6d0
movsbl (%rax), %edi
callq 0x4fab0
testb $0x1, %al
jne 0x51800
jmp 0x5185c
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0xd6d0
movsbl (%rax), %edi
callq 0x4fab0
testb $0x1, %al
jne 0x5181c
jmp 0x5185c
cmpq $0x2, -0x20(%rbp)
je 0x5183d
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0xd6d0
movsbl (%rax), %edi
callq 0x4fab0
testb $0x1, %al
jne 0x5185c
movq -0x28(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
addq $0x2, %rcx
movq %rcx, (%rax)
jmp 0x518dd
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xd6d0
movsbl (%rax), %edi
callq 0x4fab0
testb $0x1, %al
jne 0x51877
jmp 0x518db
movq -0x18(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
addq $0x1, %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x29(%rbp)
jae 0x518b4
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x1, %rsi
callq 0xd6d0
movsbl (%rax), %edi
callq 0x4fab0
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
testb $0x1, %al
jne 0x518bd
jmp 0x518d9
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0x51885
jmp 0x5192f
jmp 0x518dd
jmp 0x518df
movq -0x28(%rbp), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x2a(%rbp)
jae 0x51908
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xd6d0
movsbl (%rax), %edi
callq 0x4fab0
xorb $-0x1, %al
movb %al, -0x2a(%rbp)
movb -0x2a(%rbp), %al
testb $0x1, %al
jne 0x51911
jmp 0x5192d
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0x518df
jmp 0x5192f
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)