// File: /workspace/github_cpp_makefile_star2_O1/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
xorl %eax, %eax
movl %eax, 0x240(%rsp,%rax,4)
incq %rax
cmpq $0x64, %rax
jne 0x48293
leaq 0x240(%rsp), %rax
leaq 0x48(%rsp), %rsi
movq %rax, (%rsi)
movq $0x0, 0x8(%rsi)
movq $0x32, 0x10(%rsi)
movq $0x2, 0x18(%rsi)
leaq 0x78(%rsp), %rdi
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdx
callq 0x4a2ca
xorl %r14d, %r14d
movq %rsp, %rbp
xorl %r13d, %r13d
movq 0x48(%rsp), %rax
movq %r13, %rcx
subq 0x50(%rsp), %rcx
imulq 0x60(%rsp), %rcx
movl (%rax,%rcx,4), %r15d
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %rbp, %rdi
leaq 0x640d1(%rip), %rsi     # 0xac3e4
leaq 0x640db(%rip), %rdx     # 0xac3f5
callq 0xd0b8
xorl %esi, %esi
cmpq %r15, %r14
sete %sil
movq %rbx, %r15
movq %rbx, %rdi
movq %rbp, %r12
movq %rbp, %rdx
callq 0xbf0a
leaq 0x59314(%rip), %rbp     # 0xa1654
movq %r15, %rdi
movq %rbp, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x640a1(%rip), %rsi     # 0xac3f6
callq 0x19c24
movq %rax, %rdi
leaq 0x5cfc6(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r15
cmpb $0x1, 0x188(%rax)
jne 0x48397
movq %r13, %rax
subq 0x50(%rsp), %rax
imulq 0x60(%rsp), %rax
movq 0x48(%rsp), %rcx
movq %r15, %rdi
addq $0x10, %rdi
movl (%rcx,%rax,4), %esi
callq 0x22f0
movq %r15, %rdi
movq %rbp, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x64044(%rip), %rsi     # 0xac3f0
callq 0x2ce10
movq %rax, %rdi
leaq 0x5cf6f(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r15
cmpb $0x1, 0x188(%rax)
jne 0x483db
movq %r15, %rdi
addq $0x10, %rdi
movl %r14d, %esi
callq 0x22f0
movq %r15, %rdi
leaq 0x6ff84(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %rbx, %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x4840d
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x90(%rsp), %rax
movq 0x98(%rsp), %rcx
shlq $0x2, %rcx
subq %rcx, %rax
movl (%rax,%r14,2), %r15d
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %r12, %rbp
movq %r12, %rdi
leaq 0x63fc1(%rip), %rsi     # 0xac3ff
leaq 0x63fd0(%rip), %rdx     # 0xac415
callq 0xd0b8
xorl %esi, %esi
cmpq %r15, %r14
sete %sil
movq %rbx, %rdi
movq %rbp, %rdx
callq 0xbf0a
leaq 0x591ef(%rip), %rbp     # 0xa1654
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x63f9c(%rip), %rsi     # 0xac416
callq 0x18b66
movq %rax, %rdi
leaq 0x5cea1(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r15
cmpb $0x1, 0x188(%rax)
jne 0x484c1
movq 0x90(%rsp), %rax
movq 0x98(%rsp), %rcx
shlq $0x2, %rcx
subq %rcx, %rax
movq %r15, %rdi
addq $0x10, %rdi
movl (%rax,%r14,2), %esi
callq 0x22f0
movq %r15, %rdi
movq %rbp, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x63f1a(%rip), %rsi     # 0xac3f0
callq 0x2ce10
movq %rax, %rdi
leaq 0x5ce45(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r15
cmpb $0x1, 0x188(%rax)
jne 0x48505
movq %r15, %rdi
addq $0x10, %rdi
movl %r14d, %esi
callq 0x22f0
movq %r15, %rdi
leaq 0x6fe5a(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %rbx, %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x48537
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
incq %r13
addq $0x2, %r14
cmpq $0x32, %r13
movq %r12, %rbp
jne 0x482e9
leaq 0x254(%rsp), %rax
leaq 0x68(%rsp), %rsi
movq %rax, (%rsi)
movq %rsp, %rdi
leaq 0xb0(%rsp), %rdx
leaq 0x28(%rsp), %rcx
callq 0x4af4b
movq 0x68(%rsp), %rax
movl (%rax), %ebx
movq 0x18(%rsp), %rax
movl (%rax), %ebp
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x63e96(%rip), %rsi     # 0xac424
leaq 0x63ea8(%rip), %rdx     # 0xac43d
leaq 0x28(%rsp), %rdi
callq 0xd0b8
xorl %esi, %esi
cmpl %ebp, %ebx
sete %sil
leaq 0xb0(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0xbf0a
leaq 0x59094(%rip), %rsi     # 0xa1654
leaq 0xb0(%rsp), %rdi
callq 0x18a16
leaq 0x5aae6(%rip), %rsi     # 0xa30ba
movq %rax, %rdi
callq 0x19c24
leaq 0x5cd47(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x4860a
movq 0x68(%rsp), %rax
movq %rbx, %rdi
addq $0x10, %rdi
movl (%rax), %esi
callq 0x22f0
leaq 0x59043(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x63e10(%rip), %rsi     # 0xac430
movq %rax, %rdi
callq 0x18b66
leaq 0x5ccfb(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x48656
movq 0x18(%rsp), %rax
movq %rbx, %rdi
addq $0x10, %rdi
movl (%rax), %esi
callq 0x22f0
leaq 0x6fd0c(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0xb0(%rsp), %rdi
callq 0xbf62
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x48689
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
cmpq $0x0, 0x18(%rsp)
je 0x486b0
xorl %ebx, %ebx
movq %rbx, 0x18(%rsp)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
movq %rbx, 0x8(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x1cc90
addq $0x3d8, %rsp            # imm = 0x3D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x48791
movq %rax, %rbx
jmp 0x48704
jmp 0x48730
movq %rax, %rbx
jmp 0x486ed
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0xbf62
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x48704
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
cmpq $0x0, 0x18(%rsp)
je 0x4877d
xorl %r14d, %r14d
movq %r14, 0x18(%rsp)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
shlq $0x2, %rsi
callq 0x21f0
movq %r14, 0x8(%rsp)
jmp 0x4877d
jmp 0x48730
movq %rax, %rbx
jmp 0x4877d
jmp 0x48740
jmp 0x48752
jmp 0x4873b
movq %rax, %rbx
jmp 0x48762
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0xbf62
jmp 0x48762
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x4877d
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x78(%rsp), %rdi
callq 0x1cc90
movq %rbx, %rdi
callq 0x2300
jmp 0x48791
movq %rax, %rdi
callq 0xc036