// File: /workspace/github_cpp_makefile_star2_O1/dsharlet[P]array/test/array_ref.cpp
// Function: nda::test_array_ref_crop_slice_body()
TEST(array_ref_crop_slice) {
  array<int, shape<dense_dim<0>, dim<>>> a({8, 9});
  fill_pattern(a);

  auto a_slice1 = a(3, _);
  static_assert(a_slice1.rank() == 1, "");
  assert_dim_eq(a_slice1.x(), a.y());
  // TODO: This doesn't pass because check_pattern doesn't understand
  // that there is a second dimension to the pattern.
  // check_pattern(a_slice1);

  auto a_slice2 = a(_, 2);
  static_assert(a_slice2.rank() == 1, "");
  assert_dim_eq(a_slice2.x(), a.x());
  // check_pattern(a_slice2);

  auto a_crop1_slice2 = a(interval<4, 3>(), 5);
  static_assert(a_crop1_slice2.rank() == 1, "");
  assert_dim_eq(a_crop1_slice2.x(), dense_dim<4, 3>());
  // check_pattern(a_crop1_slice2);

  auto a_slice1_crop2 = a(6, interval<4, 3>());
  static_assert(a_slice1_crop2.rank() == 1, "");
  assert_dim_eq(a_slice1_crop2.x(), dim<4, 3>(4, 3, a.y().stride()));
  // check_pattern(a_slice1_crop2);

  auto a_crop1_crop2 = a(interval<>(2, 6), interval<3, 4>());
  static_assert(a_crop1_crop2.rank() == 2, "");
  assert_dim_eq(a_crop1_crop2.x(), dense_dim<>(2, 6));
  assert_dim_eq(a_crop1_crop2.y(), dim<3, 4>(3, 4, a.y().stride()));
  check_pattern(a_crop1_crop2);

  auto a_all1_crop2 = a(_, interval<3, 4>());
  static_assert(a_all1_crop2.rank() == 2, "");
  assert_dim_eq(a_all1_crop2.x(), a.x());
  assert_dim_eq(a_all1_crop2.y(), dim<3, 4>(3, 4, a.y().stride()));
  check_pattern(a_all1_crop2);

  auto a_temp_names = a(range(2, 6), fixed_interval<5>(3));
  static_assert(a_temp_names.rank() == 2, "");
  assert_dim_eq(a_temp_names.x(), dense_dim<>(2, 4));
  assert_dim_eq(a_temp_names.y(), fixed_dim<5>(3, 5, a.y().stride()));
  check_pattern(a_temp_names);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
leaq 0x58(%rsp), %r15
movq $0x0, (%r15)
movl $0x8, %r14d
movq %r14, 0x8(%r15)
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
movq %r12, 0x10(%r15)
xorl %edi, %edi
movq %r15, %rsi
callq 0x4b05b
xorps %xmm0, %xmm0
leaq 0x8(%rsp), %rbx
movups %xmm0, 0x8(%rbx)
movups %xmm0, 0x18(%rbx)
movq $0x9, 0x28(%rbx)
movq %r12, 0x30(%rbx)
movq %r14, 0x40(%rbx)
movq %rbx, %rdi
callq 0x4b7fa
movq %rbx, %rdi
callq 0x4b8b4
movq 0x18(%rbx), %rax
movq %rax, (%r15)
addq %r15, %r14
movups 0x20(%rbx), %xmm0
movups %xmm0, 0x8(%r15)
movups 0x30(%rbx), %xmm0
movups %xmm0, 0x18(%r15)
movups 0x40(%rbx), %xmm0
movups %xmm0, 0x28(%r15)
leaq 0xc0(%rsp), %rax
movl $0x0, (%rax)
leaq 0x90(%rsp), %rbx
movq %rax, (%rbx)
movq %r15, 0x8(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4bdaa
leaq 0x28(%rsp), %rsi
movq -0x8(%rsi), %rax
leaq 0x180(%rsp), %rdi
movups (%rsi), %xmm0
movups %xmm0, (%rdi)
movq 0x10(%rsi), %rcx
movq %rcx, 0x10(%rdi)
leaq 0xc(%rax), %rcx
testq %rax, %rax
cmoveq %rax, %rcx
movq %rcx, -0x8(%rdi)
callq 0x4a3a3
movq 0x20(%rsp), %r12
movq 0x40(%rsp), %r15
movq 0x48(%rsp), %r13
movq 0x50(%rsp), %rbp
leaq 0x58(%rsp), %rsi
movq $0x0, (%rsi)
movq %r13, 0x8(%rsi)
movq $0x1, 0x10(%rsi)
xorl %edi, %edi
callq 0x4b05b
movl $0x2, %eax
leaq 0x40(%rsp), %r14
subq -0x18(%r14), %rax
imulq -0x8(%r14), %rax
testq %r12, %r12
leaq (%r12,%rax,4), %rax
cmoveq %r12, %rax
leaq 0x160(%rsp), %rdi
movq %rax, -0x8(%rdi)
movq %r15, (%rdi)
movq %r13, 0x8(%rdi)
movq %rbp, 0x10(%rdi)
movq %r14, %rsi
callq 0x4a522
movq 0x20(%rsp), %r15
leaq 0x58(%rsp), %rsi
movq $0x4, (%rsi)
movq $0x3, 0x8(%rsi)
movq $0x1, 0x10(%rsi)
xorl %edi, %edi
callq 0x4b0ec
movl $0x5, %eax
subq 0x28(%rsp), %rax
imulq 0x38(%rsp), %rax
testq %r15, %r15
leaq 0x10(%r15,%rax,4), %rax
cmoveq %r15, %rax
leaq 0x138(%rsp), %rdi
movq %rax, -0x8(%rdi)
leaq 0x58(%rsp), %rsi
callq 0x4a682
movq 0x20(%rsp), %r12
movq 0x38(%rsp), %r15
leaq 0x58(%rsp), %rsi
movq $0x4, (%rsi)
movq $0x3, 0x8(%rsi)
movq %r15, 0x10(%rsi)
xorl %edi, %edi
callq 0x4b1ae
movl $0x4, %eax
subq 0x28(%rsp), %rax
movq 0x38(%rsp), %rcx
imulq %rcx, %rax
testq %r12, %r12
leaq 0x18(%r12,%rax,4), %rax
cmoveq %r12, %rax
leaq 0x148(%rsp), %rdi
movq %rax, -0x8(%rdi)
movq %r15, 0x8(%rdi)
leaq 0x58(%rsp), %rsi
movq %rcx, 0x8(%rsi)
callq 0x4a7d9
movq 0x20(%rsp), %r15
movq 0x38(%rsp), %rax
leaq 0x58(%rsp), %rdi
movq $0x2, 0x10(%rdi)
movq $0x6, 0x18(%rdi)
movq %rax, 0x8(%rdi)
callq 0x4b23c
leaq 0x58(%rsp), %rsi
movq 0x20(%rsi), %rax
leaq 0xd8(%rsp), %rdi
movq %rax, 0x10(%rdi)
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movups %xmm1, (%rdi)
movl $0x3, %eax
subq 0x28(%rsp), %rax
imulq 0x38(%rsp), %rax
testq %r15, %r15
leaq 0x8(%r15,%rax,4), %rax
cmoveq %r15, %rax
movups %xmm0, -0x10(%rdi)
movq %rax, -0x18(%rdi)
movq $0x2, (%rsi)
movq $0x6, 0x8(%rsi)
callq 0x4a939
leaq 0xc8(%rsp), %r15
movq 0x38(%rsp), %rax
leaq 0x58(%rsp), %rsi
movq %rax, 0x8(%rsi)
movq %r15, %rdi
callq 0x4aaa2
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
leaq 0x58(%rsp), %rsi
leaq 0xc0(%rsp), %rax
movq %rax, (%rsi)
movq %rbx, 0x8(%rsi)
movq %r15, %rdi
callq 0x4bfe0
movq 0x20(%rsp), %r15
movq 0x38(%rsp), %rax
movq 0x10(%r14), %rcx
leaq 0x58(%rsp), %rdi
movq %rcx, 0x20(%rdi)
movups (%r14), %xmm0
movups %xmm0, 0x10(%rdi)
movq %rax, 0x8(%rdi)
callq 0x4b325
movq 0x78(%rsp), %rax
leaq 0x118(%rsp), %rdi
movq %rax, 0x10(%rdi)
movups 0x58(%rsp), %xmm0
movups 0x68(%rsp), %xmm1
movups %xmm1, (%rdi)
movl $0x3, %eax
subq 0x28(%rsp), %rax
movups %xmm0, -0x10(%rdi)
imulq 0x38(%rsp), %rax
testq %r15, %r15
leaq (%r15,%rax,4), %rax
cmoveq %r15, %rax
movq %rax, -0x18(%rdi)
movq %r14, %rsi
callq 0x4a522
leaq 0x108(%rsp), %r15
movq 0x38(%rsp), %rax
leaq 0x58(%rsp), %rsi
movq %rax, 0x8(%rsi)
movq %r15, %rdi
callq 0x4aaa2
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
leaq 0x100(%rsp), %rax
leaq 0x58(%rsp), %r14
movq %rax, (%r14)
movq %rbx, 0x8(%r14)
movq %r15, %rdi
movq %r14, %rsi
callq 0x4c26a
movq 0x20(%rsp), %rbx
movq 0x38(%rsp), %rax
leaq 0x90(%rsp), %rdi
movq $0x2, 0x18(%rdi)
movq $0x4, 0x20(%rdi)
movq $0x3, (%rdi)
movq %rax, 0x10(%rdi)
callq 0x4b388
leaq 0x90(%rsp), %rsi
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movups 0x20(%rsi), %xmm2
leaq 0x78(%rsp), %rdi
movups %xmm2, 0x8(%rdi)
movups %xmm1, -0x8(%rdi)
movl $0x3, %eax
subq 0x28(%rsp), %rax
imulq 0x38(%rsp), %rax
testq %rbx, %rbx
leaq 0x8(%rbx,%rax,4), %rax
cmoveq %rbx, %rax
movups %xmm0, -0x18(%rdi)
movq %rax, -0x20(%rdi)
movq $0x2, (%rsi)
movq $0x4, 0x8(%rsi)
callq 0x4a939
leaq 0x60(%rsp), %rbx
movq 0x38(%rsp), %rax
leaq 0x90(%rsp), %rsi
movq $0x3, (%rsi)
movq %rax, 0x10(%rsi)
movq %rbx, %rdi
callq 0x4ac02
xorps %xmm0, %xmm0
leaq 0xf0(%rsp), %rax
movaps %xmm0, (%rax)
leaq 0x90(%rsp), %rsi
movq %r14, (%rsi)
movq %rax, 0x8(%rsi)
movq %rbx, %rdi
callq 0x4c55e
leaq 0x8(%rsp), %rdi
callq 0x4bcc4
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4a1cf
jmp 0x4a1ba
jmp 0x4a1ba
jmp 0x4a1ba
jmp 0x4a1ba
jmp 0x4a1ba
jmp 0x4a1ba
jmp 0x4a1ba
jmp 0x4a1ba
jmp 0x4a1ba
jmp 0x4a1ba
jmp 0x4a1ba
jmp 0x4a1ba
jmp 0x4a1ba
jmp 0x4a1ba
jmp 0x4a1ba
jmp 0x4a1ba
jmp 0x4a1ba
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4bcc4
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc036
nop