// File: /workspace/github_cpp_makefile_star2_O1/j-faria[P]cpp-loadtxt/./src/loadtxt.hpp
// Function: loadtxt<double>::operator()()
vector<vector<T>> operator()()
    {
        if (_fname.empty()) {
            string msg = "loadtxt: filename is empty";
            throw invalid_argument(msg);
        }

        ifstream infile( _fname );

        if (infile.fail()) {
            string msg = "loadtxt: could not read file (" + _fname + ")!";
            throw runtime_error(msg);
        }
        
        // ignore first `skiprows` lines
        static const int max_line = 65536;
        for (size_t i = 0; i < _skiprows; i++)
            infile.ignore(max_line, '\n');

        vector<T> record;
        size_t rows_read = 0;

        // read each line
        while (rows_read < _max_rows || _max_rows == 0)
        {
            // clear the record before reading
            record.clear();

            // read the entire line into a string (a record is terminated by a newline)
            string line;
            getline(infile, line);

            if (infile.eof() && line.empty())
                break;
            
            if (line.find(_comments, 0) == 0)
                continue;

            // // use a stringstream to separate the fields out of the line
            // stringstream ss(line);

            size_t found = line.find_first_of(_delimiters);

            while (found != string::npos) {
                string cell = line.substr(0, found);

                if (!cell.empty()) {
                    // convert the field to a double
                    try
                    {
                        T val = convert(cell);
                        record.push_back(val);
                    }
                    catch(const std::invalid_argument& e)
                    {
                        std::cerr << "loadtxt: while reading file \"" << _fname << "\", ";
                        std::cerr << "could not convert field '" << cell << "' to double ";
                        std::cerr << "at row " << rows_read << " column " << record.size() + 1 << "\n";
                        throw;
                    }
                    
                }
                line.erase(0, found + 1);
                found = line.find_first_of(_delimiters);

                if (found == string::npos) {
                    if (line.empty())
                        continue;

                    try
                    {
                        T val = convert(line);
                        record.push_back(val);
                    }
                    catch(const std::invalid_argument& e)
                    {
                        std::cerr << "loadtxt: while reading file \"" << _fname << "\", ";
                        std::cerr << "could not convert field '" << line << "' to double ";
                        std::cerr << "at row " << rows_read << " column " << record.size() + 1 << "\n";
                        // throw;
                    }
                }
            }
            // // convert each field to a double
            // // and add the newly-converted field to the end of the record
            // string cell;
            // double f;

            // while (getline(ss, cell, _delimiters[0])) {
            //     if (cell.empty()) continue;
            //     f = stod(cell);   
            //     record.push_back(f);
            // }

            // while (ss >> f) {
            //         record.push_back(f);
            // }

            _filedata.push_back(record);

            rows_read++;
        }
        
        // complain if something went wrong
        if (rows_read != _max_rows && !infile.eof())
        {
            cout << "loadtxt: could not read file (" << _fname << ")!\n";
            exit(1);
        }

        infile.close();

        size_t nlines = _filedata.size();

        // only read _max_rows of content
        if (_max_rows != 0)
            nlines = min(nlines, _max_rows);

        size_t ncols = _filedata[0].size();

        vector<int> cols;
        if (_usecols.size() == 0)
        {
            data.resize(ncols);
            cols.resize(ncols);
            std::iota(cols.begin(), cols.end(), 0);
        }
        else
        {
            data.resize(_usecols.size());
            cols = _usecols;
            //! usecols starts from 1!
            for (auto& j : cols)
                j--;
        }

        for (size_t i = 0; i < data.size(); i++)
            data[i].reserve(nlines);
        
        for (size_t i = 0; i < nlines; i++)
        {
            int k = 0;
            for (auto j : cols)
            {
                data[k].push_back(_filedata[i][j]);
                k++;
            }
        }
        
        return data;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rdi, -0xa8(%rbp)
cmpq $0x0, 0x20(%rsi)
je 0x3b99
movq %rsi, %rbx
leaq 0x18(%rsi), %r14
leaq -0x2c0(%rbp), %r13
movq %r13, %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x2270
movq (%r13), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x2a0(%rbp,%rax)
jne 0x3bf5
movq %rbx, -0x78(%rbp)
cmpq $0x0, 0x78(%rbx)
je 0x3667
xorl %ebx, %ebx
leaq -0x2c0(%rbp), %r14
movl $0x10000, %esi          # imm = 0x10000
movq %r14, %rdi
movl $0xa, %edx
callq 0x2120
incq %rbx
movq -0x78(%rbp), %rax
cmpq 0x78(%rax), %rbx
jb 0x3648
xorps %xmm0, %xmm0
leaq -0x70(%rbp), %rax
movaps %xmm0, (%rax)
movq $0x0, 0x10(%rax)
leaq -0x40(%rbp), %r15
movq -0x78(%rbp), %rbx
leaq 0xa0(%rbx), %rax
movq %rax, -0xb8(%rbp)
movq $0x0, -0x58(%rbp)
leaq -0x50(%rbp), %r14
leaq -0xa0(%rbp), %r12
movq 0x98(%rbx), %rax
decq %rax
cmpq -0x58(%rbp), %rax
jb 0x398b
movq -0x70(%rbp), %rax
cmpq %rax, -0x68(%rbp)
je 0x36c4
movq %rax, -0x68(%rbp)
movq %r15, -0x50(%rbp)
movq $0x0, -0x48(%rbp)
movb $0x0, -0x40(%rbp)
movq -0x2c0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %edx
movq %r13, %rdi
movq %r14, %rsi
callq 0x2300
movq -0x2c0(%rbp), %rax
movq -0x18(%rax), %rax
movb -0x2a0(%rbp,%rax), %al
shrb %al
cmpq $0x0, -0x48(%rbp)
sete %r13b
andb %al, %r13b
jne 0x3966
movq 0x38(%rbx), %rsi
movq 0x40(%rbx), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x22d0
testq %rax, %rax
je 0x3966
movq 0x58(%rbx), %rsi
movq 0x60(%rbx), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x2240
cmpq $-0x1, %rax
je 0x394e
movq %rax, %r15
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0x21f0
cmpq $0x0, -0x98(%rbp)
je 0x37a9
movq %rbx, %rdi
movq %r12, %rsi
callq 0x421a
movsd %xmm0, -0x80(%rbp)
movq -0x68(%rbp), %rsi
cmpq -0x60(%rbp), %rsi
je 0x379c
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, -0x68(%rbp)
jmp 0x37a9
leaq -0x70(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x4570
incq %r15
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x2060
movq 0x58(%rbx), %rsi
movq 0x60(%rbx), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x2240
movq %rax, %r15
cmpq $-0x1, %rax
jne 0x3810
cmpq $0x0, -0x48(%rbp)
je 0x3810
movq %rbx, %rdi
movq %r14, %rsi
callq 0x421a
movsd %xmm0, -0x80(%rbp)
movq -0x68(%rbp), %rsi
cmpq -0x60(%rbp), %rsi
je 0x3803
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, -0x68(%rbp)
jmp 0x3810
leaq -0x70(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x4570
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x3832
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x21e0
cmpq $-0x1, %r15
jne 0x375a
jmp 0x394e
cmpl $0x1, %edx
jne 0x3cf8
movq %rax, %rdi
callq 0x20b0
movl $0x1d, %edx
movq 0x478a(%rip), %rdi      # 0x7fe8
leaq 0x1c7e(%rip), %rsi      # 0x54e3
callq 0x2200
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
movq 0x476f(%rip), %rdi      # 0x7fe8
callq 0x2200
movl $0x3, %edx
movq %rax, %rdi
leaq 0x1c74(%rip), %rsi      # 0x5501
callq 0x2200
movl $0x19, %edx
movq 0x474a(%rip), %rdi      # 0x7fe8
leaq 0x1c60(%rip), %rsi      # 0x5505
callq 0x2200
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq 0x472f(%rip), %rdi      # 0x7fe8
callq 0x2200
movl $0xc, %edx
movq %rax, %rdi
leaq 0x1c52(%rip), %rsi      # 0x551f
callq 0x2200
movl $0x7, %edx
movq 0x470a(%rip), %rdi      # 0x7fe8
leaq 0x1c47(%rip), %rsi      # 0x552c
callq 0x2200
movq 0x46f7(%rip), %rdi      # 0x7fe8
movq -0x58(%rbp), %rsi
callq 0x2140
movl $0x8, %edx
movq %rax, %rdi
leaq 0x1c2b(%rip), %rsi      # 0x5534
movq %rax, -0xb0(%rbp)
callq 0x2200
movq -0xb0(%rbp), %rdi
movq -0x68(%rbp), %rsi
subq -0x70(%rbp), %rsi
sarq $0x3, %rsi
incq %rsi
callq 0x2140
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1c00(%rip), %rsi      # 0x553f
callq 0x2200
callq 0x22a0
jmp 0x3810
movq -0xb8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x40(%rbp), %r15
callq 0x4294
incq -0x58(%rbp)
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x397b
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21e0
testb %r13b, %r13b
leaq -0x2c0(%rbp), %r13
je 0x36a2
movq -0x58(%rbp), %rax
cmpq 0x98(%rbx), %rax
je 0x39b1
movq -0x2c0(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x2a0(%rbp,%rax)
je 0x3c3e
leaq -0x2c0(%rbp), %rdi
callq 0x2050
movq 0xa8(%rbx), %rax
movq 0x98(%rbx), %rcx
movq 0xa0(%rbx), %rdx
subq %rdx, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %r12 # imm = 0xAAAAAAAAAAAAAAAB
imulq %r12, %rax
cmpq %rax, %rcx
movq %rax, %r13
cmovbq %rcx, %r13
testq %rcx, %rcx
cmoveq %rax, %r13
movq 0x8(%rdx), %r15
subq (%rdx), %r15
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq 0x88(%rbx), %rsi
subq 0x80(%rbx), %rsi
je 0x3a4f
sarq $0x2, %rsi
movq %rbx, %rdi
callq 0x42d0
leaq 0x80(%rbx), %rsi
leaq -0x50(%rbp), %rdi
callq 0x434c
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
cmpq %rcx, %rax
je 0x3a86
decl (%rax)
addq $0x4, %rax
jmp 0x3a42
sarq $0x3, %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x42d0
leaq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0x4314
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
cmpq %rcx, %rax
je 0x3a86
xorl %edx, %edx
movl %edx, (%rax)
incl %edx
addq $0x4, %rax
cmpq %rcx, %rax
jne 0x3a79
movq (%rbx), %rdi
cmpq %rdi, 0x8(%rbx)
je 0x3ac1
xorl %ebx, %ebx
xorl %r14d, %r14d
addq %rbx, %rdi
movq %r13, %rsi
callq 0x442c
incq %r14
movq -0x78(%rbp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rax
subq %rdi, %rax
sarq $0x3, %rax
imulq %r12, %rax
addq $0x18, %rbx
cmpq %rax, %r14
jb 0x3a94
testq %r13, %r13
je 0x3b3a
xorl %r15d, %r15d
movq %r13, -0x58(%rbp)
movq -0x50(%rbp), %r12
movq -0x48(%rbp), %r13
cmpq %r13, %r12
je 0x3b2e
leaq (%r15,%r15,2), %r14
xorl %ebx, %ebx
movslq (%r12), %rdx
movq -0x78(%rbp), %rcx
movq 0xa0(%rcx), %rax
shlq $0x3, %rdx
addq (%rax,%r14,8), %rdx
movq (%rcx), %rdi
movq 0x8(%rdi,%rbx), %rsi
cmpq 0x10(%rdi,%rbx), %rsi
je 0x3b19
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi,%rbx)
jmp 0x3b21
addq %rbx, %rdi
callq 0x4570
addq $0x4, %r12
addq $0x18, %rbx
cmpq %r13, %r12
jne 0x3ae0
incq %r15
movq -0x58(%rbp), %r13
cmpq %r13, %r15
jne 0x3acd
movq -0xa8(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x44cc
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3b5f
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x21e0
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x3b74
movq -0x60(%rbp), %rsi
subq %rdi, %rsi
callq 0x21e0
leaq -0x2c0(%rbp), %rdi
callq 0x2070
movq -0xa8(%rbp), %rax
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x2b0(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x18fb(%rip), %rsi      # 0x54a6
leaq 0x190e(%rip), %rdx      # 0x54c0
leaq -0x2c0(%rbp), %rdi
callq 0x40ee
movl $0x10, %edi
callq 0x20d0
movq %rax, %rbx
leaq -0x2c0(%rbp), %rsi
movq %rax, %rdi
callq 0x22c0
movq 0x43ef(%rip), %rsi      # 0x7fd0
movq 0x43d8(%rip), %rdx      # 0x7fc0
movq %rbx, %rdi
callq 0x22b0
jmp 0x3ecd
leaq 0x18c5(%rip), %rsi      # 0x54c1
leaq -0xa0(%rbp), %rdi
movq %r14, %rdx
callq 0x4187
leaq 0x18ce(%rip), %rsi      # 0x54e0
leaq -0xa0(%rbp), %rdi
callq 0x2310
leaq -0x40(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x3c83
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x3c8e
movq 0x4373(%rip), %rdi      # 0x7fb8
leaq 0x1875(%rip), %rsi      # 0x54c1
movl $0x1e, %edx
callq 0x2200
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
movq 0x4353(%rip), %rdi      # 0x7fb8
callq 0x2200
leaq 0x18cc(%rip), %rsi      # 0x553d
movq %rax, %rdi
callq 0x21c0
movl $0x1, %edi
callq 0x2210
movq %rdx, -0x50(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x40(%rbp)
movq 0x8(%rax), %rdx
movq %rdx, -0x48(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x90(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3cc4
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x21e0
movl $0x10, %edi
callq 0x20d0
movq %rax, %rbx
leaq -0x50(%rbp), %rsi
movq %rax, %rdi
callq 0x2280
movq 0x430c(%rip), %rsi      # 0x7ff0
movq 0x42c5(%rip), %rdx      # 0x7fb0
movq %rbx, %rdi
callq 0x22b0
jmp 0x3ecd
leaq -0x40(%rbp), %r15
movq %rax, %rbx
jmp 0x3eef
jmp 0x3ee8
movq %rax, %rbx
callq 0x22a0
jmp 0x3eeb
movq %rax, %r15
jmp 0x3d26
movq %rax, %r15
movq %rbx, %rdi
callq 0x2160
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x3d89
movq -0x40(%rbp), %rsi
jmp 0x3d4f
movq %rax, %r15
leaq -0x90(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3d89
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x21e0
jmp 0x3d89
movq %rax, %r15
jmp 0x3d69
movq %rax, %r15
movq %rbx, %rdi
callq 0x2160
movq -0x2c0(%rbp), %rdi
cmpq %r14, %rdi
je 0x3d94
movq -0x2b0(%rbp), %rsi
incq %rsi
callq 0x21e0
jmp 0x3d94
movq %rax, %r15
movq %r15, %rbx
jmp 0x3f50
movq %rax, %r15
movq %r15, %rbx
jmp 0x3f5c
movq %rax, %rbx
jmp 0x3f3b
jmp 0x3f23
jmp 0x3db8
jmp 0x3f23
movq %rax, %rbx
jmp 0x3f50
movq %rax, %rbx
jmp 0x3f11
movq %rax, %rbx
cmpl $0x1, %edx
jne 0x3eeb
movq %rbx, %rdi
callq 0x20b0
movq 0x420d(%rip), %rdi      # 0x7fe8
leaq 0x1701(%rip), %rsi      # 0x54e3
movl $0x1d, %edx
callq 0x2200
movq -0x78(%rbp), %rax
movq 0x18(%rax), %rsi
movq 0x20(%rax), %rdx
movq 0x41e9(%rip), %rdi      # 0x7fe8
callq 0x2200
leaq 0x16f6(%rip), %rsi      # 0x5501
movl $0x3, %edx
movq %rax, %rdi
callq 0x2200
movq 0x41c9(%rip), %rdi      # 0x7fe8
leaq 0x16df(%rip), %rsi      # 0x5505
movl $0x19, %edx
callq 0x2200
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq 0x41a3(%rip), %rdi      # 0x7fe8
callq 0x2200
leaq 0x16ce(%rip), %rsi      # 0x551f
movl $0xc, %edx
movq %rax, %rdi
callq 0x2200
movq 0x4183(%rip), %rdi      # 0x7fe8
leaq 0x16c0(%rip), %rsi      # 0x552c
movl $0x7, %edx
callq 0x2200
movq 0x416b(%rip), %rdi      # 0x7fe8
movq -0x58(%rbp), %rsi
callq 0x2140
movq %rax, %rbx
leaq 0x16a4(%rip), %rsi      # 0x5534
movl $0x8, %edx
movq %rax, %rdi
callq 0x2200
movq -0x68(%rbp), %rsi
subq -0x70(%rbp), %rsi
sarq $0x3, %rsi
incq %rsi
movq %rbx, %rdi
callq 0x2140
leaq 0x1684(%rip), %rsi      # 0x553f
movl $0x1, %edx
movq %rax, %rdi
callq 0x2200
callq 0x2230
movq %rax, %rbx
callq 0x22a0
jmp 0x3eeb
movq %rax, %rdi
callq 0x4046
movq %rax, %rbx
leaq -0x40(%rbp), %r15
jmp 0x3f11
movq %rax, %rbx
leaq -0x40(%rbp), %r15
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x3f11
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x21e0
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x3f3b
movq -0x40(%rbp), %rsi
incq %rsi
jmp 0x3f36
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3f3b
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x21e0
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x3f50
movq -0x60(%rbp), %rsi
subq %rdi, %rsi
callq 0x21e0
leaq -0x2c0(%rbp), %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x22e0