// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/shape.cpp
// Function: nda::test_for_each_index_2d_body()
TEST(for_each_index_2d) {
  dense_shape<2> s(10, 4);
  s.resolve();
  int expected_flat_offset = 0;
  for_each_index(s, [&](std::tuple<int, int> 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, 40);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
leaq 0x68(%rsp), %rbx
pushq $0xa
popq %rsi
pushq $0x4
popq %rdx
movq %rbx, %rdi
callq 0x10754
movq %rbx, %rdi
callq 0x13ae7
leaq 0x10(%rsp), %rax
andl $0x0, (%rax)
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
addq %rax, %rcx
movq %rcx, 0x28(%rsp)
movl $0x0, 0x14(%rsp)
leaq 0x98(%rsp), %rbp
leaq 0x19a53(%rip), %r15     # 0x8d647
leaq 0x1d9f7(%rip), %r14     # 0x915f2
cmpq 0x28(%rsp), %rax
je 0x73d76
movq 0x80(%rsp), %rbx
movq 0x88(%rsp), %rcx
movq %rax, 0x30(%rsp)
cltq
movq %rax, 0x18(%rsp)
shlq $0x20, %rbx
subq $0x1, %rcx
jb 0x73d69
movq %rcx, 0x38(%rsp)
movq %rbx, 0x40(%rsp)
sarq $0x20, %rbx
movq %rbx, %rax
subq 0x80(%rsp), %rax
movq %r15, %r12
movq %rbp, %r15
movq 0x18(%rsp), %rbp
subq 0x68(%rsp), %rbp
imulq 0x78(%rsp), %rbp
addq %rax, %rbp
leaq 0x48(%rsp), %r13
movq %r13, %rdi
leaq 0x37c35(%rip), %rsi     # 0xab8a6
leaq 0xf(%rsp), %rdx
callq 0x66a0
movslq 0x14(%rsp), %rax
xorl %esi, %esi
cmpq %rax, %rbp
movq %r15, %rbp
movq %r12, %r15
sete %sil
movq %rbp, %rdi
movq %r13, %rdx
callq 0x6894
movq %rbp, %rdi
movq %r15, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x372af(%rip), %rsi     # 0xaaf5e
callq 0x1071a
movq %rax, %rdi
movq %r14, %rsi
callq 0x106fe
subq 0x80(%rsp), %rbx
movq 0x18(%rsp), %rcx
subq 0x68(%rsp), %rcx
imulq 0x78(%rsp), %rcx
addq %rbx, %rcx
movq %rcx, 0x20(%rsp)
movq %rax, %rdi
leaq 0x20(%rsp), %rsi
callq 0x107ba
movq %rax, %rdi
movq %r15, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x37bea(%rip), %rsi     # 0xab8eb
callq 0x3bfc6
movq %rax, %rdi
movq %r14, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x10736
movq %rax, %rdi
leaq 0x3157a(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %rbp, %rdi
callq 0x68d4
leaq 0x48(%rsp), %rdi
callq 0x2090
movl 0x10(%rsp), %eax
incl %eax
movl %eax, 0x14(%rsp)
movl %eax, 0x10(%rsp)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq 0x40(%rsp), %rbx
addq %rax, %rbx
movq 0x38(%rsp), %rcx
jmp 0x73c26
movq 0x30(%rsp), %rax
incq %rax
jmp 0x73bfb
leaq 0x36887(%rip), %rsi     # 0xaa604
leaq 0x48(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl $0x28, 0x14(%rsp)
sete %sil
leaq 0x98(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x6894
leaq 0x19897(%rip), %rsi     # 0x8d647
leaq 0x98(%rsp), %rdi
callq 0x106fe
leaq 0x37b27(%rip), %rsi     # 0xab8eb
movq %rax, %rdi
callq 0x3bfc6
leaq 0x1d81f(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
leaq 0x19858(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x2b0fb(%rip), %rsi     # 0x9eef9
movq %rax, %rdi
callq 0x10896
leaq 0x1d7e5(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x20(%rsp), %rsi
movl $0x28, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x31473(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x98(%rsp), %rdi
callq 0x68d4
leaq 0x48(%rsp), %rdi
callq 0x2090
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x73e9e
jmp 0x73e69
jmp 0x73e7d
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x68d4
jmp 0x73e94
jmp 0x73ea6
movq %rax, %rbx
jmp 0x73e94
jmp 0x73e84
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x68d4
leaq 0x48(%rsp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba