// File: /workspace/github_cpp_makefile_star2_O2/IlanPrice[P]Linear-Algebra-Library-in-Cplusplus/Matrix.cpp
// Function: Matrix::getElements(int, int, int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Vector Matrix:: getElements(int istart, int iend, int jstart, int jend, std::string vector) // when you want the output of a slice to be a vector not a matrix object
{
	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");
	}

	int sRows = iend - istart + 1; int sColumns = jend - jstart + 1;
	Vector slice(std::max(sRows,sColumns));
	if (sRows == 1)
	{
		for (int j = 0; j<sColumns; j++)
		{
			slice(j+1) = mElements[istart -1][jstart -1 + j];
		}
	}
	else if (sColumns == 1)
	{
		for (int i = 0; i<sRows; i++)
		{
			slice(i+1) = mElements[istart -1 + i][jstart -1];
		}
	}
	else throw Exception("Incorrect dimensions",
			"One of the dimensions of the output must be 1 in order to output a vector");

	return slice;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
testl %r9d, %r9d
jle 0x2f4c
movl %ecx, %r12d
testl %ecx, %ecx
jle 0x2f4c
movl %edx, %r15d
testl %edx, %edx
jle 0x2f4c
movl %r8d, %ebp
testl %r8d, %r8d
jle 0x2f4c
movq %rsi, %r14
movl 0x8(%rsi), %eax
cmpl %r12d, %eax
jl 0x2ee3
movl 0xc(%r14), %ecx
cmpl %ebp, %ecx
jl 0x2ee3
cmpl %r15d, %eax
jb 0x2ee3
cmpl %r9d, %ecx
jl 0x2ee3
movq %rdi, %rbx
movl %r12d, %eax
subl %r15d, %eax
incl %eax
movl %r9d, %r13d
subl %ebp, %r13d
leal 0x1(%r13), %esi
cmpl %esi, %eax
cmovgl %eax, %esi
movl %r9d, 0x10(%rsp)
callq 0x186c
subl %r15d, %r12d
jne 0x2e7b
movl %r15d, %r15d
movslq %r13d, %r12
movl %ebp, %eax
leaq -0x8(,%rax,8), %r13
xorl %ebp, %ebp
cmpq %r12, %rbp
jg 0x2ece
movq (%r14), %rax
movq -0x8(%rax,%r15,8), %rax
addq %r13, %rax
movsd (%rax,%rbp,8), %xmm0
movsd %xmm0, 0x10(%rsp)
leal 0x1(%rbp), %esi
movq %rbx, %rdi
callq 0x2030
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
incq %rbp
jmp 0x2e42
cmpl %ebp, 0x10(%rsp)
jne 0x2fbe
movl %ebp, %r13d
movslq %r12d, %r12
movl %r15d, %eax
leaq -0x8(,%rax,8), %r15
xorl %ebp, %ebp
cmpq %r12, %rbp
jg 0x2ece
movq (%r14), %rax
addq %r15, %rax
movq (%rax,%rbp,8), %rax
movsd -0x8(%rax,%r13,8), %xmm0
movsd %xmm0, 0x10(%rsp)
leal 0x1(%rbp), %esi
movq %rbx, %rdi
callq 0x2030
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
incq %rbp
jmp 0x2e98
movq %rbx, %rax
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 0x623f(%rip), %rsi      # 0x9134
leaq 0x78(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x1060
leaq 0x630d(%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 0xae68(%rip), %rsi      # 0xdda0
leaq -0x7c5(%rip), %rdx      # 0x277a
movq %rbx, %rdi
callq 0x1150
jmp 0x3022
pushq $0x40
popq %rdi
callq 0x1080
movq %rax, %rbx
leaq 0x627f(%rip), %rsi      # 0x91dd
leaq 0xb8(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x1060
leaq 0x6273(%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 0xadf3(%rip), %rsi      # 0xdda0
leaq -0x83a(%rip), %rdx      # 0x277a
movq %rbx, %rdi
callq 0x1150
jmp 0x3022
pushq $0x40
popq %rdi
callq 0x1080
movq %rax, %r15
leaq 0x6339(%rip), %rsi      # 0x9309
leaq 0x38(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x1060
leaq 0x6338(%rip), %rsi      # 0x931e
leaq 0x18(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x1060
movb $0x1, %bpl
leaq 0x38(%rsp), %rsi
leaq 0x18(%rsp), %rdx
movq %r15, %rdi
callq 0x2790
xorl %ebp, %ebp
leaq 0xad8d(%rip), %rsi      # 0xdda0
leaq -0x8a0(%rip), %rdx      # 0x277a
movq %r15, %rdi
callq 0x1150
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x1070
jmp 0x3037
movq %rax, %r14
movb $0x1, %bpl
leaq 0x38(%rsp), %rdi
callq 0x1070
testb %bpl, %bpl
jne 0x304b
jmp 0x30b1
movq %rax, %r14
movq %r15, %rdi
callq 0x10b0
jmp 0x30b1
movq %rax, %r14
leaq 0x98(%rsp), %rdi
callq 0x1070
jmp 0x306d
movq %rax, %r14
movb $0x1, %bpl
leaq 0xb8(%rsp), %rdi
jmp 0x3091
movq %rax, %r14
leaq 0x58(%rsp), %rdi
callq 0x1070
jmp 0x308c
movq %rax, %r14
movb $0x1, %bpl
leaq 0x78(%rsp), %rdi
callq 0x1070
testb %bpl, %bpl
jne 0x30a2
jmp 0x30b9
jmp 0x309f
movq %rax, %r14
movq %rbx, %rdi
callq 0x10b0
jmp 0x30b9
jmp 0x30ae
movq %rax, %r14
movq %rbx, %rdi
callq 0x1908
movq %r14, %rdi
callq 0x1180
nop