// File: /workspace/github_cpp_makefile_star2_O3/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 $0x218, %rsp            # imm = 0x218
xorl %ebx, %ebx
leaq 0x88(%rsp), %rsi
movq %rbx, (%rsi)
movl $0xa, %r15d
movq %r15, 0x8(%rsi)
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
movq %r12, 0x10(%rsi)
xorl %edi, %edi
callq 0xd133
leaq 0x58(%rsp), %r14
movq %rbx, (%r14)
movq $0x4, 0x8(%r14)
movq %r12, 0x10(%r14)
movq %rbx, 0x18(%r14)
movq %r15, 0x20(%r14)
movl $0x4, %edi
movq %r14, %rsi
callq 0x1c7de
movq %rax, 0x10(%r14)
movq 0x8(%r14), %rax
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x86a99
movq 0x58(%rsp), %rax
addq %rax, 0x20(%rsp)
xorl %ebx, %ebx
leaq 0x88(%rsp), %r15
leaq 0x1cdb8(%rip), %r12     # 0xa3684
movq 0x78(%rsp), %rcx
testq %rcx, %rcx
je 0x86a8b
movq 0x70(%rsp), %r13
movq %rax, 0x40(%rsp)
cltq
movq %rax, 0x28(%rsp)
movslq %ebx, %rbx
shlq $0x20, %r13
movq %rcx, 0x50(%rsp)
movq %r13, 0x48(%rsp)
sarq $0x20, %r13
movq %r13, %rax
subq 0x70(%rsp), %rax
movq 0x28(%rsp), %rbp
subq 0x58(%rsp), %rbp
imulq 0x68(%rsp), %rbp
addq %rax, %rbp
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq $0x1f, 0x38(%rsp)
movq %r15, %r14
movq %rsp, %r15
movq %r15, %rdi
leaq 0x38(%rsp), %rsi
xorl %edx, %edx
callq 0x2310
movq %rax, (%rsp)
movq 0x38(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movups 0x39767(%rip), %xmm0    # 0xc00be
movups %xmm0, 0xf(%rax)
movups 0x3974d(%rip), %xmm0    # 0xc00af
movups %xmm0, (%rax)
movq %rcx, 0x8(%rsp)
movq (%rsp), %rax
movb $0x0, (%rax,%rcx)
xorl %esi, %esi
movq %rbx, 0x30(%rsp)
cmpq %rbp, %rbx
sete %sil
movq %r14, %rdi
movq %r15, %rdx
movq %r14, %r15
leaq 0x208c6(%rip), %rbx     # 0xa7256
callq 0xbf80
movq %r15, %rdi
movq %r12, %rsi
callq 0x18fba
movq %rax, %rdi
leaq 0x39725(%rip), %rsi     # 0xc00cf
callq 0x1909a
movq %rax, %rdi
movq %rbx, %rsi
callq 0x18fba
movq %rax, %rbp
cmpb $0x1, 0x188(%rax)
jne 0x869ea
subq 0x70(%rsp), %r13
movq 0x28(%rsp), %rsi
subq 0x58(%rsp), %rsi
imulq 0x68(%rsp), %rsi
addq %r13, %rsi
movq %rbp, %rdi
addq $0x10, %rdi
callq 0x21b0
movq %rbp, %rdi
movq %r12, %rsi
callq 0x18fba
movq %rax, %rdi
leaq 0x39779(%rip), %rsi     # 0xc0178
callq 0x4ace2
movq %rax, %rdi
movq %rbx, %rsi
callq 0x18fba
movq %rax, %rbp
cmpb $0x1, 0x188(%rax)
jne 0x86a2c
movq %rbp, %rdi
addq $0x10, %rdi
movq 0x30(%rsp), %rsi
callq 0x22f0
movq %rbp, %rdi
leaq 0x33863(%rip), %rsi     # 0xba299
callq 0x18fba
movq %r15, %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x86a5e
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x30(%rsp), %rbx
incq %rbx
movabsq $0x100000000, %rax      # imm = 0x100000000
movq 0x48(%rsp), %r13
addq %rax, %r13
movq 0x50(%rsp), %rcx
decq %rcx
jne 0x868f2
movq 0x40(%rsp), %rax
incq %rax
cmpq 0x20(%rsp), %rax
jne 0x868cc
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x38430(%rip), %rsi     # 0xbeed9
leaq 0x38443(%rip), %rdx     # 0xbeef3
movq %rsp, %rdi
callq 0xd14c
xorl %esi, %esi
cmpl $0x28, %ebx
sete %sil
leaq 0x88(%rsp), %rdi
movq %rsp, %rdx
callq 0xbf80
leaq 0x1cbac(%rip), %rsi     # 0xa3684
leaq 0x88(%rsp), %rdi
callq 0x18fba
leaq 0x3968c(%rip), %rsi     # 0xc0178
movq %rax, %rdi
callq 0x4ace2
leaq 0x2075b(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x86b1d
movq %r14, %rdi
addq $0x10, %rdi
movl %ebx, %esi
callq 0x22f0
leaq 0x1cb60(%rip), %rsi     # 0xa3684
movq %r14, %rdi
callq 0x18fba
leaq 0x2d255(%rip), %rsi     # 0xb3d88
movq %rax, %rdi
callq 0x1917a
leaq 0x20714(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x86b67
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x28, %esi
callq 0x22f0
leaq 0x3372b(%rip), %rsi     # 0xba299
movq %rbx, %rdi
callq 0x18fba
leaq 0x88(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x86b99
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x86c06
jmp 0x86bb7
movq %rax, %rbx
jmp 0x86bc7
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
cmpq %r15, %rdi
jne 0x86bf9
jmp 0x86c06
jmp 0x86c0e
movq %rax, %rbx
jmp 0x86beb
jmp 0x86bdb
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x86c06
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc0a9