// File: /workspace/github_cpp_makefile_star2_O1/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
xorl %eax, %eax
movl %eax, 0x210(%rsp,%rax,4)
incq %rax
cmpq $0x64, %rax
jne 0x464fb
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 0xd09f
leaq 0x38(%rsp), %r13
leaq 0x5b10b(%rip), %r12     # 0xa1654
leaq 0x5edda(%rip), %rbp     # 0xa532a
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 0xbf0a
movq %rbx, %rdi
movq %r12, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x6683c(%rip), %rsi     # 0xacdeb
callq 0x18a86
movq %rax, %rdi
movq %rbp, %rsi
callq 0x18a16
movq %rax, %r15
cmpb $0x1, 0x188(%rax)
jne 0x465df
movq %r15, %rdi
addq $0x10, %rdi
movl 0x210(%rsp,%r14,4), %esi
callq 0x22f0
movq %r15, %rdi
movq %r12, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x6681a(%rip), %rsi     # 0xace0e
callq 0x18a16
movq %rax, %rdi
movq %rbp, %rsi
callq 0x18a16
movq %rax, %r15
cmpb $0x1, 0x188(%rax)
jne 0x4661f
movq %r15, %rdi
addq $0x10, %rdi
movl %r14d, %esi
callq 0x22f0
movq %r15, %rdi
leaq 0x71d40(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %rbx, %rdi
callq 0xbf62
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x4664d
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
incq %r14
cmpq $0x64, %r14
jne 0x46550
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 0xd09f
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 0x1c2a0
movq %rax, 0x10(%r14)
movq 0x20(%r14), %r14
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x65ac7(%rip), %rsi     # 0xac19a
addq %rsi, %rbx
movq %rsp, %rdi
movq %rbx, %rdx
callq 0xd0b8
xorl %esi, %esi
cmpq $0x14, %r14
sete %sil
leaq 0x80(%rsp), %rdi
movq %rsp, %rdx
callq 0xbf0a
leaq 0x5af52(%rip), %rsi     # 0xa1654
leaq 0x80(%rsp), %rdi
callq 0x18a16
leaq 0x65a99(%rip), %rsi     # 0xac1af
movq %rax, %rdi
callq 0x1a104
leaq 0x5ec05(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x4674a
movq 0x50(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0x5af03(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x5cacb(%rip), %rsi     # 0xa322b
movq %rax, %rdi
callq 0x18bd6
leaq 0x5ebbb(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x46794
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x14, %esi
callq 0x22f0
leaq 0x71bce(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0x80(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x467cb
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x38(%rsp), %rbx
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x659dc(%rip), %rsi     # 0xac1be
leaq 0x659e9(%rip), %rdx     # 0xac1d2
callq 0xd0b8
xorl %esi, %esi
cmpq $0x5, %rbx
sete %sil
leaq 0x80(%rsp), %rdi
movq %rsp, %rdx
callq 0xbf0a
leaq 0x5ae45(%rip), %rsi     # 0xa1654
leaq 0x80(%rsp), %rdi
callq 0x18a16
leaq 0x659b0(%rip), %rsi     # 0xac1d3
movq %rax, %rdi
callq 0x4a1d8
leaq 0x5eaf8(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x46857
movq 0x38(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0x5adf6(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x5c993(%rip), %rsi     # 0xa3200
movq %rax, %rdi
callq 0x18a16
leaq 0x5eaae(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x468a1
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x5, %esi
callq 0x22f0
leaq 0x71ac1(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0x80(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x468d8
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x50(%rsp), %rbx
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x658f4(%rip), %rsi     # 0xac1e3
leaq 0x65900(%rip), %rdx     # 0xac1f6
callq 0xd0b8
xorl %esi, %esi
cmpq $0x14, %rbx
sete %sil
leaq 0x80(%rsp), %rdi
movq %rsp, %rdx
callq 0xbf0a
leaq 0x5ad38(%rip), %rsi     # 0xa1654
leaq 0x80(%rsp), %rdi
callq 0x18a16
leaq 0x658c7(%rip), %rsi     # 0xac1f7
movq %rax, %rdi
callq 0x18b66
leaq 0x5e9eb(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x46964
movq 0x50(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0x5ace9(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x5c8b1(%rip), %rsi     # 0xa322b
movq %rax, %rdi
callq 0x18bd6
leaq 0x5e9a1(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x469ae
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x14, %esi
callq 0x22f0
leaq 0x719b4(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0x80(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x469e5
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x38(%rsp), %rbx
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x65809(%rip), %rsi     # 0xac205
leaq 0x65817(%rip), %rdx     # 0xac21a
callq 0xd0b8
xorl %esi, %esi
cmpq $0x5, %rbx
sete %sil
leaq 0x80(%rsp), %rdi
movq %rsp, %rdx
callq 0xbf0a
leaq 0x5ac2b(%rip), %rsi     # 0xa1654
leaq 0x80(%rsp), %rdi
callq 0x18a16
leaq 0x657de(%rip), %rsi     # 0xac21b
movq %rax, %rdi
callq 0x18b9e
leaq 0x5e8de(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x46a71
movq 0x38(%rsp), %rsi
movq %rbx, %rdi
addq $0x10, %rdi
callq 0x21b0
leaq 0x5abdc(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x5c779(%rip), %rsi     # 0xa3200
movq %rax, %rdi
callq 0x18a16
leaq 0x5e894(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x46abb
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x5, %esi
callq 0x22f0
leaq 0x718a7(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0x80(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x46af2
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x38(%rsp), %rax
movq %rax, 0x68(%rsp)
testq %rax, %rax
je 0x46cff
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 0x46ce2
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 0x66248(%rip), %xmm0    # 0xacdff
movups %xmm0, 0xa(%rax)
movups 0x66233(%rip), %xmm0    # 0xacdf5
movups %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 0xbf0a
movq %r12, %rdi
leaq 0x5aa62(%rip), %rsi     # 0xa1654
callq 0x18a16
movq %rax, %rdi
leaq 0x6620f(%rip), %rsi     # 0xace10
callq 0x18b2e
movq %rax, %rdi
leaq 0x5e71a(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r13
cmpb $0x1, 0x188(%rax)
jne 0x46c4f
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 0x5a9fb(%rip), %rsi     # 0xa1654
callq 0x18a16
movq %rax, %rdi
leaq 0x6619d(%rip), %rsi     # 0xace05
callq 0x18abe
movq %rax, %rdi
leaq 0x5e6b3(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r13
cmpb $0x1, 0x188(%rax)
jne 0x46c97
movq %r13, %rdi
addq $0x10, %rdi
movl %r14d, %esi
callq 0x22f0
movq %r13, %rdi
leaq 0x716c8(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %r12, %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x46cc9
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %r15
incl %r14d
decq %rbx
jne 0x46b4b
movq 0x60(%rsp), %rcx
incq %rcx
addl $0x14, 0x24(%rsp)
movq %rcx, 0x60(%rsp)
cmpq 0x68(%rsp), %rcx
jne 0x46b22
addq $0x3a8, %rsp            # imm = 0x3A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x46d17
jmp 0x46d17
jmp 0x46d17
movq %rax, %rbx
jmp 0x46de1
jmp 0x46d3d
jmp 0x46d4f
jmp 0x46d61
jmp 0x46d73
jmp 0x46db1
jmp 0x46db1
jmp 0x46db1
jmp 0x46db1
jmp 0x46d3d
jmp 0x46d4f
jmp 0x46d61
jmp 0x46d73
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xbf62
jmp 0x46dc6
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xbf62
jmp 0x46dc6
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xbf62
jmp 0x46dc6
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xbf62
jmp 0x46dc6
jmp 0x46de9
movq %rax, %rbx
jmp 0x46d9c
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xbf62
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x46de1
movq 0x38(%rsp), %rsi
jmp 0x46dd9
jmp 0x46de9
jmp 0x46db6
movq %rax, %rbx
jmp 0x46dc6
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x46de1
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc036