// File: /workspace/github_cpp_makefile_star2_O1/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 0x29c6
movq 0x70(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x90(%rsp,%rax)
jne 0x29c6
movq 0x278(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x298(%rsp,%rax)
jne 0x29c6
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x3ba6(%rip), %rdx      # 0x627b
leaq 0x20(%rsp), %rdi
movq %rdx, %rsi
callq 0x3f68
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 0x276f
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 0x2751
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x10(%rbx)
jmp 0x275c
movq %r13, %rdi
movq %r12, %rdx
callq 0x3ff8
movq 0x70(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x90(%rsp,%rax)
je 0x2719
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 0x282e
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 0x2996
leaq -0x80000000(%rax), %rcx
cmpq %r14, %rcx
jb 0x29a2
movl (%r12), %ecx
cmpl $0x22, %ecx
je 0x29a2
testl %ecx, %ecx
jne 0x27fd
movl %r13d, (%r12)
movl %eax, 0xc(%rsp)
movq 0x28(%rbx), %rsi
cmpq 0x30(%rbx), %rsi
je 0x281a
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rbx)
jmp 0x2783
movq 0x68(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x411c
jmp 0x2783
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 0x28de
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 0x29ae
leaq -0x80000000(%rax), %rcx
cmpq %r14, %rcx
jb 0x29ba
movl (%r12), %ecx
cmpl $0x22, %ecx
je 0x29ba
testl %ecx, %ecx
jne 0x28ad
movl %r13d, (%r12)
movl %eax, 0xc(%rsp)
movq 0x40(%rbx), %rsi
cmpq 0x48(%rbx), %rsi
je 0x28ca
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x40(%rbx)
jmp 0x2833
movq 0x60(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x411c
jmp 0x2833
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
leaq 0x30(%rsp), %r14
leaq 0x50(%rsp), %r8
je 0x292f
sarq $0x2, %rcx
movl 0x4(%rbx), %esi
movl $0x1, %edx
movl -0x4(%rax,%rdx,4), %edi
cmpl %esi, %edi
jle 0x2925
movl %edi, 0x4(%rbx)
movl %edi, %esi
movl %edx, %edi
incq %rdx
cmpq %rdi, %rcx
ja 0x2918
incl 0x4(%rbx)
movq 0x40(%rsp), %rdi
cmpq %r8, %rdi
je 0x2949
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x2960
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 0x36b7(%rip), %rdi      # 0x6054
callq 0x20d0
leaq 0x36ab(%rip), %rdi      # 0x6054
callq 0x2220
leaq 0x369f(%rip), %rdi      # 0x6054
callq 0x20d0
leaq 0x3693(%rip), %rdi      # 0x6054
callq 0x2220
movq 0x660b(%rip), %rdi      # 0x8fd8
leaq 0x366c(%rip), %rsi      # 0x6040
movl $0x13, %edx
callq 0x21c0
movq 0x65f3(%rip), %rdi      # 0x8fd8
callq 0x20a0
movl $0x1, %edi
callq 0x21d0
jmp 0x2a10
movq %rax, %r14
jmp 0x2a84
movq %rax, %r14
jmp 0x2a8e
movq %rax, %r14
jmp 0x2a9b
jmp 0x2a19
movq %rax, %r14
jmp 0x2a77
jmp 0x2a25
jmp 0x2a25
movq %rax, %r14
leaq 0x30(%rsp), %r15
jmp 0x2a49
jmp 0x2a25
movq %rax, %r14
jmp 0x2a3a
jmp 0x2a2c
movq %rax, %r14
cmpl $0x0, (%r12)
jne 0x2a3a
movl %r13d, (%r12)
movq 0x10(%rsp), %r13
leaq 0x30(%rsp), %r15
leaq 0x50(%rsp), %rbp
movq 0x40(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2a60
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x2a77
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 0x2ab4
movq 0x48(%rbx), %rsi
subq %rdi, %rsi
callq 0x2190
movq 0x68(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x2acd
movq 0x30(%rbx), %rsi
subq %rdi, %rsi
callq 0x2190
movq (%r13), %rdi
testq %rdi, %rdi
je 0x2ae2
movq 0x18(%rbx), %rsi
subq %rdi, %rsi
callq 0x2190
movq %r14, %rdi
callq 0x2270