// File: IlanPrice[P]Linear-Algebra-Library-in-Cplusplus/Matrix.cpp
// Function: Matrix::getElements(int, int, int, int)
Matrix Matrix:: getElements(int istart, int iend, int jstart, int jend)
{
	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;
	Matrix slice(sRows, sColumns);
	for (int i = 0; i<sRows; i++)
	{
		for (int j = 0; j<sColumns; j++)
		{
			slice.mElements[i][j] = mElements[istart -1 + i][jstart -1 + j];
		}
	}
	return slice;
}

// Assembly:
subq $0x128, %rsp            # imm = 0x128
movq %rdi, 0x30(%rsp)
movq %rdi, %rax
movq %rax, 0x38(%rsp)
movq %rdi, 0x120(%rsp)
movq %rsi, 0x118(%rsp)
movl %edx, 0x114(%rsp)
movl %ecx, 0x110(%rsp)
movl %r8d, 0x10c(%rsp)
movl %r9d, 0x108(%rsp)
movq 0x118(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpl $0x1, 0x114(%rsp)
jl 0x54bb
cmpl $0x1, 0x10c(%rsp)
jl 0x54bb
cmpl $0x1, 0x110(%rsp)
jl 0x54bb
cmpl $0x1, 0x108(%rsp)
jge 0x55fc
movb $0x1, 0xae(%rsp)
movl $0x40, %edi
callq 0x2070
movq %rax, 0x20(%rsp)
leaq 0xe7(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x21c0
movq 0x28(%rsp), %rdx
leaq 0xcccd(%rip), %rsi      # 0x121bd
leaq 0xe8(%rsp), %rdi
callq 0x2110
jmp 0x54ff
leaq 0xaf(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x21c0
movq 0x18(%rsp), %rdx
leaq 0xccad(%rip), %rsi      # 0x121ca
leaq 0xb0(%rsp), %rdi
callq 0x2110
jmp 0x552c
movq 0x20(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
leaq 0xb0(%rsp), %rdx
callq 0x4d60
jmp 0x5548
movq 0x20(%rsp), %rdi
movb $0x0, 0xae(%rsp)
leaq 0x10844(%rip), %rsi     # 0x15da0
leaq -0x833(%rip), %rdx      # 0x4d30
callq 0x2180
jmp 0x586f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
jmp 0x55d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
jmp 0x55ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x2080
leaq 0xaf(%rsp), %rdi
callq 0x20f0
leaq 0xe8(%rsp), %rdi
callq 0x2080
leaq 0xe7(%rsp), %rdi
callq 0x20f0
testb $0x1, 0xae(%rsp)
jne 0x55ed
jmp 0x55f7
movq 0x20(%rsp), %rdi
callq 0x20a0
jmp 0x5862
movq 0x40(%rsp), %rcx
movl 0x110(%rsp), %eax
cmpl 0x8(%rcx), %eax
jg 0x5644
movq 0x40(%rsp), %rcx
movl 0x108(%rsp), %eax
cmpl 0xc(%rcx), %eax
jg 0x5644
movq 0x40(%rsp), %rcx
movl 0x114(%rsp), %eax
cmpl 0x8(%rcx), %eax
jg 0x5644
movq 0x40(%rsp), %rcx
movl 0x10c(%rsp), %eax
cmpl 0xc(%rcx), %eax
jle 0x576b
movb $0x1, 0x5e(%rsp)
movl $0x40, %edi
callq 0x2070
movq %rax, 0x8(%rsp)
leaq 0x87(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x21c0
movq 0x10(%rsp), %rdx
leaq 0xca9e(%rip), %rsi      # 0x12114
leaq 0x88(%rsp), %rdi
callq 0x2110
jmp 0x5685
leaq 0x5f(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x21c0
movq (%rsp), %rdx
leaq 0xcb5a(%rip), %rsi      # 0x121f8
leaq 0x60(%rsp), %rdi
callq 0x2110
jmp 0x56aa
movq 0x8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x4d60
jmp 0x56c3
movq 0x8(%rsp), %rdi
movb $0x0, 0x5e(%rsp)
leaq 0x106cc(%rip), %rsi     # 0x15da0
leaq -0x9ab(%rip), %rdx      # 0x4d30
callq 0x2180
jmp 0x586f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
jmp 0x5746
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
jmp 0x572f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x2080
leaq 0x5f(%rsp), %rdi
callq 0x20f0
leaq 0x88(%rsp), %rdi
callq 0x2080
leaq 0x87(%rsp), %rdi
callq 0x20f0
testb $0x1, 0x5e(%rsp)
jne 0x575c
jmp 0x5766
movq 0x8(%rsp), %rdi
callq 0x20a0
jmp 0x5862
jmp 0x576d
movq 0x30(%rsp), %rdi
movl 0x110(%rsp), %eax
subl 0x114(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58(%rsp)
movl 0x108(%rsp), %eax
subl 0x10c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
movb $0x0, 0x53(%rsp)
movl 0x58(%rsp), %esi
movl 0x54(%rsp), %edx
callq 0x4e80
movl $0x0, 0x4c(%rsp)
movl 0x4c(%rsp), %eax
cmpl 0x58(%rsp), %eax
jge 0x583f
movl $0x0, 0x48(%rsp)
movl 0x48(%rsp), %eax
cmpl 0x54(%rsp), %eax
jge 0x582d
movq 0x30(%rsp), %rax
movq 0x40(%rsp), %rcx
movq (%rcx), %rcx
movl 0x114(%rsp), %edx
subl $0x1, %edx
addl 0x4c(%rsp), %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movl 0x10c(%rsp), %edx
subl $0x1, %edx
addl 0x48(%rsp), %edx
movslq %edx, %rdx
movsd (%rcx,%rdx,8), %xmm0
movq (%rax), %rax
movslq 0x4c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x48(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x57c8
jmp 0x582f
movl 0x4c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4c(%rsp)
jmp 0x57b6
movb $0x1, 0x53(%rsp)
testb $0x1, 0x53(%rsp)
jne 0x5855
movq 0x30(%rsp), %rdi
callq 0x5230
movq 0x38(%rsp), %rax
addq $0x128, %rsp            # imm = 0x128
retq
movq 0xd8(%rsp), %rdi
callq 0x21b0
nop