// File: /workspace/github_cpp_makefile_star2_O3/mh0fm4[P]SCDC/src/components/common/common.cc
// Function: split_uri(char const*, long long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)
void split_uri(const char *uri, scdcint_t uri_size, string *scheme, string *authority, string *path)
{
  string s = (uri_size < 0)?string(uri):string(uri, uri_size);

  SCDC_TRACE("split_uri: '" << s << "'");

  if (scheme) *scheme = "";
  if (authority) *authority = "";
  if (path) *path = "";

  size_t offset = 0, p;

  /* if there is a (first) ':', then ... */
  p = s.find(":", offset);
  if (p != string::npos)
  {
    /* ... all up to the ':' is the scheme */
    if (scheme) *scheme = s.substr(offset, p - offset);
    offset = p + 1;
  }

  /* if there is a '//' following, then ... */
  if (s.substr(offset, 2) == "//")
  {
    offset += 2;

    /* ... if there is a '/', then ... */
    p = s.find("/", offset);
    if (p != string::npos)
    {
      /* ... all up to the '/' is the authority */
      if (authority) *authority = s.substr(offset, p - offset);
      offset = p + 1;

    } else
    {
      /* ... all remaining is the authority */
      if (authority) *authority = s.substr(offset);
      offset = string::npos;
    }

  } else
  {
    /* ... if there is an immediate '/', then skip it (because it marks the beginning of the path) */
    p = s.find("/", offset);
    if (p == offset) ++offset;
  }

  /* if there is something left, then this is the path */
  if (offset != string::npos)
  {
    if (path) *path = s.substr(offset);
  }

  SCDC_TRACE("split_uri: scheme: '" << ((scheme)?*scheme:"") << "', authority: '" << ((authority)?*authority:"") << "', path: '" << ((path)?*path:"") << "'");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rdx
movq %rdi, %rsi
testq %rdx, %rdx
js 0x1c819
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x1be38
jmp 0x1c828
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x1bd28
testq %r15, %r15
je 0x1c845
movq 0x8(%r15), %rdx
leaq 0x4ecf5(%rip), %rcx     # 0x6b52d
movq %r15, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xb870
testq %r14, %r14
je 0x1c862
movq 0x8(%r14), %rdx
leaq 0x4ecd8(%rip), %rcx     # 0x6b52d
movq %r14, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xb870
testq %rbx, %rbx
je 0x1c87f
movq 0x8(%rbx), %rdx
leaq 0x4ecbb(%rip), %rcx     # 0x6b52d
movq %rbx, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xb870
leaq 0x4dade(%rip), %rsi     # 0x6a364
xorl %r12d, %r12d
leaq 0x28(%rsp), %rdi
movl $0x1, %ecx
xorl %edx, %edx
callq 0xb9b0
cmpq $-0x1, %rax
je 0x1c8ed
movq %rax, %r13
testq %r15, %r15
je 0x1c8e7
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
xorl %edx, %edx
movq %r13, %rcx
callq 0xb530
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0xb670
movq (%r12), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1c8e7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
incq %r13
movq %r13, %r12
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movl $0x2, %ecx
movq %r12, %rdx
callq 0xb530
leaq 0x4da61(%rip), %rsi     # 0x6a36c
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xb110
movl %eax, %ebp
movq (%r15), %rdi
leaq 0x18(%rsp), %r13
cmpq %r13, %rdi
je 0x1c934
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
testl %ebp, %ebp
je 0x1c960
leaq 0x4da2e(%rip), %rsi     # 0x6a36d
leaq 0x28(%rsp), %rdi
movl $0x1, %ecx
movq %r12, %rdx
callq 0xb9b0
xorl %r15d, %r15d
cmpq %r12, %rax
sete %r15b
addq %r12, %r15
jmp 0x1c9d0
addq $0x2, %r12
leaq 0x4da02(%rip), %rsi     # 0x6a36d
leaq 0x28(%rsp), %rdi
movl $0x1, %ecx
movq %r12, %rdx
callq 0xb9b0
cmpq $-0x1, %rax
je 0x1ca43
movq %rax, %r15
testq %r14, %r14
je 0x1c9cd
movq %r15, %rcx
subq %r12, %rcx
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq %r12, %rdx
callq 0xb530
leaq 0x8(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0xb670
movq (%r12), %rdi
cmpq %r13, %rdi
je 0x1c9cd
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
incq %r15
testq %rbx, %rbx
je 0x1ca19
cmpq $-0x1, %r15
je 0x1ca19
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq %r15, %rdx
movq $-0x1, %rcx
callq 0xb530
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb670
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x1ca19
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1ca34
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r14, %r14
je 0x1ca19
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq %r12, %rdx
movq $-0x1, %rcx
callq 0xb530
leaq 0x8(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xb670
movq (%rbx), %rdi
jmp 0x1ca07
jmp 0x1ca80
jmp 0x1ca80
jmp 0x1ca80
jmp 0x1ca80
jmp 0x1ca80
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1ca9e
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
movq %rbx, %rdi
callq 0xb9c0