// File: /workspace/github_cpp_makefile_star2_O2/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 $0x3c8, %rsp            # imm = 0x3C8
xorl %eax, %eax
cmpq $0x64, %rax
je 0x38f61
movl %eax, 0x230(%rsp,%rax,4)
incq %rax
jmp 0x38f4f
leaq 0xa0(%rsp), %r15
pushq $0x64
popq %rsi
movq %r15, %rdi
callq 0x106be
movq (%r15), %rax
movq 0x8(%r15), %rcx
movq %rax, %r12
shlq $0x20, %r12
leaq 0x546be(%rip), %rbx     # 0x8d647
leaq 0x58662(%rip), %r13     # 0x915f2
movq %rax, 0x40(%rsp)
subq $0x1, %rcx
jb 0x390a1
movq %rcx, 0x50(%rsp)
movl %eax, 0x18(%rsp)
movq %r12, 0x38(%rsp)
sarq $0x20, %r12
subq 0x40(%rsp), %r12
xorl %ebp, %ebp
movl %eax, 0x48(%rsp)
cmpl 0x230(%rsp,%r12,4), %eax
sete %bpl
movq %rbx, %r14
leaq 0x58(%rsp), %rbx
movq %rbx, %rdi
leaq 0x601b0(%rip), %rsi     # 0x9918a
leaq 0x8(%rsp), %rdx
callq 0x66a0
movq %r15, %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq %r14, %rbx
callq 0x6894
movq %r15, %rdi
movq %rbx, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x60190(%rip), %rsi     # 0x99199
callq 0x1079e
movq %rax, %rdi
movq %r13, %rsi
callq 0x106fe
leaq (%rsp,%r12,4), %rsi
addq $0x230, %rsi            # imm = 0x230
movq %rax, %rdi
callq 0x10736
movq %rax, %rdi
movq %rbx, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x6017b(%rip), %rsi     # 0x991bc
callq 0x106fe
movq %rax, %rdi
movq %r13, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x18(%rsp), %rsi
callq 0x10736
movq %rax, %rdi
leaq 0x6c23a(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %r15, %rdi
callq 0x68d4
leaq 0x58(%rsp), %rdi
callq 0x2090
movabsq $0x100000000, %rax      # imm = 0x100000000
movq 0x38(%rsp), %r12
addq %rax, %r12
movl 0x48(%rsp), %eax
incl %eax
movq 0x50(%rsp), %rcx
jmp 0x38f95
leaq 0xa0(%rsp), %rbx
pushq $0x14
popq %rsi
pushq $0x5
popq %rdx
movq %rbx, %rdi
callq 0x10754
leaq 0x230(%rsp), %rax
leaq 0x60(%rsp), %r14
movq %rax, -0x8(%r14)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups %xmm0, (%r14)
movups %xmm1, 0x10(%r14)
movups %xmm2, 0x20(%r14)
movq %r14, %rdi
callq 0x13ae7
movq 0x20(%r14), %rbx
leaq 0x5f44e(%rip), %rsi     # 0x98542
leaq 0x18(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpq $0x14, %rbx
sete %sil
leaq 0xa0(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x6894
leaq 0x54521(%rip), %rsi     # 0x8d647
leaq 0xa0(%rsp), %rdi
callq 0x106fe
leaq 0x5f41d(%rip), %rsi     # 0x98557
movq %rax, %rdi
callq 0x11bb4
leaq 0x584a9(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq 0x80(%rsp), %rcx
leaq 0x8(%rsp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x544d7(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x563c5(%rip), %rsi     # 0x8f544
movq %rax, %rdi
callq 0x10896
leaq 0x58464(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x4(%rsp), %rsi
movl $0x14, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x6c0f2(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0xa0(%rsp), %rdi
callq 0x68d4
leaq 0x18(%rsp), %rdi
callq 0x2090
movq 0x68(%rsp), %rbx
leaq 0x5f38b(%rip), %rsi     # 0x98566
leaq 0x18(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpq $0x5, %rbx
sete %sil
leaq 0xa0(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x6894
leaq 0x5443a(%rip), %rsi     # 0x8d647
leaq 0xa0(%rsp), %rdi
callq 0x106fe
leaq 0x5f35a(%rip), %rsi     # 0x9857b
movq %rax, %rdi
callq 0x3bfaa
leaq 0x583c2(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq 0x68(%rsp), %rcx
leaq 0x8(%rsp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x543f3(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x562b6(%rip), %rsi     # 0x8f519
movq %rax, %rdi
callq 0x106fe
leaq 0x58380(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x4(%rsp), %rsi
movl $0x5, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x6c00e(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0xa0(%rsp), %rdi
callq 0x68d4
leaq 0x18(%rsp), %rdi
callq 0x2090
movq 0x80(%rsp), %rbx
leaq 0x5f2c9(%rip), %rsi     # 0x9858b
leaq 0x18(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpq $0x14, %rbx
sete %sil
leaq 0xa0(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x6894
leaq 0x54353(%rip), %rsi     # 0x8d647
leaq 0xa0(%rsp), %rdi
callq 0x106fe
leaq 0x5f297(%rip), %rsi     # 0x9859f
movq %rax, %rdi
callq 0x1085e
leaq 0x582db(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq 0x80(%rsp), %rcx
leaq 0x8(%rsp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x54309(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x561f7(%rip), %rsi     # 0x8f544
movq %rax, %rdi
callq 0x10896
leaq 0x58296(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x4(%rsp), %rsi
movl $0x14, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x6bf24(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0xa0(%rsp), %rdi
callq 0x68d4
leaq 0x18(%rsp), %rdi
callq 0x2090
movq 0x68(%rsp), %rbx
leaq 0x5f204(%rip), %rsi     # 0x985ad
leaq 0x18(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpq $0x5, %rbx
sete %sil
leaq 0xa0(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x6894
leaq 0x5426c(%rip), %rsi     # 0x8d647
leaq 0xa0(%rsp), %rdi
callq 0x106fe
leaq 0x5f1d4(%rip), %rsi     # 0x985c3
movq %rax, %rdi
callq 0x1087a
leaq 0x581f4(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq 0x68(%rsp), %rcx
leaq 0x8(%rsp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x107ba
leaq 0x54225(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x560e8(%rip), %rsi     # 0x8f519
movq %rax, %rdi
callq 0x106fe
leaq 0x581b2(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x4(%rsp), %rsi
movl $0x5, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x6be40(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0xa0(%rsp), %rdi
callq 0x68d4
leaq 0x18(%rsp), %rdi
callq 0x2090
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rcx
addq %rax, %rcx
movq %rcx, 0x90(%rsp)
imull $0x14, %eax, %ecx
movl %ecx, 0x14(%rsp)
leaq 0xa0(%rsp), %r14
leaq 0x5419b(%rip), %r12     # 0x8d647
leaq 0x5813f(%rip), %r15     # 0x915f2
cmpq 0x90(%rsp), %rax
je 0x3964c
movq 0x78(%rsp), %rdx
movq 0x80(%rsp), %rcx
movq %rax, 0x98(%rsp)
movslq %eax, %r13
movq %rdx, %rbx
shlq $0x20, %rbx
addl 0x14(%rsp), %edx
movq %r13, 0x40(%rsp)
subq $0x1, %rcx
jb 0x39637
movq %rcx, 0x50(%rsp)
movq %rbx, 0x48(%rsp)
sarq $0x20, %rbx
movq %rbx, %rax
subq 0x78(%rsp), %rax
movq %r13, %rcx
subq 0x60(%rsp), %rcx
imulq 0x70(%rsp), %rcx
shlq $0x2, %rax
addq 0x58(%rsp), %rax
xorl %ebp, %ebp
movq %rdx, 0x38(%rsp)
cmpl (%rax,%rcx,4), %edx
sete %bpl
movq %r15, %r13
movq %r12, %r15
movq %r14, %r12
leaq 0x18(%rsp), %r14
movq %r14, %rdi
leaq 0x5fc5d(%rip), %rsi     # 0x991a3
leaq 0x4(%rsp), %rdx
callq 0x66a0
movq %r12, %rdi
movl %ebp, %esi
movq %r14, %rdx
movq %r12, %r14
movq %r15, %r12
movq %r13, %r15
movq 0x40(%rsp), %r13
callq 0x6894
movq %r14, %rdi
movq %r12, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x5fc3e(%rip), %rsi     # 0x991be
callq 0x1082e
movq %rax, %rdi
movq %r15, %rsi
callq 0x106fe
subq 0x78(%rsp), %rbx
movq %r13, %rcx
subq 0x60(%rsp), %rcx
imulq 0x70(%rsp), %rcx
shlq $0x2, %rbx
addq 0x58(%rsp), %rbx
leaq (%rbx,%rcx,4), %rsi
movq %rax, %rdi
callq 0x10736
movq %rax, %rdi
movq %r12, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x5fbe6(%rip), %rsi     # 0x991b3
callq 0x107d8
movq %rax, %rdi
movq %r15, %rsi
callq 0x106fe
movq 0x38(%rsp), %rcx
movl %ecx, 0x8(%rsp)
movq %rax, %rdi
leaq 0x8(%rsp), %rsi
callq 0x10736
movq %rax, %rdi
leaq 0x6bca5(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %r14, %rdi
callq 0x68d4
leaq 0x18(%rsp), %rdi
callq 0x2090
movabsq $0x100000000, %rax      # imm = 0x100000000
movq 0x48(%rsp), %rbx
addq %rax, %rbx
movq 0x38(%rsp), %rdx
incl %edx
movq 0x50(%rsp), %rcx
jmp 0x394e9
movq 0x98(%rsp), %rax
incq %rax
addl $0x14, 0x14(%rsp)
jmp 0x394b3
addq $0x3c8, %rsp            # imm = 0x3C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x39664
jmp 0x39664
jmp 0x39664
movq %rax, %rbx
jmp 0x3970d
jmp 0x39684
jmp 0x396ee
jmp 0x39696
jmp 0x396ee
jmp 0x396a8
jmp 0x396ee
jmp 0x396ba
jmp 0x396ee
jmp 0x39684
jmp 0x39696
jmp 0x396a8
jmp 0x396ba
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x68d4
jmp 0x39703
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x68d4
jmp 0x39703
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x68d4
jmp 0x39703
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x68d4
jmp 0x39703
jmp 0x39715
movq %rax, %rbx
jmp 0x396e3
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x68d4
leaq 0x58(%rsp), %rdi
jmp 0x39708
jmp 0x39715
jmp 0x396f3
movq %rax, %rbx
jmp 0x39703
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x68d4
leaq 0x18(%rsp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba