// File: /workspace/github_cpp_makefile_star2_O3/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 $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 0x88022
movq 0x58(%rsp), %rax
addq %rax, 0x20(%rsp)
xorl %ebx, %ebx
leaq 0x88(%rsp), %r15
leaq 0x1b82f(%rip), %r12     # 0xa3684
movq 0x78(%rsp), %rcx
testq %rcx, %rcx
je 0x88014
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 $0x1c, 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 0x3825f(%rip), %xmm0    # 0xc013f
movups %xmm0, 0xc(%rax)
movups 0x38248(%rip), %xmm0    # 0xc0133
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 0x1f33d(%rip), %rbx     # 0xa7256
callq 0xbf80
movq %r15, %rdi
movq %r12, %rsi
callq 0x18fba
movq %rax, %rdi
leaq 0x378b8(%rip), %rsi     # 0xbf7eb
callq 0x18ff2
movq %rax, %rdi
movq %rbx, %rsi
callq 0x18fba
movq %rax, %rbp
cmpb $0x1, 0x188(%rax)
jne 0x87f73
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 0x381f0(%rip), %rsi     # 0xc0178
callq 0x4ace2
movq %rax, %rdi
movq %rbx, %rsi
callq 0x18fba
movq %rax, %rbp
cmpb $0x1, 0x188(%rax)
jne 0x87fb5
movq %rbp, %rdi
addq $0x10, %rdi
movq 0x30(%rsp), %rsi
callq 0x22f0
movq %rbp, %rdi
leaq 0x322da(%rip), %rsi     # 0xba299
callq 0x18fba
movq %r15, %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x87fe7
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 0x87e7b
movq 0x40(%rsp), %rax
incq %rax
cmpq 0x20(%rsp), %rax
jne 0x87e55
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x36ea7(%rip), %rsi     # 0xbeed9
leaq 0x36eba(%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 0x1b623(%rip), %rsi     # 0xa3684
leaq 0x88(%rsp), %rdi
callq 0x18fba
leaq 0x38103(%rip), %rsi     # 0xc0178
movq %rax, %rdi
callq 0x4ace2
leaq 0x1f1d2(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x880a6
movq %r14, %rdi
addq $0x10, %rdi
movl %ebx, %esi
callq 0x22f0
leaq 0x1b5d7(%rip), %rsi     # 0xa3684
movq %r14, %rdi
callq 0x18fba
leaq 0x2bccc(%rip), %rsi     # 0xb3d88
movq %rax, %rdi
callq 0x1917a
leaq 0x1f18b(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x880f0
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x28, %esi
callq 0x22f0
leaq 0x321a2(%rip), %rsi     # 0xba299
movq %rbx, %rdi
callq 0x18fba
leaq 0x88(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x88122
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 0x8818f
jmp 0x88140
movq %rax, %rbx
jmp 0x88150
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
cmpq %r15, %rdi
jne 0x88182
jmp 0x8818f
jmp 0x88197
movq %rax, %rbx
jmp 0x88174
jmp 0x88164
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x8818f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc0a9