// File: /workspace/github_cpp_makefile_star2_O1/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 0x1a487
movq 0x20(%r14), %rax
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x85809
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 0x857eb
movslq %ecx, %rax
movq %rax, 0x28(%rsp)
movq 0x80(%rsp), %r15
movq %r15, %rbp
sarq $0x20, %rbp
movq %rbp, %rax
subq 0x68(%rsp), %rax
imulq 0x78(%rsp), %rax
movq 0x28(%rsp), %r14
subq 0x50(%rsp), %r14
imulq 0x60(%rsp), %r14
movq 0x48(%rsp), %rcx
imulq 0x38(%rsp), %rcx
addq %rax, %r14
subq %rcx, %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 0x38efd(%rip), %xmm0    # 0xbe5a5
movups %xmm0, (%rax)
movups 0x38f03(%rip), %xmm0    # 0xbe5b5
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 0xbf0a
movq %r13, %rdi
leaq 0x1bf66(%rip), %rsi     # 0xa1654
callq 0x18a16
movq %rax, %rdi
leaq 0x38ecb(%rip), %rsi     # 0xbe5c8
callq 0x18abe
movq %rax, %rdi
leaq 0x1fc1e(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x85758
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 0x1bef2(%rip), %rsi     # 0xa1654
callq 0x18a16
movq %rax, %rdi
leaq 0x38ea7(%rip), %rsi     # 0xbe618
callq 0x4a210
movq %rax, %rdi
leaq 0x1fbaa(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x8579f
movq %r14, %rdi
addq $0x10, %rdi
movl %ebx, %esi
callq 0x22f0
movq %r14, %rdi
leaq 0x32bc0(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %r13, %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x857d1
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
addl 0x78(%rsp), %ebx
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %r15
decq %r12
jne 0x85639
movq 0x90(%rsp), %rcx
incq %rcx
cmpq 0x20(%rsp), %rcx
movq 0x88(%rsp), %r12
jne 0x85618
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x37b8e(%rip), %rsi     # 0xbd3a7
leaq 0x37ba2(%rip), %rdx     # 0xbd3c2
movq %rsp, %rdi
callq 0xd0b8
xorl %esi, %esi
cmpl $0x78, %ebx
sete %sil
leaq 0x98(%rsp), %rdi
movq %rsp, %rdx
callq 0xbf0a
leaq 0x1be0c(%rip), %rsi     # 0xa1654
leaq 0x98(%rsp), %rdi
callq 0x18a16
leaq 0x38dbc(%rip), %rsi     # 0xbe618
movq %rax, %rdi
callq 0x4a210
leaq 0x1fabf(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x8588d
movq %r14, %rdi
addq $0x10, %rdi
movl %ebx, %esi
callq 0x22f0
leaq 0x1bdc0(%rip), %rsi     # 0xa1654
movq %r14, %rdi
callq 0x18a16
leaq 0x37b1c(%rip), %rsi     # 0xbd3bf
movq %rax, %rdi
callq 0x19436
leaq 0x1fa78(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x858d7
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x78, %esi
callq 0x22f0
leaq 0x32a8b(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0x98(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x85909
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 0x85976
jmp 0x85927
movq %rax, %rbx
jmp 0x85937
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
cmpq %r15, %rdi
jne 0x85969
jmp 0x85976
jmp 0x8597e
movq %rax, %rbx
jmp 0x8595b
jmp 0x8594b
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x85976
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc036