// File: /workspace/github_cpp_makefile_star2_O1/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 0xd6cd
cmpl $0x1, 0x4(%r14)
jle 0xd84c
leaq 0x18(%r14), %rdi
leaq 0x3b1d(%rip), %rsi      # 0x111f5
callq 0x30e0
testl %eax, %eax
je 0xd76c
movl (%r14), %esi
movl 0x4(%r14), %edx
decl %esi
decl %edx
xorps %xmm0, %xmm0
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xa1a2
movslq (%rbx), %rax
testq %rax, %rax
jle 0xd83a
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 0xd75f
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 0xd73a
incq %r9
cmpq %rax, %r9
jne 0xd71d
jmp 0xd83a
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x3a7a(%rip), %rsi      # 0x111f5
leaq 0x3a7a(%rip), %rdx      # 0x111fc
leaq -0x48(%rbp), %r13
movq %r13, %rdi
callq 0x9334
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 0x10518
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xd7c6
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3300
cmpl $0x0, (%rbx)
jle 0xd83a
movslq %r12d, %rax
movslq %r15d, %rcx
xorl %edx, %edx
cmpl $0x0, 0x4(%rbx)
jle 0xd82f
xorl %esi, %esi
cmpq %rcx, %rdx
setge %sil
leaq (,%rdx,8), %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
leaq 0x1(%r9), %r10
cmpq %rax, %r9
cmovgeq %r10, %r9
movq 0x10(%r14), %r11
addq %rdi, %r11
movq (%r11,%rsi,8), %r11
movl %r9d, %r9d
shlq $0x4, %r9
movq 0x10(%rbx), %r15
movq (%r15,%rdx,8), %r15
movups (%r11,%r9), %xmm0
movups %xmm0, (%r15,%r8)
movslq 0x4(%rbx), %r11
addq $0x10, %r8
movq %r10, %r9
cmpq %r11, %r10
jl 0xd7f0
incq %rdx
movslq (%rbx), %rsi
cmpq %rsi, %rdx
jl 0xd7d3
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 0x39e8(%rip), %rcx      # 0x11245
movq %rcx, (%rax)
movq 0x8759(%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 0xd88d
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3300
movq %rbx, %rdi
callq 0x3520
nop