// File: /workspace/github_cpp_makefile_star2_O3/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 0x1c4bc
movq %r15, %rdi
callq 0xb200
movq %rax, %r14
testq %r12, %r12
je 0x1c4da
movq 0x8(%r12), %rdx
leaq 0x4f060(%rip), %rcx     # 0x6b52d
movq %r12, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xb870
testq %r13, %r13
je 0x1c4f7
movq 0x8(%r13), %rdx
leaq 0x4f043(%rip), %rcx     # 0x6b52d
movq %r13, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xb870
testq %rbx, %rbx
je 0x1c514
movq 0x8(%rbx), %rdx
leaq 0x4f026(%rip), %rcx     # 0x6b52d
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 0x1c6fb
movq %rbx, 0x20(%rsp)
cmpb $0x3a, (%r15)
je 0x1c576
cmpq $0x5, %r14
movl $0x5, %ebp
cmovbq %r14, %rbp
leaq 0x4de19(%rip), %rsi     # 0x6a360
movq %r15, %rdi
movq %rbp, %rdx
callq 0xb240
testl %eax, %eax
je 0x1c576
leaq 0x4de09(%rip), %rsi     # 0x6a366
movq %r15, %rdi
movq %rbp, %rdx
callq 0xb240
testl %eax, %eax
je 0x1c576
movq 0x20(%rsp), %rbp
jmp 0x1c623
movq %r15, %rdi
movl $0x20, %esi
movq %r14, %rdx
callq 0xb5b0
movq %rax, %rbp
testq %r13, %r13
je 0x1c5f9
testq %rbp, %rbp
je 0x1c5b9
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 0x1be38
jmp 0x1c5d1
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq (%r15,%r14), %rdx
movq %rsp, %rdi
movq %r15, %rsi
callq 0x1be38
movq %rsp, %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0xb670
movq (%rbx), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x1c5f9
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xb510
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 0x20(%rsp), %rbp
jne 0x1c6fb
movq %r15, %rdi
movl $0x20, %esi
movq %r14, %rdx
callq 0xb5b0
movq %rax, %r13
testq %r12, %r12
je 0x1c6a6
testq %r13, %r13
je 0x1c666
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 0x1be38
jmp 0x1c67e
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq (%r15,%r14), %rdx
movq %rsp, %rdi
movq %r15, %rsi
callq 0x1be38
movq %rsp, %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0xb670
movq (%rbx), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x1c6a6
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xb510
testq %rbp, %rbp
je 0x1c6fb
testq %r13, %r13
je 0x1c6fb
incq %r13
addq %r15, %r14
subq %r13, %r14
testq %r14, %r14
jle 0x1c6fb
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
addq %r13, %r14
movq %rsp, %rbx
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1be38
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xb670
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x1c6fb
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 0x1c710
jmp 0x1c710
jmp 0x1c710
movq %rax, %rdi
callq 0xb9c0