// File: /workspace/github_cpp_makefile_star2_O3/bothaynahazem[P]AsuMathLabG13/Matrix2017.cpp
// Function: Matrix::setSubMatrix(int, int, Matrix&)
void Matrix::setSubMatrix(int r, int c, Matrix& m)
{
	if ((r + m.nRows)>nRows || (c + m.nColumns)>nColumns)
		throw("Invalid matrix dimension");
	for (int iR = 0;iR<m.nRows;iR++)
		for (int iC = 0;iC<m.nColumns;iC++)
		{   if(this->type=="complex"&&m.type!="complex")
		    cvalues[r + iR][c + iC] = m.values[iR][iC];
		    else if(this->type!="complex"&&m.type=="complex")
            {
            //copy from values to cvalues first
            if(values)
            {
            for (int rows = 0;iR<this->nRows;iR++)
            for (int columns = 0;iC<this->nColumns;iC++)
            cvalues[rows][columns] = values[rows][columns];
            }
        //copy from values to cvalues first
            cvalues[r + iR][c + iC] = m.cvalues[iR][iC];
            }
            else if(this->type=="complex"&&m.type=="complex")
              cvalues[r + iR][c + iC] = m.cvalues[iR][iC];
            else
			values[r + iR][c + iC] = m.values[iR][iC];
		}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r13
movl (%rcx), %eax
movq %rsi, -0x38(%rbp)
leal (%rax,%rsi), %ecx
cmpl (%rdi), %ecx
jg 0xd5d5
movq %rdi, %r12
movl 0x4(%r13), %ecx
leal (%rcx,%rdx), %esi
cmpl 0x4(%rdi), %esi
jg 0xd5d5
testl %eax, %eax
jle 0xd5c6
leaq 0x18(%r12), %rsi
movq %rsi, -0x48(%rbp)
leaq 0x18(%r13), %rsi
movq %rsi, -0x40(%rbp)
xorl %r14d, %r14d
leaq 0x3e36(%rip), %rbx      # 0x111f5
movq %rdx, -0x30(%rbp)
testl %ecx, %ecx
jle 0xd5ba
xorl %r15d, %r15d
movq -0x48(%rbp), %rdi
movq %rbx, %rsi
callq 0x30e0
testl %eax, %eax
je 0xd469
movq -0x48(%rbp), %rdi
movq %rbx, %rsi
callq 0x30e0
testl %eax, %eax
je 0xd406
movq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x30e0
testl %eax, %eax
je 0xd4c5
movq -0x48(%rbp), %rdi
movq %rbx, %rsi
callq 0x30e0
testl %eax, %eax
jne 0xd42e
movq -0x40(%rbp), %rdi
leaq 0x3dd4(%rip), %rsi      # 0x111f5
callq 0x30e0
testl %eax, %eax
je 0xd527
movq 0x8(%r13), %rax
movslq %r14d, %rcx
movq (%rax,%rcx,8), %rax
movslq %r15d, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x8(%r12), %rax
movq -0x38(%rbp), %rcx
addl %r14d, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq -0x30(%rbp), %rdx
leal (%r15,%rdx), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0xd59f
movq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x30e0
testl %eax, %eax
je 0xd3e2
movq 0x8(%r13), %rax
movslq %r14d, %rcx
movq (%rax,%rcx,8), %rax
movslq %r15d, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x10(%r12), %rax
movq -0x38(%rbp), %rcx
addl %r14d, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq -0x30(%rbp), %rdx
leal (%r15,%rdx), %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
movsd %xmm0, (%rax,%rcx)
movq $0x0, 0x8(%rax,%rcx)
jmp 0xd5a6
cmpq $0x0, 0x8(%r12)
je 0xd565
movl (%r12), %ecx
cmpl %ecx, %r14d
movq -0x30(%rbp), %rdx
jge 0xd569
movl 0x4(%r12), %eax
cmpl %eax, %r15d
jge 0xd51d
movq 0x8(%r12), %rax
movq 0x10(%r12), %rcx
movq (%rax), %rax
movsd (%rax), %xmm0
movq (%rcx), %rax
movsd %xmm0, (%rax)
movq $0x0, 0x8(%rax)
incl %r15d
movl 0x4(%r12), %eax
cmpl %eax, %r15d
jl 0xd4ec
movl (%r12), %ecx
incl %r14d
cmpl %ecx, %r14d
jl 0xd4e7
jmp 0xd569
movq 0x10(%r13), %rax
movslq %r14d, %rcx
movq (%rax,%rcx,8), %rax
movslq %r15d, %rcx
shlq $0x4, %rcx
movq 0x10(%r12), %rdx
movq -0x38(%rbp), %rsi
addl %r14d, %esi
movslq %esi, %rsi
movq (%rdx,%rsi,8), %rdi
movq -0x30(%rbp), %rdx
leal (%r15,%rdx), %esi
movslq %esi, %rsi
shlq $0x4, %rsi
movups (%rax,%rcx), %xmm0
movups %xmm0, (%rdi,%rsi)
jmp 0xd59f
movq -0x30(%rbp), %rdx
movq 0x10(%r13), %rax
movslq %r14d, %rcx
movq (%rax,%rcx,8), %rax
movslq %r15d, %r8
movq %r8, %rsi
shlq $0x4, %rsi
movq 0x10(%r12), %rdi
addl -0x38(%rbp), %ecx
movslq %ecx, %rcx
movq (%rdi,%rcx,8), %rcx
addl %edx, %r8d
movslq %r8d, %rdi
shlq $0x4, %rdi
movups (%rax,%rsi), %xmm0
movups %xmm0, (%rcx,%rdi)
leaq 0x3c4f(%rip), %rbx      # 0x111f5
incl %r15d
movl 0x4(%r13), %ecx
cmpl %ecx, %r15d
jl 0xd3ce
movl (%r13), %eax
incl %r14d
cmpl %eax, %r14d
jl 0xd3c3
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x3170
leaq 0x3c5f(%rip), %rcx      # 0x11245
movq %rcx, (%rax)
movq 0x89d0(%rip), %rsi      # 0x15fc0
movq %rax, %rdi
xorl %edx, %edx
callq 0x34d0