// File: /workspace/github_cpp_makefile_star2_O2/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 $0x238, %rsp            # imm = 0x238
leaq 0x60(%rsp), %rbx
andq $0x0, (%rbx)
movq $0x8, 0x8(%rbx)
movq $0x1, 0x10(%rbx)
andq $0x0, 0x18(%rbx)
movq $0x5, 0x20(%rbx)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x28(%rbx)
andq $0x0, 0x30(%rbx)
movq $0x3, 0x38(%rbx)
movq %rax, 0x40(%rbx)
movq %rbx, %rdi
callq 0x11e95
leaq 0xc(%rsp), %rax
andl $0x0, (%rax)
movl 0x30(%rbx), %eax
movl %eax, 0x14(%rsp)
movq 0x38(%rbx), %rax
movq %rax, 0x28(%rsp)
movq 0x18(%rbx), %rdx
movq 0x20(%rbx), %rax
addq %rdx, %rax
movq %rax, 0x30(%rsp)
xorl %r12d, %r12d
leaq 0xa8(%rsp), %r15
leaq 0x1a0cb(%rip), %r14     # 0x8d647
leaq 0x1e06f(%rip), %rbp     # 0x915f2
cmpq 0x30(%rsp), %rdx
je 0x736c7
movq 0x28(%rsp), %rax
movl 0x14(%rsp), %esi
movq %rdx, 0x18(%rsp)
subq $0x1, %rax
jb 0x736bf
movq %rax, 0x38(%rsp)
leaq 0x60(%rsp), %rdi
movl %esi, 0x10(%rsp)
xorl %ecx, %ecx
callq 0x160c0
movq %rax, %r12
movslq 0xc(%rsp), %r13
movq %r14, %rbx
leaq 0x40(%rsp), %r14
movq %r14, %rdi
leaq 0x382a3(%rip), %rsi     # 0xab878
leaq 0xb(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpq %r13, %r12
sete %sil
movq %r15, %rdi
movq %r14, %rdx
movq %rbx, %r14
callq 0x6894
movq %r15, %rdi
movq %r14, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x38290(%rip), %rsi     # 0xab89b
callq 0x107d8
movq %rax, %rdi
movq %rbp, %rsi
callq 0x106fe
movq %rax, %r12
leaq 0x60(%rsp), %rdi
movl 0x10(%rsp), %esi
movq 0x18(%rsp), %rdx
xorl %ecx, %ecx
callq 0x160c0
movq %rax, 0x20(%rsp)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
callq 0x107ba
movq %rax, %rdi
movq %r14, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x38291(%rip), %rsi     # 0xab8eb
callq 0x3bfc6
movq %rax, %rdi
movq %rbp, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0xc(%rsp), %rsi
callq 0x10736
movq %rax, %rdi
leaq 0x31c21(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %r15, %rdi
callq 0x68d4
leaq 0x40(%rsp), %rdi
callq 0x2090
movl 0xc(%rsp), %r12d
addl 0xa0(%rsp), %r12d
movl %r12d, 0xc(%rsp)
movl 0x10(%rsp), %esi
incl %esi
movq 0x18(%rsp), %rdx
movq 0x38(%rsp), %rax
jmp 0x7359c
incq %rdx
jmp 0x73583
leaq 0x36f64(%rip), %rsi     # 0xaa632
leaq 0x40(%rsp), %rdi
leaq 0xb(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl $0x78, %r12d
sete %sil
leaq 0xa8(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x6894
leaq 0x19f47(%rip), %rsi     # 0x8d647
leaq 0xa8(%rsp), %rdi
callq 0x106fe
leaq 0x381d7(%rip), %rsi     # 0xab8eb
movq %rax, %rdi
callq 0x3bfc6
leaq 0x1decf(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xc(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
leaq 0x19f08(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x36efc(%rip), %rsi     # 0xaa64a
movq %rax, %rdi
callq 0x1110a
leaq 0x1de95(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x20(%rsp), %rsi
movl $0x78, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x31b23(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0xa8(%rsp), %rdi
callq 0x68d4
leaq 0x40(%rsp), %rdi
callq 0x2090
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x737ee
jmp 0x737b9
jmp 0x737cd
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x68d4
jmp 0x737e4
jmp 0x737f6
movq %rax, %rbx
jmp 0x737e4
jmp 0x737d4
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x68d4
leaq 0x40(%rsp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba