// File: 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:
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdi, 0x70(%rsp)
movq %rdi, %rax
movq %rax, 0x78(%rsp)
movq 0x1c0(%rsp), %rax
movq %rdi, 0x1b0(%rsp)
movq %rsi, 0x1a8(%rsp)
movl %edx, 0x1a4(%rsp)
movl %ecx, 0x1a0(%rsp)
movl %r8d, 0x19c(%rsp)
movl %r9d, 0x198(%rsp)
movq 0x1a8(%rsp), %rax
movq %rax, 0x80(%rsp)
cmpl $0x1, 0x1a4(%rsp)
jl 0x58f6
cmpl $0x1, 0x19c(%rsp)
jl 0x58f6
cmpl $0x1, 0x1a0(%rsp)
jl 0x58f6
cmpl $0x1, 0x198(%rsp)
jge 0x5a37
movb $0x1, 0x13e(%rsp)
movl $0x40, %edi
callq 0x2070
movq %rax, 0x60(%rsp)
leaq 0x177(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x21c0
movq 0x68(%rsp), %rdx
leaq 0xc892(%rip), %rsi      # 0x121bd
leaq 0x178(%rsp), %rdi
callq 0x2110
jmp 0x593a
leaq 0x13f(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x21c0
movq 0x58(%rsp), %rdx
leaq 0xc872(%rip), %rsi      # 0x121ca
leaq 0x140(%rsp), %rdi
callq 0x2110
jmp 0x5967
movq 0x60(%rsp), %rdi
leaq 0x178(%rsp), %rsi
leaq 0x140(%rsp), %rdx
callq 0x4d60
jmp 0x5983
movq 0x60(%rsp), %rdi
movb $0x0, 0x13e(%rsp)
leaq 0x10409(%rip), %rsi     # 0x15da0
leaq -0xc6e(%rip), %rdx      # 0x4d30
callq 0x2180
jmp 0x5f12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0x5a0f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0x59f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0x140(%rsp), %rdi
callq 0x2080
leaq 0x13f(%rsp), %rdi
callq 0x20f0
leaq 0x178(%rsp), %rdi
callq 0x2080
leaq 0x177(%rsp), %rdi
callq 0x20f0
testb $0x1, 0x13e(%rsp)
jne 0x5a28
jmp 0x5a32
movq 0x60(%rsp), %rdi
callq 0x20a0
jmp 0x5f05
movq 0x80(%rsp), %rcx
movl 0x1a0(%rsp), %eax
cmpl 0x8(%rcx), %eax
jg 0x5a8b
movq 0x80(%rsp), %rcx
movl 0x198(%rsp), %eax
cmpl 0xc(%rcx), %eax
jg 0x5a8b
movq 0x80(%rsp), %rcx
movl 0x1a4(%rsp), %eax
cmpl 0x8(%rcx), %eax
jg 0x5a8b
movq 0x80(%rsp), %rcx
movl 0x19c(%rsp), %eax
cmpl 0xc(%rcx), %eax
jle 0x5bcc
movb $0x1, 0xee(%rsp)
movl $0x40, %edi
callq 0x2070
movq %rax, 0x48(%rsp)
leaq 0x117(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x21c0
movq 0x50(%rsp), %rdx
leaq 0xc654(%rip), %rsi      # 0x12114
leaq 0x118(%rsp), %rdi
callq 0x2110
jmp 0x5acf
leaq 0xef(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x21c0
movq 0x40(%rsp), %rdx
leaq 0xc70b(%rip), %rsi      # 0x121f8
leaq 0xf0(%rsp), %rdi
callq 0x2110
jmp 0x5afc
movq 0x48(%rsp), %rdi
leaq 0x118(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
callq 0x4d60
jmp 0x5b18
movq 0x48(%rsp), %rdi
movb $0x0, 0xee(%rsp)
leaq 0x10274(%rip), %rsi     # 0x15da0
leaq -0xe03(%rip), %rdx      # 0x4d30
callq 0x2180
jmp 0x5f12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0x5ba4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0x5b8a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x2080
leaq 0xef(%rsp), %rdi
callq 0x20f0
leaq 0x118(%rsp), %rdi
callq 0x2080
leaq 0x117(%rsp), %rdi
callq 0x20f0
testb $0x1, 0xee(%rsp)
jne 0x5bbd
jmp 0x5bc7
movq 0x48(%rsp), %rdi
callq 0x20a0
jmp 0x5f05
jmp 0x5bce
movl 0x1a0(%rsp), %eax
subl 0x1a4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xe8(%rsp)
movl 0x198(%rsp), %eax
subl 0x19c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xe4(%rsp)
movb $0x0, 0xe3(%rsp)
leaq 0xe8(%rsp), %rdi
leaq 0xe4(%rsp), %rsi
callq 0x10d90
movq 0x70(%rsp), %rdi
movl (%rax), %esi
callq 0x2d70
cmpl $0x1, 0xe8(%rsp)
jne 0x5ceb
movl $0x0, 0xdc(%rsp)
movl 0xdc(%rsp), %eax
cmpl 0xe4(%rsp), %eax
jge 0x5ce6
movq 0x70(%rsp), %rdi
movq 0x80(%rsp), %rax
movq (%rax), %rax
movl 0x1a4(%rsp), %ecx
decl %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl 0x19c(%rsp), %r8d
movl 0xdc(%rsp), %esi
movl %esi, %edx
movl %r8d, %ecx
leal -0x1(%rcx,%rdx), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x30(%rsp)
incl %esi
callq 0x3ee0
movq %rax, 0x38(%rsp)
jmp 0x5ca8
movq 0x38(%rsp), %rax
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rax)
movl 0xdc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xdc(%rsp)
jmp 0x5c40
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0x5efb
jmp 0x5ed2
cmpl $0x1, 0xe4(%rsp)
jne 0x5d92
movl $0x0, 0xd8(%rsp)
movl 0xd8(%rsp), %eax
cmpl 0xe8(%rsp), %eax
jge 0x5d8d
movq 0x70(%rsp), %rdi
movq 0x80(%rsp), %rax
movq (%rax), %rax
movl 0x1a4(%rsp), %r8d
movl 0xd8(%rsp), %esi
movl %esi, %edx
movl %r8d, %ecx
leal -0x1(%rcx,%rdx), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl 0x19c(%rsp), %ecx
decl %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x20(%rsp)
incl %esi
callq 0x3ee0
movq %rax, 0x28(%rsp)
jmp 0x5d68
movq 0x28(%rsp), %rax
movsd 0x20(%rsp), %xmm0
movsd %xmm0, (%rax)
movl 0xd8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd8(%rsp)
jmp 0x5d04
jmp 0x5ed0
movb $0x1, 0x8e(%rsp)
movl $0x40, %edi
callq 0x2070
movq %rax, 0x10(%rsp)
leaq 0xb7(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x21c0
movq 0x18(%rsp), %rdx
leaq 0xc532(%rip), %rsi      # 0x122f9
leaq 0xb8(%rsp), %rdi
callq 0x2110
jmp 0x5dd6
leaq 0x8f(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x21c0
movq 0x8(%rsp), %rdx
leaq 0xc51a(%rip), %rsi      # 0x1230e
leaq 0x90(%rsp), %rdi
callq 0x2110
jmp 0x5e03
movq 0x10(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x4d60
jmp 0x5e1f
movq 0x10(%rsp), %rdi
movb $0x0, 0x8e(%rsp)
leaq 0xff6d(%rip), %rsi      # 0x15da0
leaq -0x110a(%rip), %rdx     # 0x4d30
callq 0x2180
jmp 0x5f12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0x5eab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0x5e91
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x2080
leaq 0x8f(%rsp), %rdi
callq 0x20f0
leaq 0xb8(%rsp), %rdi
callq 0x2080
leaq 0xb7(%rsp), %rdi
callq 0x20f0
testb $0x1, 0x8e(%rsp)
jne 0x5ec4
jmp 0x5ece
movq 0x10(%rsp), %rdi
callq 0x20a0
jmp 0x5efb
jmp 0x5ed2
movb $0x1, 0xe3(%rsp)
testb $0x1, 0xe3(%rsp)
jne 0x5eee
movq 0x70(%rsp), %rdi
callq 0x2ea0
movq 0x78(%rsp), %rax
addq $0x1b8, %rsp            # imm = 0x1B8
retq
movq 0x70(%rsp), %rdi
callq 0x2ea0
movq 0x168(%rsp), %rdi
callq 0x21b0
nopw %cs:(%rax,%rax)