// File: /workspace/github_cpp_makefile_star2_O2/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 0x1acb4
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x1a1f2
jmp 0x1acc3
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x1a132
testq %r15, %r15
je 0x1acd7
leaq 0x377ee(%rip), %rsi     # 0x524bd
movq %r15, %rdi
callq 0xba40
testq %r14, %r14
je 0x1aceb
leaq 0x377da(%rip), %rsi     # 0x524bd
movq %r14, %rdi
callq 0xba40
testq %rbx, %rbx
je 0x1acff
leaq 0x377c6(%rip), %rsi     # 0x524bd
movq %rbx, %rdi
callq 0xba40
leaq 0x3663e(%rip), %rsi     # 0x51344
xorl %r12d, %r12d
leaq 0x8(%rsp), %rdi
xorl %edx, %edx
callq 0xbab0
cmpq $-0x1, %rax
je 0x1ad55
movq %rax, %r13
testq %r15, %r15
je 0x1ad4f
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
xorl %edx, %edx
movq %r13, %rcx
callq 0xb560
leaq 0x28(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0xb690
movq %r12, %rdi
callq 0xb230
incq %r13
movq %r13, %r12
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
pushq $0x2
popq %rcx
movq %r12, %rdx
callq 0xb560
leaq 0x365db(%rip), %rsi     # 0x5134c
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x19be0
movl %eax, %ebp
movq %r15, %rdi
callq 0xb230
testb %bpl, %bpl
je 0x1adec
addq $0x2, %r12
leaq 0x365b5(%rip), %rsi     # 0x5134d
leaq 0x8(%rsp), %rdi
movq %r12, %rdx
callq 0xbab0
cmpq $-0x1, %rax
je 0x1ae42
movq %rax, %r15
testq %r14, %r14
je 0x1ade7
movq %r15, %rcx
subq %r12, %rcx
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq %r12, %rdx
callq 0xb560
leaq 0x28(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0xb690
movq %r12, %rdi
callq 0xb230
incq %r15
jmp 0x1ae0d
leaq 0x3655a(%rip), %rsi     # 0x5134d
leaq 0x8(%rsp), %rdi
movq %r12, %rdx
callq 0xbab0
xorl %r15d, %r15d
cmpq %r12, %rax
sete %r15b
addq %r12, %r15
testq %rbx, %rbx
je 0x1ae74
cmpq $-0x1, %r15
je 0x1ae74
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
pushq $-0x1
popq %rcx
movq %r15, %rdx
callq 0xb560
leaq 0x28(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb690
movq %r14, %rdi
jmp 0x1ae6f
testq %r14, %r14
je 0x1ae74
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
pushq $-0x1
popq %rcx
movq %r12, %rdx
callq 0xb560
leaq 0x28(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xb690
movq %rbx, %rdi
callq 0xb230
leaq 0x8(%rsp), %rdi
callq 0xb230
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1ae97
jmp 0x1ae97
jmp 0x1ae97
jmp 0x1ae97
jmp 0x1ae97
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xb230
movq %rbx, %rdi
callq 0xb9a0