// File: 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
movq %rsp, %rbp
subq $0x730, %rsp            # imm = 0x730
leaq -0x50(%rbp), %rdi
movq %rdi, -0x5e8(%rbp)
movl $0x3, %esi
callq 0x36c00
movq -0x5e8(%rbp), %rsi
movl $0x0, -0x54(%rbp)
leaq -0x38(%rbp), %rdi
movq %rdi, -0x5e0(%rbp)
leaq -0x54(%rbp), %rdx
callq 0x96c10
movq -0x5e0(%rbp), %rdi
xorl %esi, %esi
callq 0x96c80
movq %rax, -0x5d8(%rbp)
jmp 0x8e499
movq -0x5d8(%rbp), %rax
movl $0x5, (%rax)
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x96c80
movq %rax, -0x5f0(%rbp)
jmp 0x8e4bd
movq -0x5f0(%rbp), %rax
movl $0x2, (%rax)
leaq -0x38(%rbp), %rdi
movl $0x2, %esi
callq 0x96c80
movq %rax, -0x5f8(%rbp)
jmp 0x8e4e1
movq -0x5f8(%rbp), %rax
movl $0x6, (%rax)
leaq -0x88(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x499e0
jmp 0x8e500
leaq -0xa8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x96cc0
jmp 0x8e515
leaq -0xa8(%rbp), %rdi
xorl %esi, %esi
callq 0x96d10
movq %rax, -0x600(%rbp)
jmp 0x8e52c
movq -0x600(%rbp), %rax
movl $0xa, (%rax)
leaq -0xa8(%rbp), %rdi
movl $0x1, %esi
callq 0x96d10
movq %rax, -0x608(%rbp)
jmp 0x8e553
movq -0x608(%rbp), %rax
movl $0x14, (%rax)
leaq -0xa8(%rbp), %rdi
movl $0x2, %esi
callq 0x96d10
movq %rax, -0x610(%rbp)
jmp 0x8e57a
movq -0x610(%rbp), %rax
movl $0x1e, (%rax)
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x96c80
movq %rax, -0x618(%rbp)
jmp 0x8e59b
movq -0x618(%rbp), %rax
movl (%rax), %eax
subl $0xa, %eax
sete %al
movb %al, -0x621(%rbp)
leaq -0x259(%rbp), %rdi
movq %rdi, -0x620(%rbp)
callq 0x33b0
movq -0x620(%rbp), %rdx
leaq 0x1594cc(%rip), %rsi    # 0x1e7a9d
leaq -0x258(%rbp), %rdi
callq 0x10a90
jmp 0x8e5df
movb -0x621(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x238(%rbp), %rdi
leaq -0x258(%rbp), %rdx
callq 0x10f80
jmp 0x8e600
leaq 0x14e1de(%rip), %rsi    # 0x1dc7e5
leaq -0x238(%rbp), %rdi
callq 0x34320
movq %rax, -0x630(%rbp)
jmp 0x8e61c
movq -0x630(%rbp), %rdi
leaq 0x15947f(%rip), %rsi    # 0x1e7aa9
callq 0x661c0
movq %rax, -0x638(%rbp)
jmp 0x8e638
movq -0x638(%rbp), %rdi
leaq 0x152166(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0x640(%rbp)
jmp 0x8e654
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x96c80
movq %rax, -0x648(%rbp)
jmp 0x8e668
movq -0x648(%rbp), %rsi
movq -0x640(%rbp), %rdi
callq 0x343a0
movq %rax, -0x650(%rbp)
jmp 0x8e684
movq -0x650(%rbp), %rdi
leaq 0x14e153(%rip), %rsi    # 0x1dc7e5
callq 0x34320
movq %rax, -0x658(%rbp)
jmp 0x8e6a0
movq -0x658(%rbp), %rdi
leaq 0x14fafc(%rip), %rsi    # 0x1de1aa
callq 0x34840
movq %rax, -0x660(%rbp)
jmp 0x8e6bc
movq -0x660(%rbp), %rdi
leaq 0x1520e2(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0x668(%rbp)
jmp 0x8e6d8
movq -0x668(%rbp), %rdi
movl $0xa, -0x260(%rbp)
leaq -0x260(%rbp), %rsi
callq 0x343a0
movq %rax, -0x670(%rbp)
jmp 0x8e6fe
movq -0x670(%rbp), %rdi
leaq 0x167d6f(%rip), %rsi    # 0x1f647b
callq 0x34320
jmp 0x8e713
leaq -0x238(%rbp), %rdi
callq 0x10ff0
jmp 0x8e721
leaq -0x258(%rbp), %rdi
callq 0x3100
leaq -0x259(%rbp), %rdi
callq 0x3290
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x96c80
movq %rax, -0x678(%rbp)
jmp 0x8e750
movq -0x678(%rbp), %rax
movl (%rax), %eax
subl $0x14, %eax
sete %al
movb %al, -0x681(%rbp)
leaq -0x411(%rbp), %rdi
movq %rdi, -0x680(%rbp)
callq 0x33b0
movq -0x680(%rbp), %rdx
leaq 0x159329(%rip), %rsi    # 0x1e7aaf
leaq -0x410(%rbp), %rdi
callq 0x10a90
jmp 0x8e794
movb -0x681(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x3f0(%rbp), %rdi
leaq -0x410(%rbp), %rdx
callq 0x10f80
jmp 0x8e7b5
leaq 0x14e029(%rip), %rsi    # 0x1dc7e5
leaq -0x3f0(%rbp), %rdi
callq 0x34320
movq %rax, -0x690(%rbp)
jmp 0x8e7d1
movq -0x690(%rbp), %rdi
leaq 0x1592dc(%rip), %rsi    # 0x1e7abb
callq 0x661c0
movq %rax, -0x698(%rbp)
jmp 0x8e7ed
movq -0x698(%rbp), %rdi
leaq 0x151fb1(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0x6a0(%rbp)
jmp 0x8e809
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x96c80
movq %rax, -0x6a8(%rbp)
jmp 0x8e820
movq -0x6a8(%rbp), %rsi
movq -0x6a0(%rbp), %rdi
callq 0x343a0
movq %rax, -0x6b0(%rbp)
jmp 0x8e83c
movq -0x6b0(%rbp), %rdi
leaq 0x14df9b(%rip), %rsi    # 0x1dc7e5
callq 0x34320
movq %rax, -0x6b8(%rbp)
jmp 0x8e858
movq -0x6b8(%rbp), %rdi
leaq 0x14ff22(%rip), %rsi    # 0x1de788
callq 0x34840
movq %rax, -0x6c0(%rbp)
jmp 0x8e874
movq -0x6c0(%rbp), %rdi
leaq 0x151f2a(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0x6c8(%rbp)
jmp 0x8e890
movq -0x6c8(%rbp), %rdi
movl $0x14, -0x418(%rbp)
leaq -0x418(%rbp), %rsi
callq 0x343a0
movq %rax, -0x6d0(%rbp)
jmp 0x8e8b6
movq -0x6d0(%rbp), %rdi
leaq 0x167bb7(%rip), %rsi    # 0x1f647b
callq 0x34320
jmp 0x8e8cb
leaq -0x3f0(%rbp), %rdi
callq 0x10ff0
jmp 0x8e8d9
leaq -0x410(%rbp), %rdi
callq 0x3100
leaq -0x411(%rbp), %rdi
callq 0x3290
leaq -0x38(%rbp), %rdi
movl $0x2, %esi
callq 0x96c80
movq %rax, -0x6d8(%rbp)
jmp 0x8e908
movq -0x6d8(%rbp), %rax
movl (%rax), %eax
subl $0x1e, %eax
sete %al
movb %al, -0x6e1(%rbp)
leaq -0x5c9(%rbp), %rdi
movq %rdi, -0x6e0(%rbp)
callq 0x33b0
movq -0x6e0(%rbp), %rdx
leaq 0x159183(%rip), %rsi    # 0x1e7ac1
leaq -0x5c8(%rbp), %rdi
callq 0x10a90
jmp 0x8e94c
movb -0x6e1(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x5a8(%rbp), %rdi
leaq -0x5c8(%rbp), %rdx
callq 0x10f80
jmp 0x8e96d
leaq 0x14de71(%rip), %rsi    # 0x1dc7e5
leaq -0x5a8(%rbp), %rdi
callq 0x34320
movq %rax, -0x6f0(%rbp)
jmp 0x8e989
movq -0x6f0(%rbp), %rdi
leaq 0x159136(%rip), %rsi    # 0x1e7acd
callq 0x661c0
movq %rax, -0x6f8(%rbp)
jmp 0x8e9a5
movq -0x6f8(%rbp), %rdi
leaq 0x151df9(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0x700(%rbp)
jmp 0x8e9c1
leaq -0x38(%rbp), %rdi
movl $0x2, %esi
callq 0x96c80
movq %rax, -0x708(%rbp)
jmp 0x8e9d8
movq -0x708(%rbp), %rsi
movq -0x700(%rbp), %rdi
callq 0x343a0
movq %rax, -0x710(%rbp)
jmp 0x8e9f4
movq -0x710(%rbp), %rdi
leaq 0x14dde3(%rip), %rsi    # 0x1dc7e5
callq 0x34320
movq %rax, -0x718(%rbp)
jmp 0x8ea10
movq -0x718(%rbp), %rdi
leaq 0x16c9b3(%rip), %rsi    # 0x1fb3d1
callq 0x34840
movq %rax, -0x720(%rbp)
jmp 0x8ea2c
movq -0x720(%rbp), %rdi
leaq 0x151d72(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0x728(%rbp)
jmp 0x8ea48
movq -0x728(%rbp), %rdi
movl $0x1e, -0x5d0(%rbp)
leaq -0x5d0(%rbp), %rsi
callq 0x343a0
movq %rax, -0x730(%rbp)
jmp 0x8ea6e
movq -0x730(%rbp), %rdi
leaq 0x1679ff(%rip), %rsi    # 0x1f647b
callq 0x34320
jmp 0x8ea83
leaq -0x5a8(%rbp), %rdi
callq 0x10ff0
jmp 0x8ea91
leaq -0x5c8(%rbp), %rdi
callq 0x3100
leaq -0x5c9(%rbp), %rdi
callq 0x3290
leaq -0x38(%rbp), %rdi
callq 0x36c70
addq $0x730, %rsp            # imm = 0x730
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x8ebc3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x8eb10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x8eb04
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x10ff0
jmp 0x8eb02
jmp 0x8eb04
leaq -0x258(%rbp), %rdi
callq 0x3100
leaq -0x259(%rbp), %rdi
callq 0x3290
jmp 0x8ebc3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x8eb65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x8eb59
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x10ff0
jmp 0x8eb57
jmp 0x8eb59
leaq -0x410(%rbp), %rdi
callq 0x3100
leaq -0x411(%rbp), %rdi
callq 0x3290
jmp 0x8ebc3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x8ebb7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x8ebab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x5a8(%rbp), %rdi
callq 0x10ff0
jmp 0x8eba9
jmp 0x8ebab
leaq -0x5c8(%rbp), %rdi
callq 0x3100
leaq -0x5c9(%rbp), %rdi
callq 0x3290
leaq -0x38(%rbp), %rdi
callq 0x36c70
movq -0x60(%rbp), %rdi
callq 0x33a0
movq %rax, %rdi
callq 0x116d0
nopl (%rax)