// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/array_ref.cpp
// Function: nda::test_array_ref_copy_body()
TEST(array_ref_copy) {
  int data[100];
  for (int i = 0; i < 100; i++) {
    data[i] = i;
  }

  array_ref_of_rank<int, 1> evens(data, {dim<>(0, 50, 2)});
  dense_array<int, 1> evens_copy = make_compact_copy(evens);
  for (int i = 0; i < 50; i++) {
    ASSERT_EQ(evens(i), i * 2);
    ASSERT_EQ(evens_copy(i), i * 2);
  }

  array_ref_of_rank<int, 0> scalar(&data[5], {});
  array_of_rank<int, 0> scalar_copy = make_compact_copy(scalar);
  ASSERT_EQ(scalar(), scalar_copy());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3f8, %rsp            # imm = 0x3F8
xorl %eax, %eax
cmpq $0x64, %rax
je 0x3a773
movl %eax, 0x260(%rsp,%rax,4)
incq %rax
jmp 0x3a761
leaq 0x260(%rsp), %rax
leaq 0x58(%rsp), %rdi
movq %rax, -0x8(%rdi)
andq $0x0, (%rdi)
movq $0x32, 0x8(%rdi)
movq $0x2, 0x10(%rdi)
callq 0x173a7
leaq 0x98(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0xd0(%rsp), %r13
movq %r13, %rdx
callq 0x3c053
pushq $0x32
popq %rax
xorl %ebp, %ebp
leaq 0x70(%rsp), %r15
leaq 0x18(%rsp), %r14
xorl %r12d, %r12d
xorl %ecx, %ecx
subq $0x1, %rax
jb 0x3a9de
movq %rax, 0x28(%rsp)
movq %rcx, 0x10(%rsp)
movq %rcx, %rax
subq 0x58(%rsp), %rax
movq 0x50(%rsp), %rcx
imulq 0x68(%rsp), %rax
movl (%rcx,%rax,4), %ebx
movq %r15, %rdi
leaq 0x5df8a(%rip), %rsi     # 0x9878c
movq %r14, %rdx
callq 0x66a0
xorl %esi, %esi
cmpq %rbx, %rbp
sete %sil
movq %r13, %rbx
movq %r13, %rdi
movq %r15, %r14
movq %r15, %rdx
callq 0x6894
movq %rbx, %rdi
leaq 0x52e19(%rip), %rsi     # 0x8d647
callq 0x106fe
movq %rax, %rdi
leaq 0x5df61(%rip), %rsi     # 0x9879e
callq 0x118ac
movq %rax, %rdi
leaq 0x56da6(%rip), %rsi     # 0x915f2
callq 0x106fe
movq 0x10(%rsp), %rsi
subq 0x58(%rsp), %rsi
imulq 0x68(%rsp), %rsi
shlq $0x2, %rsi
addq 0x50(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
movq %rax, %rdi
leaq 0x52dcb(%rip), %rsi     # 0x8d647
callq 0x106fe
movq %rax, %rdi
leaq 0x5df0d(%rip), %rsi     # 0x98798
callq 0x223dc
movq %rax, %rdi
leaq 0x56d58(%rip), %rsi     # 0x915f2
callq 0x106fe
movl %ebp, 0x30(%rsp)
movq %rax, %rdi
leaq 0x30(%rsp), %rsi
callq 0x10736
movq %rax, %rdi
leaq 0x6a9e8(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %rbx, %rdi
callq 0x68d4
movq %r14, %r15
movq %r14, %rdi
callq 0x2090
movq 0xb0(%rsp), %rax
movq 0xb8(%rsp), %rcx
shlq $0x2, %rcx
subq %rcx, %rax
movl (%r12,%rax), %ebx
movq %r14, %rdi
leaq 0x5deb0(%rip), %rsi     # 0x987a7
leaq 0x18(%rsp), %r14
movq %r14, %rdx
callq 0x66a0
xorl %esi, %esi
cmpq %rbx, %rbp
sete %sil
movq %r13, %rdi
movq %r15, %rdx
callq 0x6894
movq %r13, %rdi
leaq 0x52d25(%rip), %rsi     # 0x8d647
callq 0x106fe
movq %rax, %rdi
leaq 0x5de8d(%rip), %rsi     # 0x987be
callq 0x1085e
movq %rax, %rdi
leaq 0x56cb2(%rip), %rsi     # 0x915f2
callq 0x106fe
movq 0xb0(%rsp), %rsi
movq 0xb8(%rsp), %rcx
shlq $0x2, %rcx
subq %rcx, %rsi
addq %r12, %rsi
movq %rax, %rdi
callq 0x10736
movq %rax, %rdi
leaq 0x52cd6(%rip), %rsi     # 0x8d647
callq 0x106fe
movq %rax, %rdi
leaq 0x5de18(%rip), %rsi     # 0x98798
callq 0x223dc
movq %rax, %rdi
leaq 0x56c63(%rip), %rsi     # 0x915f2
callq 0x106fe
movl %ebp, 0x30(%rsp)
movq %rax, %rdi
leaq 0x30(%rsp), %rsi
callq 0x10736
movq %rax, %rdi
leaq 0x6a8f3(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %r13, %rdi
callq 0x68d4
movq %r15, %rdi
callq 0x2090
movq 0x10(%rsp), %rcx
incq %rcx
addq $0x4, %r12
addq $0x2, %rbp
movq 0x28(%rsp), %rax
jmp 0x3a7ce
leaq 0x274(%rsp), %rax
leaq 0x18(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x70(%rsp), %rdi
leaq 0xd0(%rsp), %rdx
callq 0x3c096
movq 0x18(%rsp), %rax
movl (%rax), %ebx
movq 0x88(%rsp), %rax
movl (%rax), %ebp
leaq 0x5ddb4(%rip), %rsi     # 0x987cc
leaq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl %ebp, %ebx
sete %sil
leaq 0xd0(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x6894
leaq 0x52bff(%rip), %rsi     # 0x8d647
leaq 0xd0(%rsp), %rdi
callq 0x106fe
leaq 0x54977(%rip), %rsi     # 0x8f3d3
movq %rax, %rdi
callq 0x118ac
leaq 0x56b87(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq 0x18(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
leaq 0x52bc0(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x5dd42(%rip), %rsi     # 0x987d8
movq %rax, %rdi
callq 0x1085e
leaq 0x56b4d(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq 0x88(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
leaq 0x6a7de(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0xd0(%rsp), %rdi
callq 0x68d4
leaq 0x30(%rsp), %rdi
callq 0x2090
leaq 0x70(%rsp), %rdi
callq 0x6baa
leaq 0x98(%rsp), %rdi
callq 0x1090e
addq $0x3f8, %rsp            # imm = 0x3F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3ab32
jmp 0x3ab40
movq %rax, %rbx
jmp 0x3ab28
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x68d4
leaq 0x30(%rsp), %rdi
callq 0x2090
leaq 0x70(%rsp), %rdi
callq 0x6baa
jmp 0x3ab7c
jmp 0x3ab40
movq %rax, %rbx
jmp 0x3ab7c
jmp 0x3ab4b
jmp 0x3ab50
jmp 0x3ab62
movq %rax, %rbx
jmp 0x3ab72
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x68d4
jmp 0x3ab72
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x68d4
leaq 0x70(%rsp), %rdi
callq 0x2090
leaq 0x98(%rsp), %rdi
callq 0x1090e
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba