// File: bothaynahazem[P]AsuMathLabG13/Matrix2017.cpp
// Function: Matrix::Matrix(int, int, int, double)
Matrix::Matrix(int nRows, int nColumns, int initialization, double initializationValue)
{
	this->nRows = nRows;
	this->nColumns = nColumns;
	cvalues=NULL;
	if ((nRows*nColumns) == 0)
	{
		values = NULL;
		return;
	}
	values = new double*[nRows];
	for (int iR = 0;iR<nRows;iR++)
	{
		values[iR] = new double[nColumns];
		for (int iC = 0;iC<nColumns;iC++)
		{
			switch (initialization)
			{
			case MI_ZEROS:
				values[iR][iC] = 0;
				break;
			case MI_ONES:
				values[iR][iC] = 1;
				break;
			case MI_EYE:
				values[iR][iC] = (iR == iC) ? 1 : 0;
				break;
			case MI_RAND: values[iR][iC] = (rand() % 1000000) / 1000000.0;
				break;
			case MI_VALUE:
				values[iR][iC] = initializationValue;
				break;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movsd %xmm0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x40(%rbp)
addq $0x18, %rdi
movq %rdi, -0x48(%rbp)
callq 0x3510
movq -0x40(%rbp), %rax
movl -0xc(%rbp), %ecx
movl %ecx, (%rax)
movl -0x10(%rbp), %ecx
movl %ecx, 0x4(%rax)
movq $0x0, 0x10(%rax)
movl -0xc(%rbp), %eax
imull -0x10(%rbp), %eax
cmpl $0x0, %eax
jne 0xe823
movq -0x40(%rbp), %rax
movq $0x0, 0x8(%rax)
jmp 0xe9e0
movslq -0xc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x3030
movq %rax, -0x50(%rbp)
jmp 0xe848
movq -0x40(%rbp), %rax
movq -0x50(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xe9e0
movslq -0x10(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x3030
movq %rax, -0x58(%rbp)
jmp 0xe88c
movq -0x58(%rbp), %rdx
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0xe9d0
movl -0x14(%rbp), %eax
movq %rax, -0x60(%rbp)
subq $0x4, %rax
ja 0xe9c0
movq -0x60(%rbp), %rax
leaq 0xcae1(%rip), %rcx      # 0x1b3b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x3270
jmp 0xe9e6
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x34(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0xe9c0
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x34(%rbp), %rcx
movsd 0xca51(%rip), %xmm0     # 0x1b380
movsd %xmm0, (%rax,%rcx,8)
jmp 0xe9c0
movq -0x40(%rbp), %rax
movl -0x30(%rbp), %esi
movl -0x34(%rbp), %edi
xorl %ecx, %ecx
movl $0x1, %edx
cmpl %edi, %esi
cmovel %edx, %ecx
cvtsi2sd %ecx, %xmm0
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x34(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0xe9c0
callq 0x30f0
movl $0xf4240, %ecx          # imm = 0xF4240
cltd
idivl %ecx
movq -0x40(%rbp), %rax
cvtsi2sd %edx, %xmm0
movsd 0xc9f1(%rip), %xmm1     # 0x1b378
divsd %xmm1, %xmm0
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x34(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0xe9c0
movq -0x40(%rbp), %rax
movsd -0x20(%rbp), %xmm0
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x34(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0xe9c2
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xe8a7
jmp 0xe9d2
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xe85b
addq $0x60, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x3630
nop