// File: /workspace/github_cpp_makefile_star2_O1/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, %r12
movq %rdi, %rsi
testq %r12, %r12
js 0x1c8c0
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq (%rsi,%r12), %rdx
leaq 0x28(%rsp), %rdi
callq 0x1bee6
jmp 0x1c8cf
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x1bdd6
testq %r12, %r12
testq %r15, %r15
je 0x1c8ef
movq 0x8(%r15), %rdx
leaq 0x4ec2b(%rip), %rcx     # 0x6b50d
movq %r15, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xb870
testq %r14, %r14
je 0x1c90c
movq 0x8(%r14), %rdx
leaq 0x4ec0e(%rip), %rcx     # 0x6b50d
movq %r14, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xb870
testq %rbx, %rbx
je 0x1c929
movq 0x8(%rbx), %rdx
leaq 0x4ebf1(%rip), %rcx     # 0x6b50d
movq %rbx, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xb870
leaq 0x4da14(%rip), %rsi     # 0x6a344
xorl %r12d, %r12d
leaq 0x28(%rsp), %rdi
movl $0x1, %ecx
xorl %edx, %edx
callq 0xb9b0
cmpq $-0x1, %rax
je 0x1c997
movq %rax, %r13
testq %r15, %r15
je 0x1c991
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 0x1c991
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 0x4d997(%rip), %rsi     # 0x6a34c
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xb110
movl %eax, %ebp
movq (%r15), %rdi
leaq 0x18(%rsp), %r13
cmpq %r13, %rdi
je 0x1c9de
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
testl %ebp, %ebp
je 0x1ca0d
leaq 0x4d964(%rip), %rsi     # 0x6a34d
leaq 0x28(%rsp), %rdi
movl $0x1, %ecx
movq %r12, %rdx
callq 0xb9b0
xorl %r15d, %r15d
cmpq %r12, %rax
sete %r15b
addq %r12, %r15
jmp 0x1cac5
addq $0x2, %r12
leaq 0x4d935(%rip), %rsi     # 0x6a34d
leaq 0x28(%rsp), %rdi
movl $0x1, %ecx
movq %r12, %rdx
callq 0xb9b0
cmpq $-0x1, %rax
je 0x1ca7b
movq %rax, %r15
testq %r14, %r14
je 0x1ca76
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 0x1ca76
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
incq %r15
jmp 0x1cac5
testq %r14, %r14
je 0x1cabe
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq %r12, %rdx
movq $-0x1, %rcx
callq 0xb530
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0xb670
movq (%r15), %rdi
cmpq %r13, %rdi
je 0x1cabe
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq $-0x1, %r15
testq %rbx, %rbx
je 0x1cb0e
cmpq $-0x1, %r15
je 0x1cb0e
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 0x1cb0e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1cb29
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1cb4c
jmp 0x1cb4c
jmp 0x1cb42
jmp 0x1cb4c
jmp 0x1cb4c
movq %rax, %rbx
testq %r12, %r12
jmp 0x1cb6a
jmp 0x1cb4c
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1cb6a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
movq %rbx, %rdi
callq 0xb9c0