// File: /workspace/github_cpp_makefile_star2_O2/Krymancer[P]Matrix-cpp/src/Matrix.cpp
// Function: Matrix::Matrix(char const*)
Matrix::Matrix(const char *fileName) {
    std::ifstream file_A(fileName);
    int colSize = 0;
    int rowSize = 0;
    std::string line_A;
    int idx = 0;
    double element_A;
    double *vector_A = nullptr;

    if (fileName == "Error") {
        std::cout << "The dimentions of Matrix are wrong for this operation!\n";
    } else {
        if (file_A.is_open() && file_A.good()) {
            // cout << "File A.txt is open. \n";
            while (getline(file_A, line_A)) {
                rowSize += 1;
                std::stringstream stream_A(line_A);
                colSize = 0;
                while (1) {
                    stream_A >> element_A;
                    if (!stream_A)
                        break;
                    colSize += 1;
                    double *tempArr = new double[idx + 1];
                    std::copy(vector_A, vector_A + idx, tempArr);
                    tempArr[idx] = element_A;
                    vector_A = tempArr;
                    idx += 1;
                }
            }
        } else {
            std::cout << " Failed to open.\n";
        }
    }
    int j;
    idx = 0;
    data.resize(rowSize);
    for (unsigned i = 0; i < data.size(); i++) {
        data[i].resize(colSize);
    }
    for (int i = 0; i < rowSize; i++) {
        for (j = 0; j < colSize; j++) {
            this->data[i][j] = vector_A[idx];
            idx++;
        }
    }
    cols = colSize;
    rows = rowSize;
    delete[] vector_A;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3d8, %rsp            # imm = 0x3D8
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8(%rdi), %rax
movq %rax, -0x40(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
andq $0x0, 0x18(%rdi)
leaq -0x400(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x2300
leaq -0x60(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x4ace(%rip), %rax      # 0x705c
cmpq %rax, %rbx
je 0x26bd
leaq -0x388(%rbp), %rdi
callq 0x2060
leaq 0x4af0(%rip), %rsi      # 0x709a
testb %al, %al
je 0x26c4
movq -0x400(%rbp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, -0x3e0(%rbp,%rax)
jne 0x26c4
movq $0x0, -0x30(%rbp)
xorl %ebx, %ebx
xorl %r12d, %r12d
xorl %r13d, %r13d
movq %r14, -0x48(%rbp)
leaq -0x400(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2050
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x27a9
leaq -0x1f8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x18
popq %rdx
callq 0x2270
incl %ebx
movslq %r12d, %r12
leaq (,%r12,8), %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x30(%rbp)
leaq -0x1f8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2120
movq -0x1f8(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x1d8(%rbp,%rax)
jne 0x26a8
movq %r13, %r14
movq -0x38(%rbp), %rax
leaq 0x8(%rax), %r13
cmpq $-0x1, %r12
movq %r13, %rdi
pushq $-0x1
popq %rax
cmovlq %rax, %rdi
callq 0x2030
movq %rax, %r15
testq %r12, %r12
je 0x2687
movq %r15, %rdi
movq %r14, %rsi
movq -0x38(%rbp), %rdx
callq 0x2290
movsd -0x50(%rbp), %xmm0
movsd %xmm0, (%r15,%r12,8)
incq %r12
movq -0x30(%rbp), %rax
incl %eax
movq %rax, -0x30(%rbp)
movq %r13, -0x38(%rbp)
movq %r15, %r13
jmp 0x262d
leaq -0x1f8(%rbp), %rdi
callq 0x2160
movq -0x48(%rbp), %r14
jmp 0x25df
leaq 0x499e(%rip), %rsi      # 0x7062
movq 0x890d(%rip), %rdi      # 0xafd8
callq 0x21b0
xorl %r12d, %r12d
xorl %ebx, %ebx
xorl %r13d, %r13d
movq %r13, -0x30(%rbp)
movl %ebx, -0x38(%rbp)
movl %ebx, %r15d
movq -0x40(%rbp), %rdi
movq %r15, %rsi
callq 0x38fc
movq %r12, %rbx
movslq %r12d, %r12
xorl %r13d, %r13d
movl %r13d, %r13d
movq 0x8(%r14), %rdi
movq 0x10(%r14), %rax
subq %rdi, %rax
cqto
pushq $0x18
popq %rcx
idivq %rcx
cmpq %r13, %rax
jbe 0x2726
imulq $0x18, %r13, %rax
addq %rax, %rdi
movq %r12, %rsi
callq 0x39a4
incl %r13d
jmp 0x26f7
movq %rbx, %r11
movl %r11d, %eax
xorl %ecx, %ecx
xorl %edx, %edx
movq -0x30(%rbp), %rbx
cmpq %r15, %rcx
je 0x276b
imulq $0x18, %rcx, %rsi
addq %rdi, %rsi
movslq %edx, %rdx
leaq (%rbx,%rdx,8), %r9
xorl %r8d, %r8d
cmpq %r8, %rax
je 0x2763
movsd (%r9,%r8,8), %xmm0
movq (%rsi), %r10
movsd %xmm0, (%r10,%r8,8)
incq %r8
jmp 0x274a
incq %rcx
addq %r8, %rdx
jmp 0x2734
movl %r11d, 0x4(%r14)
movl -0x38(%rbp), %eax
movl %eax, (%r14)
testq %rbx, %rbx
je 0x2782
movq %rbx, %rdi
callq 0x2210
leaq -0x70(%rbp), %rdi
callq 0x20c0
leaq -0x400(%rbp), %rdi
callq 0x2070
addq $0x3d8, %rsp            # imm = 0x3D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x30(%rbp), %r12
jmp 0x26d8
jmp 0x27bf
jmp 0x27bf
movq %rax, %rbx
jmp 0x27ea
jmp 0x27bf
jmp 0x27bf
movq %rax, %rbx
jmp 0x27d5
jmp 0x27c6
movq %rax, %rbx
leaq -0x1f8(%rbp), %rdi
callq 0x2160
leaq -0x70(%rbp), %rdi
callq 0x20c0
leaq -0x400(%rbp), %rdi
callq 0x2070
movq -0x40(%rbp), %rdi
callq 0x3978
movq %rbx, %rdi
callq 0x22c0
nop