// File: /workspace/github_cpp_makefile_star2_O1/schaefed[P]Ndarray/test/test_ndarray.cpp
// Function: testBroadcasting()
void testBroadcasting(){
	array<size_t, 1> shape = {8};
	vector<int64_t> basevec  = range(shape[0]);
	auto array1 = ndarray<int64_t, 1>(basevec.data(), shape);
	auto array2 = array1.broadcastTo<2>({8,8});

	for (size_t i=0; i<array2.shape[0]; i++){
		for (size_t j=0; j<array2.shape[1]; j++){
			assert (array2[i].data.get()[j] == basevec[j]); // broadcasting incorrect
			assert (array2[i][j] == basevec[j]); // broadcasting incorrect
		}
	}

	// should be moved to testIteration at one point in time...
	size_t idx = 0;
	for (auto e: array2){
		idx %= array2.shape[0];
		assert(e == basevec[idx]);
		idx++;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
leaq 0x8(%rsp), %rbx
leaq 0x50(%rsp), %rdx
movl $0x8, %esi
movq %rbx, %rdi
callq 0x4c96
xorl %eax, %eax
movq (%rbx), %rcx
movq %rax, (%rcx,%rax,8)
incq %rax
cmpq $0x8, %rax
jne 0x495e
movq 0x8(%rsp), %rsi
xorps %xmm0, %xmm0
leaq 0x90(%rsp), %rcx
movaps %xmm0, (%rcx)
movaps %xmm0, 0x10(%rcx)
leaq 0x4a7(%rip), %rax       # 0x4e30
movq %rax, (%rcx)
leaq 0x1589(%rip), %rax      # 0x5f1c
movq %rax, 0x18(%rcx)
leaq 0x1586(%rip), %rax      # 0x5f24
movq %rax, 0x10(%rcx)
leaq 0xb8(%rsp), %rdi
movl $0x8, %edx
callq 0x56cf
movq 0xa0(%rsp), %rax
testq %rax, %rax
je 0x49d3
leaq 0x90(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x50(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
movl $0x8, %edx
movl $0x8, %ecx
callq 0x57ae
cmpq $0x0, 0x70(%rsp)
je 0x4abe
xorl %ebx, %ebx
leaq 0x20(%rsp), %r14
leaq 0x50(%rsp), %r15
cmpq $0x0, 0x78(%rsp)
je 0x4ab0
xorl %r13d, %r13d
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x4e32
movq 0x30(%rsp), %rax
movq (%rax,%r13,8), %rax
movq 0x8(%rsp), %rcx
cmpq (%rcx,%r13,8), %rax
jne 0x4ba9
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x4a4b
callq 0x5924
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x4e32
movq %r13, %r12
sarq $0x3f, %r12
andq 0x40(%rsp), %r12
addq %r13, %r12
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x6142
imulq 0x48(%rsp), %r12
movq 0x30(%rsp), %rax
movq (%rax,%r12,8), %rax
movq 0x8(%rsp), %rcx
cmpq (%rcx,%r13,8), %rax
jne 0x4b8a
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x4aa2
callq 0x5924
incq %r13
cmpq 0x78(%rsp), %r13
jb 0x4a16
incq %rbx
cmpq 0x70(%rsp), %rbx
jb 0x4a07
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rcx
leaq 0x80(%rsp), %rdx
movq %rcx, 0x20(%rsp)
movq %rcx, 0x28(%rsp)
movq $0x0, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
leaq 0xe8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x4f6a
xorl %r14d, %r14d
leaq 0x20(%rsp), %rbx
movq 0x28(%rsp), %rax
cmpq 0xf0(%rsp), %rax
je 0x4b41
movq (%rax), %rcx
movq %r14, %rax
xorl %edx, %edx
divq 0x70(%rsp)
movq 0x8(%rsp), %rax
cmpq (%rax,%rdx,8), %rcx
jne 0x4bc8
movq %rdx, %r14
incq %r14
movq %rbx, %rdi
callq 0x6428
jmp 0x4b06
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x4b50
callq 0x5924
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x4b62
callq 0x5924
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x4b79
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x28c6(%rip), %rdi      # 0x7457
leaq 0x24b0(%rip), %rsi      # 0x7048
leaq 0x28a0(%rip), %rcx      # 0x743f
movl $0x91, %edx
callq 0x20b0
leaq 0x2869(%rip), %rdi      # 0x7419
leaq 0x2491(%rip), %rsi      # 0x7048
leaq 0x2881(%rip), %rcx      # 0x743f
movl $0x90, %edx
callq 0x20b0
leaq 0x28a3(%rip), %rdi      # 0x7472
leaq 0x2472(%rip), %rsi      # 0x7048
leaq 0x2862(%rip), %rcx      # 0x743f
movl $0x99, %edx
callq 0x20b0
jmp 0x4c14
jmp 0x4c34
movq %rax, %rbx
jmp 0x4c46
movq %rax, %rbx
movq 0xa0(%rsp), %rax
testq %rax, %rax
je 0x4c58
leaq 0x90(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x4c58
movq %rax, %rdi
callq 0x52f2
jmp 0x4c34
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x4c37
callq 0x5924
jmp 0x4c37
jmp 0x4c34
movq %rax, %rbx
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x4c46
callq 0x5924
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x4c58
callq 0x5924
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x4c6f
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
movq %rbx, %rdi
callq 0x21a0