// File: /workspace/github_cpp_makefile_star2_O2/IlanPrice[P]Linear-Algebra-Library-in-Cplusplus/Matrix.cpp
// Function: Matrix::setElements(int, int, int, int, Vector)
void Matrix:: setElements(int istart, int iend, int jstart, int jend, Vector v)
{
	if (istart < 1 || jstart < 1 || iend < 1 || jend < 1)
		    {
		      throw Exception("out of range",
				  "accessing vector through () - index too small");
		    }
		  else if (iend > mRows || jend > mColumns || istart > mRows || jstart > mColumns)
		    {
		      throw Exception("length mismatch",
				  "accessing vector through () - index too high");
		    }

		if (iend==istart) // if user is setting part of a row to the specified vector
		{
			int sColumns = jend - jstart + 1;
			for (int j = 0; j<sColumns; j++)
			{
				mElements[istart -1][jstart -1 + j] = v(j+1);
			}

		}
		else if (jend == jstart) // if user is setting part of a column to the specified vector
		{
			int sRows = iend - istart + 1;
			for (int i = 0; i<sRows; i++)
			{
				mElements[istart -1 + i][jstart-1] = v(i+1);
			}

		}

		else
		{
			throw Exception("length mismatch",
							  "trying to assign a vector to a space of the form mxn where both m and n are greater than 1");
		}

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %r9, 0x10(%rsp)
testl %r8d, %r8d
jle 0x3447
testl %edx, %edx
jle 0x3447
testl %esi, %esi
jle 0x3447
testl %ecx, %ecx
jle 0x3447
movq %rdi, %r14
movl 0x8(%rdi), %eax
cmpl %edx, %eax
jl 0x33de
movl 0xc(%r14), %edi
cmpl %ecx, %edi
jl 0x33de
cmpl %esi, %eax
jb 0x33de
cmpl %r8d, %edi
jl 0x33de
subl %esi, %edx
jne 0x3381
subl %ecx, %r8d
movl %esi, %r12d
movslq %r8d, %r13
movl %ecx, %eax
leaq -0x8(,%rax,8), %rbp
xorl %r15d, %r15d
cmpq %r13, %r15
jg 0x33cc
leaq 0x1(%r15), %rbx
movq 0x10(%rsp), %rdi
movl %ebx, %esi
callq 0x2030
movsd (%rax), %xmm0
movq (%r14), %rax
movq -0x8(%rax,%r12,8), %rax
addq %rbp, %rax
movsd %xmm0, (%rax,%r15,8)
movq %rbx, %r15
jmp 0x3352
cmpl %ecx, %r8d
jne 0x34b9
movl %ecx, %r12d
movslq %edx, %r13
movl %esi, %eax
leaq -0x8(,%rax,8), %rbp
xorl %ebx, %ebx
cmpq %r13, %rbx
jg 0x33cc
leaq 0x1(%rbx), %r15
movq 0x10(%rsp), %rdi
movl %r15d, %esi
callq 0x2030
movsd (%rax), %xmm0
movq (%r14), %rax
addq %rbp, %rax
movq (%rax,%rbx,8), %rax
movsd %xmm0, -0x8(%rax,%r12,8)
movq %r15, %rbx
jmp 0x339c
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x40
popq %rdi
callq 0x1080
movq %rax, %rbx
leaq 0x5d44(%rip), %rsi      # 0x9134
leaq 0x78(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x1060
leaq 0x5e12(%rip), %rsi      # 0x9218
leaq 0x58(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x1060
movb $0x1, %bpl
leaq 0x78(%rsp), %rsi
leaq 0x58(%rsp), %rdx
movq %rbx, %rdi
callq 0x2790
xorl %ebp, %ebp
leaq 0xa96d(%rip), %rsi      # 0xdda0
leaq -0xcc0(%rip), %rdx      # 0x277a
movq %rbx, %rdi
callq 0x1150
jmp 0x351d
pushq $0x40
popq %rdi
callq 0x1080
movq %rax, %rbx
leaq 0x5d84(%rip), %rsi      # 0x91dd
leaq 0xb8(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x1060
leaq 0x5d78(%rip), %rsi      # 0x91ea
leaq 0x98(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x1060
movb $0x1, %bpl
leaq 0xb8(%rsp), %rsi
leaq 0x98(%rsp), %rdx
movq %rbx, %rdi
callq 0x2790
xorl %ebp, %ebp
leaq 0xa8f8(%rip), %rsi      # 0xdda0
leaq -0xd35(%rip), %rdx      # 0x277a
movq %rbx, %rdi
callq 0x1150
jmp 0x351d
pushq $0x40
popq %rdi
callq 0x1080
movq %rax, %rbx
leaq 0x5c69(%rip), %rsi      # 0x9134
leaq 0x38(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x1060
leaq 0x5e87(%rip), %rsi      # 0x9368
leaq 0x18(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x1060
movb $0x1, %bpl
leaq 0x38(%rsp), %rsi
leaq 0x18(%rsp), %rdx
movq %rbx, %rdi
callq 0x2790
xorl %ebp, %ebp
leaq 0xa892(%rip), %rsi      # 0xdda0
leaq -0xd9b(%rip), %rdx      # 0x277a
movq %rbx, %rdi
callq 0x1150
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x1070
jmp 0x3532
movq %rax, %r14
movb $0x1, %bpl
leaq 0x38(%rsp), %rdi
jmp 0x3577
jmp 0x3585
movq %rax, %r14
leaq 0x98(%rsp), %rdi
callq 0x1070
jmp 0x3553
movq %rax, %r14
movb $0x1, %bpl
leaq 0xb8(%rsp), %rdi
jmp 0x3577
movq %rax, %r14
leaq 0x58(%rsp), %rdi
callq 0x1070
jmp 0x3572
movq %rax, %r14
movb $0x1, %bpl
leaq 0x78(%rsp), %rdi
callq 0x1070
testb %bpl, %bpl
jne 0x3588
jmp 0x3590
jmp 0x3585
movq %rax, %r14
movq %rbx, %rdi
callq 0x10b0
movq %r14, %rdi
callq 0x1180