// File: bothaynahazem[P]AsuMathLabG13/Matrix2017.cpp
// Function: Matrix::getSubMatrix(int, int, int, int)
Matrix Matrix::getSubMatrix(int r, int c, int nRows, int nColumns)
{
	if ((r + nRows)>nRows || (c + nColumns)>nColumns)
		throw("Invalid matrix dimension");
		if(this->type=="complex")
        {
            Matrix m("complex",nRows, nColumns);
	for (int iR = 0;iR<m.nRows;iR++)
		for (int iC = 0;iC<m.nColumns;iC++)
			m.cvalues[iR][iC] = cvalues[r + iR][c + iC];
	return m;
        }
		else{
	Matrix m(nRows, nColumns);
	for (int iR = 0;iR<m.nRows;iR++)
		for (int iC = 0;iC<m.nColumns;iC++)
			m.values[iR][iC] = values[r + iR][c + iC];
	return m;
		}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0xa0(%rbp)
movq %rdi, %rax
movq %rax, -0x98(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
movl -0x14(%rbp), %eax
addl -0x1c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0x13d33
movl -0x18(%rbp), %eax
addl -0x20(%rbp), %eax
cmpl -0x20(%rbp), %eax
jle 0x13d5a
movl $0x8, %edi
callq 0x31c0
movq %rax, %rdi
leaq 0x770e(%rip), %rax      # 0x1b455
movq %rax, (%rdi)
movq 0xe277(%rip), %rsi      # 0x21fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x35f0
movq -0x90(%rbp), %rdi
addq $0x18, %rdi
leaq 0x7699(%rip), %rsi      # 0x1b405
callq 0xafa0
testb $0x1, %al
jne 0x13d7a
jmp 0x13ef5
movb $0x0, -0x21(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x3640
movq -0xa8(%rbp), %rdx
leaq 0x7669(%rip), %rsi      # 0x1b405
leaq -0x48(%rbp), %rdi
callq 0xab40
jmp 0x13da7
movl -0x1c(%rbp), %eax
movl %eax, -0xb0(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0xac(%rbp)
leaq -0x70(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x19810
jmp 0x13dca
movl -0xac(%rbp), %ecx
movl -0xb0(%rbp), %edx
movq -0xa0(%rbp), %rdi
movsd -0x70(%rbp), %xmm0
movsd -0x68(%rbp), %xmm1
leaq -0x48(%rbp), %rsi
xorl %r8d, %r8d
callq 0x19470
jmp 0x13df5
leaq -0x48(%rbp), %rdi
callq 0x3270
leaq -0x49(%rbp), %rdi
callq 0x3410
movl $0x0, -0x74(%rbp)
movq -0xa0(%rbp), %rcx
movl -0x74(%rbp), %eax
cmpl (%rcx), %eax
jge 0x13eda
movl $0x0, -0x78(%rbp)
movq -0xa0(%rbp), %rcx
movl -0x78(%rbp), %eax
cmpl 0x4(%rcx), %eax
jge 0x13eca
movq -0xa0(%rbp), %rax
movq -0x90(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x14(%rbp), %edx
addl -0x74(%rbp), %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movl -0x18(%rbp), %edx
addl -0x78(%rbp), %edx
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x10(%rax), %rax
movslq -0x74(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movslq -0x78(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x13e27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x13ebc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x3270
leaq -0x49(%rbp), %rdi
callq 0x3410
jmp 0x13fd6
jmp 0x13ecc
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x13e0e
movb $0x1, -0x21(%rbp)
testb $0x1, -0x21(%rbp)
jne 0x13ef0
movq -0xa0(%rbp), %rdi
callq 0xe650
jmp 0x13fc6
movq -0xa0(%rbp), %rdi
movb $0x0, -0x79(%rbp)
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
xorl %ecx, %ecx
xorps %xmm0, %xmm0
callq 0xe7c0
movl $0x0, -0x80(%rbp)
movq -0xa0(%rbp), %rcx
movl -0x80(%rbp), %eax
cmpl (%rcx), %eax
jge 0x13fae
movl $0x0, -0x84(%rbp)
movq -0xa0(%rbp), %rcx
movl -0x84(%rbp), %eax
cmpl 0x4(%rcx), %eax
jge 0x13f9e
movq -0xa0(%rbp), %rax
movq -0x90(%rbp), %rcx
movq 0x8(%rcx), %rcx
movl -0x14(%rbp), %edx
addl -0x80(%rbp), %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movl -0x18(%rbp), %edx
addl -0x84(%rbp), %edx
movslq %edx, %rdx
movsd (%rcx,%rdx,8), %xmm0
movq 0x8(%rax), %rax
movslq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x84(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x13f33
jmp 0x13fa0
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x13f17
movb $0x1, -0x79(%rbp)
testb $0x1, -0x79(%rbp)
jne 0x13fc4
movq -0xa0(%rbp), %rdi
callq 0xe650
jmp 0x13fc6
movq -0x98(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x3630
nop