// File: /workspace/github_cpp_makefile_star2_O3/dsharlet[P]array/test/shape.cpp
// Function: nda::test_for_each_index_2d_of_3d_body()
TEST(for_each_index_2d_of_3d) {
  shape_of_rank<3> s(3, 5, {0, 8, 1});
  s.resolve();
  int expected_flat_offset = 0;
  for_each_index<0, 1>(s, [&](std::tuple<int, int> i) {
    ASSERT_EQ(s(std::get<0>(i), std::get<1>(i), 0), expected_flat_offset);
    expected_flat_offset += s.x().stride();
  });
  // Ensure the for_each_index loop above actually ran.
  ASSERT_EQ(expected_flat_offset, 120);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
xorl %ebx, %ebx
leaq 0x50(%rsp), %rdx
movq %rbx, -0x18(%rdx)
movq $0x8, -0x10(%rdx)
movq $0x1, -0x8(%rdx)
movq %rbx, (%rdx)
movq $0x5, 0x8(%rdx)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x10(%rdx)
leaq 0x68(%rsp), %rsi
movq %rbx, (%rsi)
movq $0x3, 0x8(%rsi)
movq %rax, 0x10(%rsi)
leaq 0x38(%rsp), %r14
movq %r14, %rdi
movq %r14, %rcx
callq 0x1a9f3
movq 0x20(%r14), %rax
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x88d4b
movq 0x68(%rsp), %rax
movq 0x50(%rsp), %rcx
addq %rcx, 0x20(%rsp)
movq 0x70(%rsp), %r12
shlq $0x20, %rax
movq %rax, 0x80(%rsp)
xorl %ebx, %ebx
movq %r12, 0x88(%rsp)
testq %r12, %r12
movq %rcx, 0x90(%rsp)
je 0x88d2d
movslq %ecx, %rax
movq %rax, 0x28(%rsp)
movq 0x78(%rsp), %rax
movq 0x80(%rsp), %r15
movq %r15, %rbp
sarq $0x20, %rbp
movq %rbp, %rcx
subq 0x68(%rsp), %rcx
movq 0x28(%rsp), %r14
subq 0x50(%rsp), %r14
imulq 0x60(%rsp), %r14
imulq %rax, %rcx
movq 0x48(%rsp), %rax
imulq 0x38(%rsp), %rax
addq %rcx, %r14
subq %rax, %r14
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq $0x3c, 0x30(%rsp)
movq %rsp, %r13
movq %r13, %rdi
leaq 0x30(%rsp), %rsi
xorl %edx, %edx
callq 0x2310
movq %rax, (%rsp)
movq 0x30(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movups 0x37579(%rip), %xmm0    # 0xc0150
movups %xmm0, (%rax)
movups 0x3757f(%rip), %xmm0    # 0xc0160
movups %xmm0, 0x10(%rax)
movups 0x37584(%rip), %xmm0    # 0xc0170
movups %xmm0, 0x20(%rax)
movups 0x37585(%rip), %xmm0    # 0xc017c
movups %xmm0, 0x2c(%rax)
movq %rcx, 0x8(%rsp)
movb $0x0, (%rax,%rcx)
movslq %ebx, %rax
xorl %esi, %esi
cmpq %rax, %r14
sete %sil
leaq 0x98(%rsp), %rdi
movq %r13, %rdx
movq %rdi, %r13
callq 0xbf80
movq %r13, %rdi
leaq 0x1aa57(%rip), %rsi     # 0xa3684
callq 0x18fba
movq %rax, %rdi
leaq 0x37551(%rip), %rsi     # 0xc018d
callq 0x3f5dc
movq %rax, %rdi
leaq 0x1e60b(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x88c97
movq 0x28(%rsp), %rax
subq 0x50(%rsp), %rax
imulq 0x60(%rsp), %rax
subq 0x68(%rsp), %rbp
imulq 0x78(%rsp), %rbp
movq 0x48(%rsp), %rcx
imulq 0x38(%rsp), %rcx
addq %rax, %rbp
subq %rcx, %rbp
movq %r14, %rdi
addq $0x10, %rdi
movq %rbp, %rsi
callq 0x21b0
movq %r14, %rdi
leaq 0x1a9e3(%rip), %rsi     # 0xa3684
callq 0x18fba
movq %rax, %rdi
leaq 0x374c8(%rip), %rsi     # 0xc0178
callq 0x4ace2
movq %rax, %rdi
leaq 0x1e597(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x88cde
movq %r14, %rdi
addq $0x10, %rdi
movl %ebx, %esi
callq 0x22f0
movq %r14, %rdi
leaq 0x315b1(%rip), %rsi     # 0xba299
callq 0x18fba
movq %r13, %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x88d10
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x78(%rsp), %rax
addl %eax, %ebx
movabsq $0x100000000, %rcx      # imm = 0x100000000
addq %rcx, %r15
decq %r12
jne 0x88b6a
movq 0x90(%rsp), %rcx
incq %rcx
cmpq 0x20(%rsp), %rcx
movq 0x88(%rsp), %r12
jne 0x88b44
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x361ac(%rip), %rsi     # 0xbef07
leaq 0x361c0(%rip), %rdx     # 0xbef22
movq %rsp, %rdi
callq 0xd14c
xorl %esi, %esi
cmpl $0x78, %ebx
sete %sil
leaq 0x98(%rsp), %rdi
movq %rsp, %rdx
callq 0xbf80
leaq 0x1a8fa(%rip), %rsi     # 0xa3684
leaq 0x98(%rsp), %rdi
callq 0x18fba
leaq 0x373da(%rip), %rsi     # 0xc0178
movq %rax, %rdi
callq 0x4ace2
leaq 0x1e4a9(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x88dcf
movq %r14, %rdi
addq $0x10, %rdi
movl %ebx, %esi
callq 0x22f0
leaq 0x1a8ae(%rip), %rsi     # 0xa3684
movq %r14, %rdi
callq 0x18fba
leaq 0x3613a(%rip), %rsi     # 0xbef1f
movq %rax, %rdi
callq 0x19a02
leaq 0x1e462(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x88e19
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x78, %esi
callq 0x22f0
leaq 0x31479(%rip), %rsi     # 0xba299
movq %rbx, %rdi
callq 0x18fba
leaq 0x98(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x88e4b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x88eb8
jmp 0x88e69
movq %rax, %rbx
jmp 0x88e79
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
cmpq %r15, %rdi
jne 0x88eab
jmp 0x88eb8
jmp 0x88ec0
movq %rax, %rbx
jmp 0x88e9d
jmp 0x88e8d
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x88eb8
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc0a9