// File: /workspace/github_cpp_makefile_star2_O1/atfrank[P]PCASA/lib/Misc.cpp
// Function: void Misc::splitNum<int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<int, std::allocator<int>>&, bool)
void Misc::splitNum (const std::string &str, const std::string &delim, std::vector<SplitVec> &out, const bool repeat){
  out.clear();
  out.reserve(500); //Still need resizing but reduces moving of data in memory
  size_t p0=0;
  size_t p1=std::string::npos;
  size_t plast=std::string::npos;
  SplitVec tmp;

  //Only use this if all columns are needed as a number!

  //"repeat" = true means that a blank string is added when there are
  //back-to-back delimiters. Otherwise, repeat=false ignores back-to-back delimiters.

  plast=str.find_last_not_of(delim);
  p1=str.find_first_of(delim,p0);

  while (p1 != std::string::npos){
    if (p1-p0 > 0){
      std::stringstream(str.substr(p0,p1-p0)) >> tmp;
      out.push_back(tmp);
    }
    else{
      if (repeat){
        std::stringstream(str.substr(p0,p1-p0)) >> tmp;
        out.push_back(tmp);
      }
    }
    p0=p1+1;
    p1=str.find_first_of(delim, p0);
  }
  //After last delimiter
  if (plast != std::string::npos && plast >= p0){
    std::stringstream(str.substr(p0,p1-p0)) >> tmp;
    out.push_back(tmp);
  }
  else{
    if (repeat){
      std::stringstream(str.substr(p0,p1-p0)) >> tmp;
      out.push_back(tmp);
    }
  }
  //std::cerr << out.size() << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movl %ecx, 0x2c(%rsp)
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq (%rdx), %rax
cmpq %rax, 0x8(%rdx)
je 0x2244f
movq %rax, 0x8(%rbx)
movl $0x1f4, %esi            # imm = 0x1F4
movq %rbx, %rdi
callq 0x22732
movq (%r15), %rsi
movq 0x8(%r15), %rcx
movq %r14, %rdi
movq $-0x1, %rdx
callq 0x44b0
movq %rax, 0x38(%rsp)
movq (%r15), %rsi
movq 0x8(%r15), %rcx
xorl %ebp, %ebp
movq %r14, %rdi
xorl %edx, %edx
callq 0x4450
cmpq $-0x1, %rax
je 0x225ab
movq %rax, %r12
leaq 0x40(%rsp), %rax
addq $0x80, %rax
movq %rax, 0x30(%rsp)
xorl %ebp, %ebp
movq %r12, %rcx
subq %rbp, %rcx
jne 0x224f5
cmpb $0x0, 0x2c(%rsp)
je 0x22586
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0x4300
leaq 0x40(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
movl $0x18, %edx
callq 0x4490
movq %rbp, %rdi
leaq 0x4(%rsp), %rsi
callq 0x41b0
jmp 0x2252a
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4300
leaq 0x40(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
movl $0x18, %edx
callq 0x4490
movq %rbp, %rdi
leaq 0x4(%rsp), %rsi
callq 0x41b0
movq %rbp, %rdi
movq 0x3cea74(%rip), %rsi    # 0x3f0fa8
callq 0x4240
movq 0x30(%rsp), %rdi
callq 0x4110
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2255f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42e0
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x22579
movl 0x4(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x22586
movq %rbx, %rdi
leaq 0x4(%rsp), %rdx
callq 0x23264
movq %r12, %rbp
incq %rbp
movq (%r15), %rsi
movq 0x8(%r15), %rcx
movq %r14, %rdi
movq %rbp, %rdx
callq 0x4450
movq %rax, %r12
cmpq $-0x1, %rax
jne 0x224a9
movq 0x38(%rsp), %rax
cmpq $-0x1, %rax
je 0x225f7
cmpq %rbp, %rax
jb 0x225f7
movq %rbp, %rcx
notq %rcx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4300
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
movl $0x18, %edx
callq 0x4490
leaq 0x40(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x41b0
jmp 0x2263c
cmpb $0x0, 0x2c(%rsp)
je 0x2269c
movq %rbp, %rcx
notq %rcx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4300
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
movl $0x18, %edx
callq 0x4490
leaq 0x40(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x41b0
movq 0x3ce965(%rip), %rsi    # 0x3f0fa8
leaq 0x40(%rsp), %rdi
callq 0x4240
leaq 0xc0(%rsp), %rdi
callq 0x4110
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x22675
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42e0
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x2268f
movl 0x4(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x2269c
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0x23264
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x226b2
jmp 0x226d5
movq %rax, %rbx
movq 0x3ce8ec(%rip), %rsi    # 0x3f0fa8
leaq 0x40(%rsp), %rdi
callq 0x4240
leaq 0xc0(%rsp), %rdi
callq 0x4110
jmp 0x226d8
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x22717
jmp 0x226e7
jmp 0x2270a
movq %rax, %rbx
movq 0x3ce8b7(%rip), %rsi    # 0x3f0fa8
leaq 0x40(%rsp), %rdi
callq 0x4240
leaq 0xc0(%rsp), %rdi
callq 0x4110
jmp 0x2270d
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x22729
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42e0
movq %rbx, %rdi
callq 0x4550
nop