// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/array_ref.cpp
// Function: nda::test_array_ref_implicit_conversion_body()
TEST(array_ref_implicit_conversion) {
  array_ref_of_rank<int, 3> null_ref(nullptr, {10, 20, 30});
  array_of_rank<int, 3> non_ref({5, 10, 20});
  dense_array<int, 3> dense_non_ref({5, 10, 20});
  const array_of_rank<int, 3>& const_non_ref = non_ref;

  // array -> ref
  array_ref_of_rank<int, 3> ref(non_ref);
  array_ref_of_rank<const int, 3> const_ref(const_non_ref);
  ref = non_ref;
  const_ref = non_ref;
  const_ref = const_non_ref;

  // non-const -> const
  array_ref_of_rank<const int, 3> const_null_ref(null_ref);
  const_null_ref = null_ref;
  const_ref = non_ref;
  non_template_const(null_ref);
  non_template_const(non_ref);

  // arbitrary -> dense
  dense_array_ref<int, 3> dense_null_ref(null_ref);
  dense_null_ref = null_ref;
  non_template_dense(null_ref);
  // non_template_dense(non_ref);

  // dense -> general
  array_ref_of_rank<int, 3> null_ref2(dense_null_ref);
  null_ref = dense_null_ref;
  non_template(dense_null_ref);
  // non_template(dense_non_ref);

  // nullptr -> ref
  non_template(nullptr);
  non_template_const(nullptr);
  non_template_dense(nullptr);

  ASSERT_EQ(overload_shape(null_ref), general);
  ASSERT_EQ(overload_shape(dense_null_ref), dense);
  ASSERT_EQ(overload_shape_const(null_ref), general);
  ASSERT_EQ(overload_shape_const(dense_null_ref), dense);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x330, %rsp            # imm = 0x330
leaq 0xd0(%rsp), %r15
pushq $0xa
popq %rbp
pushq $0x14
popq %r14
pushq $0x1e
popq %rcx
movq %r15, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x10b74
leaq 0x38(%rsp), %rbx
andq $0x0, -0x8(%rbx)
pushq $0x9
popq %rcx
movq %rbx, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %rbx, %rdi
callq 0x11e95
leaq 0xd0(%rsp), %r15
pushq $0x5
popq %r12
movq %r15, %rdi
movl %r12d, %esi
movl %ebp, %edx
movl %r14d, %ecx
callq 0x10b74
leaq 0x2c8(%rsp), %rdi
movq %r15, %rsi
callq 0x10b92
leaq 0xd0(%rsp), %rdi
movl %r12d, %esi
movl %ebp, %edx
movl %r14d, %ecx
callq 0x10810
leaq 0x260(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x6750
leaq 0x80(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3c146
leaq 0x80(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3c184
leaq 0xd0(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3c146
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
movq 0x80(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0xb8(%rsp), %xmm0
movups %xmm0, 0x68(%rsp)
movq $0x1, 0x78(%rsp)
movups 0xa0(%rsp), %xmm0
movups %xmm0, 0x50(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0x10(%rbx)
movups 0x88(%rsp), %xmm0
movups %xmm0, (%rbx)
leaq 0xd8(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x18(%rdi)
movups %xmm0, 0x30(%rdi)
andq $0x0, 0x8(%rdi)
movaps %xmm0, -0x8(%rdi)
movq %r14, 0x10(%rdi)
movq %r14, 0x28(%rdi)
movq %r14, 0x40(%rdi)
callq 0x11e95
leaq 0xd8(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x18(%rdi)
movups %xmm0, 0x30(%rdi)
andq $0x0, 0x8(%rdi)
movaps %xmm0, -0x8(%rdi)
movq %r14, 0x10(%rdi)
movq %r14, 0x28(%rdi)
movq %r14, 0x40(%rdi)
callq 0x11e95
leaq 0xd8(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x18(%rdi)
movups %xmm0, 0x30(%rdi)
andq $0x0, 0x8(%rdi)
movaps %xmm0, -0x8(%rdi)
movq %r14, 0x10(%rdi)
movq %r14, 0x28(%rdi)
callq 0x6e6d
leaq 0x5d8c6(%rip), %rsi     # 0x9886e
leaq 0x10(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x66a0
leaq 0xd0(%rsp), %rdi
pushq $0x1
popq %rsi
leaq 0x10(%rsp), %rdx
callq 0x6894
leaq 0x52674(%rip), %rsi     # 0x8d647
leaq 0xd0(%rsp), %rdi
callq 0x106fe
leaq 0x5d8ab(%rip), %rsi     # 0x98892
movq %rax, %rdi
callq 0x34cb0
leaq 0x565fc(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xc(%rsp), %rsi
andl $0x0, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x52632(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x5d866(%rip), %rsi     # 0x9888a
movq %rax, %rdi
callq 0x107f4
leaq 0x565bf(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq %rax, %rbx
leaq 0x8(%rsp), %rsi
andl $0x0, (%rsi)
movq %rax, %rdi
callq 0x3b3d2
leaq 0x6a24d(%rip), %rsi     # 0xa52a2
movq %rbx, %rdi
callq 0x106fe
leaq 0xd0(%rsp), %rdi
callq 0x68d4
leaq 0x10(%rsp), %rdi
callq 0x2090
leaq 0x5d830(%rip), %rsi     # 0x988ab
leaq 0x10(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x66a0
leaq 0xd0(%rsp), %rdi
pushq $0x1
popq %rsi
leaq 0x10(%rsp), %rdx
callq 0x6894
leaq 0x525a1(%rip), %rsi     # 0x8d647
leaq 0xd0(%rsp), %rdi
callq 0x106fe
leaq 0x5d819(%rip), %rsi     # 0x988d3
movq %rax, %rdi
callq 0x3160a
leaq 0x56529(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xc(%rsp), %rsi
movl $0x1, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x5255c(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x5d7d3(%rip), %rsi     # 0x988cd
movq %rax, %rdi
callq 0x223dc
leaq 0x564e9(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq %rax, %rbx
leaq 0x8(%rsp), %rsi
movl $0x1, (%rsi)
movq %rax, %rdi
callq 0x3b3d2
leaq 0x6a174(%rip), %rsi     # 0xa52a2
movq %rbx, %rdi
callq 0x106fe
leaq 0xd0(%rsp), %rdi
callq 0x68d4
leaq 0x10(%rsp), %rdi
callq 0x2090
leaq 0x5d79e(%rip), %rsi     # 0x988f2
leaq 0x10(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x66a0
leaq 0xd0(%rsp), %rdi
pushq $0x1
popq %rsi
leaq 0x10(%rsp), %rdx
callq 0x6894
leaq 0x524c8(%rip), %rsi     # 0x8d647
leaq 0xd0(%rsp), %rdi
callq 0x106fe
leaq 0x5d789(%rip), %rsi     # 0x9891c
movq %rax, %rdi
callq 0x3160a
leaq 0x56450(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xc(%rsp), %rsi
andl $0x0, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x52486(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x5d6ba(%rip), %rsi     # 0x9888a
movq %rax, %rdi
callq 0x107f4
leaq 0x56413(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq %rax, %rbx
leaq 0x8(%rsp), %rsi
andl $0x0, (%rsi)
movq %rax, %rdi
callq 0x3b3d2
leaq 0x6a0a1(%rip), %rsi     # 0xa52a2
movq %rbx, %rdi
callq 0x106fe
leaq 0xd0(%rsp), %rdi
callq 0x68d4
leaq 0x10(%rsp), %rdi
callq 0x2090
leaq 0x5d714(%rip), %rsi     # 0x9893b
leaq 0x10(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x66a0
leaq 0xd0(%rsp), %rdi
pushq $0x1
popq %rsi
leaq 0x10(%rsp), %rdx
callq 0x6894
leaq 0x523f5(%rip), %rsi     # 0x8d647
leaq 0xd0(%rsp), %rdi
callq 0x106fe
leaq 0x5d703(%rip), %rsi     # 0x98969
movq %rax, %rdi
callq 0x3167c
leaq 0x5637d(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xc(%rsp), %rsi
movl $0x1, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x523b0(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x5d627(%rip), %rsi     # 0x988cd
movq %rax, %rdi
callq 0x223dc
leaq 0x5633d(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq %rax, %rbx
leaq 0x8(%rsp), %rsi
movl $0x1, (%rsi)
movq %rax, %rdi
callq 0x3b3d2
leaq 0x69fc8(%rip), %rsi     # 0xa52a2
movq %rbx, %rdi
callq 0x106fe
leaq 0xd0(%rsp), %rdi
callq 0x68d4
leaq 0x10(%rsp), %rdi
callq 0x2090
leaq 0x260(%rsp), %rdi
callq 0x69c2
leaq 0x2c8(%rsp), %rdi
callq 0x10d02
addq $0x330, %rsp            # imm = 0x330
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3b346
jmp 0x3b346
jmp 0x3b346
jmp 0x3b346
jmp 0x3b346
jmp 0x3b346
jmp 0x3b346
jmp 0x3b346
jmp 0x3b358
jmp 0x3b341
jmp 0x3b36a
jmp 0x3b341
jmp 0x3b37c
jmp 0x3b341
jmp 0x3b38e
movq %rax, %rbx
jmp 0x3b39e
movq %rax, %rbx
jmp 0x3b3a8
movq %rax, %rbx
jmp 0x3b3b5
jmp 0x3b358
jmp 0x3b36a
jmp 0x3b37c
jmp 0x3b38e
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x68d4
jmp 0x3b39e
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x68d4
jmp 0x3b39e
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x68d4
jmp 0x3b39e
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x68d4
leaq 0x10(%rsp), %rdi
callq 0x2090
leaq 0x260(%rsp), %rdi
callq 0x69c2
leaq 0x2c8(%rsp), %rdi
callq 0x10d02
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba