// File: /workspace/github_cpp_makefile_star2_O1/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 0xe8(%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 0xdf80
movq %r14, %rdi
callq 0xe05e
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 0xd9c27(%rip), %rax     # 0xe4fa0
leaq 0x28(%rsp), %rdx
movq %rax, (%rdx)
callq 0xe62c
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 0x120(%rsp), %ecx
movq 0x10(%rsp), %rdi
leal (%rdi,%rcx), %edx
addl 0x128(%rsp), %ecx
movl 0x108(%rsp), %esi
addl %esi, %edi
addl 0x110(%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 0xdf80
movq %rbp, %rdi
callq 0xe05e
movq 0x100(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x108(%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, 0xb0(%rsp)
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
leaq 0xb8(%rsp), %rax
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movq %rbx, %rdi
leaq 0xb0(%rsp), %rbp
movq %rbp, %rsi
callq 0xe73d
movq 0x98(%rsp), %rax
movq 0xa0(%rsp), %rcx
movq 0x80(%rsp), %rdx
movq 0x130(%rsp), %rsi
movq 0x100(%rsp), %rdi
movq 0x118(%rsp), %r8
movq %rax, %r9
subq 0x120(%rsp), %r9
imulq %rsi, %r9
movq %rdx, %r10
subq 0x108(%rsp), %r10
imulq %r8, %r10
testq %rdi, %rdi
leaq (%rdi,%r10,4), %r10
leaq (%r10,%r9,4), %r9
cmoveq %rdi, %r9
movq 0x88(%rsp), %rdi
movq %r9, 0xb0(%rsp)
movq %rdx, 0xb8(%rsp)
movq %rdi, 0xc0(%rsp)
movq %r8, 0xc8(%rsp)
movq %rax, 0xd0(%rsp)
movq %rcx, 0xd8(%rsp)
movq %rsi, 0xe0(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 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 0xec7e
movl %eax, %ebp
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbx, %rdi
leaq 0x95a97(%rip), %rsi     # 0xa1064
leaq 0x95aa9(%rip), %rdx     # 0xa107d
callq 0xd0b8
movzbl %bpl, %esi
movq %r15, %rdi
movq %rbx, %rdx
callq 0xbf0a
movq %r15, %rdi
callq 0xbf62
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xb60c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x60(%rsp), %rdi
callq 0xe542
addq $0x4, %r14
cmpq $0x8, %r14
jne 0xb3d1
movq 0x8(%rsp), %rax
addq $0x4, %rax
cmpq $0x8, %rax
jne 0xb3b1
leaq 0xe8(%rsp), %rdi
callq 0xe542
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb6aa
jmp 0xb690
jmp 0xb660
jmp 0xb660
jmp 0xb6aa
movq %rax, %rbx
jmp 0xb684
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xb684
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x60(%rsp), %rdi
callq 0xe542
jmp 0xb693
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0xe542
movq %rbx, %rdi
callq 0x2300
jmp 0xb6aa
movq %rax, %rdi
callq 0xc036