// File: 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
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
leaq -0x30(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x43c30
movq -0xc8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0x213b6(%rip), %rdx     # 0x63e3b
callq 0x43ea0
jmp 0x42a8c
leaq -0x30(%rbp), %rdi
callq 0x43420
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x43450
leaq -0x30(%rbp), %rdi
callq 0x434a0
movq %rax, -0x60(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x43450
leaq -0x48(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x43470
testb $0x1, %al
jne 0x42ad6
jmp 0x42cfe
leaq -0x48(%rbp), %rdi
callq 0x43610
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
leaq 0x21046(%rip), %rsi     # 0x63b34
xorl %eax, %eax
movl %eax, %edx
callq 0x5a30
cmpq $-0x1, %rax
je 0x42cac
leaq -0x80(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x43c30
movq -0xd0(%rbp), %rdi
movq -0x68(%rbp), %rsi
leaq 0x21011(%rip), %rdx     # 0x63b34
callq 0x43ea0
jmp 0x42b2a
leaq -0x80(%rbp), %rdi
callq 0x43630
cmpq $0x2, %rax
je 0x42b77
movb $0x0, -0x1(%rbp)
movl $0x1, -0x84(%rbp)
jmp 0x42c95
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x42d23
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x43680
jmp 0x42d23
leaq -0x80(%rbp), %rdi
callq 0x43420
movq %rax, -0x90(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x44000
movq %rax, %rdi
callq 0x51d0
movq %rax, %rdi
callq 0x5800
movl %eax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x43420
movq %rax, -0xa0(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x44020
movq %rax, %rdi
callq 0x44000
movq %rax, %rdi
callq 0x51d0
movq %rax, %rdi
callq 0x5800
movl %eax, -0x94(%rbp)
movl -0x88(%rbp), %eax
cmpl -0x94(%rbp), %eax
jg 0x42c3e
movl -0x88(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
cmpl -0x94(%rbp), %eax
jg 0x42c3c
movq -0x18(%rbp), %rdi
movl -0xa4(%rbp), %eax
movl %eax, -0xa8(%rbp)
leaq -0xa8(%rbp), %rsi
callq 0x44040
jmp 0x42c29
jmp 0x42c2b
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x42bfd
jmp 0x42c8b
movl -0x88(%rbp), %eax
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %eax
cmpl -0x94(%rbp), %eax
jl 0x42c89
movq -0x18(%rbp), %rdi
movl -0xac(%rbp), %eax
movl %eax, -0xb0(%rbp)
leaq -0xb0(%rbp), %rsi
callq 0x44040
jmp 0x42c76
jmp 0x42c78
movl -0xac(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x42c4a
jmp 0x42c8b
movl $0x0, -0x84(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x43680
movl -0x84(%rbp), %eax
testl %eax, %eax
jne 0x42d0c
jmp 0x42caa
jmp 0x42ce5
movq -0x18(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x68(%rbp), %rdi
callq 0x51d0
movq %rax, %rdi
callq 0x5800
movq -0xd8(%rbp), %rdi
movl %eax, -0xb4(%rbp)
leaq -0xb4(%rbp), %rsi
callq 0x44040
jmp 0x42ce3
jmp 0x42ce5
jmp 0x42ce7
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x44070
movq %rax, -0xc0(%rbp)
jmp 0x42aa6
movb $0x1, -0x1(%rbp)
movl $0x1, -0x84(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x43680
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xe0, %rsp
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x43680
movq -0x38(%rbp), %rdi
callq 0x5920
nopw %cs:(%rax,%rax)
nop