// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
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 0x4baaf
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 0x4c394
movq %rbx, %rdi
callq 0x4c45c
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 0x118(%rsp), %r12
movl $0x0, (%r12)
leaq 0x90(%rsp), %rbx
movq %r12, (%rbx)
movq %r15, 0x8(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4c95c
leaq 0x28(%rsp), %rsi
movq -0x8(%rsi), %rax
leaq 0x198(%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 0x4ae75
movq 0x20(%rsp), %r13
movq 0x40(%rsp), %r15
movups 0x48(%rsp), %xmm0
leaq 0x58(%rsp), %rsi
movq $0x0, (%rsi)
movaps %xmm0, 0xc0(%rsp)
movlps %xmm0, 0x8(%rsi)
movq $0x1, 0x10(%rsi)
xorl %edi, %edi
callq 0x4baaf
leaq 0x40(%rsp), %r14
movl $0x2, %eax
subq -0x18(%r14), %rax
imulq -0x8(%r14), %rax
testq %r13, %r13
leaq (%r13,%rax,4), %rax
cmoveq %r13, %rax
leaq 0x178(%rsp), %rdi
movq %rax, -0x8(%rdi)
movq %r15, (%rdi)
movaps 0xc0(%rsp), %xmm0
movups %xmm0, 0x8(%rdi)
movq %r14, %rsi
callq 0x4aff4
movq 0x20(%rsp), %r15
leaq 0x58(%rsp), %rsi
movq $0x4, (%rsi)
movq $0x3, 0x8(%rsi)
movq $0x1, 0x10(%rsi)
xorl %edi, %edi
callq 0x4bb40
movl $0x5, %eax
subq 0x28(%rsp), %rax
imulq 0x38(%rsp), %rax
testq %r15, %r15
leaq 0x10(%r15,%rax,4), %rax
cmoveq %r15, %rax
leaq 0x150(%rsp), %rdi
movq %rax, -0x8(%rdi)
leaq 0x58(%rsp), %rsi
callq 0x4b154
movq 0x20(%rsp), %r13
movq 0x38(%rsp), %r15
leaq 0x58(%rsp), %rsi
movq $0x4, (%rsi)
movq $0x3, 0x8(%rsi)
movq %r15, 0x10(%rsi)
xorl %edi, %edi
callq 0x4bc02
movl $0x4, %eax
subq 0x28(%rsp), %rax
movq 0x38(%rsp), %rcx
imulq %rcx, %rax
testq %r13, %r13
leaq 0x18(%r13,%rax,4), %rax
cmoveq %r13, %rax
leaq 0x160(%rsp), %rdi
movq %rax, -0x8(%rdi)
movq %r15, 0x8(%rdi)
leaq 0x58(%rsp), %rsi
movq %rcx, 0x8(%rsi)
callq 0x4b2ab
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 0x4bc90
leaq 0x58(%rsp), %rsi
movq 0x20(%rsi), %rax
leaq 0x130(%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 0x4b40b
leaq 0x120(%rsp), %r15
movq 0x38(%rsp), %rax
leaq 0x58(%rsp), %rsi
movq %rax, 0x8(%rsi)
movq %r15, %rdi
callq 0x4b574
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
leaq 0x58(%rsp), %rsi
movq %r12, (%rsi)
movq %rbx, 0x8(%rsi)
movq %r15, %rdi
callq 0x4cb92
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 0x4bd6b
movq 0x78(%rsp), %rax
leaq 0x100(%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 0x4aff4
leaq 0xf0(%rsp), %r15
movq 0x38(%rsp), %rax
leaq 0x58(%rsp), %rsi
movq %rax, 0x8(%rsi)
movq %r15, %rdi
callq 0x4b574
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
leaq 0xe8(%rsp), %rax
leaq 0x58(%rsp), %r14
movq %rax, (%r14)
movq %rbx, 0x8(%r14)
movq %r15, %rdi
movq %r14, %rsi
callq 0x4ce1c
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 0x4bdc0
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 0x4b40b
leaq 0x60(%rsp), %rbx
movq 0x38(%rsp), %rax
leaq 0x90(%rsp), %rsi
movq $0x3, (%rsi)
movq %rax, 0x10(%rsi)
movq %rbx, %rdi
callq 0x4b6d4
xorps %xmm0, %xmm0
leaq 0xd0(%rsp), %rax
movaps %xmm0, (%rax)
leaq 0x90(%rsp), %rsi
movq %r14, (%rsi)
movq %rax, 0x8(%rsi)
movq %rbx, %rdi
callq 0x4d110
leaq 0x8(%rsp), %rdi
callq 0x4c876
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x4aca2
jmp 0x4ac8d
jmp 0x4ac8d
jmp 0x4ac8d
jmp 0x4ac8d
jmp 0x4ac8d
jmp 0x4ac8d
jmp 0x4ac8d
jmp 0x4ac8d
jmp 0x4ac8d
jmp 0x4ac8d
jmp 0x4ac8d
jmp 0x4ac8d
jmp 0x4ac8d
jmp 0x4ac8d
jmp 0x4ac8d
jmp 0x4ac8d
jmp 0x4ac8d
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4c876
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc0a9