// File: 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
subq $0x280, %rsp            # imm = 0x280
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x220(%rbp)
addq $0x18, %rdi
leaq 0x98bc(%rip), %rsi      # 0x1b405
callq 0xafa0
testb $0x1, %al
jne 0x11b57
jmp 0x11e0c
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
leaq 0x989f(%rip), %rsi      # 0x1b405
callq 0xafa0
testb $0x1, %al
jne 0x11b74
jmp 0x11e0c
movq -0x220(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
je 0x11bad
movl $0x8, %edi
callq 0x31c0
movq %rax, %rdi
leaq 0x98d4(%rip), %rax      # 0x1b46e
movq %rax, (%rdi)
movq 0x10424(%rip), %rsi     # 0x21fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x35f0
leaq -0x69(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x3640
movq -0x228(%rbp), %rdx
leaq 0x983a(%rip), %rsi      # 0x1b405
leaq -0x68(%rbp), %rdi
callq 0xab40
jmp 0x11bd6
movq -0x220(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x230(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x22c(%rbp)
leaq -0x90(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x19810
jmp 0x11c06
movl -0x22c(%rbp), %ecx
movl -0x230(%rbp), %edx
movsd -0x90(%rbp), %xmm0
movsd -0x88(%rbp), %xmm1
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
xorl %r8d, %r8d
callq 0x19470
jmp 0x11c34
leaq -0x68(%rbp), %rdi
callq 0x3270
leaq -0x69(%rbp), %rdi
callq 0x3410
movl $0x0, -0x94(%rbp)
movl -0x94(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0x11dec
movl $0x0, -0x98(%rbp)
movl -0x98(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x11dd6
movq -0x38(%rbp), %rax
movslq -0x94(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x98(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
xorps %xmm0, %xmm0
callq 0x19840
jmp 0x11c9f
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x11dc0
movq -0x220(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x94(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x9c(%rbp), %rcx
movq %rcx, %rax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax,%rcx,8), %rsi
movslq -0x98(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x19a40
movsd %xmm1, -0x240(%rbp)
movsd %xmm0, -0x238(%rbp)
jmp 0x11d14
movsd -0x240(%rbp), %xmm0
movsd -0x238(%rbp), %xmm1
movsd %xmm1, -0xb0(%rbp)
movsd %xmm0, -0xa8(%rbp)
movq -0x38(%rbp), %rax
movslq -0x94(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x98(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x198b0
jmp 0x11d5f
jmp 0x11d61
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x11ca9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x11d98
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x3270
leaq -0x69(%rbp), %rdi
callq 0x3410
jmp 0x125cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0xe650
jmp 0x125cd
jmp 0x11dc2
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x11c69
jmp 0x11dd8
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x11c50
movq -0x220(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xecf0
jmp 0x11dfe
leaq -0x48(%rbp), %rdi
callq 0xe650
jmp 0x125c4
movq -0x220(%rbp), %rdi
addq $0x18, %rdi
leaq 0x95e7(%rip), %rsi      # 0x1b405
callq 0xafa0
testb $0x1, %al
jne 0x11e2c
jmp 0x1210b
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
leaq 0x95ca(%rip), %rsi      # 0x1b405
callq 0xaca0
testb $0x1, %al
jne 0x11e49
jmp 0x1210b
movq -0x220(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
je 0x11e82
movl $0x8, %edi
callq 0x31c0
movq %rax, %rdi
leaq 0x95ff(%rip), %rax      # 0x1b46e
movq %rax, (%rdi)
movq 0x1014f(%rip), %rsi     # 0x21fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x35f0
leaq -0x109(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x3640
movq -0x248(%rbp), %rdx
leaq 0x9562(%rip), %rsi      # 0x1b405
leaq -0x108(%rbp), %rdi
callq 0xab40
jmp 0x11eb1
movq -0x220(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x250(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x24c(%rbp)
leaq -0x120(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x19810
jmp 0x11ee1
movl -0x24c(%rbp), %ecx
movl -0x250(%rbp), %edx
movsd -0x120(%rbp), %xmm0
movsd -0x118(%rbp), %xmm1
leaq -0xe8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
xorl %r8d, %r8d
callq 0x19470
jmp 0x11f15
leaq -0x108(%rbp), %rdi
callq 0x3270
leaq -0x109(%rbp), %rdi
callq 0x3410
movl $0x0, -0x124(%rbp)
movl -0x124(%rbp), %eax
cmpl -0xe8(%rbp), %eax
jge 0x120e5
movl $0x0, -0x128(%rbp)
movl -0x128(%rbp), %eax
cmpl -0xe4(%rbp), %eax
jge 0x120cf
movq -0xd8(%rbp), %rax
movslq -0x124(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x128(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
xorps %xmm0, %xmm0
callq 0x19840
jmp 0x11f8f
movl $0x0, -0x12c(%rbp)
movl -0x12c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x120b9
movq -0x220(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x124(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x12c(%rbp), %rcx
movq %rcx, %rax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax,%rcx,8), %rax
movslq -0x128(%rbp), %rcx
leaq (%rax,%rcx,8), %rsi
callq 0x19a80
movsd %xmm1, -0x260(%rbp)
movsd %xmm0, -0x258(%rbp)
jmp 0x12001
movsd -0x260(%rbp), %xmm0
movsd -0x258(%rbp), %xmm1
movsd %xmm1, -0x140(%rbp)
movsd %xmm0, -0x138(%rbp)
movq -0xd8(%rbp), %rax
movslq -0x124(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x128(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
leaq -0x140(%rbp), %rsi
callq 0x198b0
jmp 0x1204f
jmp 0x12051
movl -0x12c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x12c(%rbp)
jmp 0x11f99
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x1208b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x3270
leaq -0x109(%rbp), %rdi
callq 0x3410
jmp 0x125cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0xe650
jmp 0x125cd
jmp 0x120bb
movl -0x128(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x128(%rbp)
jmp 0x11f53
jmp 0x120d1
movl -0x124(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x124(%rbp)
jmp 0x11f37
movq -0x220(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0xecf0
jmp 0x120fa
leaq -0xe8(%rbp), %rdi
callq 0xe650
jmp 0x125c2
movq -0x220(%rbp), %rdi
addq $0x18, %rdi
leaq 0x92e8(%rip), %rsi      # 0x1b405
callq 0xaca0
testb $0x1, %al
jne 0x1212b
jmp 0x12407
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
leaq 0x92cb(%rip), %rsi      # 0x1b405
callq 0xafa0
testb $0x1, %al
jne 0x12148
jmp 0x12407
movq -0x220(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
je 0x12181
movl $0x8, %edi
callq 0x31c0
movq %rax, %rdi
leaq 0x9300(%rip), %rax      # 0x1b46e
movq %rax, (%rdi)
movq 0xfe50(%rip), %rsi      # 0x21fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x35f0
leaq -0x199(%rbp), %rdi
movq %rdi, -0x268(%rbp)
callq 0x3640
movq -0x268(%rbp), %rdx
leaq 0x9263(%rip), %rsi      # 0x1b405
leaq -0x198(%rbp), %rdi
callq 0xab40
jmp 0x121b0
movq -0x220(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x270(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x26c(%rbp)
leaq -0x1b0(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x19810
jmp 0x121e0
movl -0x26c(%rbp), %ecx
movl -0x270(%rbp), %edx
movsd -0x1b0(%rbp), %xmm0
movsd -0x1a8(%rbp), %xmm1
leaq -0x178(%rbp), %rdi
leaq -0x198(%rbp), %rsi
xorl %r8d, %r8d
callq 0x19470
jmp 0x12214
leaq -0x198(%rbp), %rdi
callq 0x3270
leaq -0x199(%rbp), %rdi
callq 0x3410
movl $0x0, -0x1b4(%rbp)
movl -0x1b4(%rbp), %eax
cmpl -0x178(%rbp), %eax
jge 0x123e1
movl $0x0, -0x1b8(%rbp)
movl -0x1b8(%rbp), %eax
cmpl -0x174(%rbp), %eax
jge 0x123cb
movq -0x168(%rbp), %rax
movslq -0x1b4(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x1b8(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
xorps %xmm0, %xmm0
callq 0x19840
jmp 0x1228e
movl $0x0, -0x1bc(%rbp)
movl -0x1bc(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x123b5
movq -0x220(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1b4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1bc(%rbp), %rcx
leaq (%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax,%rcx,8), %rsi
movslq -0x1b8(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x19ac0
movsd %xmm1, -0x280(%rbp)
movsd %xmm0, -0x278(%rbp)
jmp 0x122fd
movsd -0x280(%rbp), %xmm0
movsd -0x278(%rbp), %xmm1
movsd %xmm1, -0x1d0(%rbp)
movsd %xmm0, -0x1c8(%rbp)
movq -0x168(%rbp), %rax
movslq -0x1b4(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x1b8(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x198b0
jmp 0x1234b
jmp 0x1234d
movl -0x1bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1bc(%rbp)
jmp 0x12298
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x12387
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x3270
leaq -0x199(%rbp), %rdi
callq 0x3410
jmp 0x125cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x178(%rbp), %rdi
callq 0xe650
jmp 0x125cd
jmp 0x123b7
movl -0x1b8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b8(%rbp)
jmp 0x12252
jmp 0x123cd
movl -0x1b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b4(%rbp)
jmp 0x12236
movq -0x220(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0xecf0
jmp 0x123f6
leaq -0x178(%rbp), %rdi
callq 0xe650
jmp 0x125c0
movq -0x220(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
je 0x12440
movl $0x8, %edi
callq 0x31c0
movq %rax, %rdi
leaq 0x9041(%rip), %rax      # 0x1b46e
movq %rax, (%rdi)
movq 0xfb91(%rip), %rsi      # 0x21fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x35f0
movq -0x220(%rbp), %rax
movl (%rax), %esi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
leaq -0x208(%rbp), %rdi
xorl %ecx, %ecx
xorps %xmm0, %xmm0
callq 0xe7c0
movl $0x0, -0x20c(%rbp)
movl -0x20c(%rbp), %eax
cmpl -0x208(%rbp), %eax
jge 0x12583
movl $0x0, -0x210(%rbp)
movl -0x210(%rbp), %eax
cmpl -0x204(%rbp), %eax
jge 0x1256d
movq -0x200(%rbp), %rax
movslq -0x20c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x210(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, -0x214(%rbp)
movl -0x214(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x12557
movq -0x220(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x20c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x214(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x214(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x210(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq -0x200(%rbp), %rax
movslq -0x20c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x210(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x214(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x214(%rbp)
jmp 0x124c4
jmp 0x12559
movl -0x210(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x210(%rbp)
jmp 0x12487
jmp 0x1256f
movl -0x20c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20c(%rbp)
jmp 0x1246b
movq -0x220(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0xecf0
jmp 0x12598
leaq -0x208(%rbp), %rdi
callq 0xe650
jmp 0x125c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x208(%rbp), %rdi
callq 0xe650
jmp 0x125cd
jmp 0x125c2
jmp 0x125c4
addq $0x280, %rsp            # imm = 0x280
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x3630
nopw %cs:(%rax,%rax)