// File: schaefed[P]Ndarray/test/test_ndarray.cpp
// Function: testAssignment()
void testAssignment(){
	array<size_t, 2> shape = {16, 16};
	vector<int64_t> basevec  = range(product<size_t>(shape));
	auto array2d = ndarray<int64_t, 2>(basevec.data(), shape);
	auto array1d = array2d[0];

	array1d[0] = 3;
	assert(array1d[0] == 3); // single value assignment failed!

	array2d[eee] = 21;
	for (auto e: array2d){
		assert(e == 21); // broadcast assignment failed!
	}

	array2d[Slice<1>(0,-1,2)][eee] = 42;
	bool tmp = true;
	for (auto e: array1d){
		assert ( e = (tmp) ? 42 : 21); // broadcast assignment failed
		tmp = not tmp;
	}

	array2d[__] = array1d;
	for (size_t i=0; i < array2d.shape[0] ; i++){
		assert (array2d[i][0] == array1d[0]); // broadcast assignment failed
		assert (array2d[i][8] == array1d[8]); // broadcast assignment failed
		assert (array2d[i][15] == array1d[15]); // broadcast assignment failed
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x450, %rsp            # imm = 0x450
movups 0xaa2e(%rip), %xmm0     # 0xd030
movaps %xmm0, -0x10(%rbp)
movaps -0x10(%rbp), %xmm0
movaps %xmm0, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x52f0
movq %rax, %rsi
leaq -0x28(%rbp), %rdi
movq %rdi, -0x3a8(%rbp)
callq 0x2400
movq -0x3a8(%rbp), %rdi
callq 0x54b0
movq %rax, -0x3a0(%rbp)
movaps -0x10(%rbp), %xmm0
movaps %xmm0, -0x90(%rbp)
leaq 0x2e7d(%rip), %rsi      # 0x54d0
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x398(%rbp)
callq 0x54e0
movq -0x3a0(%rbp), %rsi
movq -0x398(%rbp), %r8
movq -0x90(%rbp), %rdx
movq -0x88(%rbp), %rcx
leaq -0x80(%rbp), %rdi
callq 0x5330
jmp 0x268d
leaq -0xb0(%rbp), %rdi
callq 0x5570
xorl %eax, %eax
movl %eax, %edx
leaq -0xf0(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x5590
jmp 0x26af
xorl %eax, %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x5750
movq %rax, -0x3b0(%rbp)
jmp 0x26c8
movq -0x3b0(%rbp), %rax
movq $0x3, (%rax)
xorl %eax, %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x5750
movq %rax, -0x3b8(%rbp)
jmp 0x26ef
movq -0x3b8(%rbp), %rax
cmpq $0x3, (%rax)
jne 0x26fe
jmp 0x276e
leaq 0xa96b(%rip), %rdi      # 0xd070
leaq 0xa974(%rip), %rsi      # 0xd080
movl $0x12, %edx
leaq 0xa97e(%rip), %rcx      # 0xd096
callq 0x2100
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x5570
jmp 0x2d8c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x2d83
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x2d77
movq $0x15, -0xf8(%rbp)
leaq -0x138(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x57d0
jmp 0x278b
leaq -0x138(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x5800
jmp 0x27a0
leaq -0x138(%rbp), %rdi
callq 0x5880
leaq -0x80(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rsi
leaq -0x170(%rbp), %rdi
callq 0x58a0
jmp 0x27cc
movq -0x148(%rbp), %rsi
leaq -0x198(%rbp), %rdi
callq 0x58f0
jmp 0x27e1
jmp 0x27e3
leaq -0x170(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x59a0
movb %al, -0x3b9(%rbp)
jmp 0x27fe
movb -0x3b9(%rbp), %al
testb $0x1, %al
jne 0x280d
jmp 0x2896
leaq -0x170(%rbp), %rdi
callq 0x59d0
movq %rax, -0x3c8(%rbp)
jmp 0x2822
movq -0x3c8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x1a0(%rbp)
cmpq $0x15, -0x1a0(%rbp)
jne 0x283f
jmp 0x2881
leaq 0xa866(%rip), %rdi      # 0xd0ac
leaq 0xa833(%rip), %rsi      # 0xd080
movl $0x16, %edx
leaq 0xa83d(%rip), %rcx      # 0xd096
callq 0x2100
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x5880
jmp 0x2d77
jmp 0x2883
leaq -0x170(%rbp), %rdi
callq 0x59f0
jmp 0x2891
jmp 0x27e3
movq $0x2a, -0x1a8(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x248(%rbp), %rdi
movq $-0x1, %rdx
movl $0x2, %ecx
callq 0x5ce0
jmp 0x28bf
movups -0x248(%rbp), %xmm0
movups -0x238(%rbp), %xmm1
movq %rsp, %rax
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
leaq -0x228(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x5a20
jmp 0x28e9
leaq -0x1e8(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x57d0
jmp 0x28fe
leaq -0x1e8(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x5800
jmp 0x2913
leaq -0x1e8(%rbp), %rdi
callq 0x5880
leaq -0x228(%rbp), %rdi
callq 0x5880
movb $0x1, -0x24a(%rbp)
leaq -0xf0(%rbp), %rax
movq %rax, -0x258(%rbp)
movq -0x258(%rbp), %rsi
leaq -0x280(%rbp), %rdi
callq 0x5d20
jmp 0x2955
movq -0x258(%rbp), %rsi
leaq -0x2a8(%rbp), %rdi
callq 0x5d70
jmp 0x296a
jmp 0x296c
leaq -0x280(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x5e20
movb %al, -0x3c9(%rbp)
jmp 0x2987
movb -0x3c9(%rbp), %al
testb $0x1, %al
jne 0x2996
jmp 0x2a68
leaq -0x280(%rbp), %rdi
callq 0x5e50
movq %rax, -0x3d8(%rbp)
jmp 0x29ab
movq -0x3d8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x2b0(%rbp)
movb -0x24a(%rbp), %dl
movl $0x15, %eax
movl $0x2a, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
cltq
movq %rax, -0x2b0(%rbp)
cmpq $0x0, %rax
je 0x29e3
jmp 0x2a45
leaq 0xa6ca(%rip), %rdi      # 0xd0b4
leaq 0xa68f(%rip), %rsi      # 0xd080
movl $0x1c, %edx
leaq 0xa699(%rip), %rcx      # 0xd096
callq 0x2100
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x2a34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x5880
leaq -0x228(%rbp), %rdi
callq 0x5880
jmp 0x2d77
movb -0x24a(%rbp), %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x24a(%rbp)
leaq -0x280(%rbp), %rdi
callq 0x5e70
jmp 0x2a63
jmp 0x296c
leaq -0x2f0(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x57d0
jmp 0x2a7a
leaq -0x2f0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x5ea0
jmp 0x2a8f
leaq -0x2f0(%rbp), %rdi
callq 0x5880
movq $0x0, -0x300(%rbp)
movq -0x300(%rbp), %rax
movq %rax, -0x3e0(%rbp)
leaq -0x80(%rbp), %rdi
addq $0x20, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5fe0
movq %rax, %rcx
movq -0x3e0(%rbp), %rax
cmpq (%rcx), %rax
jae 0x2d50
movq -0x300(%rbp), %rdx
leaq -0x330(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x5590
jmp 0x2af1
xorl %eax, %eax
movl %eax, %esi
leaq -0x330(%rbp), %rdi
callq 0x5750
movq %rax, -0x3e8(%rbp)
jmp 0x2b0a
movq -0x3e8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x3f8(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x5750
movq %rax, -0x3f0(%rbp)
jmp 0x2b34
movq -0x3f8(%rbp), %rax
movq -0x3f0(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x2b49
jmp 0x2bae
leaq 0xa578(%rip), %rdi      # 0xd0c8
leaq 0xa529(%rip), %rsi      # 0xd080
movl $0x22, %edx
leaq 0xa533(%rip), %rcx      # 0xd096
callq 0x2100
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x2f0(%rbp), %rdi
callq 0x5880
jmp 0x2d77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x330(%rbp), %rdi
callq 0x6010
jmp 0x2d77
leaq -0x330(%rbp), %rdi
callq 0x6010
movq -0x300(%rbp), %rdx
leaq -0x360(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x5590
jmp 0x2bd3
leaq -0x360(%rbp), %rdi
movl $0x8, %esi
callq 0x5750
movq %rax, -0x400(%rbp)
jmp 0x2bed
movq -0x400(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x410(%rbp)
leaq -0xf0(%rbp), %rdi
movl $0x8, %esi
callq 0x5750
movq %rax, -0x408(%rbp)
jmp 0x2c18
movq -0x410(%rbp), %rax
movq -0x408(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x2c2d
jmp 0x2c6f
leaq 0xa4b0(%rip), %rdi      # 0xd0e4
leaq 0xa445(%rip), %rsi      # 0xd080
movl $0x23, %edx
leaq 0xa44f(%rip), %rcx      # 0xd096
callq 0x2100
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x360(%rbp), %rdi
callq 0x6010
jmp 0x2d77
leaq -0x360(%rbp), %rdi
callq 0x6010
movq -0x300(%rbp), %rdx
leaq -0x390(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x5590
jmp 0x2c94
leaq -0x390(%rbp), %rdi
movl $0xf, %esi
callq 0x5750
movq %rax, -0x418(%rbp)
jmp 0x2cae
movq -0x418(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x428(%rbp)
leaq -0xf0(%rbp), %rdi
movl $0xf, %esi
callq 0x5750
movq %rax, -0x420(%rbp)
jmp 0x2cd9
movq -0x428(%rbp), %rax
movq -0x420(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x2cee
jmp 0x2d2d
leaq 0xa40b(%rip), %rdi      # 0xd100
leaq 0xa384(%rip), %rsi      # 0xd080
movl $0x24, %edx
leaq 0xa38e(%rip), %rcx      # 0xd096
callq 0x2100
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x390(%rbp), %rdi
callq 0x6010
jmp 0x2d77
leaq -0x390(%rbp), %rdi
callq 0x6010
movq -0x300(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x300(%rbp)
jmp 0x2aa6
leaq -0xf0(%rbp), %rdi
callq 0x6010
leaq -0x80(%rbp), %rdi
callq 0x5880
leaq -0x28(%rbp), %rdi
callq 0x5290
addq $0x450, %rsp            # imm = 0x450
popq %rbp
retq
leaq -0xf0(%rbp), %rdi
callq 0x6010
leaq -0x80(%rbp), %rdi
callq 0x5880
leaq -0x28(%rbp), %rdi
callq 0x5290
movq -0xb8(%rbp), %rdi
callq 0x2270
nopw %cs:(%rax,%rax)