// File: /workspace/github_cpp_makefile_star2_O2/canzarlab[P]Trajan/src/read_csv.cpp
// Function: CSVReader::getDoubleData(int, int)
std::vector<std::vector<double> > CSVReader::getDoubleData(int from_row, int to_row)
{
    vector<vector<double> > data;
    ifstream inputFile(fileName);
    int l = 0; // 0
    int count =0;
 
    while (inputFile) {
        if (count >= to_row) break;
        l++;
        string s;
        if (!getline(inputFile, s)) break;
        if (s[0] != '#') {
            istringstream ss(s);
            vector<double> record;
            int removefist = 0;
            
            while (ss) {
                string line;
                if (!getline(ss, line, ','))
                {
                    break;
                }
                try {
                    if (removefist >= 0){ // matrix
                        record.push_back(stod(line));
                    }    
                    
                    else
                        removefist++;
                }
                catch (const std::invalid_argument e) {
                    cout << "NaN found in file " << fileName << " line " << l
                         << endl;
                    e.what();
                }
            }
            if (count >= from_row)
                data.push_back(record);
            count ++;
        }
    }
 
    if (!inputFile.eof()) {
        cerr << "Could not read file " << fileName << "\n";
        __throw_invalid_argument("File not found.");
    }
 
    return data;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movl %ecx, 0xc(%rsp)
movl %edx, 0x8(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, (%rsp)
andq $0x0, 0x10(%rdi)
leaq 0x90(%rsp), %rdi
pushq $0x8
popq %rdx
movq %rsi, 0x10(%rsp)
callq 0x3360
xorl %r12d, %r12d
leaq 0x298(%rsp), %rbx
leaq 0x50(%rsp), %r15
leaq 0x70(%rsp), %rbp
xorl %r14d, %r14d
movq 0x90(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xb0(%rsp,%rax)
jne 0x7eb8
cmpl 0xc(%rsp), %r14d
jge 0x7eb8
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
andq $0x0, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x3070
incl %r12d
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x20(%rax,%rcx), %r13d
testb $0x5, %r13b
jne 0x7e98
movq 0x28(%rsp), %rax
cmpb $0x23, (%rax)
je 0x7e98
movq %rbx, %rdi
leaq 0x28(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x33b0
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
andq $0x0, 0x80(%rsp)
movq 0x298(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x2b8(%rsp,%rax)
jne 0x7e72
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
andq $0x0, 0x58(%rsp)
movb $0x0, 0x60(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
pushq $0x2c
popq %rdx
callq 0x3410
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x7e6a
movq %r15, %rdi
xorl %esi, %esi
callq 0x80ce
movsd %xmm0, 0x18(%rsp)
movq %rbp, %rdi
leaq 0x18(%rsp), %rsi
callq 0x9b56
movq %r15, %rdi
callq 0x3100
jmp 0x7d67
cmpl $0x1, %edx
jne 0x7f54
movq %rax, %rdi
movq %rax, 0x48(%rsp)
callq 0x3280
leaq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x8114
movq 0x48(%rsp), %rdi
callq 0x30e0
movq 0x81bf(%rip), %rdi      # 0xffd0
leaq 0x23f8(%rip), %rsi      # 0xa210
callq 0x3210
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x3200
movq %rax, %rdi
leaq 0x23ef(%rip), %rsi      # 0xa223
callq 0x3210
movq %rax, %rdi
movl %r12d, %esi
callq 0x33d0
movq %rax, %rdi
callq 0x3120
leaq 0x18(%rsp), %rdi
callq 0x3320
leaq 0x18(%rsp), %rdi
callq 0x3390
callq 0x3380
jmp 0x7dd3
movq %r15, %rdi
callq 0x3100
cmpl 0x8(%rsp), %r14d
jl 0x7e85
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0x80e8
incl %r14d
movq %rbp, %rdi
callq 0x79a8
movq %rbx, %rdi
callq 0x3110
leaq 0x28(%rsp), %rdi
callq 0x3100
testb $0x5, %r13b
je 0x7cd3
movq 0x90(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xb0(%rsp,%rax)
je 0x7ee5
leaq 0x90(%rsp), %rdi
callq 0x3090
movq (%rsp), %rax
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8104(%rip), %rdi      # 0xfff0
leaq 0x2337(%rip), %rsi      # 0xa22a
callq 0x3210
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x3200
leaq 0x215b(%rip), %rsi      # 0xa067
movq %rax, %rdi
callq 0x3210
leaq 0x2324(%rip), %rdi      # 0xa23f
callq 0x3170
jmp 0x7f54
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x3390
callq 0x3380
jmp 0x7f57
movq %rax, %rdi
callq 0x5b54
movq %rax, %rbx
jmp 0x7f82
movq %rax, %rbx
jmp 0x7f8f
movq %rax, %rbx
jmp 0x7f61
jmp 0x7f4f
movq %rax, %rbx
jmp 0x7f78
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x3100
leaq 0x70(%rsp), %rdi
callq 0x79a8
leaq 0x298(%rsp), %rdi
callq 0x3110
leaq 0x28(%rsp), %rdi
callq 0x3100
leaq 0x90(%rsp), %rdi
callq 0x3090
movq (%rsp), %rdi
callq 0x5a94
movq %rbx, %rdi
callq 0x33e0