// File: /workspace/github_cpp_makefile_star2_O3/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 0x501a(%rip), %rsi      # 0x111f5
movq %r15, %rdi
callq 0x30e0
testl %eax, %eax
movq %rbx, -0x30(%rbp)
jne 0xc203
leaq 0x18(%rbx), %rdi
leaq 0x4fff(%rip), %rsi      # 0x111f5
callq 0x30e0
testl %eax, %eax
je 0xc585
leaq 0x4feb(%rip), %rsi      # 0x111f5
movq %r15, %rdi
callq 0x30e0
testl %eax, %eax
je 0xc2f7
leaq 0x4fd4(%rip), %rsi      # 0x111f5
movq %r15, %rdi
callq 0x30e0
testl %eax, %eax
movq -0x30(%rbp), %rbx
je 0xc249
leaq 0x18(%rbx), %rdi
leaq 0x4fb9(%rip), %rsi      # 0x111f5
callq 0x30e0
testl %eax, %eax
je 0xc459
movl 0x4(%r13), %eax
cmpl (%rbx), %eax
jne 0xc703
movl (%r13), %esi
movl 0x4(%rbx), %edx
leaq -0x68(%rbp), %r15
xorpd %xmm0, %xmm0
movq %r15, %rdi
xorl %ecx, %ecx
callq 0xa262
movslq (%r15), %rax
testq %rax, %rax
jle 0xc2e6
movl -0x64(%rbp), %ecx
movq -0x60(%rbp), %rdx
movq -0x30(%rbp), %rsi
movl 0x4(%rsi), %esi
xorl %edi, %edi
testl %ecx, %ecx
jle 0xc2de
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 0xc2d6
movq (%r9,%rdi,8), %rbx
xorpd %xmm0, %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 0xc2b4
incq %r11
cmpq %rcx, %r11
jne 0xc29d
incq %rdi
cmpq %rax, %rdi
jne 0xc286
leaq -0x68(%rbp), %rsi
movq %r13, %rdi
callq 0xa5fe
jmp 0xc6e8
movq -0x30(%rbp), %rax
leaq 0x18(%rax), %rdi
leaq 0x4eef(%rip), %rsi      # 0x111f5
callq 0x30e0
testl %eax, %eax
je 0xc21a
movl 0x4(%r13), %eax
movq -0x30(%rbp), %rcx
cmpl (%rcx), %eax
jne 0xc703
leaq -0xb8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x4ec0(%rip), %rsi      # 0x111f5
leaq 0x4ec0(%rip), %rdx      # 0x111fc
leaq -0xc8(%rbp), %rdi
callq 0x93ea
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 0x106da
movq -0xc8(%rbp), %rdi
cmpq %r15, %rdi
je 0xc389
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x3300
movl -0x68(%rbp), %ecx
testl %ecx, %ecx
movq -0x30(%rbp), %r10
jle 0xc448
movl -0x64(%rbp), %edx
xorl %eax, %eax
xorpd %xmm0, %xmm0
testl %edx, %edx
jle 0xc439
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 0xc426
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 0xc3cd
incq %rcx
movslq -0x64(%rbp), %rdx
cmpq %rdx, %rcx
jl 0xc3ab
movl -0x68(%rbp), %ecx
incq %rax
movslq %ecx, %rsi
cmpq %rsi, %rax
jl 0xc3a1
leaq -0x68(%rbp), %rsi
movq %r13, %rdi
callq 0xa5fe
jmp 0xc6e8
movl 0x4(%r13), %eax
cmpl (%rbx), %eax
jne 0xc703
leaq -0x98(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x4d7e(%rip), %rsi      # 0x111f5
leaq 0x4d7e(%rip), %rdx      # 0x111fc
leaq -0xa8(%rbp), %rdi
callq 0x93ea
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 0x106da
movq -0xa8(%rbp), %rdi
cmpq %r15, %rdi
je 0xc4cb
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x3300
movl -0x68(%rbp), %ecx
testl %ecx, %ecx
movq -0x30(%rbp), %r9
jle 0xc574
movl -0x64(%rbp), %edx
xorl %eax, %eax
xorpd %xmm0, %xmm0
testl %edx, %edx
jle 0xc565
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 0xc556
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 0xc506
incq %rcx
movslq -0x64(%rbp), %rdx
cmpq %rdx, %rcx
jl 0xc4e9
movl -0x68(%rbp), %ecx
incq %rax
movslq %ecx, %rsi
cmpq %rsi, %rax
jl 0xc4e3
leaq -0x68(%rbp), %rsi
movq %r13, %rdi
callq 0xa5fe
jmp 0xc6e8
movl 0x4(%r13), %eax
cmpl (%rbx), %eax
jne 0xc703
leaq -0xd8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x4c52(%rip), %rsi      # 0x111f5
leaq 0x4c52(%rip), %rdx      # 0x111fc
leaq -0xe8(%rbp), %rdi
callq 0x93ea
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 0x106da
movq -0xe8(%rbp), %rdi
cmpq %r15, %rdi
je 0xc5f7
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x3300
movl -0x68(%rbp), %ecx
testl %ecx, %ecx
movq -0x30(%rbp), %rsi
jle 0xc6dc
movl -0x64(%rbp), %eax
xorl %r12d, %r12d
leaq -0x80(%rbp), %r14
movq %r13, -0x70(%rbp)
testl %eax, %eax
jle 0xc6cd
xorl %r13d, %r13d
movq -0x58(%rbp), %rax
movq (%rax,%r12,8), %rax
movq %r13, -0x88(%rbp)
shlq $0x4, %r13
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax,%r13)
cmpl $0x0, 0x4(%rsi)
jle 0xc6af
xorl %r15d, %r15d
xorl %ebx, %ebx
movq -0x70(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax,%r12,8), %rax
movq 0x10(%rsi), %rcx
movq (%rcx,%r15), %rsi
addq %r13, %rsi
movups (%rax,%r15,2), %xmm0
movaps %xmm0, -0x80(%rbp)
movq %r14, %rdi
callq 0x10952
movq -0x30(%rbp), %rsi
movsd -0x80(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
movq -0x58(%rbp), %rax
movq (%rax,%r12,8), %rax
addsd (%rax,%r13), %xmm0
addsd 0x8(%rax,%r13), %xmm1
movsd %xmm0, (%rax,%r13)
movsd %xmm1, 0x8(%rax,%r13)
incq %rbx
movslq 0x4(%rsi), %rax
addq $0x8, %r15
cmpq %rax, %rbx
jl 0xc647
movq -0x88(%rbp), %r13
incq %r13
movslq -0x64(%rbp), %rax
cmpq %rax, %r13
jl 0xc61f
movl -0x68(%rbp), %ecx
movq -0x70(%rbp), %r13
incq %r12
movslq %ecx, %rdx
cmpq %rdx, %r12
jl 0xc614
leaq -0x68(%rbp), %rsi
movq %r13, %rdi
callq 0xa5fe
leaq -0x68(%rbp), %rdi
callq 0xa186
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x3170
leaq 0x4b4a(%rip), %rcx      # 0x1125e
movq %rcx, (%rax)
movq 0x98a2(%rip), %rsi      # 0x15fc0
movq %rax, %rdi
xorl %edx, %edx
callq 0x34d0
jmp 0xc787
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
cmpq %r15, %rdi
je 0xc793
movq -0xd8(%rbp), %rsi
jmp 0xc778
jmp 0xc782
jmp 0xc787
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r15, %rdi
je 0xc793
movq -0x98(%rbp), %rsi
jmp 0xc778
jmp 0xc782
jmp 0xc787
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r15, %rdi
je 0xc793
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x3300
jmp 0xc793
movq %rax, %rbx
jmp 0xc793
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0xa186
movq %rbx, %rdi
callq 0x3520
nop