// File: /workspace/github_cpp_makefile_star2_O2/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 0x1a9a8
movq %r15, %rdi
callq 0xb210
movq %rax, %r14
testq %r12, %r12
je 0x1a9bc
leaq 0x37b09(%rip), %rsi     # 0x524bd
movq %r12, %rdi
callq 0xba40
testq %r13, %r13
je 0x1a9d0
leaq 0x37af5(%rip), %rsi     # 0x524bd
movq %r13, %rdi
callq 0xba40
testq %rbx, %rbx
je 0x1a9e4
leaq 0x37ae1(%rip), %rsi     # 0x524bd
movq %rbx, %rdi
callq 0xba40
testq %r15, %r15
sete %al
testq %r14, %r14
setle %cl
orb %al, %cl
jne 0x1ab9f
movq %rbx, (%rsp)
cmpb $0x3a, (%r15)
je 0x1aa42
cmpq $0x5, %r14
pushq $0x5
popq %rbp
cmovbq %r14, %rbp
leaq 0x3692c(%rip), %rsi     # 0x51340
movq %r15, %rdi
movq %rbp, %rdx
callq 0xb260
testl %eax, %eax
je 0x1aa42
leaq 0x3691c(%rip), %rsi     # 0x51346
movq %r15, %rdi
movq %rbp, %rdx
callq 0xb260
testl %eax, %eax
je 0x1aa42
movq (%rsp), %rbp
jmp 0x1aae0
pushq $0x20
popq %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0xb5f0
movq %rax, %rbp
testq %r13, %r13
je 0x1aab7
testq %rbp, %rbp
je 0x1aa85
movq %rbp, %rdx
subq %r15, %rdx
cmpq %r14, %rdx
cmovgeq %r14, %rdx
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
addq %r15, %rdx
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x1a1f2
jmp 0x1aa9f
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq (%r15,%r14), %rdx
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x1a1f2
leaq 0x8(%rsp), %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0xb690
movq %rbx, %rdi
callq 0xb230
leaq 0x1(%rbp), %rax
subq %rax, %r15
addq %r15, %r14
testq %rbp, %rbp
sete %cl
cmoveq %rbp, %rax
testq %r14, %r14
setle %dl
orb %cl, %dl
movq %rax, %r15
movq (%rsp), %rbp
jne 0x1ab9f
pushq $0x20
popq %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0xb5f0
movq %rax, %r13
testq %r12, %r12
je 0x1ab55
testq %r13, %r13
je 0x1ab23
movq %r13, %rdx
subq %r15, %rdx
cmpq %r14, %rdx
cmovgeq %r14, %rdx
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
addq %r15, %rdx
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x1a1f2
jmp 0x1ab3d
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq (%r15,%r14), %rdx
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x1a1f2
leaq 0x8(%rsp), %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0xb690
movq %rbx, %rdi
callq 0xb230
testq %rbp, %rbp
je 0x1ab9f
testq %r13, %r13
je 0x1ab9f
incq %r13
addq %r15, %r14
subq %r13, %r14
testq %r14, %r14
jle 0x1ab9f
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
addq %r13, %r14
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1a1f2
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xb690
movq %rbx, %rdi
callq 0xb230
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1abb4
jmp 0x1abb4
jmp 0x1abb4
movq %rax, %rdi
callq 0xb9a0