// File: /workspace/github_cpp_makefile_star2_O1/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 0x1a487
movq 0x20(%r14), %rax
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x86d70
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 0x86d52
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 $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 0x379f1(%rip), %xmm0    # 0xbe5f0
movups %xmm0, (%rax)
movups 0x379f7(%rip), %xmm0    # 0xbe600
movups %xmm0, 0x10(%rax)
movups 0x379fc(%rip), %xmm0    # 0xbe610
movups %xmm0, 0x20(%rax)
movups 0x379fd(%rip), %xmm0    # 0xbe61c
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 0xbf0a
movq %r13, %rdi
leaq 0x1a9ff(%rip), %rsi     # 0xa1654
callq 0x18a16
movq %rax, %rdi
leaq 0x379c9(%rip), %rsi     # 0xbe62d
callq 0x3ec32
movq %rax, %rdi
leaq 0x1e6b7(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x86cbf
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 0x1a98b(%rip), %rsi     # 0xa1654
callq 0x18a16
movq %rax, %rdi
leaq 0x37940(%rip), %rsi     # 0xbe618
callq 0x4a210
movq %rax, %rdi
leaq 0x1e643(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x86d06
movq %r14, %rdi
addq $0x10, %rdi
movl %ebx, %esi
callq 0x22f0
movq %r14, %rdi
leaq 0x31659(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %r13, %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x86d38
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
addl 0x78(%rsp), %ebx
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %r15
decq %r12
jne 0x86b90
movq 0x90(%rsp), %rcx
incq %rcx
cmpq 0x20(%rsp), %rcx
movq 0x88(%rsp), %r12
jne 0x86b6f
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x36627(%rip), %rsi     # 0xbd3a7
leaq 0x3663b(%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 0x1a8a5(%rip), %rsi     # 0xa1654
leaq 0x98(%rsp), %rdi
callq 0x18a16
leaq 0x37855(%rip), %rsi     # 0xbe618
movq %rax, %rdi
callq 0x4a210
leaq 0x1e558(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x86df4
movq %r14, %rdi
addq $0x10, %rdi
movl %ebx, %esi
callq 0x22f0
leaq 0x1a859(%rip), %rsi     # 0xa1654
movq %r14, %rdi
callq 0x18a16
leaq 0x365b5(%rip), %rsi     # 0xbd3bf
movq %rax, %rdi
callq 0x19436
leaq 0x1e511(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x86e3e
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x78, %esi
callq 0x22f0
leaq 0x31524(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0x98(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x86e70
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 0x86edd
jmp 0x86e8e
movq %rax, %rbx
jmp 0x86e9e
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
cmpq %r15, %rdi
jne 0x86ed0
jmp 0x86edd
jmp 0x86ee5
movq %rax, %rbx
jmp 0x86ec2
jmp 0x86eb2
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0xbf62
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x86edd
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc036