// File: /workspace/github_cpp_makefile_star2_O1/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 0xd09f
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 0x1c2a0
movq %rax, 0x10(%r14)
movq 0x8(%r14), %rax
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x86032
movq 0x58(%rsp), %rax
addq %rax, 0x20(%rsp)
xorl %ebx, %ebx
leaq 0x88(%rsp), %r15
leaq 0x1b7ef(%rip), %r12     # 0xa1654
movq 0x78(%rsp), %rcx
testq %rcx, %rcx
je 0x86024
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 0x386ef(%rip), %xmm0    # 0xbe5df
movups %xmm0, 0xc(%rax)
movups 0x386d8(%rip), %xmm0    # 0xbe5d3
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 0x1f401(%rip), %rbx     # 0xa532a
callq 0xbf0a
movq %r15, %rdi
movq %r12, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x37d48(%rip), %rsi     # 0xbdc8b
callq 0x18a4e
movq %rax, %rdi
movq %rbx, %rsi
callq 0x18a16
movq %rax, %rbp
cmpb $0x1, 0x188(%rax)
jne 0x85f83
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 0x18a16
movq %rax, %rdi
leaq 0x38680(%rip), %rsi     # 0xbe618
callq 0x4a210
movq %rax, %rdi
movq %rbx, %rsi
callq 0x18a16
movq %rax, %rbp
cmpb $0x1, 0x188(%rax)
jne 0x85fc5
movq %rbp, %rdi
addq $0x10, %rdi
movq 0x30(%rsp), %rsi
callq 0x22f0
movq %rbp, %rdi
leaq 0x3239a(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %r15, %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x85ff7
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 0x85e8b
movq 0x40(%rsp), %rax
incq %rax
cmpq 0x20(%rsp), %rax
jne 0x85e65
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x37337(%rip), %rsi     # 0xbd379
leaq 0x3734a(%rip), %rdx     # 0xbd393
movq %rsp, %rdi
callq 0xd0b8
xorl %esi, %esi
cmpl $0x28, %ebx
sete %sil
leaq 0x88(%rsp), %rdi
movq %rsp, %rdx
callq 0xbf0a
leaq 0x1b5e3(%rip), %rsi     # 0xa1654
leaq 0x88(%rsp), %rdi
callq 0x18a16
leaq 0x38593(%rip), %rsi     # 0xbe618
movq %rax, %rdi
callq 0x4a210
leaq 0x1f296(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x860b6
movq %r14, %rdi
addq $0x10, %rdi
movl %ebx, %esi
callq 0x22f0
leaq 0x1b597(%rip), %rsi     # 0xa1654
movq %r14, %rdi
callq 0x18a16
leaq 0x2bd8c(%rip), %rsi     # 0xb1e58
movq %rax, %rdi
callq 0x18bd6
leaq 0x1f24f(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x86100
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x28, %esi
callq 0x22f0
leaq 0x32262(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0x88(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x86132
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 0x8619f
jmp 0x86150
movq %rax, %rbx
jmp 0x86160
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
cmpq %r15, %rdi
jne 0x86192
jmp 0x8619f
jmp 0x861a7
movq %rax, %rbx
jmp 0x86184
jmp 0x86174
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x8619f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc036