// File: /workspace/github_cpp_makefile_star2_O3/dsharlet[P]array/test/algorithm.cpp
// Function: nda::test_algorithm_copy_body()
TEST(algorithm_copy) {
  array_of_rank<int, 2> a({10, 20});
  generate(a, rand);

  for (int crop_min : {0, 1}) {
    for (int crop_max : {0, 1}) {
      int x_min = a.shape().x().min() + crop_min;
      int x_max = a.shape().x().max() - crop_max;
      int y_min = a.shape().y().min() + crop_min;
      int y_max = a.shape().y().max() - crop_max;
      shape_of_rank<2> b_shape({{x_min, x_max - x_min + 1}, {y_min, y_max - y_min + 1}});
      array_of_rank<int, 2> b(b_shape);

      copy(a, b);
      ASSERT(equal(a(b.x(), b.y()), b));
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2c8, %rsp            # imm = 0x2C8
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
xorps %xmm0, %xmm0
leaq 0xb0(%rsp), %r14
movups %xmm0, 0x18(%r14)
movups %xmm0, 0x8(%r14)
movq $0x14, 0x28(%r14)
movq %rax, 0x30(%r14)
movq $0x0, 0x38(%r14)
movq $0xa, 0x40(%r14)
movq %rax, 0x48(%r14)
movq %r14, %rdi
callq 0xe236
movq %r14, %rdi
callq 0xe334
movq 0x18(%r14), %rsi
leaq 0x68(%rsp), %rdi
movq %rsi, -0x8(%rdi)
movups 0x20(%r14), %xmm0
movups %xmm0, (%rdi)
movups 0x30(%r14), %xmm0
movups %xmm0, 0x10(%rdi)
movups 0x40(%r14), %xmm0
movups %xmm0, 0x20(%rdi)
movq 0xdbb57(%rip), %rax     # 0xe6fa0
leaq 0x28(%rsp), %rdx
movq %rax, (%rdx)
callq 0xe934
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x20(%rsp)
leaq 0x80(%rsp), %r12
leaq 0x30(%rsp), %r13
xorl %eax, %eax
leaq 0x28(%rsp), %rbx
leaq 0x138(%rsp), %r15
movq %rax, 0x8(%rsp)
movl 0x20(%rsp,%rax), %eax
movq %rax, 0x10(%rsp)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x18(%rsp)
xorl %r14d, %r14d
movl 0x18(%rsp,%r14), %eax
movl 0xe8(%rsp), %ecx
movq 0x10(%rsp), %rdi
leal (%rdi,%rcx), %edx
addl 0xf0(%rsp), %ecx
movl 0xd0(%rsp), %esi
addl %esi, %edi
addl 0xd8(%rsp), %esi
movslq %edx, %rdx
subl %edx, %ecx
subl %eax, %ecx
movslq %ecx, %rcx
movslq %edi, %rdi
addl %edi, %eax
subl %eax, %esi
movslq %esi, %rax
xorps %xmm0, %xmm0
leaq 0x68(%rsp), %rsi
movups %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
movq %rdi, 0x80(%rsp)
movq %rax, 0x88(%rsp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x90(%rsp)
movq %rdx, 0x98(%rsp)
movq %rcx, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
leaq 0x60(%rsp), %rbp
movq %rbp, %rdi
callq 0xe236
movq %rbp, %rdi
callq 0xe334
movq 0xc8(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0xd0(%rsp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x20(%r13)
movups %xmm1, 0x10(%r13)
movups %xmm0, (%r13)
movq 0x78(%rsp), %rax
movq %rax, 0x100(%rsp)
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
leaq 0x108(%rsp), %rax
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movq %rbx, %rdi
leaq 0x100(%rsp), %rbp
movq %rbp, %rsi
callq 0xea45
movq 0xf8(%rsp), %rax
movq 0xc8(%rsp), %rcx
movq 0xe0(%rsp), %rdx
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdi
subq 0xd0(%rsp), %rdi
imulq %rdx, %rdi
movq 0x98(%rsp), %r8
subq 0xe8(%rsp), %r8
imulq %rax, %r8
testq %rcx, %rcx
movups 0x80(%rsp), %xmm0
leaq (%rcx,%rdi,4), %rdi
movups %xmm0, 0x108(%rsp)
movq %rdx, 0x118(%rsp)
movups 0x98(%rsp), %xmm0
leaq (%rdi,%r8,4), %rdx
cmoveq %rcx, %rdx
movq %rdx, 0x100(%rsp)
movups %xmm0, 0x120(%rsp)
movq %rax, 0x130(%rsp)
movq %rsi, 0x28(%rsp)
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
movups %xmm2, 0x20(%r13)
movups %xmm1, 0x10(%r13)
movups %xmm0, (%r13)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xefd2
movl %eax, %ebp
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbx, %rdi
leaq 0x97a0d(%rip), %rsi     # 0xa3094
leaq 0x97a1f(%rip), %rdx     # 0xa30ad
callq 0xd14c
movzbl %bpl, %esi
movq %r15, %rdi
movq %rbx, %rdx
callq 0xbf80
movq %r15, %rdi
callq 0xbfd8
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xb6c6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x60(%rsp), %rdi
callq 0xe84a
addq $0x4, %r14
cmpq $0x8, %r14
jne 0xb4a1
movq 0x8(%rsp), %rax
addq $0x4, %rax
cmpq $0x8, %rax
jne 0xb481
leaq 0xb0(%rsp), %rdi
callq 0xe84a
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb764
jmp 0xb74a
jmp 0xb71a
jmp 0xb71a
jmp 0xb764
movq %rax, %rbx
jmp 0xb73e
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xb73e
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x60(%rsp), %rdi
callq 0xe84a
jmp 0xb74d
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0xe84a
movq %rbx, %rdi
callq 0x2300
jmp 0xb764
movq %rax, %rdi
callq 0xc0a9