// File: /workspace/github_cpp_makefile_star2_O1/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 0x459c
movl %ecx, %r15d
testl %ecx, %ecx
jle 0x459c
testl %edx, %edx
jle 0x459c
testl %r8d, %r8d
jle 0x459c
movq %rsi, %r14
movl 0x8(%rsi), %eax
cmpl %r15d, %eax
jl 0x4517
movl 0xc(%r14), %ecx
cmpl %r8d, %ecx
jl 0x4517
cmpl %edx, %eax
jl 0x4517
cmpl %r9d, %ecx
jl 0x4517
movq %rdi, %rbx
movl %r15d, %eax
subl %edx, %eax
leal 0x1(%rax), %esi
movl %r9d, %r13d
subl %r8d, %r13d
leal 0x1(%r13), %r12d
cmpl %r12d, %esi
cmovlel %r12d, %esi
movl %r8d, 0x8(%rsp)
movl %edx, %ebp
movl %r9d, 0x14(%rsp)
callq 0x28c8
movl %ebp, %eax
subl %ebp, %r15d
jne 0x44a8
testl %r13d, %r13d
movl 0x8(%rsp), %ebp
js 0x4502
movl %eax, %r13d
movl %ebp, %eax
leaq -0x8(,%rax,8), %rbp
xorl %r15d, %r15d
movq (%r14), %rax
movq -0x8(%rax,%r13,8), %rax
addq %rbp, %rax
movsd (%rax,%r15,8), %xmm0
movsd %xmm0, 0x8(%rsp)
incq %r15
movq %rbx, %rdi
movl %r15d, %esi
callq 0x3354
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rax)
cmpq %r15, %r12
jne 0x4472
jmp 0x4502
movl 0x8(%rsp), %ebp
cmpl %ebp, 0x14(%rsp)
jne 0x462d
testl %r15d, %r15d
js 0x4502
movl %ebp, %r13d
incl %r15d
movl %eax, %eax
leaq -0x8(,%rax,8), %rbp
xorl %r12d, %r12d
movq (%r14), %rax
addq %rbp, %rax
movq (%rax,%r12,8), %rax
movsd -0x8(%rax,%r13,8), %xmm0
movsd %xmm0, 0x8(%rsp)
incq %r12
movq %rbx, %rdi
movl %r12d, %esi
callq 0x3354
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rax)
cmpq %r12, %r15
jne 0x44ce
movq %rbx, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x40, %edi
callq 0x2070
movq %rax, %rbx
leaq 0x88(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x7bfd(%rip), %rsi      # 0xc134
leaq 0x7c05(%rip), %rdx      # 0xc143
leaq 0x78(%rsp), %rdi
callq 0x3c6e
leaq 0x68(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x7cbf(%rip), %rsi      # 0xc218
leaq 0x7ce4(%rip), %rdx      # 0xc244
leaq 0x58(%rsp), %rdi
callq 0x3c6e
movb $0x1, %bpl
leaq 0x78(%rsp), %rsi
leaq 0x58(%rsp), %rdx
movq %rbx, %rdi
callq 0x3d00
xorl %ebp, %ebp
leaq 0xb810(%rip), %rsi      # 0xfd98
leaq -0x94b(%rip), %rdx      # 0x3c44
movq %rbx, %rdi
callq 0x2190
jmp 0x46aa
movl $0x40, %edi
callq 0x2070
movq %rax, %rbx
leaq 0xc8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x7c21(%rip), %rsi      # 0xc1dd
leaq 0x7c26(%rip), %rdx      # 0xc1e9
leaq 0xb8(%rsp), %rdi
callq 0x3c6e
leaq 0xa8(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x7c06(%rip), %rsi      # 0xc1ea
leaq 0x7c2c(%rip), %rdx      # 0xc217
leaq 0x98(%rsp), %rdi
callq 0x3c6e
movb $0x1, %bpl
leaq 0xb8(%rsp), %rsi
leaq 0x98(%rsp), %rdx
movq %rbx, %rdi
callq 0x3d00
xorl %ebp, %ebp
leaq 0xb77c(%rip), %rsi      # 0xfd98
leaq -0x9df(%rip), %rdx      # 0x3c44
movq %rbx, %rdi
callq 0x2190
jmp 0x46aa
movl $0x40, %edi
callq 0x2070
movq %rax, %r15
leaq 0x48(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x7ce6(%rip), %rsi      # 0xc331
leaq 0x7cf3(%rip), %rdx      # 0xc345
leaq 0x38(%rsp), %rdi
callq 0x3c6e
leaq 0x28(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x7cda(%rip), %rsi      # 0xc346
leaq 0x7d1c(%rip), %rdx      # 0xc38f
leaq 0x18(%rsp), %rdi
callq 0x3c6e
movb $0x1, %bpl
leaq 0x38(%rsp), %rsi
leaq 0x18(%rsp), %rdx
movq %r15, %rdi
callq 0x3d00
xorl %ebp, %ebp
leaq 0xb6fd(%rip), %rsi      # 0xfd98
leaq -0xa5e(%rip), %rdx      # 0x3c44
movq %r15, %rdi
callq 0x2190
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x46c4
callq 0x2110
jmp 0x46c4
movq %rax, %r14
movb $0x1, %bpl
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x46db
callq 0x2110
jmp 0x46db
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x4758
movq %r15, %rdi
callq 0x20c0
jmp 0x4758
movq %rax, %r14
movq 0x98(%rsp), %rdi
cmpq %r12, %rdi
je 0x4707
callq 0x2110
jmp 0x4707
movq %rax, %r14
movb $0x1, %bpl
movq 0xb8(%rsp), %rdi
jmp 0x4730
movq %rax, %r14
movq 0x58(%rsp), %rdi
cmpq %r12, %rdi
je 0x472b
callq 0x2110
jmp 0x472b
movq %rax, %r14
movb $0x1, %bpl
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0x4744
callq 0x2110
jmp 0x4744
jmp 0x473e
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x4760
movq %rbx, %rdi
callq 0x20c0
jmp 0x4760
jmp 0x4755
movq %rax, %r14
movq %rbx, %rdi
callq 0x2970
movq %r14, %rdi
callq 0x21c0