// File: /workspace/github_cpp_makefile_star2_O3/fanyazhi[P]Spline-Fitting/src/CRSmatrix.cpp
// Function: CRSmatrix::CRSmatrix(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
CRSmatrix::CRSmatrix(std::string valueFilePath, std::string rowPtrFilePath, std::string colIndFilePath) {
    //Read in files
    std::ifstream rowFile, valueFile, colFile;

    rowFile.open(rowPtrFilePath);
    valueFile.open(valueFilePath);
    colFile.open(colIndFilePath);

    // Check if the file is open
    if (!rowFile || !valueFile || !colFile) {
        std::cout << "Unable to open file" << std::endl;
        exit(1);
    }

    // Declare a variable to load the contents from the file
    std::string line = "";

    // Loading the value vector
    std::string myValue;
    while (valueFile.good()) {
        getline(valueFile, myValue, '\n');
        //convert string value to double value
        double myDoubleValue = atof(myValue.c_str());
        value.push_back(myDoubleValue);
    }

    // Loading the row pointer vector
    while (rowFile >> line) {
        int rowNum = stoi(line);
        rowPtr.push_back(rowNum);
    }

    // Loading the column indice vector
    while (colFile >> line) {
        int colIndex = stoi(line);
        colInd.push_back(colIndex);
    }

    //find total number of rows
    rowNum = rowPtr.size() - 1;

    //find total number of columns
    colNum = 0;
    for (unsigned int i = 0; i < colInd.size(); i++) {
        if (colInd[i] > colNum) colNum = colInd[i];
    }
    colNum++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x688, %rsp            # imm = 0x688
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x8(%rdi), %r13
leaq 0x20(%rdi), %rax
movq %rax, 0x68(%rsp)
leaq 0x38(%rdi), %rax
movq %rax, 0x60(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rdi)
movups %xmm0, 0x28(%rdi)
movups %xmm0, 0x18(%rdi)
movups %xmm0, 0x8(%rdi)
movq $0x0, 0x48(%rdi)
leaq 0x480(%rsp), %rdi
callq 0x21b0
leaq 0x70(%rsp), %rdi
callq 0x21b0
leaq 0x278(%rsp), %rdi
callq 0x21b0
leaq 0x480(%rsp), %rdi
movq %r12, %rsi
movl $0x8, %edx
callq 0x2150
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
movl $0x8, %edx
callq 0x2150
leaq 0x278(%rsp), %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x2150
movq 0x480(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x4a0(%rsp,%rax)
jne 0x29e0
movq 0x70(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x90(%rsp,%rax)
jne 0x29e0
movq 0x278(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x298(%rsp,%rax)
jne 0x29e0
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x3bde(%rip), %rdx      # 0x62bb
leaq 0x20(%rsp), %rdi
movq %rdx, %rsi
callq 0x3f9c
leaq 0x50(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq $0x0, -0x8(%rbp)
movb $0x0, (%rbp)
movq 0x70(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x90(%rsp,%rax)
jne 0x2777
leaq 0x70(%rsp), %r14
leaq 0x40(%rsp), %r15
leaq 0x18(%rsp), %r12
movq %r14, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x2290
movq 0x40(%rsp), %rdi
callq 0x21e0
movsd %xmm0, 0x18(%rsp)
movq 0x10(%rbx), %rsi
cmpq 0x18(%rbx), %rsi
je 0x2759
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x10(%rbx)
jmp 0x2764
movq %r13, %rdi
movq %r12, %rdx
callq 0x4032
movq 0x70(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x90(%rsp,%rax)
je 0x2721
movq %r13, 0x10(%rsp)
movabsq $-0x100000000, %r14     # imm = 0xFFFFFFFF00000000
leaq 0x20(%rsp), %rbp
leaq 0x480(%rsp), %rdi
movq %rbp, %rsi
callq 0x21f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2836
movq 0x20(%rsp), %r15
callq 0x2040
movq %rax, %r12
movl (%rax), %r13d
movl $0x0, (%rax)
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
movl $0xa, %edx
callq 0x2200
cmpq %r15, 0x18(%rsp)
je 0x29b0
leaq -0x80000000(%rax), %rcx
cmpq %r14, %rcx
jb 0x29bc
movl (%r12), %ecx
cmpl $0x22, %ecx
je 0x29bc
testl %ecx, %ecx
jne 0x2805
movl %r13d, (%r12)
movl %eax, 0xc(%rsp)
movq 0x28(%rbx), %rsi
cmpq 0x30(%rbx), %rsi
je 0x2822
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rbx)
jmp 0x278b
movq 0x68(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x4156
jmp 0x278b
leaq 0x20(%rsp), %rbp
leaq 0x278(%rsp), %rdi
movq %rbp, %rsi
callq 0x21f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x28e6
movq 0x20(%rsp), %r15
callq 0x2040
movq %rax, %r12
movl (%rax), %r13d
movl $0x0, (%rax)
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
movl $0xa, %edx
callq 0x2200
cmpq %r15, 0x18(%rsp)
je 0x29c8
leaq -0x80000000(%rax), %rcx
cmpq %r14, %rcx
jb 0x29d4
movl (%r12), %ecx
cmpl $0x22, %ecx
je 0x29d4
testl %ecx, %ecx
jne 0x28b5
movl %r13d, (%r12)
movl %eax, 0xc(%rsp)
movq 0x40(%rbx), %rsi
cmpq 0x48(%rbx), %rsi
je 0x28d2
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x40(%rbx)
jmp 0x283b
movq 0x60(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x4156
jmp 0x283b
movq 0x28(%rbx), %rdx
movq 0x38(%rbx), %rax
subq 0x20(%rbx), %rdx
shrq $0x2, %rdx
decl %edx
movq 0x40(%rbx), %rcx
movl %edx, (%rbx)
movl $0x0, 0x4(%rbx)
subq %rax, %rcx
je 0x293a
sarq $0x2, %rcx
xorl %edx, %edx
movl $0x1, %esi
leaq 0x30(%rsp), %r14
leaq 0x50(%rsp), %r8
movl -0x4(%rax,%rsi,4), %edi
cmpl %edx, %edi
jle 0x292c
movl %edi, 0x4(%rbx)
movl %edi, %edx
movl %esi, %edi
incq %rsi
cmpq %rdi, %rcx
ja 0x291f
incl %edx
jmp 0x2949
movl $0x1, %edx
leaq 0x30(%rsp), %r14
leaq 0x50(%rsp), %r8
movl %edx, 0x4(%rbx)
movq 0x40(%rsp), %rdi
cmpq %r8, %rdi
je 0x2963
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x297a
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0x278(%rsp), %rdi
callq 0x2060
leaq 0x70(%rsp), %rdi
callq 0x2060
leaq 0x480(%rsp), %rdi
callq 0x2060
addq $0x688, %rsp            # imm = 0x688
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x369d(%rip), %rdi      # 0x6054
callq 0x20d0
leaq 0x3691(%rip), %rdi      # 0x6054
callq 0x2220
leaq 0x3685(%rip), %rdi      # 0x6054
callq 0x20d0
leaq 0x3679(%rip), %rdi      # 0x6054
callq 0x2220
movq 0x65f1(%rip), %rdi      # 0x8fd8
leaq 0x3652(%rip), %rsi      # 0x6040
movl $0x13, %edx
callq 0x21c0
movq 0x65d9(%rip), %rdi      # 0x8fd8
callq 0x20a0
movl $0x1, %edi
callq 0x21d0
jmp 0x2a2a
movq %rax, %r14
jmp 0x2a9e
movq %rax, %r14
jmp 0x2aa8
movq %rax, %r14
jmp 0x2ab5
jmp 0x2a33
movq %rax, %r14
jmp 0x2a91
jmp 0x2a3f
jmp 0x2a3f
movq %rax, %r14
leaq 0x30(%rsp), %r15
jmp 0x2a63
jmp 0x2a3f
movq %rax, %r14
jmp 0x2a54
jmp 0x2a46
movq %rax, %r14
cmpl $0x0, (%r12)
jne 0x2a54
movl %r13d, (%r12)
movq 0x10(%rsp), %r13
leaq 0x30(%rsp), %r15
leaq 0x50(%rsp), %rbp
movq 0x40(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2a7a
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x2a91
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0x278(%rsp), %rdi
callq 0x2060
leaq 0x70(%rsp), %rdi
callq 0x2060
leaq 0x480(%rsp), %rdi
callq 0x2060
movq 0x60(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x2ace
movq 0x48(%rbx), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0x68(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x2ae7
movq 0x30(%rbx), %rsi
subq %rdi, %rsi
callq 0x2190
movq (%r13), %rdi
testq %rdi, %rdi
je 0x2afc
movq 0x18(%rbx), %rsi
subq %rdi, %rsi
callq 0x2190
movq %r14, %rdi
callq 0x2270