// File: /workspace/github_cpp_makefile_star2_O3/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 $0x3d8, %rsp            # imm = 0x3D8
movdqa 0x65267(%rip), %xmm0    # 0xadf90
xorl %eax, %eax
movdqa 0x6526d(%rip), %xmm1    # 0xadfa0
movdqa %xmm0, 0x240(%rsp,%rax,4)
addq $0x4, %rax
paddd %xmm1, %xmm0
cmpq $0x64, %rax
jne 0x48d33
leaq 0x240(%rsp), %rax
leaq 0x80(%rsp), %rsi
movq %rax, (%rsi)
movq $0x0, 0x8(%rsi)
movq $0x32, 0x10(%rsi)
movq $0x2, 0x18(%rsi)
leaq 0x48(%rsp), %rdi
leaq 0xb0(%rsp), %r14
movq %r14, %rdx
callq 0x4ad9c
xorl %r15d, %r15d
movq %rsp, %rbx
xorl %ebp, %ebp
movq 0x80(%rsp), %rax
movq %rbp, %rcx
subq 0x88(%rsp), %rcx
imulq 0x98(%rsp), %rcx
movl (%rax,%rcx,4), %r12d
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %rbx, %rdi
leaq 0x65457(%rip), %rsi     # 0xae21c
leaq 0x65461(%rip), %rdx     # 0xae22d
callq 0xd14c
xorl %esi, %esi
cmpq %r12, %r15
sete %sil
movq %r14, %r12
movq %r14, %rdi
movq %rbx, %r13
movq %rbx, %rdx
callq 0xbf80
leaq 0x5a892(%rip), %rbx     # 0xa3684
movq %r12, %rdi
movq %rbx, %rsi
callq 0x18fba
movq %rax, %rdi
leaq 0x65427(%rip), %rsi     # 0xae22e
callq 0x1a146
movq %rax, %rdi
leaq 0x5e440(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r12
cmpb $0x1, 0x188(%rax)
jne 0x48e52
movq %rbp, %rax
subq 0x88(%rsp), %rax
imulq 0x98(%rsp), %rax
movq 0x80(%rsp), %rcx
movq %r12, %rdi
addq $0x10, %rdi
movl (%rcx,%rax,4), %esi
callq 0x22f0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x18fba
movq %rax, %rdi
leaq 0x653c1(%rip), %rsi     # 0xae228
callq 0x2d7d8
movq %rax, %rdi
leaq 0x5e3e0(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r12
cmpb $0x1, 0x188(%rax)
jne 0x48e96
movq %r12, %rdi
addq $0x10, %rdi
movl %r15d, %esi
callq 0x22f0
movq %r12, %rdi
leaq 0x713f9(%rip), %rsi     # 0xba299
callq 0x18fba
movq %r14, %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x48ec8
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rcx
shlq $0x2, %rcx
subq %rcx, %rax
movl (%rax,%r15,2), %r12d
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %r13, %rbx
movq %r13, %rdi
leaq 0x65344(%rip), %rsi     # 0xae237
leaq 0x65353(%rip), %rdx     # 0xae24d
callq 0xd14c
xorl %esi, %esi
cmpq %r12, %r15
sete %sil
movq %r14, %rdi
movq %rbx, %rdx
callq 0xbf80
leaq 0x5a76a(%rip), %rbx     # 0xa3684
movq %r14, %rdi
movq %rbx, %rsi
callq 0x18fba
movq %rax, %rdi
leaq 0x6531f(%rip), %rsi     # 0xae24e
callq 0x1910a
movq %rax, %rdi
leaq 0x5e318(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r12
cmpb $0x1, 0x188(%rax)
jne 0x48f70
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rcx
shlq $0x2, %rcx
subq %rcx, %rax
movq %r12, %rdi
addq $0x10, %rdi
movl (%rax,%r15,2), %esi
callq 0x22f0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x18fba
movq %rax, %rdi
leaq 0x652a3(%rip), %rsi     # 0xae228
callq 0x2d7d8
movq %rax, %rdi
leaq 0x5e2c2(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r12
cmpb $0x1, 0x188(%rax)
jne 0x48fb4
movq %r12, %rdi
addq $0x10, %rdi
movl %r15d, %esi
callq 0x22f0
movq %r12, %rdi
leaq 0x712db(%rip), %rsi     # 0xba299
callq 0x18fba
movq %r14, %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x48fe6
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
incq %rbp
addq $0x2, %r15
cmpq $0x32, %rbp
movq %r13, %rbx
jne 0x48d92
leaq 0x254(%rsp), %rax
leaq 0xa0(%rsp), %rsi
movq %rax, (%rsi)
movq %rsp, %rdi
leaq 0xb0(%rsp), %rdx
leaq 0x28(%rsp), %rcx
callq 0x4b9e1
movq 0xa0(%rsp), %rax
movl (%rax), %ebx
movq 0x18(%rsp), %rax
movl (%rax), %ebp
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x65219(%rip), %rsi     # 0xae25c
leaq 0x6522b(%rip), %rdx     # 0xae275
leaq 0x28(%rsp), %rdi
callq 0xd14c
xorl %esi, %esi
cmpl %ebp, %ebx
sete %sil
leaq 0xb0(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0xbf80
leaq 0x5a60f(%rip), %rsi     # 0xa3684
leaq 0xb0(%rsp), %rdi
callq 0x18fba
leaq 0x5c079(%rip), %rsi     # 0xa5102
movq %rax, %rdi
callq 0x1a146
leaq 0x5e1be(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x490c2
movq 0xa0(%rsp), %rax
movq %rbx, %rdi
addq $0x10, %rdi
movl (%rax), %esi
callq 0x22f0
leaq 0x5a5bb(%rip), %rsi     # 0xa3684
movq %rbx, %rdi
callq 0x18fba
leaq 0x65190(%rip), %rsi     # 0xae268
movq %rax, %rdi
callq 0x1910a
leaq 0x5e16f(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x4910e
movq 0x18(%rsp), %rax
movq %rbx, %rdi
addq $0x10, %rdi
movl (%rax), %esi
callq 0x22f0
leaq 0x71184(%rip), %rsi     # 0xba299
movq %rbx, %rdi
callq 0x18fba
leaq 0xb0(%rsp), %rdi
callq 0xbfd8
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x49141
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
cmpq $0x0, 0x18(%rsp)
je 0x49165
movq $0x0, 0x18(%rsp)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
cmpq $0x0, 0x60(%rsp)
je 0x49196
pxor %xmm0, %xmm0
leaq 0x48(%rsp), %rax
movdqu %xmm0, 0x18(%rax)
movq $0x0, 0x28(%rax)
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
addq $0x3d8, %rsp            # imm = 0x3D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x491db
jmp 0x491fe
movq %rax, %rbx
jmp 0x491c4
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0xbfd8
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x491db
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
cmpq $0x0, 0x18(%rsp)
je 0x4924b
movq $0x0, 0x18(%rsp)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
shlq $0x2, %rsi
jmp 0x49246
jmp 0x491fe
movq %rax, %rbx
jmp 0x4924b
jmp 0x4920e
jmp 0x49220
jmp 0x49209
movq %rax, %rbx
jmp 0x49230
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0xbfd8
jmp 0x49230
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x4924b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
cmpq $0x0, 0x60(%rsp)
je 0x4927c
pxor %xmm0, %xmm0
leaq 0x48(%rsp), %rax
movdqu %xmm0, 0x18(%rax)
movq $0x0, 0x28(%rax)
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc0a9