// File: dsharlet[P]array/test/array.cpp
// Function: nda::test_array_copy_body()
TEST(array_copy) {
  array_of_rank<int, 3> a({4, 5, 6});
  fill_pattern(a);

  dense_array<int, 3> b({4, 5, 6});
  copy(a, b);
  check_pattern(b);

  array_of_rank<int, 3> c({dim<>(0, 4, 2), 5, 6});
  copy(b, c);
  check_pattern(c);

  array_of_rank<int, 3> d = make_copy(a, c.shape());
  ASSERT_EQ(c.shape(), d.shape());
  check_pattern(d);

  dense_array<int, 3> e = make_copy(a, b.shape());
  ASSERT_EQ(b.shape(), e.shape());
  check_pattern(e);

  dense_array<int, 3> g({{1, 2}, {1, 3}, {1, 4}});
  copy(a, g);
  check_pattern(g);

  array_of_rank<int, 3> h = make_copy(a);
  check_pattern(h);

  array_of_rank<int, 3, uninitialized_std_allocator<int>> h_uninitialized =
      make_copy(a, uninitialized_std_allocator<int>());
  check_pattern(h_uninitialized);

  array_of_rank<int, 3> i = make_copy(a.ref());
  check_pattern(i);

  array_of_rank<int, 3, uninitialized_std_allocator<int>> i_uninitialized =
      make_copy(a.ref(), uninitialized_std_allocator<int>());
  check_pattern(i_uninitialized);

  array_of_rank<int, 3> j = make_copy(a.cref());
  check_pattern(i);

  array_of_rank<int, 3, uninitialized_std_allocator<int>> j_uninitialized =
      make_copy(a.cref(), uninitialized_std_allocator<int>());
  check_pattern(j_uninitialized);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe20, %rsp            # imm = 0xE20
leaq -0xb0(%rbp), %rdi
movq %rdi, -0xc78(%rbp)
movl $0x4, %esi
movl $0x5, %edx
movl $0x6, %ecx
callq 0x34ec0
movq -0xc78(%rbp), %rsi
leaq -0x68(%rbp), %rdi
movq %rdi, -0xc70(%rbp)
callq 0x34f10
movq -0xc70(%rbp), %rdi
xorl %esi, %esi
callq 0x34fb0
jmp 0x26014
leaq -0x170(%rbp), %rdi
movl $0x4, %esi
movl $0x5, %edx
movl $0x6, %ecx
callq 0x34640
jmp 0x26031
leaq -0x128(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x10d10
jmp 0x26046
leaq -0x68(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x35b90
jmp 0x26058
leaq -0x188(%rbp), %rdi
movq %rdi, -0xc80(%rbp)
callq 0x35c10
movq -0xc80(%rbp), %rsi
leaq -0x128(%rbp), %rdi
callq 0x35be0
jmp 0x26080
xorl %eax, %eax
movl %eax, %esi
leaq -0x250(%rbp), %rdi
movl $0x4, %edx
movl $0x2, %ecx
callq 0x10c60
jmp 0x2609c
movq -0x240(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x10(%rax)
movups -0x250(%rbp), %xmm0
movups %xmm0, (%rax)
leaq -0x238(%rbp), %rdi
movl $0x5, %esi
movl $0x6, %edx
callq 0x35aa0
jmp 0x260cc
leaq -0x1f0(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x34f10
jmp 0x260e1
leaq -0x128(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x35c40
jmp 0x260f6
leaq -0x268(%rbp), %rdi
movq %rdi, -0xc88(%rbp)
callq 0x35c10
movq -0xc88(%rbp), %rsi
leaq -0x1f0(%rbp), %rdi
callq 0x35c90
jmp 0x2611e
leaq -0x1f0(%rbp), %rdi
callq 0x35d20
movq %rax, -0xc90(%rbp)
jmp 0x26133
leaq -0x2d1(%rbp), %rdi
movq %rdi, -0xc98(%rbp)
callq 0x10e30
movq -0xc90(%rbp), %rdx
movq -0xc98(%rbp), %rcx
leaq -0x2d0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x35cc0
jmp 0x26166
leaq -0x2d1(%rbp), %rdi
callq 0x10e50
leaq -0x1f0(%rbp), %rdi
callq 0x35d20
movq %rax, -0xca0(%rbp)
jmp 0x26187
leaq -0x2d0(%rbp), %rdi
callq 0x35d20
movq %rax, -0xca8(%rbp)
jmp 0x2619c
movq -0xca8(%rbp), %rsi
movq -0xca0(%rbp), %rdi
callq 0x35d40
movb %al, -0xca9(%rbp)
jmp 0x261b7
leaq -0x489(%rbp), %rdi
movq %rdi, -0xcb8(%rbp)
callq 0x33b0
movq -0xcb8(%rbp), %rdx
leaq 0x1b834f(%rip), %rsi    # 0x1de527
leaq -0x488(%rbp), %rdi
callq 0x10a90
jmp 0x261e6
movb -0xca9(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x468(%rbp), %rdi
leaq -0x488(%rbp), %rdx
callq 0x10f80
jmp 0x26207
leaq 0x1b65d7(%rip), %rsi    # 0x1dc7e5
leaq -0x468(%rbp), %rdi
callq 0x34320
movq %rax, -0xcc0(%rbp)
jmp 0x26223
movq -0xcc0(%rbp), %rdi
leaq 0x1b830d(%rip), %rsi    # 0x1de53e
callq 0x344d0
movq %rax, -0xcc8(%rbp)
jmp 0x2623f
movq -0xcc8(%rbp), %rdi
leaq 0x1ba55f(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0xcd0(%rbp)
jmp 0x2625b
leaq -0x1f0(%rbp), %rdi
callq 0x35d20
movq %rax, -0xcd8(%rbp)
jmp 0x26270
movq -0xcd8(%rbp), %rsi
movq -0xcd0(%rbp), %rdi
callq 0x35d80
movq %rax, -0xce0(%rbp)
jmp 0x2628c
movq -0xce0(%rbp), %rdi
leaq 0x1b654b(%rip), %rsi    # 0x1dc7e5
callq 0x34320
movq %rax, -0xce8(%rbp)
jmp 0x262a8
movq -0xce8(%rbp), %rdi
leaq 0x1b827e(%rip), %rsi    # 0x1de534
callq 0x344d0
movq %rax, -0xcf0(%rbp)
jmp 0x262c4
movq -0xcf0(%rbp), %rdi
leaq 0x1ba4da(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0xcf8(%rbp)
jmp 0x262e0
leaq -0x2d0(%rbp), %rdi
callq 0x35d20
movq %rax, -0xd00(%rbp)
jmp 0x262f5
movq -0xd00(%rbp), %rsi
movq -0xcf8(%rbp), %rdi
callq 0x35d80
movq %rax, -0xd08(%rbp)
jmp 0x26311
movq -0xd08(%rbp), %rdi
leaq 0x1d015c(%rip), %rsi    # 0x1f647b
callq 0x34320
jmp 0x26326
leaq -0x468(%rbp), %rdi
callq 0x10ff0
jmp 0x26334
leaq -0x488(%rbp), %rdi
callq 0x3100
leaq -0x489(%rbp), %rdi
callq 0x3290
leaq -0x4a8(%rbp), %rdi
movq %rdi, -0xd10(%rbp)
callq 0x35c10
movq -0xd10(%rbp), %rsi
leaq -0x2d0(%rbp), %rdi
callq 0x35c90
jmp 0x26374
leaq -0x128(%rbp), %rdi
callq 0x35e20
movq %rax, -0xd18(%rbp)
jmp 0x26389
leaq -0x511(%rbp), %rdi
movq %rdi, -0xd20(%rbp)
callq 0x10e30
movq -0xd18(%rbp), %rdx
movq -0xd20(%rbp), %rcx
leaq -0x510(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x35dc0
jmp 0x263bc
leaq -0x511(%rbp), %rdi
callq 0x10e50
leaq -0x128(%rbp), %rdi
callq 0x35e20
movq %rax, -0xd28(%rbp)
jmp 0x263dd
leaq -0x510(%rbp), %rdi
callq 0x35e20
movq %rax, -0xd30(%rbp)
jmp 0x263f2
movq -0xd30(%rbp), %rsi
movq -0xd28(%rbp), %rdi
callq 0x18f50
movb %al, -0xd31(%rbp)
jmp 0x2640d
leaq -0x6c9(%rbp), %rdi
movq %rdi, -0xd40(%rbp)
callq 0x33b0
movq -0xd40(%rbp), %rdx
leaq 0x1b811a(%rip), %rsi    # 0x1de548
leaq -0x6c8(%rbp), %rdi
callq 0x10a90
jmp 0x2643c
movb -0xd31(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x6a8(%rbp), %rdi
leaq -0x6c8(%rbp), %rdx
callq 0x10f80
jmp 0x2645d
leaq 0x1b6381(%rip), %rsi    # 0x1dc7e5
leaq -0x6a8(%rbp), %rdi
callq 0x34320
movq %rax, -0xd48(%rbp)
jmp 0x26479
movq -0xd48(%rbp), %rdi
leaq 0x1b80d8(%rip), %rsi    # 0x1de55f
callq 0x344d0
movq %rax, -0xd50(%rbp)
jmp 0x26495
movq -0xd50(%rbp), %rdi
leaq 0x1ba309(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0xd58(%rbp)
jmp 0x264b1
leaq -0x128(%rbp), %rdi
callq 0x35e20
movq %rax, -0xd60(%rbp)
jmp 0x264c6
movq -0xd60(%rbp), %rsi
movq -0xd58(%rbp), %rdi
callq 0x35e40
movq %rax, -0xd68(%rbp)
jmp 0x264e2
movq -0xd68(%rbp), %rdi
leaq 0x1b62f5(%rip), %rsi    # 0x1dc7e5
callq 0x34320
movq %rax, -0xd70(%rbp)
jmp 0x264fe
movq -0xd70(%rbp), %rdi
leaq 0x1b8049(%rip), %rsi    # 0x1de555
callq 0x344d0
movq %rax, -0xd78(%rbp)
jmp 0x2651a
movq -0xd78(%rbp), %rdi
leaq 0x1ba284(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0xd80(%rbp)
jmp 0x26536
leaq -0x510(%rbp), %rdi
callq 0x35e20
movq %rax, -0xd88(%rbp)
jmp 0x2654b
movq -0xd88(%rbp), %rsi
movq -0xd80(%rbp), %rdi
callq 0x35e40
movq %rax, -0xd90(%rbp)
jmp 0x26567
movq -0xd90(%rbp), %rdi
leaq 0x1cff06(%rip), %rsi    # 0x1f647b
callq 0x34320
jmp 0x2657c
leaq -0x6a8(%rbp), %rdi
callq 0x10ff0
jmp 0x2658a
leaq -0x6c8(%rbp), %rdi
callq 0x3100
leaq -0x6c9(%rbp), %rdi
callq 0x3290
leaq -0x6e8(%rbp), %rdi
movq %rdi, -0xd98(%rbp)
callq 0x35c10
movq -0xd98(%rbp), %rsi
leaq -0x510(%rbp), %rdi
callq 0x35be0
jmp 0x265ca
leaq -0x7b0(%rbp), %rdi
movl $0x2, %edx
movl $0x1, %ecx
movq %rcx, %rsi
callq 0x16d70
jmp 0x265e5
leaq -0x7c8(%rbp), %rdi
movl $0x1, %esi
movl $0x3, %edx
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
callq 0x10c60
jmp 0x26607
leaq -0x7e0(%rbp), %rdi
movl $0x1, %esi
movl $0x4, %edx
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
callq 0x10c60
jmp 0x26629
leaq -0x798(%rbp), %rdi
leaq -0x7b0(%rbp), %rsi
leaq -0x7c8(%rbp), %rdx
leaq -0x7e0(%rbp), %rcx
callq 0x10cb0
jmp 0x2664c
leaq -0x750(%rbp), %rdi
leaq -0x798(%rbp), %rsi
callq 0x10d10
jmp 0x26661
leaq -0x68(%rbp), %rdi
leaq -0x750(%rbp), %rsi
callq 0x35b90
jmp 0x26673
leaq -0x7f8(%rbp), %rdi
movq %rdi, -0xda0(%rbp)
callq 0x35c10
movq -0xda0(%rbp), %rsi
leaq -0x750(%rbp), %rdi
callq 0x35be0
jmp 0x2669b
leaq -0x861(%rbp), %rdi
movq %rdi, -0xda8(%rbp)
callq 0x10e30
movq -0xda8(%rbp), %rdx
leaq -0x860(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x35e80
jmp 0x266c7
leaq -0x861(%rbp), %rdi
callq 0x10e50
leaq -0x880(%rbp), %rdi
movq %rdi, -0xdb0(%rbp)
callq 0x35c10
movq -0xdb0(%rbp), %rsi
leaq -0x860(%rbp), %rdi
callq 0x35c90
jmp 0x266fb
leaq -0x8e9(%rbp), %rdi
movq %rdi, -0xdb8(%rbp)
callq 0x35f20
movq -0xdb8(%rbp), %rdx
leaq -0x8e8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x35ed0
jmp 0x26727
leaq -0x8e9(%rbp), %rdi
callq 0x35f40
leaq -0x908(%rbp), %rdi
movq %rdi, -0xdc0(%rbp)
callq 0x35c10
movq -0xdc0(%rbp), %rsi
leaq -0x8e8(%rbp), %rdi
callq 0x35f60
jmp 0x2675b
leaq -0x9c0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x36040
jmp 0x2676d
leaq -0x9c1(%rbp), %rdi
movq %rdi, -0xdc8(%rbp)
callq 0x10e30
movq -0xdc8(%rbp), %rdx
leaq -0x970(%rbp), %rdi
leaq -0x9c0(%rbp), %rsi
callq 0x35f90
jmp 0x2679c
leaq -0x9c1(%rbp), %rdi
callq 0x10e50
leaq -0x9e0(%rbp), %rdi
movq %rdi, -0xdd0(%rbp)
callq 0x35c10
movq -0xdd0(%rbp), %rsi
leaq -0x970(%rbp), %rdi
callq 0x35c90
jmp 0x267d0
leaq -0xa98(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x36040
jmp 0x267e2
leaq -0xa99(%rbp), %rdi
movq %rdi, -0xdd8(%rbp)
callq 0x35f20
movq -0xdd8(%rbp), %rdx
leaq -0xa48(%rbp), %rdi
leaq -0xa98(%rbp), %rsi
callq 0x36080
jmp 0x26811
leaq -0xa99(%rbp), %rdi
callq 0x35f40
leaq -0xab8(%rbp), %rdi
movq %rdi, -0xde0(%rbp)
callq 0x35c10
movq -0xde0(%rbp), %rsi
leaq -0xa48(%rbp), %rdi
callq 0x35f60
jmp 0x26845
leaq -0xb70(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x361e0
jmp 0x26857
leaq -0xb71(%rbp), %rdi
movq %rdi, -0xde8(%rbp)
callq 0x10e30
movq -0xde8(%rbp), %rdx
leaq -0xb20(%rbp), %rdi
leaq -0xb70(%rbp), %rsi
callq 0x36130
jmp 0x26886
leaq -0xb71(%rbp), %rdi
callq 0x10e50
leaq -0xb90(%rbp), %rdi
movq %rdi, -0xdf0(%rbp)
callq 0x35c10
movq -0xdf0(%rbp), %rsi
leaq -0x970(%rbp), %rdi
callq 0x35c90
jmp 0x268ba
leaq -0xc48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x361e0
jmp 0x268cc
leaq -0xc49(%rbp), %rdi
movq %rdi, -0xdf8(%rbp)
callq 0x35f20
movq -0xdf8(%rbp), %rdx
leaq -0xbf8(%rbp), %rdi
leaq -0xc48(%rbp), %rsi
callq 0x36220
jmp 0x268fb
leaq -0xc49(%rbp), %rdi
callq 0x35f40
leaq -0xc68(%rbp), %rdi
movq %rdi, -0xe00(%rbp)
callq 0x35c10
movq -0xe00(%rbp), %rsi
leaq -0xbf8(%rbp), %rdi
callq 0x35f60
jmp 0x2692f
leaq -0xbf8(%rbp), %rdi
callq 0x362d0
leaq -0xb20(%rbp), %rdi
callq 0x35160
leaq -0xa48(%rbp), %rdi
callq 0x362d0
leaq -0x970(%rbp), %rdi
callq 0x35160
leaq -0x8e8(%rbp), %rdi
callq 0x362d0
leaq -0x860(%rbp), %rdi
callq 0x35160
leaq -0x750(%rbp), %rdi
callq 0x11110
leaq -0x510(%rbp), %rdi
callq 0x11110
leaq -0x2d0(%rbp), %rdi
callq 0x35160
leaq -0x1f0(%rbp), %rdi
callq 0x35160
leaq -0x128(%rbp), %rdi
callq 0x11110
leaq -0x68(%rbp), %rdi
callq 0x35160
addq $0xe20, %rsp            # imm = 0xE20
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x26d32
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x26d26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x26d1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x2d1(%rbp), %rdi
callq 0x10e50
jmp 0x26d1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x26d0e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x26a9a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x26a8e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x468(%rbp), %rdi
callq 0x10ff0
jmp 0x26a8c
jmp 0x26a8e
leaq -0x488(%rbp), %rdi
callq 0x3100
leaq -0x489(%rbp), %rdi
callq 0x3290
jmp 0x26d0e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x511(%rbp), %rdi
callq 0x10e50
jmp 0x26d0e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x26d02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x26b3b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x26b2f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x6a8(%rbp), %rdi
callq 0x10ff0
jmp 0x26b2d
jmp 0x26b2f
leaq -0x6c8(%rbp), %rdi
callq 0x3100
leaq -0x6c9(%rbp), %rdi
callq 0x3290
jmp 0x26d02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x26cf6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x861(%rbp), %rdi
callq 0x10e50
jmp 0x26cf6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x26cea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x8e9(%rbp), %rdi
callq 0x35f40
jmp 0x26cea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x26cde
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x9c1(%rbp), %rdi
callq 0x10e50
jmp 0x26cde
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x26cd2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0xa99(%rbp), %rdi
callq 0x35f40
jmp 0x26cd2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x26cc6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0xb71(%rbp), %rdi
callq 0x10e50
jmp 0x26cc6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x26cba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0xc49(%rbp), %rdi
callq 0x35f40
jmp 0x26cba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0xbf8(%rbp), %rdi
callq 0x362d0
leaq -0xb20(%rbp), %rdi
callq 0x35160
leaq -0xa48(%rbp), %rdi
callq 0x362d0
leaq -0x970(%rbp), %rdi
callq 0x35160
leaq -0x8e8(%rbp), %rdi
callq 0x362d0
leaq -0x860(%rbp), %rdi
callq 0x35160
leaq -0x750(%rbp), %rdi
callq 0x11110
leaq -0x510(%rbp), %rdi
callq 0x11110
leaq -0x2d0(%rbp), %rdi
callq 0x35160
leaq -0x1f0(%rbp), %rdi
callq 0x35160
leaq -0x128(%rbp), %rdi
callq 0x11110
leaq -0x68(%rbp), %rdi
callq 0x35160
movq -0xb8(%rbp), %rdi
callq 0x33a0
movq %rax, %rdi
callq 0x116d0
nop