// File: /workspace/github_cpp_makefile_star2_O3/dsharlet[P]array/test/shape.cpp
// Function: nda::test_for_all_indices_2d_of_3d_body()
TEST(for_all_indices_2d_of_3d) {
  shape_of_rank<3> s(3, 5, {0, 8, 1});
  s.resolve();
  int expected_flat_offset = 0;
  for_all_indices<0, 1>(s, [&](int x, int y) {
    ASSERT_EQ(s(x, y, 0), expected_flat_offset);
    expected_flat_offset += s.x().stride();
  });
  // Ensure the for_all_indices 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 0x877ff
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 0x877e1
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 $0x22, 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 0x38a6a(%rip), %xmm0    # 0xc0105
movups %xmm0, (%rax)
movups 0x38a70(%rip), %xmm0    # 0xc0115
movups %xmm0, 0x10(%rax)
movw $0x7465, 0x20(%rax)     # imm = 0x7465
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 0x1bfa3(%rip), %rsi     # 0xa3684
callq 0x18fba
movq %rax, %rdi
leaq 0x38a38(%rip), %rsi     # 0xc0128
callq 0x19062
movq %rax, %rdi
leaq 0x1fb57(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x8774b
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 0x1bf2f(%rip), %rsi     # 0xa3684
callq 0x18fba
movq %rax, %rdi
leaq 0x38a14(%rip), %rsi     # 0xc0178
callq 0x4ace2
movq %rax, %rdi
leaq 0x1fae3(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x87792
movq %r14, %rdi
addq $0x10, %rdi
movl %ebx, %esi
callq 0x22f0
movq %r14, %rdi
leaq 0x32afd(%rip), %rsi     # 0xba299
callq 0x18fba
movq %r13, %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x877c4
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 0x8762e
movq 0x90(%rsp), %rcx
incq %rcx
cmpq 0x20(%rsp), %rcx
movq 0x88(%rsp), %r12
jne 0x87608
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x376f8(%rip), %rsi     # 0xbef07
leaq 0x3770c(%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 0x1be46(%rip), %rsi     # 0xa3684
leaq 0x98(%rsp), %rdi
callq 0x18fba
leaq 0x38926(%rip), %rsi     # 0xc0178
movq %rax, %rdi
callq 0x4ace2
leaq 0x1f9f5(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x87883
movq %r14, %rdi
addq $0x10, %rdi
movl %ebx, %esi
callq 0x22f0
leaq 0x1bdfa(%rip), %rsi     # 0xa3684
movq %r14, %rdi
callq 0x18fba
leaq 0x37686(%rip), %rsi     # 0xbef1f
movq %rax, %rdi
callq 0x19a02
leaq 0x1f9ae(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x878cd
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x78, %esi
callq 0x22f0
leaq 0x329c5(%rip), %rsi     # 0xba299
movq %rbx, %rdi
callq 0x18fba
leaq 0x98(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x878ff
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 0x8796c
jmp 0x8791d
movq %rax, %rbx
jmp 0x8792d
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
cmpq %r15, %rdi
jne 0x8795f
jmp 0x8796c
jmp 0x87974
movq %rax, %rbx
jmp 0x87951
jmp 0x87941
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0xbfd8
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x8796c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc0a9