// File: /workspace/github_cpp_makefile_star2_O3/adamiaonr[P]rid-analytics/src/argvparser.cpp
// Function: CommandLineProcessing::expandRangeStringToUInt(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<unsigned int, std::allocator<unsigned int>>&)
bool CommandLineProcessing::expandRangeStringToUInt( const std::string & _string,
        std::vector< unsigned int > & _expanded )
{
    list<string> tokens;
    // split string by delimiter
    splitString(tokens, _string, ",");

    // loop over all entries
    for(list<string>::const_iterator it = tokens.begin(); it != tokens.end(); it++)
    {
        const string& entry = *it; // convenience reference

#ifdef ARGVPARSER_DEBUG

        cout << "TOKEN: " << entry << endl;
#endif

        // if range was given
        if (entry.find("-") != string::npos)
        {
            // split into upper and lower border
            list<string> range_borders;
            splitString(range_borders, entry, "-");

            // fail if insane range spec
            if (range_borders.size() != 2)
                return(false);

            int first = atoi(range_borders.begin()->c_str());
            int second = atoi((++range_borders.begin())->c_str());

            // write id in increasing order
            if (first <= second)

            {
                for (int j=first; j<=second; ++j)
                {
                    _expanded.push_back(j);
                }
            }
            else // write id in decreasing order
            {
                for (int k=first; k>=second; k--)
                {
                    _expanded.push_back(k);
                }
            }
        }
        else // single number was given
            _expanded.push_back(atoi(entry.c_str())); // store id
    }

    return(true);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %rsi
leaq 0x20(%rsp), %rbp
movq %rbp, 0x8(%rbp)
movq %rbp, (%rbp)
movq $0x0, 0x10(%rbp)
leaq 0xf73f(%rip), %rdx      # 0x30d67
movq %rbp, %rdi
callq 0x21c12
movq 0x20(%rsp), %r15
movb $0x1, %r14b
cmpq %rbp, %r15
je 0x21787
leaq 0xf418(%rip), %r12      # 0x30a60
leaq 0x4(%rsp), %r13
leaq 0x10(%r15), %r14
movl $0x1, %ecx
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x46f0
cmpq $-0x1, %rax
je 0x216f3
leaq 0x8(%rsp), %rdi
movq %rdi, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movq $0x0, 0x18(%rsp)
movq %r14, %rsi
movq %r12, %rdx
callq 0x21c12
cmpq $0x2, 0x18(%rsp)
jne 0x2177a
movq %rbp, %r12
movq 0x8(%rsp), %r14
movq 0x10(%r14), %rdi
callq 0x45f0
movl %eax, %ebp
movq (%r14), %rax
movq 0x10(%rax), %rdi
callq 0x45f0
movl %eax, %r14d
cmpl %eax, %ebp
jle 0x21715
movl %ebp, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x216dc
movl %ebp, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x216e7
movq %rbx, %rdi
movq %r13, %rdx
callq 0x22fb0
leal -0x1(%rbp), %eax
cmpl %r14d, %ebp
movl %eax, %ebp
jg 0x216c2
jmp 0x21744
movq (%r14), %rdi
callq 0x45f0
movl %eax, 0x8(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x21766
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x21758
incl %r14d
movl %ebp, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x21732
movl %ebp, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x2173d
movq %rbx, %rdi
movq %r13, %rdx
callq 0x22fb0
incl %ebp
cmpl %ebp, %r14d
jne 0x21718
leaq 0x8(%rsp), %rdi
callq 0x21fac
movq %r12, %rbp
leaq 0xf308(%rip), %r12      # 0x30a60
movq (%r15), %r15
cmpq %rbp, %r15
jne 0x2164d
jmp 0x21775
movq %rbx, %rdi
leaq 0x8(%rsp), %rdx
callq 0x22fb0
jmp 0x21758
movb $0x1, %r14b
jmp 0x21787
leaq 0x8(%rsp), %rdi
callq 0x21fac
xorl %r14d, %r14d
leaq 0x20(%rsp), %rdi
callq 0x21fac
movl %r14d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x217a5
movq %rax, %rbx
jmp 0x217bb
jmp 0x217ae
jmp 0x217ae
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x21fac
leaq 0x20(%rsp), %rdi
callq 0x21fac
movq %rbx, %rdi
callq 0x4700
nop