// File: /workspace/github_cpp_makefile_star2_O1/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
movl (%rcx), %eax
movq %rsi, -0x38(%rbp)
addl %esi, %eax
cmpl (%rdi), %eax
jg 0xd4b7
movq %rcx, %r13
movq %rdi, %r12
movl 0x4(%rcx), %eax
addl %edx, %eax
cmpl 0x4(%rdi), %eax
jg 0xd4b7
cmpl $0x0, (%r13)
jle 0xd4a8
leaq 0x18(%r12), %rax
movq %rax, -0x48(%rbp)
leaq 0x18(%r13), %rax
movq %rax, -0x40(%rbp)
xorl %r14d, %r14d
leaq 0x3f38(%rip), %rbx      # 0x111f5
movq %rdx, -0x30(%rbp)
cmpl $0x0, 0x4(%r13)
jle 0xd49b
xorl %r15d, %r15d
movq -0x48(%rbp), %rdi
movq %rbx, %rsi
callq 0x30e0
testl %eax, %eax
je 0xd36a
movq -0x48(%rbp), %rdi
movq %rbx, %rsi
callq 0x30e0
testl %eax, %eax
je 0xd307
movq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x30e0
testl %eax, %eax
je 0xd3c6
movq -0x48(%rbp), %rdi
movq %rbx, %rsi
callq 0x30e0
testl %eax, %eax
jne 0xd32f
movq -0x40(%rbp), %rdi
leaq 0x3ed3(%rip), %rsi      # 0x111f5
callq 0x30e0
testl %eax, %eax
je 0xd40f
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 0xd487
movq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x30e0
testl %eax, %eax
je 0xd2e3
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 0xd48e
cmpq $0x0, 0x8(%r12)
je 0xd44d
cmpl (%r12), %r14d
movq -0x30(%rbp), %rdx
jge 0xd451
cmpl 0x4(%r12), %r15d
jge 0xd404
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
jmp 0xd3d8
incl %r14d
cmpl (%r12), %r14d
jl 0xd3d8
jmp 0xd451
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 0xd487
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 0x3d67(%rip), %rbx      # 0x111f5
incl %r15d
cmpl 0x4(%r13), %r15d
jl 0xd2cf
incl %r14d
cmpl (%r13), %r14d
jl 0xd2c1
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x3170
leaq 0x3d7d(%rip), %rcx      # 0x11245
movq %rcx, (%rax)
movq 0x8aee(%rip), %rsi      # 0x15fc0
movq %rax, %rdi
xorl %edx, %edx
callq 0x34d0