// File: /workspace/github_cpp_makefile_star2_O1/mgo1977[P]c---parsing-argument-options/example1.cc
// Function: main
int main(int argc, char** argv) {

    /*
     * This is a simple example, to show the usage of this tool.
     * These are the main steps to use:
     *
     *  a. create all options, between set of the existing ones you have:
     *  b. Now, the easy part: create the parser, add the options and parse it
     *
     *  Please, take a look at the documentation in the header file "Parser.h"
     *  for a full description of each option
     *
     */

    BoolOption    debug         ('d', "debug",      false, "enables the debug mode");
    StringOption  username      ('u', "username",   true , "set the username");
    IntegerOption port          ('p', "port",       false, 23, "server port");
    FloatOption   portability   ('n', "portability",false, "smart option...");
    StringListOption  book      ('j', "book",       false, "book of interest. could be more than one");

    // default value is the limit of the type. for int types => (sizeof(int) * 1024)
    std::list<int> defaultPortRange;
    defaultPortRange.push_back(1);
    defaultPortRange.push_back(sizeof(int)*1024);
    IntegerRange  portRange     ('r', "portrange",  false, defaultPortRange, "range of ports");

    Parser parser;

    parser.addOption(debug)
          .addOption(username)
          .addOption(port)
          .addOption(portability)
          .addOption(book)
          .addOption(portRange);

    vector<string> otherArguments = parser.parse(argc, argv);

    if ( debug.isSet() ) {
        cout << "debug flag was set" << endl;
    }

    // username is mandatory, so we don't need to check it
    cout << "username was set to '" << username.getValue() << "'" << endl;

    // port has a default value, so we can choose not to check it
    // and work with the default value transparently
    cout << "port was set to '" << port.getValue() << "'" << endl;


    if ( portability.isSet() ) {
        cout << "portability was set to '" << portability.getValue() << "'" << endl;
    }

    if ( book.isSet() ) {
        std::list<std::string> values = book.getValue();

        cout << "book was set with " << values.size() << " entries: ";

        for(std::list<string>::iterator entry = values.begin();
            entry != values.end();
            ++entry
        ) {
            if ( entry != values.begin() )
                cout << ", ";

            cout << "'" << *entry << "'";
        }

        cout << endl;

    }

    //if ( portRange.isSet() ) {
        std::list<int> list = portRange.getValue();
        if ( list.size() > 0 ) {
            cout << "Range seted from '" << list.front() << "' to '" << list.back() << "'." << endl;
        } else {
            cout << "is null" << std::endl;
        }
    //}
 
    // if other arguments were specified, we can easily access them
    if ( ! otherArguments.empty() ) {

        cout << "otherArguments: ";

        for(vector<string>::iterator argIter = otherArguments.begin();
            argIter != otherArguments.end();
            ++argIter
        ) {

            if ( argIter != otherArguments.begin() )
                cout << ", ";

            cout << "'" << *argIter << "'";

        }

        cout << endl;

    }


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3d8, %rsp            # imm = 0x3D8
movq %rsi, %r13
movl %edi, %ebx
leaq 0x2a31(%rip), %rdx      # 0x70d5
leaq 0x2a30(%rip), %r9       # 0x70db
leaq -0x370(%rbp), %r14
movq %r14, %rdi
movl $0x64, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5976
movb $0x0, 0x5a(%r14)
leaq 0x5540(%rip), %rax      # 0x9c10
movq %rax, (%r14)
leaq 0x2a20(%rip), %rdx      # 0x70fa
leaq 0x2a11(%rip), %r9       # 0x70f2
leaq -0x118(%rbp), %rdi
movl $0x75, %esi
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x5976
leaq 0x55f4(%rip), %rax      # 0x9cf8
leaq -0xa8(%rbp), %rcx
movq %rax, -0x70(%rcx)
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x88(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x29d7(%rip), %rdx      # 0x710a
leaq 0x29c9(%rip), %r9       # 0x7103
leaq -0x1e8(%rbp), %rdi
movl $0x70, %esi
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x5976
leaq 0x55ce(%rip), %rax      # 0x9d28
movq %rax, -0x1e8(%rbp)
movl $0x17, -0x188(%rbp)
leaq 0x299d(%rip), %rdx      # 0x710f
leaq 0x29a2(%rip), %r9       # 0x711b
leaq -0x180(%rbp), %rdi
movl $0x6e, %esi
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x5976
leaq 0x55bf(%rip), %rax      # 0x9d58
movq %rax, -0x180(%rbp)
leaq 0x2984(%rip), %rdx      # 0x712b
leaq 0x2982(%rip), %r9       # 0x7130
leaq -0x278(%rbp), %rdi
movl $0x6a, %esi
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x5976
leaq 0x54fa(%rip), %rax      # 0x9cc8
leaq -0x218(%rbp), %rcx
movq %rax, -0x60(%rcx)
movq %rcx, 0x8(%rcx)
movq %rcx, (%rcx)
xorl %eax, %eax
movq %rax, 0x10(%rcx)
leaq -0x200(%rbp), %rcx
movq %rcx, 0x8(%rcx)
movq %rcx, (%rcx)
movq %rax, 0x10(%rcx)
leaq -0x60(%rbp), %r15
movq %r15, 0x8(%r15)
movq %r15, (%r15)
movq %rax, 0x10(%r15)
movl $0x18, %edi
callq 0x31c0
movl $0x1, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x3040
incq 0x10(%r15)
movl $0x18, %edi
callq 0x31c0
movl $0x1000, 0x10(%rax)     # imm = 0x1000
movq %rax, %rdi
movq %r15, %rsi
callq 0x3040
incq 0x10(%r15)
leaq 0x290b(%rip), %rdx      # 0x7159
leaq 0x290e(%rip), %r9       # 0x7163
leaq -0x400(%rbp), %r12
movq %r12, %rdi
movl $0x72, %esi
xorl %ecx, %ecx
movq %r15, %r8
callq 0x6b28
leaq 0x5513(%rip), %rax      # 0x9d88
movq %rax, -0x400(%rbp)
leaq -0x310(%rbp), %rdi
callq 0x548a
leaq -0x2b0(%rbp), %r15
leaq -0x48(%rbp), %rsi
movq %r14, (%rsi)
movq %r15, %rdi
callq 0x5bb2
leaq -0x48(%rbp), %rsi
leaq -0x118(%rbp), %rax
movq %rax, (%rsi)
movq %r15, %rdi
callq 0x5bb2
leaq -0x48(%rbp), %rsi
leaq -0x1e8(%rbp), %rax
movq %rax, (%rsi)
movq %r15, %rdi
callq 0x5bb2
leaq -0x48(%rbp), %rsi
leaq -0x180(%rbp), %rax
movq %rax, (%rsi)
movq %r15, %rdi
callq 0x5bb2
leaq -0x48(%rbp), %rsi
leaq -0x278(%rbp), %rax
movq %rax, (%rsi)
movq %r15, %rdi
callq 0x5bb2
leaq -0x48(%rbp), %rsi
movq %r12, (%rsi)
movq %r15, %rdi
callq 0x5bb2
leaq -0x78(%rbp), %rdi
leaq -0x310(%rbp), %rsi
movl %ebx, %edx
movq %r13, %rcx
callq 0x34dc
cmpb $0x1, -0x318(%rbp)
jne 0x4969
movq 0x56a6(%rip), %rbx      # 0x9fd0
leaq 0x2841(%rip), %rsi      # 0x7172
movl $0x12, %edx
movq %rbx, %rdi
callq 0x3210
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq 0x5674(%rip), %rdi      # 0x9fd0
callq 0x3030
movq %rax, %rdi
callq 0x3110
movq 0x5660(%rip), %rdi      # 0x9fd0
leaq 0x280e(%rip), %rsi      # 0x7185
movl $0x15, %edx
callq 0x3210
leaq -0x48(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x5542
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq 0x5630(%rip), %rdi      # 0x9fd0
callq 0x3210
movq %rax, %rbx
leaq 0x2846(%rip), %rsi      # 0x71f5
movl $0x1, %edx
movq %rax, %rdi
callq 0x3210
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3110
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x49fc
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x31d0
movq 0x55cd(%rip), %rdi      # 0x9fd0
leaq 0x2791(%rip), %rsi      # 0x719b
movl $0x11, %edx
callq 0x3210
movzbl -0x190(%rbp), %eax
xorl $0x1, %eax
movl -0x18c(%rbp,%rax,4), %esi
movq 0x55a4(%rip), %rdi      # 0x9fd0
callq 0x3300
movq %rax, %rbx
leaq 0x27ba(%rip), %rsi      # 0x71f5
movl $0x1, %edx
movq %rax, %rdi
callq 0x3210
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3110
cmpb $0x1, -0x128(%rbp)
jne 0x4aed
movq 0x5551(%rip), %rdi      # 0x9fd0
leaq 0x2727(%rip), %rsi      # 0x71ad
movl $0x18, %edx
callq 0x3210
movzbl -0x128(%rbp), %eax
xorl $0x1, %eax
cvtss2sd -0x124(%rbp,%rax,4), %xmm0
movq 0x5526(%rip), %rdi      # 0x9fd0
callq 0x32d0
movq %rax, %rbx
leaq 0x273c(%rip), %rsi      # 0x71f5
movl $0x1, %edx
movq %rax, %rdi
callq 0x3210
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3110
cmpb $0x1, -0x220(%rbp)
jne 0x4be6
leaq -0x48(%rbp), %rbx
leaq -0x278(%rbp), %rsi
movq %rbx, %rdi
callq 0x557c
movq 0x54bc(%rip), %rdi      # 0x9fd0
leaq 0x26ab(%rip), %rsi      # 0x71c6
movl $0x12, %edx
callq 0x3210
movq -0x38(%rbp), %rsi
movq 0x54a0(%rip), %rdi      # 0x9fd0
callq 0x3100
leaq 0x269d(%rip), %rsi      # 0x71d9
movl $0xa, %edx
movq %rax, %rdi
callq 0x3210
movq 0x5480(%rip), %r14      # 0x9fd0
leaq 0x269e(%rip), %r12      # 0x71f5
leaq 0x2519(%rip), %r15      # 0x7077
movq %rbx, %r13
movq (%r13), %r13
cmpq %rbx, %r13
je 0x4bb2
cmpq -0x48(%rbp), %r13
je 0x4b80
movl $0x2, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3210
movl $0x1, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x3210
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
movq %r14, %rdi
callq 0x3210
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x3210
jmp 0x4b61
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq 0x5400(%rip), %rdi      # 0x9fd0
callq 0x3030
movq %rax, %rdi
callq 0x3110
leaq -0x48(%rbp), %rdi
callq 0x5d2c
leaq -0x48(%rbp), %r12
leaq -0x400(%rbp), %rsi
movq %r12, %rdi
callq 0x55a8
cmpq $0x0, -0x38(%rbp)
je 0x4c7e
movq 0x53c9(%rip), %rdi      # 0x9fd0
leaq 0x25d6(%rip), %rsi      # 0x71e4
movl $0x12, %edx
callq 0x3210
movq -0x48(%rbp), %rax
movl 0x10(%rax), %esi
movq 0x53aa(%rip), %rdi      # 0x9fd0
callq 0x3300
movq %rax, %rbx
leaq 0x25c2(%rip), %rsi      # 0x71f7
movl $0x6, %edx
movq %rax, %rdi
callq 0x3210
movq -0x40(%rbp), %rax
movl 0x10(%rax), %esi
movq %rbx, %rdi
callq 0x3300
movq %rax, %rbx
leaq 0x25a3(%rip), %rsi      # 0x71fe
movl $0x2, %edx
movq %rax, %rdi
callq 0x3210
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
jmp 0x4cad
movq 0x534b(%rip), %rbx      # 0x9fd0
leaq 0x2575(%rip), %rsi      # 0x7201
movl $0x7, %edx
movq %rbx, %rdi
callq 0x3210
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3110
movq -0x78(%rbp), %rax
cmpq -0x70(%rbp), %rax
je 0x4d83
movq 0x52fb(%rip), %rdi      # 0x9fd0
leaq 0x252d(%rip), %rsi      # 0x7209
movl $0x10, %edx
callq 0x3210
movq -0x78(%rbp), %rbx
cmpq -0x70(%rbp), %rbx
je 0x4d54
movq 0x52d9(%rip), %r14      # 0x9fd0
leaq 0x24f7(%rip), %r13      # 0x71f5
leaq 0x2372(%rip), %r15      # 0x7077
cmpq -0x78(%rbp), %rbx
je 0x4d1b
movl $0x2, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3210
movl $0x1, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x3210
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x3210
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x3210
addq $0x20, %rbx
cmpq -0x70(%rbp), %rbx
jne 0x4d05
movq 0x5275(%rip), %rdi      # 0x9fd0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq 0x525a(%rip), %rdi      # 0x9fd0
callq 0x3030
movq %rax, %rdi
callq 0x3110
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x4da1
movq (%rdi), %rbx
movl $0x18, %esi
callq 0x31d0
movq %rbx, %rdi
cmpq %r12, %rbx
jne 0x4d8c
leaq -0x78(%rbp), %rdi
callq 0x5304
leaq -0x288(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4dc9
movq -0x288(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0x2b0(%rbp), %rdi
testq %rdi, %rdi
leaq -0xa8(%rbp), %r12
je 0x4deb
movq -0x2a0(%rbp), %rsi
subq %rdi, %rsi
callq 0x31d0
leaq 0x4e8e(%rip), %rbx      # 0x9c80
leaq -0x2c8(%rbp), %rax
movq %rbx, -0x48(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4e15
movq -0x2c8(%rbp), %rsi
incq %rsi
callq 0x31d0
leaq -0x2f0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4e34
movq -0x2f0(%rbp), %rsi
incq %rsi
callq 0x31d0
leaq 0x4e5d(%rip), %rax      # 0x9c98
leaq -0x388(%rbp), %r14
movq %rax, -0x78(%r14)
movq (%r14), %rdi
cmpq %r14, %rdi
je 0x4e63
movq (%rdi), %r15
movl $0x18, %esi
callq 0x31d0
movq %r15, %rdi
cmpq %r14, %r15
jne 0x4e4e
leaq -0x3a0(%rbp), %r14
movq (%r14), %rdi
cmpq %r14, %rdi
je 0x4e87
movq (%rdi), %r15
movl $0x18, %esi
callq 0x31d0
movq %r15, %rdi
cmpq %r14, %r15
jne 0x4e72
leaq -0x3b8(%rbp), %rax
movq %rbx, -0x48(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4eaa
movq -0x3b8(%rbp), %rsi
incq %rsi
callq 0x31d0
leaq -0x3e0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
leaq -0x60(%rbp), %r15
je 0x4ecd
movq -0x3e0(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0x4eeb
movq (%rdi), %r14
movl $0x18, %esi
callq 0x31d0
movq %r14, %rdi
cmpq %r15, %r14
jne 0x4ed6
leaq -0x230(%rbp), %r14
leaq 0x4dcf(%rip), %rax      # 0x9cc8
movq %rax, -0x48(%r14)
leaq -0x200(%rbp), %rdi
callq 0x5d2c
leaq -0x218(%rbp), %rdi
callq 0x5d2c
movq %rbx, -0x48(%r14)
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0x4f31
movq -0x230(%rbp), %rsi
incq %rsi
callq 0x31d0
leaq -0x258(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4f50
movq -0x258(%rbp), %rsi
incq %rsi
callq 0x31d0
leaq -0x138(%rbp), %rax
movq %rbx, -0x48(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4f73
movq -0x138(%rbp), %rsi
incq %rsi
callq 0x31d0
leaq -0x160(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4f92
movq -0x160(%rbp), %rsi
incq %rsi
callq 0x31d0
leaq -0x1a0(%rbp), %rax
movq %rbx, -0x48(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4fb5
movq -0x1a0(%rbp), %rsi
incq %rsi
callq 0x31d0
leaq -0x1c8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4fd4
movq -0x1c8(%rbp), %rsi
incq %rsi
callq 0x31d0
leaq 0x4d1d(%rip), %rax      # 0x9cf8
movq %rax, -0x118(%rbp)
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x5004
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0xb8(%rbp), %rdi
cmpq %r12, %rdi
je 0x501f
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x31d0
leaq -0xd0(%rbp), %rax
movq %rbx, -0x48(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5042
movq -0xd0(%rbp), %rsi
incq %rsi
callq 0x31d0
leaq -0xf8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5061
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x31d0
leaq -0x328(%rbp), %rax
movq %rbx, -0x48(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5084
movq -0x328(%rbp), %rsi
incq %rsi
callq 0x31d0
leaq -0x350(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x50a3
movq -0x350(%rbp), %rsi
incq %rsi
callq 0x31d0
xorl %eax, %eax
addq $0x3d8, %rsp            # imm = 0x3D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x512c
jmp 0x512c
jmp 0x512c
jmp 0x5121
movq %rax, %rbx
leaq -0x60(%rbp), %r15
jmp 0x5179
jmp 0x50cd
movq %rax, %rbx
leaq -0x60(%rbp), %r15
jmp 0x5185
movq %rax, %rbx
jmp 0x5185
movq %rax, %rbx
jmp 0x51af
movq %rax, %rbx
jmp 0x51bb
movq %rax, %rbx
jmp 0x51c7
movq %rax, %rbx
jmp 0x51d3
jmp 0x5154
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5160
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x31d0
jmp 0x5160
movq %rax, %rbx
leaq -0x60(%rbp), %r15
jmp 0x516d
jmp 0x5131
movq %rax, %rbx
jmp 0x5160
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x5160
movq (%rdi), %r14
movl $0x18, %esi
callq 0x31d0
movq %r14, %rdi
cmpq %r12, %r14
jne 0x513d
jmp 0x5160
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x5d2c
leaq -0x60(%rbp), %r15
leaq -0x78(%rbp), %rdi
callq 0x5304
leaq -0x310(%rbp), %rdi
callq 0x55d4
leaq -0x400(%rbp), %rdi
callq 0x5654
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0x51a3
movq (%rdi), %r14
movl $0x18, %esi
callq 0x31d0
movq %r14, %rdi
cmpq %r15, %r14
jne 0x518e
leaq -0x278(%rbp), %rdi
callq 0x56fe
leaq -0x180(%rbp), %rdi
callq 0x57fa
leaq -0x1e8(%rbp), %rdi
callq 0x57fa
leaq -0x118(%rbp), %rdi
callq 0x576a
leaq -0x370(%rbp), %rdi
callq 0x57fa
movq %rbx, %rdi
callq 0x3320
nop