// File: schaefed[P]Ndarray/src/ndarray.hpp
// Function: Ndarray<long, 2ul> Ndarray<long, 2ul>::operator[]<1ul>(Slice<1ul>)
Ndarray<T,N> operator[](Slice<DIM> slc){
		static_assert(DIM < N, "Invalid index dimension!");

		slc.update(this->shape[DIM]);
		this->checkIndex(slc);

		auto newshape = this->shape;
		auto newstrides = this->strides;
		auto start = slc.start * newstrides[DIM];
		newshape[DIM] = ceil((slc.stop - slc.start) / static_cast<double>(slc.step));
		newstrides[DIM] = newstrides[DIM] * slc.step;
		return Ndarray<T,N>(product(newshape),
							start + this->offset,
							shared_ptr<T>(this->data, (this->data).get()+start),
							newshape,
							newstrides // is start+data accesibly from the smart pointer?
							);
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0xd0(%rbp)
movq %rdi, %rax
movq %rax, -0x118(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x100(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
addq $0x20, %rdi
movl $0x1, %esi
movq %rsi, -0xf0(%rbp)
callq 0x5fe0
movq -0x100(%rbp), %rdi
movq (%rax), %rsi
callq 0xa530
movq -0x100(%rbp), %rax
movq -0xe0(%rbp), %rdi
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movaps %xmm1, -0x20(%rbp)
movaps %xmm0, -0x30(%rbp)
movaps -0x30(%rbp), %xmm0
movaps -0x20(%rbp), %xmm1
movq %rsp, %rax
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0xa580
movq -0x100(%rbp), %rax
movq -0xf0(%rbp), %rsi
movq -0xe0(%rbp), %rcx
movups 0x20(%rcx), %xmm0
movaps %xmm0, -0x40(%rbp)
movups 0x30(%rcx), %xmm0
movaps %xmm0, -0x50(%rbp)
movq (%rax), %rax
movq %rax, -0x110(%rbp)
leaq -0x50(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x5fe0
movq -0x110(%rbp), %rcx
movq %rax, %rdx
movq -0x100(%rbp), %rax
movq (%rdx), %rdx
imulq %rdx, %rcx
movq %rcx, -0x58(%rbp)
movq (%rax), %rdx
movq 0x8(%rax), %rcx
subq %rdx, %rcx
cvtsi2sd %rcx, %xmm0
movq 0x10(%rax), %xmm1
movaps 0x74e8(%rip), %xmm2     # 0xd010
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x74ec(%rip), %xmm2     # 0xd020
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x2030
movq -0xf0(%rbp), %rsi
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x74e6(%rip), %xmm1     # 0xd050
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x108(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x5fe0
movq -0x108(%rbp), %rcx
movq -0xf8(%rbp), %rdi
movq -0xf0(%rbp), %rsi
movq %rcx, (%rax)
callq 0x5fe0
movq -0x100(%rbp), %rcx
movq -0xf8(%rbp), %rdi
movq -0xf0(%rbp), %rsi
movq (%rax), %rax
movq 0x10(%rcx), %rcx
imulq %rcx, %rax
movq %rax, -0xe8(%rbp)
callq 0x5fe0
movq -0xe8(%rbp), %rcx
movq %rcx, (%rax)
movaps -0x40(%rbp), %xmm0
movaps %xmm0, -0x70(%rbp)
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x52f0
movq -0xe0(%rbp), %rdi
movq %rax, -0xc8(%rbp)
movq -0x58(%rbp), %rax
movq 0x8(%rdi), %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
addq $0x10, %rdi
movq %rdi, -0xd8(%rbp)
callq 0x6ca0
movq -0xd8(%rbp), %rsi
movq -0x58(%rbp), %rcx
leaq (%rax,%rcx,8), %rdx
leaq -0x80(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x8f40
movq -0xd0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
movq -0xb8(%rbp), %rcx
movaps -0x40(%rbp), %xmm0
movaps %xmm0, -0x90(%rbp)
movaps -0x50(%rbp), %xmm0
movaps %xmm0, -0xa0(%rbp)
movq -0x90(%rbp), %r8
movq -0x88(%rbp), %r9
movaps -0xa0(%rbp), %xmm0
movq %rsp, %rax
movups %xmm0, (%rax)
callq 0x7cd0
jmp 0x5c94
leaq -0x80(%rbp), %rdi
callq 0x6d20
movq -0x118(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x6d20
movq -0xa8(%rbp), %rdi
callq 0x2270
nopw %cs:(%rax,%rax)
nop