// File: /workspace/github_cpp_makefile_star2_O2/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 $0x38, %rsp
movq %rcx, %r8
movl (%rcx), %ecx
movq %rsi, -0x40(%rbp)
leal (%rcx,%rsi), %eax
cmpl (%rdi), %eax
jg 0xb849
movq %rdi, %r12
movl 0x4(%r8), %eax
leal (%rax,%rdx), %esi
cmpl 0x4(%rdi), %esi
jg 0xb849
leaq 0x18(%r12), %rsi
movq %rsi, -0x58(%rbp)
leaq 0x18(%r8), %rsi
movq %rsi, -0x48(%rbp)
xorl %r14d, %r14d
leaq 0x3bc0(%rip), %rsi      # 0xf1f5
movq %rdx, -0x38(%rbp)
movq %r8, -0x30(%rbp)
cmpl %ecx, %r14d
jge 0xb83a
xorl %r15d, %r15d
cmpl %eax, %r15d
jge 0xb82f
movq -0x58(%rbp), %rdi
movq %rsi, %rbx
callq 0x795a
movslq %r14d, %r13
movslq %r15d, %rcx
movq %rcx, -0x50(%rbp)
testb %al, %al
je 0xb6c6
movq -0x48(%rbp), %rdi
movq %rbx, %rsi
callq 0x78c0
testb %al, %al
je 0xb6c6
movq -0x30(%rbp), %r8
movq 0x8(%r8), %rax
movq (%rax,%r13,8), %rax
movq -0x50(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x10(%r12), %rax
movq -0x40(%rbp), %rcx
addl %r14d, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq -0x38(%rbp), %rdx
leal (%r15,%rdx), %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
movsd %xmm0, (%rax,%rcx)
andq $0x0, 0x8(%rax,%rcx)
movq %rbx, %rsi
jmp 0xb823
movq -0x58(%rbp), %rdi
movq %rbx, %rsi
callq 0x78c0
testb %al, %al
je 0xb738
movq -0x48(%rbp), %rdi
movq %rbx, %rsi
callq 0x795a
testb %al, %al
je 0xb738
cmpq $0x0, 0x8(%r12)
je 0xb7dd
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %rdx
leaq 0x3af4(%rip), %rsi      # 0xf1f5
cmpl (%r12), %r14d
jl 0xb72c
jmp 0xb7ec
movq 0x8(%r12), %rax
movq 0x10(%r12), %rcx
movq (%rax), %rax
movsd (%rax), %xmm0
movq (%rcx), %rax
movsd %xmm0, (%rax)
andq $0x0, 0x8(%rax)
incl %r15d
cmpl 0x4(%r12), %r15d
jl 0xb70c
incl %r14d
jmp 0xb701
movq -0x58(%rbp), %rdi
movq %rbx, %rsi
callq 0x795a
testb %al, %al
je 0xb79c
movq -0x48(%rbp), %rdi
leaq 0x3aa2(%rip), %rsi      # 0xf1f5
callq 0x795a
testb %al, %al
je 0xb79c
movq -0x30(%rbp), %r8
movq 0x10(%r8), %rax
movq (%rax,%r13,8), %rax
movq -0x50(%rbp), %rdi
shlq $0x4, %rdi
movq 0x10(%r12), %rcx
movq -0x40(%rbp), %rdx
addl %r14d, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movq -0x38(%rbp), %rdx
leal (%r15,%rdx), %esi
movslq %esi, %rsi
shlq $0x4, %rsi
movups (%rax,%rdi), %xmm0
movups %xmm0, (%rcx,%rsi)
jmp 0xb7d4
movq -0x30(%rbp), %r8
movq 0x8(%r8), %rax
movq (%rax,%r13,8), %rax
movq -0x50(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x8(%r12), %rax
movq -0x40(%rbp), %rcx
addl %r14d, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq -0x38(%rbp), %rdx
leal (%r15,%rdx), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
leaq 0x3a1a(%rip), %rsi      # 0xf1f5
jmp 0xb823
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %rdx
leaq 0x3a09(%rip), %rsi      # 0xf1f5
movq 0x10(%r8), %rax
movslq %r14d, %rcx
movq (%rax,%rcx,8), %rax
movslq %r15d, %r9
movq %r9, %r10
shlq $0x4, %r10
movq 0x10(%r12), %rdi
addl -0x40(%rbp), %ecx
movslq %ecx, %rcx
movq (%rdi,%rcx,8), %rcx
addl %edx, %r9d
movslq %r9d, %rdi
shlq $0x4, %rdi
movups (%rax,%r10), %xmm0
movups %xmm0, (%rcx,%rdi)
incl %r15d
movl 0x4(%r8), %eax
jmp 0xb649
incl %r14d
movl (%r8), %ecx
jmp 0xb63d
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x31a0
leaq 0x39ed(%rip), %rcx      # 0xf245
movq %rcx, (%rax)
movq 0x8766(%rip), %rsi      # 0x13fc8
movq %rax, %rdi
xorl %edx, %edx
callq 0x34e0