// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/array_ref.cpp
// Function: nda::test_reinterpret_const_body()
TEST(reinterpret_const) {
  array_of_rank<int, 1> a1({3}, 0);
  a1(0) = 5;
  a1(1) = 2;
  a1(2) = 6;

  const_array_ref_of_rank<int, 1> a1_cref = a1.cref();
  array_ref_of_rank<int, 1> a1_ref = reinterpret_const<int>(a1_cref);
  a1_ref(0) = 10;
  a1_ref(1) = 20;
  a1_ref(2) = 30;

  ASSERT_EQ(a1(0), 10);
  ASSERT_EQ(a1(1), 20);
  ASSERT_EQ(a1(2), 30);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
leaq 0x68(%rsp), %rsi
andq $0x0, (%rsi)
movq $0x3, 0x8(%rsi)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x10(%rsi)
leaq 0x10(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x3c002
movq 0x18(%r15), %rax
movq 0x20(%r15), %rdx
movq 0x30(%r15), %rcx
pushq $0x1
popq %r14
movq %r14, %rsi
subq %rdx, %rsi
pushq $0x2
popq %rbx
movq %rbx, %rdi
subq %rdx, %rdi
imulq %rcx, %rdx
shlq $0x2, %rdx
negq %rdx
movl $0x5, (%rax,%rdx)
imulq %rcx, %rsi
movl $0x2, (%rax,%rsi,4)
imulq %rcx, %rdi
movl $0x6, (%rax,%rdi,4)
movq 0x20(%r15), %rdx
movq 0x30(%r15), %rsi
movq %r14, %rdi
subq %rdx, %rdi
movq %rbx, %r8
subq %rdx, %r8
negq %rdx
imulq %rsi, %rdi
imulq %rsi, %r8
imulq %rdx, %rsi
movl $0xa, (%rax,%rsi,4)
movl $0x14, (%rax,%rdi,4)
movl $0x1e, (%rax,%r8,4)
imulq %rcx, %rdx
movl (%rax,%rdx,4), %ebp
leaq 0x5e33a(%rip), %rsi     # 0x98747
leaq 0x10(%rsp), %rdi
leaq 0xb(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl $0xa, %ebp
sete %sil
leaq 0x68(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x6894
leaq 0x5320c(%rip), %rsi     # 0x8d647
leaq 0x68(%rsp), %rdi
callq 0x106fe
leaq 0x5e307(%rip), %rsi     # 0x98753
movq %rax, %rdi
callq 0x223dc
leaq 0x57197(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rcx
imulq 0x60(%rsp), %rcx
shlq $0x2, %rcx
subq %rcx, %rsi
movq %rax, %rdi
callq 0x10736
leaq 0x531be(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x54ace(%rip), %rsi     # 0x8ef66
movq %rax, %rdi
callq 0x10896
leaq 0x5714b(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xc(%rsp), %rsi
movl $0xa, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x6add9(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x68(%rsp), %rdi
callq 0x68d4
leaq 0x10(%rsp), %rdi
callq 0x2090
movq %r14, %rax
subq 0x50(%rsp), %rax
movq 0x48(%rsp), %rcx
imulq 0x60(%rsp), %rax
movl (%rcx,%rax,4), %ebp
leaq 0x5e257(%rip), %rsi     # 0x98759
leaq 0x10(%rsp), %rdi
leaq 0xb(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl $0x14, %ebp
sete %sil
leaq 0x68(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x6894
leaq 0x53117(%rip), %rsi     # 0x8d647
leaq 0x68(%rsp), %rdi
callq 0x106fe
leaq 0x5e224(%rip), %rsi     # 0x98765
movq %rax, %rdi
callq 0x223dc
leaq 0x570a2(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
subq 0x50(%rsp), %r14
imulq 0x60(%rsp), %r14
shlq $0x2, %r14
addq 0x48(%rsp), %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0x10736
leaq 0x530c9(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x54fb7(%rip), %rsi     # 0x8f544
movq %rax, %rdi
callq 0x10896
leaq 0x57056(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xc(%rsp), %rsi
movl $0x14, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x6ace4(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x68(%rsp), %rdi
callq 0x68d4
leaq 0x10(%rsp), %rdi
callq 0x2090
movq %rbx, %rax
subq 0x50(%rsp), %rax
movq 0x48(%rsp), %rcx
imulq 0x60(%rsp), %rax
movl (%rcx,%rax,4), %ebp
leaq 0x5e174(%rip), %rsi     # 0x9876b
leaq 0x10(%rsp), %rdi
leaq 0xb(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl $0x1e, %ebp
sete %sil
leaq 0x68(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x6894
leaq 0x53022(%rip), %rsi     # 0x8d647
leaq 0x68(%rsp), %rdi
callq 0x106fe
leaq 0x5e141(%rip), %rsi     # 0x98777
movq %rax, %rdi
callq 0x223dc
leaq 0x56fad(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
subq 0x50(%rsp), %rbx
imulq 0x60(%rsp), %rbx
shlq $0x2, %rbx
addq 0x48(%rsp), %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x10736
leaq 0x52fd4(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x6fb1e(%rip), %rsi     # 0xaa1a0
movq %rax, %rdi
callq 0x10896
leaq 0x56f61(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xc(%rsp), %rsi
movl $0x1e, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x6abef(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x68(%rsp), %rdi
callq 0x68d4
leaq 0x10(%rsp), %rdi
callq 0x2090
leaq 0x30(%rsp), %rdi
callq 0x11a7a
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3a6eb
jmp 0x3a6eb
movq %rax, %rbx
jmp 0x3a734
jmp 0x3a6ff
jmp 0x3a6fa
jmp 0x3a70e
jmp 0x3a6fa
jmp 0x3a71d
movq %rax, %rbx
jmp 0x3a72a
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x68d4
jmp 0x3a72a
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x68d4
jmp 0x3a72a
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x68d4
leaq 0x10(%rsp), %rdi
callq 0x2090
leaq 0x30(%rsp), %rdi
callq 0x11a7a
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba