// File: /workspace/github_cpp_makefile_star2_O3/dsharlet[P]array/test/array_ref.cpp
// Function: nda::test_array_ref_indices_body()
TEST(array_ref_indices) {
  int data[100];
  for (int i = 0; i < 100; i++) {
    data[i] = i;
  }

  dense_array_ref<int, 1> ref_1d(data, {100});
  for_all_indices(ref_1d.shape(), [&](int x) { ASSERT_EQ(ref_1d(x), x); });

  dense_array_ref<int, 2> ref_2d(data, {20, 5});
  ASSERT_EQ(ref_2d.width(), 20);
  ASSERT_EQ(ref_2d.height(), 5);
  ASSERT_EQ(ref_2d.rows(), 20);
  ASSERT_EQ(ref_2d.columns(), 5);
  for_all_indices(ref_2d.shape(), [&](int x, int y) { ASSERT_EQ(ref_2d(x, y), y * 20 + x); });
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3a8, %rsp            # imm = 0x3A8
movdqa 0x6706f(%rip), %xmm0    # 0xadf90
xorl %eax, %eax
movdqa 0x67075(%rip), %xmm1    # 0xadfa0
movdqa %xmm0, 0x210(%rsp,%rax,4)
addq $0x4, %rax
paddd %xmm1, %xmm0
cmpq $0x64, %rax
jne 0x46f2b
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
leaq 0x80(%rsp), %rbx
movq $0x0, (%rbx)
movq $0x64, 0x8(%rbx)
movq %rax, 0x10(%rbx)
xorl %r14d, %r14d
xorl %edi, %edi
movq %rbx, %rsi
callq 0xd133
leaq 0x38(%rsp), %r13
leaq 0x5c704(%rip), %r12     # 0xa3684
leaq 0x602cf(%rip), %rbp     # 0xa7256
xorl %esi, %esi
cmpl 0x210(%rsp,%r14,4), %r14d
movq %r13, 0x28(%rsp)
movabsq $0x78203d3d20297828, %rax # imm = 0x78203D3D20297828
movq %rax, 0x6(%r13)
movabsq $0x782864315f666572, %rax # imm = 0x782864315F666572
movq %rax, (%r13)
movq $0xe, 0x30(%rsp)
movb $0x0, 0x46(%rsp)
sete %sil
movq %rbx, %rdi
leaq 0x28(%rsp), %rdx
callq 0xbf80
movq %rbx, %rdi
movq %r12, %rsi
callq 0x18fba
movq %rax, %rdi
leaq 0x67c3d(%rip), %rsi     # 0xaec23
callq 0x1902a
movq %rax, %rdi
movq %rbp, %rsi
callq 0x18fba
movq %rax, %r15
cmpb $0x1, 0x188(%rax)
jne 0x47016
movq %r15, %rdi
addq $0x10, %rdi
movl 0x210(%rsp,%r14,4), %esi
callq 0x22f0
movq %r15, %rdi
movq %r12, %rsi
callq 0x18fba
movq %rax, %rdi
leaq 0x67c1b(%rip), %rsi     # 0xaec46
callq 0x18fba
movq %rax, %rdi
movq %rbp, %rsi
callq 0x18fba
movq %rax, %r15
cmpb $0x1, 0x188(%rax)
jne 0x47056
movq %r15, %rdi
addq $0x10, %rdi
movl %r14d, %esi
callq 0x22f0
movq %r15, %rdi
leaq 0x73239(%rip), %rsi     # 0xba299
callq 0x18fba
movq %rbx, %rdi
callq 0xbfd8
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x47084
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
incq %r14
cmpq $0x64, %r14
jne 0x46f87
xorl %r15d, %r15d
leaq 0x80(%rsp), %rsi
movq %r15, (%rsi)
movl $0x14, %ebx
movq %rbx, 0x8(%rsi)
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
movq %r12, 0x10(%rsi)
xorl %edi, %edi
callq 0xd133
leaq 0x210(%rsp), %rax
leaq 0x30(%rsp), %r14
movq %rax, -0x8(%r14)
movq %r15, (%r14)
movq $0x5, 0x8(%r14)
movq %r12, 0x10(%r14)
movq %r15, 0x18(%r14)
movq %rbx, 0x20(%r14)
movl $0x5, %edi
movq %r14, %rsi
callq 0x1c7de
movq %rax, 0x10(%r14)
movq 0x20(%r14), %r14
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x66ec8(%rip), %rsi     # 0xadfd2
addq %rsi, %rbx
movq %rsp, %rdi
movq %rbx, %rdx
callq 0xd14c
xorl %esi, %esi
cmpq $0x14, %r14
sete %sil
leaq 0x80(%rsp), %rdi
movq %rsp, %rdx
callq 0xbf80
leaq 0x5c54b(%rip), %rsi     # 0xa3684
leaq 0x80(%rsp), %rdi
callq 0x18fba
leaq 0x66e9a(%rip), %rsi     # 0xadfe7
movq %rax, %rdi
callq 0x1a67a
leaq 0x600fa(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x47181
movq 0x50(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0x5c4fc(%rip), %rsi     # 0xa3684
movq %rbx, %rdi
callq 0x18fba
leaq 0x5e0dc(%rip), %rsi     # 0xa5273
movq %rax, %rdi
callq 0x1917a
leaq 0x600b0(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x471cb
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x14, %esi
callq 0x22f0
leaq 0x730c7(%rip), %rsi     # 0xba299
movq %rbx, %rdi
callq 0x18fba
leaq 0x80(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x47202
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x38(%rsp), %rbx
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x66ddd(%rip), %rsi     # 0xadff6
leaq 0x66dea(%rip), %rdx     # 0xae00a
callq 0xd14c
xorl %esi, %esi
cmpq $0x5, %rbx
sete %sil
leaq 0x80(%rsp), %rdi
movq %rsp, %rdx
callq 0xbf80
leaq 0x5c43e(%rip), %rsi     # 0xa3684
leaq 0x80(%rsp), %rdi
callq 0x18fba
leaq 0x66db1(%rip), %rsi     # 0xae00b
movq %rax, %rdi
callq 0x4acaa
leaq 0x5ffed(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x4728e
movq 0x38(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0x5c3ef(%rip), %rsi     # 0xa3684
movq %rbx, %rdi
callq 0x18fba
leaq 0x5dfa4(%rip), %rsi     # 0xa5248
movq %rax, %rdi
callq 0x18fba
leaq 0x5ffa3(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x472d8
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x5, %esi
callq 0x22f0
leaq 0x72fba(%rip), %rsi     # 0xba299
movq %rbx, %rdi
callq 0x18fba
leaq 0x80(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x4730f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x50(%rsp), %rbx
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x66cf5(%rip), %rsi     # 0xae01b
leaq 0x66d01(%rip), %rdx     # 0xae02e
callq 0xd14c
xorl %esi, %esi
cmpq $0x14, %rbx
sete %sil
leaq 0x80(%rsp), %rdi
movq %rsp, %rdx
callq 0xbf80
leaq 0x5c331(%rip), %rsi     # 0xa3684
leaq 0x80(%rsp), %rdi
callq 0x18fba
leaq 0x66cc8(%rip), %rsi     # 0xae02f
movq %rax, %rdi
callq 0x1910a
leaq 0x5fee0(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x4739b
movq 0x50(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0x5c2e2(%rip), %rsi     # 0xa3684
movq %rbx, %rdi
callq 0x18fba
leaq 0x5dec2(%rip), %rsi     # 0xa5273
movq %rax, %rdi
callq 0x1917a
leaq 0x5fe96(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x473e5
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x14, %esi
callq 0x22f0
leaq 0x72ead(%rip), %rsi     # 0xba299
movq %rbx, %rdi
callq 0x18fba
leaq 0x80(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x4741c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x38(%rsp), %rbx
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x66c0a(%rip), %rsi     # 0xae03d
leaq 0x66c18(%rip), %rdx     # 0xae052
callq 0xd14c
xorl %esi, %esi
cmpq $0x5, %rbx
sete %sil
leaq 0x80(%rsp), %rdi
movq %rsp, %rdx
callq 0xbf80
leaq 0x5c224(%rip), %rsi     # 0xa3684
leaq 0x80(%rsp), %rdi
callq 0x18fba
leaq 0x66bdf(%rip), %rsi     # 0xae053
movq %rax, %rdi
callq 0x19142
leaq 0x5fdd3(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x474a8
movq 0x38(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0x5c1d5(%rip), %rsi     # 0xa3684
movq %rbx, %rdi
callq 0x18fba
leaq 0x5dd8a(%rip), %rsi     # 0xa5248
movq %rax, %rdi
callq 0x18fba
leaq 0x5fd89(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x474f2
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x5, %esi
callq 0x22f0
leaq 0x72da0(%rip), %rsi     # 0xba299
movq %rbx, %rdi
callq 0x18fba
leaq 0x80(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x47529
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x38(%rsp), %rax
movq %rax, 0x68(%rsp)
testq %rax, %rax
je 0x47738
movq 0x30(%rsp), %rax
addq %rax, 0x68(%rsp)
movq %rax, 0x60(%rsp)
leal (,%rax,4), %eax
leal (%rax,%rax,4), %eax
movl %eax, 0x24(%rsp)
movq 0x50(%rsp), %rbx
testq %rbx, %rbx
je 0x4771b
movq 0x48(%rsp), %r14
movslq 0x60(%rsp), %rax
movq %rax, 0x70(%rsp)
movq %r14, %r15
shlq $0x20, %r15
addl 0x24(%rsp), %r14d
movq %r15, %rbp
sarq $0x20, %rbp
movq %rbp, %rax
subq 0x48(%rsp), %rax
movq 0x70(%rsp), %rcx
subq 0x30(%rsp), %rcx
imulq 0x40(%rsp), %rcx
shlq $0x2, %rax
addq 0x28(%rsp), %rax
xorl %r13d, %r13d
cmpl (%rax,%rcx,4), %r14d
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq $0x1a, 0x78(%rsp)
sete %r13b
movq %rsp, %r12
movq %r12, %rdi
leaq 0x78(%rsp), %rsi
xorl %edx, %edx
callq 0x2310
movq %rax, (%rsp)
movq 0x78(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movups 0x67649(%rip), %xmm0    # 0xaec37
movups %xmm0, 0xa(%rax)
movdqu 0x67633(%rip), %xmm0    # 0xaec2d
movdqu %xmm0, (%rax)
movq %rcx, 0x8(%rsp)
movq (%rsp), %rax
movb $0x0, (%rax,%rcx)
leaq 0x80(%rsp), %rdi
movl %r13d, %esi
movq %r12, %rdx
movq %rdi, %r12
callq 0xbf80
movq %r12, %rdi
leaq 0x5c059(%rip), %rsi     # 0xa3684
callq 0x18fba
movq %rax, %rdi
leaq 0x6760e(%rip), %rsi     # 0xaec48
callq 0x190d2
movq %rax, %rdi
leaq 0x5fc0d(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r13
cmpb $0x1, 0x188(%rax)
jne 0x47688
subq 0x48(%rsp), %rbp
shlq $0x2, %rbp
addq 0x28(%rsp), %rbp
movq 0x70(%rsp), %rax
subq 0x30(%rsp), %rax
imulq 0x40(%rsp), %rax
movq %r13, %rdi
addq $0x10, %rdi
movl (%rbp,%rax,4), %esi
callq 0x22f0
movq %r13, %rdi
leaq 0x5bff2(%rip), %rsi     # 0xa3684
callq 0x18fba
movq %rax, %rdi
leaq 0x6759c(%rip), %rsi     # 0xaec3d
callq 0x19062
movq %rax, %rdi
leaq 0x5fba6(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r13
cmpb $0x1, 0x188(%rax)
jne 0x476d0
movq %r13, %rdi
addq $0x10, %rdi
movl %r14d, %esi
callq 0x22f0
movq %r13, %rdi
leaq 0x72bbf(%rip), %rsi     # 0xba299
callq 0x18fba
movq %r12, %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x47702
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %r15
incl %r14d
decq %rbx
jne 0x47582
movq 0x60(%rsp), %rcx
incq %rcx
addl $0x14, 0x24(%rsp)
movq %rcx, 0x60(%rsp)
cmpq 0x68(%rsp), %rcx
jne 0x47559
addq $0x3a8, %rsp            # imm = 0x3A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x47750
jmp 0x47750
jmp 0x47750
movq %rax, %rbx
jmp 0x4781a
jmp 0x47776
jmp 0x47788
jmp 0x4779a
jmp 0x477ac
jmp 0x477ea
jmp 0x477ea
jmp 0x477ea
jmp 0x477ea
jmp 0x47776
jmp 0x47788
jmp 0x4779a
jmp 0x477ac
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xbfd8
jmp 0x477ff
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xbfd8
jmp 0x477ff
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xbfd8
jmp 0x477ff
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xbfd8
jmp 0x477ff
jmp 0x47822
movq %rax, %rbx
jmp 0x477d5
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xbfd8
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x4781a
movq 0x38(%rsp), %rsi
jmp 0x47812
jmp 0x47822
jmp 0x477ef
movq %rax, %rbx
jmp 0x477ff
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x4781a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc0a9