// File: /workspace/github_cpp_makefile_star2_O1/mh0fm4[P]SCDC/src/components/common/common.cc
// Function: split_cmdline(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_cmdline(const char *cmdline, scdcint_t cmdline_size, string *cmd, string *uri, string *params)
{
  const char *s = cmdline;
  scdcint_t ss = (cmdline_size < 0)?strlen(s):cmdline_size;

  SCDC_TRACE("split_cmdline: '" << string(s, ss) << "'");

  if (cmd) *cmd = "";
  if (uri) *uri = "";
  if (params) *params = "";

  if (!s || ss <= 0) goto exit;

  if (s[0] != ':' && strncmp(s, "scdc:", min(static_cast<scdcint_t>(5), ss)) != 0 && strncmp(s, "scdc+", min(static_cast<scdcint_t>(5), ss)) != 0) goto split_cmd;

  const char *n;

  n = memchr(s, ' ', ss);
  if (uri) *uri = (n)?string(s, min(ss, static_cast<scdcint_t>(n - s))):string(s, ss);
  if (n) { n++; ss -= n - s; } else { ss = 0; } 
  s = n;

  if (!s || ss <= 0) goto exit;

  SCDC_TRACE("split_cmdline: s: '" << string(s, ss) << "'");

split_cmd:

  n = memchr(s, ' ', ss);
  if (cmd) *cmd = (n)?string(s, min(ss, static_cast<scdcint_t>(n - s))):string(s, ss);
  if (n) { n++; ss -= n - s; } else { ss = 0; } 
  s = n;

  if (!s || ss <= 0) goto exit;

  SCDC_TRACE("split_cmdline: s: '" << string(s, ss) << "'");

  if (params) *params = string(s, ss);

exit:
  SCDC_TRACE("split_cmdline: cmd: '" << ((cmd)?*cmd:"") << "', uri: '" << ((uri)?*uri:"") << "', params: '" << ((params)?*params:"") << "'");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %rbx
movq %rcx, %r13
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
testq %rsi, %rsi
jns 0x1c55c
movq %r15, %rdi
callq 0xb200
movq %rax, %r14
testq %r12, %r12
je 0x1c57a
movq 0x8(%r12), %rdx
leaq 0x4efa0(%rip), %rcx     # 0x6b50d
movq %r12, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xb870
testq %r13, %r13
je 0x1c597
movq 0x8(%r13), %rdx
leaq 0x4ef83(%rip), %rcx     # 0x6b50d
movq %r13, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xb870
testq %rbx, %rbx
je 0x1c5b4
movq 0x8(%rbx), %rdx
leaq 0x4ef66(%rip), %rcx     # 0x6b50d
movq %rbx, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xb870
testq %r15, %r15
sete %al
testq %r14, %r14
setle %cl
orb %al, %cl
jne 0x1c7a1
movq %rbx, 0x20(%rsp)
cmpb $0x3a, (%r15)
je 0x1c616
cmpq $0x5, %r14
movl $0x5, %ebp
cmovlq %r14, %rbp
leaq 0x4dd59(%rip), %rsi     # 0x6a340
movq %r15, %rdi
movq %rbp, %rdx
callq 0xb240
testl %eax, %eax
je 0x1c616
leaq 0x4dd49(%rip), %rsi     # 0x6a346
movq %r15, %rdi
movq %rbp, %rdx
callq 0xb240
testl %eax, %eax
je 0x1c616
movq 0x20(%rsp), %rbp
jmp 0x1c6c4
movq %r15, %rdi
movl $0x20, %esi
movq %r14, %rdx
callq 0xb5b0
movq %rax, %rbp
testq %r13, %r13
je 0x1c699
testq %rbp, %rbp
je 0x1c659
movq %rbp, %rdx
subq %r15, %rdx
cmpq %r14, %rdx
cmovgeq %r14, %rdx
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
addq %r15, %rdx
movq %rsp, %rdi
movq %r15, %rsi
callq 0x1bee6
jmp 0x1c671
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq (%r15,%r14), %rdx
movq %rsp, %rdi
movq %r15, %rsi
callq 0x1bee6
movq %rsp, %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0xb670
movq (%rbx), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x1c699
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xb510
addq %r15, %r14
leaq 0x1(%rbp), %r15
subq %r15, %r14
testq %rbp, %rbp
sete %al
cmoveq %rbp, %r14
cmoveq %rbp, %r15
testq %r14, %r14
setle %cl
orb %al, %cl
movq 0x20(%rsp), %rbp
jne 0x1c7a1
movq %r15, %rdi
movl $0x20, %esi
movq %r14, %rdx
callq 0xb5b0
movq %rax, %r13
testq %r12, %r12
je 0x1c747
testq %r13, %r13
je 0x1c707
movq %r13, %rdx
subq %r15, %rdx
cmpq %r14, %rdx
cmovgeq %r14, %rdx
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
addq %r15, %rdx
movq %rsp, %rdi
movq %r15, %rsi
callq 0x1bee6
jmp 0x1c71f
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq (%r15,%r14), %rdx
movq %rsp, %rdi
movq %r15, %rsi
callq 0x1bee6
movq %rsp, %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0xb670
movq (%rbx), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x1c747
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x1(%r13), %rsi
addq %r15, %r14
subq %rsi, %r14
testq %r13, %r13
cmoveq %r13, %r14
testq %rbp, %rbp
je 0x1c7a1
testq %r13, %r13
je 0x1c7a1
testq %r14, %r14
jle 0x1c7a1
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
addq %rsi, %r14
movq %rsp, %rbx
movq %rbx, %rdi
movq %r14, %rdx
callq 0x1bee6
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xb670
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x1c7a1
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xb510
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1c7b6
jmp 0x1c7b6
jmp 0x1c7b6
movq %rax, %rdi
callq 0xb9c0