// File: /workspace/github_cpp_makefile_star2_O3/bothaynahazem[P]AsuMathLabG13/Matrix2017.cpp
// Function: Matrix::getCofactor(int, int)
Matrix Matrix::getCofactor(int r, int c)
{
	//valid only for (2*2) matrices.
	if (nRows <= 1 && nColumns <= 1)
		throw("Invalid matrix dimension");
		if(this->type=="complex")
        {
          Matrix m("complex",nRows - 1, nColumns - 1);
	for (int iR = 0;iR<m.nRows;iR++)
		for (int iC = 0;iC<m.nColumns;iC++)
		{
			int sR = (iR<r) ? iR : iR + 1;
			int sC = (iC<c) ? iC : iC + 1;
			m.cvalues[iR][iC] = cvalues[sR][sC];
		}
		return m;
        }
        else
        {
	Matrix m(nRows - 1, nColumns - 1);
	for (int iR = 0;iR<m.nRows;iR++)
		for (int iC = 0;iC<m.nColumns;iC++)
		{
			int sR = (iR<r) ? iR : iR + 1;
			int sC = (iC<c) ? iC : iC + 1;
			m.values[iR][iC] = values[sR][sC];
		}
		return m;
        }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %r12d
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x1, (%rsi)
jg 0xd7f1
cmpl $0x1, 0x4(%r14)
jle 0xd974
leaq 0x18(%r14), %rdi
leaq 0x39f9(%rip), %rsi      # 0x111f5
callq 0x30e0
testl %eax, %eax
je 0xd890
movl (%r14), %esi
movl 0x4(%r14), %edx
decl %esi
decl %edx
xorps %xmm0, %xmm0
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xa262
movslq (%rbx), %rax
testq %rax, %rax
jle 0xd962
movl 0x4(%rbx), %ecx
movq 0x8(%r14), %rdx
movq 0x8(%rbx), %rsi
movslq %r12d, %rdi
movslq %r15d, %r8
xorl %r9d, %r9d
testl %ecx, %ecx
jle 0xd883
xorl %r10d, %r10d
cmpq %r8, %r9
setge %r10b
leaq (%rdx,%r9,8), %r11
movq (%r11,%r10,8), %r10
movq (%rsi,%r9,8), %r11
xorl %r14d, %r14d
leaq 0x1(%r14), %r15
cmpq %rdi, %r14
movq %r15, %r12
cmovlq %r14, %r12
movl %r12d, %r12d
movsd (%r10,%r12,8), %xmm0
movsd %xmm0, (%r11,%r14,8)
movq %r15, %r14
cmpq %r15, %rcx
jne 0xd85e
incq %r9
cmpq %rax, %r9
jne 0xd841
jmp 0xd962
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x3956(%rip), %rsi      # 0x111f5
leaq 0x3956(%rip), %rdx      # 0x111fc
leaq -0x48(%rbp), %r13
movq %r13, %rdi
callq 0x93ea
movl (%r14), %edx
movl 0x4(%r14), %ecx
decl %edx
decl %ecx
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
movq %rbx, %rdi
movq %r13, %rsi
xorl %r8d, %r8d
callq 0x106da
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xd8ea
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3300
movl (%rbx), %edi
testl %edi, %edi
jle 0xd962
movslq %r12d, %rax
movslq %r15d, %rcx
movl 0x4(%rbx), %esi
xorl %edx, %edx
testl %esi, %esi
jle 0xd957
xorl %edi, %edi
cmpq %rcx, %rdx
setge %dil
leaq (,%rdx,8), %r8
xorl %r9d, %r9d
xorl %r10d, %r10d
leaq 0x1(%r10), %r11
cmpq %rax, %r10
cmovgeq %r11, %r10
movq 0x10(%r14), %rsi
addq %r8, %rsi
movq (%rsi,%rdi,8), %rsi
movl %r10d, %r10d
shlq $0x4, %r10
movq 0x10(%rbx), %r15
movq (%r15,%rdx,8), %r15
movups (%rsi,%r10), %xmm0
movups %xmm0, (%r15,%r9)
movslq 0x4(%rbx), %rsi
addq $0x10, %r9
movq %r11, %r10
cmpq %rsi, %r11
jl 0xd916
movl (%rbx), %edi
incq %rdx
movslq %edi, %r8
cmpq %r8, %rdx
jl 0xd8fb
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x3170
leaq 0x38c0(%rip), %rcx      # 0x11245
movq %rcx, (%rax)
movq 0x8631(%rip), %rsi      # 0x15fc0
movq %rax, %rdi
xorl %edx, %edx
callq 0x34d0
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xd9b5
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3300
movq %rbx, %rdi
callq 0x3520
nop