// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/shape.cpp
// Function: nda::test_for_all_indices_2d_body()
TEST(for_all_indices_2d) {
  dense_shape<2> s(10, 4);
  s.resolve();
  int expected_flat_offset = 0;
  for_all_indices(s, [&](int x, int y) {
    ASSERT_EQ(s(x, y), expected_flat_offset);
    expected_flat_offset++;
  });
  // Ensure the for_all_indices 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 0x1aa8e(%rip), %r15     # 0x8d647
leaq 0x1ea32(%rip), %r14     # 0x915f2
cmpq 0x28(%rsp), %rax
je 0x72d3b
movq 0x80(%rsp), %rbx
movq 0x88(%rsp), %rcx
movq %rax, 0x30(%rsp)
cltq
movq %rax, 0x18(%rsp)
shlq $0x20, %rbx
subq $0x1, %rcx
jb 0x72d2e
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 0x38bec(%rip), %rsi     # 0xab822
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 0x38bce(%rip), %rsi     # 0xab842
callq 0x107f4
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 0x38c25(%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 0x325b5(%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 0x72beb
movq 0x30(%rsp), %rax
incq %rax
jmp 0x72bc0
leaq 0x378c2(%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 0x1a8d2(%rip), %rsi     # 0x8d647
leaq 0x98(%rsp), %rdi
callq 0x106fe
leaq 0x38b62(%rip), %rsi     # 0xab8eb
movq %rax, %rdi
callq 0x3bfc6
leaq 0x1e85a(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
leaq 0x1a893(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x2c136(%rip), %rsi     # 0x9eef9
movq %rax, %rdi
callq 0x10896
leaq 0x1e820(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x20(%rsp), %rsi
movl $0x28, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x324ae(%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 0x72e63
jmp 0x72e2e
jmp 0x72e42
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x68d4
jmp 0x72e59
jmp 0x72e6b
movq %rax, %rbx
jmp 0x72e59
jmp 0x72e49
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