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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rsi, -0x50(%rbp)
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x8(%rbp)
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movl %edx, -0x24(%rbp)
movl %ecx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq -0x18(%rbp), %rdi
movq %rdi, -0x60(%rbp)
addq $0x18, %rdi
movq %rdi, -0x58(%rbp)
callq 0x3510
movq -0x60(%rbp), %rax
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
movl -0x24(%rbp), %ecx
movl %ecx, (%rax)
movl -0x28(%rbp), %ecx
movl %ecx, 0x4(%rax)
callq 0x3040
jmp 0x194ce
movl -0x24(%rbp), %eax
imull -0x28(%rbp), %eax
cmpl $0x0, %eax
jne 0x194fc
movq -0x60(%rbp), %rax
movq $0x0, 0x10(%rax)
jmp 0x197ef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x197f8
movq -0x50(%rbp), %rdi
leaq 0x1efe(%rip), %rsi      # 0x1b405
callq 0xafa0
movb %al, -0x61(%rbp)
jmp 0x19511
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x1951d
jmp 0x197ef
movq -0x60(%rbp), %rax
movq $0x0, 0x8(%rax)
movslq -0x24(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x3030
movq %rax, -0x70(%rbp)
jmp 0x1954e
movq -0x60(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x197ed
movslq -0x28(%rbp), %rax
movq %rax, -0x88(%rbp)
movl $0x10, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
movq %rdi, -0x80(%rbp)
callq 0x3030
movq %rax, -0x78(%rbp)
jmp 0x1959d
movq -0x88(%rbp), %rax
cmpq $0x0, %rax
je 0x19606
movq -0x78(%rbp), %rax
movq -0x88(%rbp), %rdx
shlq $0x4, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x98(%rbp)
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x19810
jmp 0x195e8
movq -0x98(%rbp), %rcx
movq -0xa0(%rbp), %rax
addq $0x10, %rax
cmpq %rcx, %rax
movq %rax, -0x90(%rbp)
jne 0x195cd
movq -0x78(%rbp), %rdx
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x40(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x197dd
movl -0x2c(%rbp), %eax
movq %rax, -0xa8(%rbp)
subq $0x4, %rax
ja 0x197cd
movq -0xa8(%rbp), %rax
leaq 0x1d75(%rip), %rcx      # 0x1b3c4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0x36d0
jmp 0x197f8
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x44(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
xorps %xmm0, %xmm0
callq 0x19840
jmp 0x1969b
jmp 0x197cd
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x44(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movsd 0x1cbd(%rip), %xmm0     # 0x1b380
callq 0x19840
jmp 0x196ca
jmp 0x197cd
movslq -0x40(%rbp), %rax
movq %rax, -0xc8(%rbp)
movslq -0x44(%rbp), %rcx
movq %rcx, -0xc0(%rbp)
subl %ecx, %eax
movsd 0x1c91(%rip), %xmm0     # 0x1b380
xorps %xmm1, %xmm1
movsd %xmm1, -0xb8(%rbp)
movsd %xmm0, -0xb0(%rbp)
je 0x19714
movsd -0xb8(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movq -0xc0(%rbp), %rax
movq -0xc8(%rbp), %rdx
movq -0x60(%rbp), %rcx
movsd -0xb0(%rbp), %xmm0
movq 0x10(%rcx), %rcx
movq (%rcx,%rdx,8), %rdi
shlq $0x4, %rax
addq %rax, %rdi
callq 0x19840
jmp 0x19744
jmp 0x197cd
callq 0x30f0
movl %eax, %ecx
movq -0x60(%rbp), %rax
movslq %ecx, %rdx
imulq $0x431bde83, %rdx, %rdx # imm = 0x431BDE83
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x32, %rdx
addl %esi, %edx
imull $0xf4240, %edx, %edx    # imm = 0xF4240
subl %edx, %ecx
cvtsi2sd %ecx, %xmm0
movsd 0x1bf9(%rip), %xmm1     # 0x1b378
divsd %xmm1, %xmm0
movq 0x10(%rax), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x44(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
callq 0x19840
jmp 0x197a1
jmp 0x197cd
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x10(%rbp), %rcx
movq %rcx, (%rax)
movq -0x8(%rbp), %rcx
movq %rcx, 0x8(%rax)
jmp 0x197cf
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x19621
jmp 0x197df
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x19561
jmp 0x197ef
addq $0xd0, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x3270
movq -0x38(%rbp), %rdi
callq 0x3630
nopw (%rax,%rax)