// File: /workspace/github_cpp_makefile_star2_O1/bothaynahazem[P]AsuMathLabG13/Matrix2017.cpp
// Function: Matrix::mul(Matrix&)
void Matrix::mul(Matrix& m)
{
	if(this->type=="complex"&& m.type=="complex"){

	if (nColumns != m.nRows) //that's how matrices are multiplied
		throw("Invalid matrix dimension for multiplication");

	Matrix r("complex",nRows, m.nColumns); //the dim of the product matrix

	for (int iR = 0; iR<r.nRows; iR++)
	{
		for (int iC = 0; iC < r.nColumns; iC++)
		{
			r.cvalues[iR][iC] = 0; //initializing this particular element of the matrix with zero

			for (int k = 0; k < m.nColumns; k++)
				r.cvalues[iR][iC] += cvalues[iR][k] * m.cvalues[k][iC];
		}
	}
 copy(r);
}
else if(this->type=="complex" && m.type!="complex"){

	if (nColumns != m.nRows) //that's how matrices are multiplied
		throw("Invalid matrix dimension for multiplication");

	Matrix r("complex",nRows, m.nColumns); //the dim of the product matrix

	for (int iR = 0; iR<r.nRows; iR++)
	{
		for (int iC = 0; iC < r.nColumns; iC++)
		{
			r.cvalues[iR][iC] = 0; //initializing this particular element of the matrix with zero

			for (int k = 0; k < m.nColumns; k++)
				r.cvalues[iR][iC] += cvalues[iR][k] * m.values[k][iC];
		}
	}
 copy(r);
}
else if(this->type!="complex" && m.type=="complex"){

	if (nColumns != m.nRows) //that's how matrices are multiplied
		throw("Invalid matrix dimension for multiplication");

	Matrix r("complex",nRows, m.nColumns); //the dim of the product matrix

	for (int iR = 0; iR<r.nRows; iR++)
	{
		for (int iC = 0; iC < r.nColumns; iC++)
		{
			r.cvalues[iR][iC] = 0; //initializing this particular element of the matrix with zero

			for (int k = 0; k < m.nColumns; k++)
				r.cvalues[iR][iC] += values[iR][k] * m.cvalues[k][iC];
		}
	}
 copy(r);
}
else{
	if (nColumns != m.nRows) //that's how matrices are multiplied
		throw("Invalid matrix dimension for multiplication");

	Matrix r(nRows, m.nColumns); //the dim of the product matrix

	for (int iR = 0; iR<r.nRows; iR++)
	{
		for (int iC = 0; iC < r.nColumns; iC++)
		{
			r.values[iR][iC] = 0; //initializing this particular element of the matrix with zero

			for (int k = 0; k < m.nColumns; k++)
				r.values[iR][iC] += values[iR][k] * m.values[k][iC];
		}
	}

	copy(r);
}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, %rbx
movq %rdi, %r13
leaq 0x18(%rdi), %r15
leaq 0x510a(%rip), %rsi      # 0x111f5
movq %r15, %rdi
callq 0x30e0
testl %eax, %eax
movq %rbx, -0x30(%rbp)
jne 0xc113
leaq 0x18(%rbx), %rdi
leaq 0x50ef(%rip), %rsi      # 0x111f5
callq 0x30e0
testl %eax, %eax
je 0xc48f
leaq 0x50db(%rip), %rsi      # 0x111f5
movq %r15, %rdi
callq 0x30e0
testl %eax, %eax
je 0xc209
leaq 0x50c4(%rip), %rsi      # 0x111f5
movq %r15, %rdi
callq 0x30e0
testl %eax, %eax
movq -0x30(%rbp), %rbx
je 0xc159
leaq 0x18(%rbx), %rdi
leaq 0x50a9(%rip), %rsi      # 0x111f5
callq 0x30e0
testl %eax, %eax
je 0xc367
movl 0x4(%r13), %eax
cmpl (%rbx), %eax
jne 0xc60b
movl (%r13), %esi
movl 0x4(%rbx), %edx
leaq -0x68(%rbp), %r15
xorpd %xmm0, %xmm0
movq %r15, %rdi
xorl %ecx, %ecx
callq 0xa1a2
movslq (%r15), %rax
testq %rax, %rax
jle 0xc1f8
movl -0x64(%rbp), %ecx
movq -0x60(%rbp), %rdx
movq -0x30(%rbp), %rsi
movl 0x4(%rsi), %esi
xorl %edi, %edi
testl %ecx, %ecx
jle 0xc1f0
movq (%rdx,%rdi,8), %r8
movq 0x8(%r13), %r9
movq -0x30(%rbp), %r10
movq 0x8(%r10), %r10
xorl %r11d, %r11d
movq $0x0, (%r8,%r11,8)
testl %esi, %esi
jle 0xc1e8
movq (%r9,%rdi,8), %rbx
movsd (%r8,%r11,8), %xmm0
xorl %r15d, %r15d
movsd (%rbx,%r15,8), %xmm1
movq (%r10,%r15,8), %r12
mulsd (%r12,%r11,8), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, (%r8,%r11,8)
incq %r15
cmpq %r15, %rsi
jne 0xc1c6
incq %r11
cmpq %rcx, %r11
jne 0xc1ad
incq %rdi
cmpq %rax, %rdi
jne 0xc196
leaq -0x68(%rbp), %rsi
movq %r13, %rdi
callq 0xa54e
jmp 0xc5f0
movq -0x30(%rbp), %rax
leaq 0x18(%rax), %rdi
leaq 0x4fdd(%rip), %rsi      # 0x111f5
callq 0x30e0
testl %eax, %eax
je 0xc12a
movl 0x4(%r13), %eax
movq -0x30(%rbp), %rcx
cmpl (%rcx), %eax
jne 0xc60b
leaq -0xb8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x4fae(%rip), %rsi      # 0x111f5
leaq 0x4fae(%rip), %rdx      # 0x111fc
leaq -0xc8(%rbp), %rdi
callq 0x9334
movl (%r13), %edx
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
leaq -0x68(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
xorl %r8d, %r8d
callq 0x10518
movq -0xc8(%rbp), %rdi
cmpq %r15, %rdi
je 0xc29b
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x3300
cmpl $0x0, -0x68(%rbp)
movq -0x30(%rbp), %r10
jle 0xc356
xorl %eax, %eax
xorpd %xmm0, %xmm0
cmpl $0x0, -0x64(%rbp)
jle 0xc346
xorl %ecx, %ecx
movq -0x58(%rbp), %rdx
movq (%rdx,%rax,8), %rsi
movq %rcx, %rdx
shlq $0x4, %rdx
movupd %xmm0, (%rsi,%rdx)
cmpl $0x0, 0x4(%r10)
jle 0xc336
movl $0x8, %esi
xorl %edi, %edi
movq 0x10(%r13), %r8
movq (%r8,%rax,8), %r8
movq 0x8(%r10), %r9
movq (%r9,%rdi,8), %r9
movsd (%r9,%rcx,8), %xmm1
movsd -0x8(%r8,%rsi), %xmm2
mulsd %xmm1, %xmm2
mulsd (%r8,%rsi), %xmm1
movq -0x58(%rbp), %r8
movq (%r8,%rax,8), %r8
addsd (%r8,%rdx), %xmm2
addsd 0x8(%r8,%rdx), %xmm1
movsd %xmm2, (%r8,%rdx)
movsd %xmm1, 0x8(%r8,%rdx)
incq %rdi
movslq 0x4(%r10), %r8
addq $0x10, %rsi
cmpq %r8, %rdi
jl 0xc2dd
incq %rcx
movslq -0x64(%rbp), %rdx
cmpq %rdx, %rcx
jl 0xc2bb
incq %rax
movslq -0x68(%rbp), %rcx
cmpq %rcx, %rax
jl 0xc2af
leaq -0x68(%rbp), %rsi
movq %r13, %rdi
callq 0xa54e
jmp 0xc5f0
movl 0x4(%r13), %eax
cmpl (%rbx), %eax
jne 0xc60b
leaq -0x98(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x4e70(%rip), %rsi      # 0x111f5
leaq 0x4e70(%rip), %rdx      # 0x111fc
leaq -0xa8(%rbp), %rdi
callq 0x9334
movl (%r13), %edx
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
leaq -0x68(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
xorl %r8d, %r8d
callq 0x10518
movq -0xa8(%rbp), %rdi
cmpq %r15, %rdi
je 0xc3d9
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x3300
cmpl $0x0, -0x68(%rbp)
movq -0x30(%rbp), %r9
jle 0xc47e
xorl %eax, %eax
xorpd %xmm0, %xmm0
cmpl $0x0, -0x64(%rbp)
jle 0xc46e
xorl %ecx, %ecx
movq -0x58(%rbp), %rdx
movq (%rdx,%rax,8), %rsi
movq %rcx, %rdx
shlq $0x4, %rdx
movupd %xmm0, (%rsi,%rdx)
cmpl $0x0, 0x4(%r9)
jle 0xc462
xorl %esi, %esi
movq 0x8(%r13), %rdi
movq (%rdi,%rax,8), %rdi
movq 0x10(%r9), %r8
movq (%r8,%rsi,8), %r8
movsd (%rdi,%rsi,8), %xmm1
movsd (%r8,%rdx), %xmm2
mulsd %xmm1, %xmm2
mulsd 0x8(%r8,%rdx), %xmm1
movq -0x58(%rbp), %rdi
movq (%rdi,%rax,8), %rdi
addsd (%rdi,%rdx), %xmm2
addsd 0x8(%rdi,%rdx), %xmm1
movsd %xmm2, (%rdi,%rdx)
movsd %xmm1, 0x8(%rdi,%rdx)
incq %rsi
movslq 0x4(%r9), %rdi
cmpq %rdi, %rsi
jl 0xc412
incq %rcx
movslq -0x64(%rbp), %rdx
cmpq %rdx, %rcx
jl 0xc3f5
incq %rax
movslq -0x68(%rbp), %rcx
cmpq %rcx, %rax
jl 0xc3ed
leaq -0x68(%rbp), %rsi
movq %r13, %rdi
callq 0xa54e
jmp 0xc5f0
movl 0x4(%r13), %eax
cmpl (%rbx), %eax
jne 0xc60b
leaq -0xd8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x4d48(%rip), %rsi      # 0x111f5
leaq 0x4d48(%rip), %rdx      # 0x111fc
leaq -0xe8(%rbp), %rdi
callq 0x9334
movl (%r13), %edx
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
leaq -0x68(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
xorl %r8d, %r8d
callq 0x10518
movq %r13, -0x70(%rbp)
movq -0xe8(%rbp), %rdi
cmpq %r15, %rdi
je 0xc505
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x3300
cmpl $0x0, -0x68(%rbp)
movq -0x30(%rbp), %rcx
jle 0xc5e3
xorl %edx, %edx
leaq -0x80(%rbp), %r14
cmpl $0x0, -0x64(%rbp)
jle 0xc5d3
xorl %r12d, %r12d
movq -0x58(%rbp), %rax
movq (%rax,%rdx,8), %rax
movq %r12, -0x88(%rbp)
shlq $0x4, %r12
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax,%r12)
cmpl $0x0, 0x4(%rcx)
jle 0xc5bc
xorl %r15d, %r15d
xorl %ebx, %ebx
movq -0x70(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax,%rdx,8), %rax
movq 0x10(%rcx), %rcx
movq (%rcx,%r15), %rsi
addq %r12, %rsi
movups (%rax,%r15,2), %xmm0
movaps %xmm0, -0x80(%rbp)
movq %r14, %rdi
movq %rdx, %r13
callq 0x10788
movq %r13, %rdx
movq -0x30(%rbp), %rcx
movsd -0x80(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
movq -0x58(%rbp), %rax
movq (%rax,%r13,8), %rax
addsd (%rax,%r12), %xmm0
addsd 0x8(%rax,%r12), %xmm1
movsd %xmm0, (%rax,%r12)
movsd %xmm1, 0x8(%rax,%r12)
incq %rbx
movslq 0x4(%rcx), %rax
addq $0x8, %r15
cmpq %rax, %rbx
jl 0xc54e
movq -0x88(%rbp), %r12
incq %r12
movslq -0x64(%rbp), %rax
cmpq %rax, %r12
jl 0xc526
incq %rdx
movslq -0x68(%rbp), %rax
cmpq %rax, %rdx
jl 0xc519
leaq -0x68(%rbp), %rsi
movq -0x70(%rbp), %rdi
callq 0xa54e
leaq -0x68(%rbp), %rdi
callq 0xa0be
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x3170
leaq 0x4c42(%rip), %rcx      # 0x1125e
movq %rcx, (%rax)
movq 0x999a(%rip), %rsi      # 0x15fc0
movq %rax, %rdi
xorl %edx, %edx
callq 0x34d0
jmp 0xc68f
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
cmpq %r15, %rdi
je 0xc69b
movq -0xd8(%rbp), %rsi
jmp 0xc680
jmp 0xc68a
jmp 0xc68f
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r15, %rdi
je 0xc69b
movq -0x98(%rbp), %rsi
jmp 0xc680
jmp 0xc68a
jmp 0xc68f
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r15, %rdi
je 0xc69b
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x3300
jmp 0xc69b
movq %rax, %rbx
jmp 0xc69b
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0xa0be
movq %rbx, %rdi
callq 0x3520
nop