// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/shape.cpp
// Function: nda::test_for_each_index_1d_body()
TEST(for_each_index_1d) {
  dense_shape<1> s(20);
  int expected_flat_offset = 0;
  for_each_index(s, [&](auto i) {
    ASSERT_EQ(s[i], expected_flat_offset);
    expected_flat_offset++;
  });
  // Ensure the for_each_index loop above actually ran.
  ASSERT_EQ(expected_flat_offset, 20);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
leaq 0x40(%rsp), %r14
pushq $0x14
popq %rsi
movq %r14, %rdi
callq 0x106be
leaq 0x4(%rsp), %rax
andl $0x0, (%rax)
movq (%r14), %r13
movq 0x8(%r14), %rax
xorl %ebp, %ebp
leaq 0x58(%rsp), %r15
leaq 0x19ce1(%rip), %r14     # 0x8d647
leaq 0x1dc85(%rip), %r12     # 0x915f2
subq $0x1, %rax
jb 0x73a73
movq %rax, 0x10(%rsp)
movq %r15, %rbx
movq %r14, %r15
movq %r13, %r14
subq 0x40(%rsp), %r14
movq %r13, 0x18(%rsp)
leaq 0x20(%rsp), %r13
movq %r13, %rdi
leaq 0x37f08(%rip), %rsi     # 0xab8a6
leaq 0x3(%rsp), %rdx
callq 0x66a0
movslq %ebp, %rax
xorl %esi, %esi
cmpq %rax, %r14
movq %r15, %r14
movq %rbx, %r15
sete %sil
movq %rbx, %rdi
movq %r13, %rdx
movq 0x18(%rsp), %r13
callq 0x6894
movq %r15, %rdi
movq %r14, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x3757f(%rip), %rsi     # 0xaaf5e
callq 0x1071a
movq %rax, %rdi
movq %r12, %rsi
callq 0x106fe
movq %r13, %rcx
subq 0x40(%rsp), %rcx
movq %rcx, 0x8(%rsp)
movq %rax, %rdi
leaq 0x8(%rsp), %rsi
callq 0x107ba
movq %rax, %rdi
movq %r14, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x37ecd(%rip), %rsi     # 0xab8eb
callq 0x3bfc6
movq %rax, %rdi
movq %r12, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x4(%rsp), %rsi
callq 0x10736
movq %rax, %rdi
leaq 0x3185d(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %r15, %rdi
callq 0x68d4
leaq 0x20(%rsp), %rdi
callq 0x2090
movl 0x4(%rsp), %ebp
incl %ebp
movl %ebp, 0x4(%rsp)
incq %r13
movq 0x10(%rsp), %rax
jmp 0x7396d
leaq 0x36b5c(%rip), %rsi     # 0xaa5d6
leaq 0x20(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl $0x14, %ebp
sete %sil
leaq 0x58(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x6894
leaq 0x19b9f(%rip), %rsi     # 0x8d647
leaq 0x58(%rsp), %rdi
callq 0x106fe
leaq 0x37e32(%rip), %rsi     # 0xab8eb
movq %rax, %rdi
callq 0x3bfc6
leaq 0x1db2a(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x4(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
leaq 0x19b63(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x1ba51(%rip), %rsi     # 0x8f544
movq %rax, %rdi
callq 0x10896
leaq 0x1daf0(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x8(%rsp), %rsi
movl $0x14, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x3177e(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x58(%rsp), %rdi
callq 0x68d4
leaq 0x20(%rsp), %rdi
callq 0x2090
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x73b8a
jmp 0x73b5b
jmp 0x73b6c
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x68d4
jmp 0x73b80
jmp 0x73b92
movq %rax, %rbx
jmp 0x73b80
jmp 0x73b73
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x68d4
leaq 0x20(%rsp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba