// File: /workspace/github_cpp_makefile_star2_O1/dsharlet[P]array/test/shape.cpp
// Function: nda::test_for_each_index_3d_body()
TEST(for_each_index_3d) {
  dense_shape<3> s(3, 5, 8);
  s.resolve();
  int expected_flat_offset = 0;
  move_only token;
  for_each_index(s, [&, token = std::move(token)](auto i) {
    ASSERT_EQ(s[i], expected_flat_offset);
    expected_flat_offset++;
    assert_used(token);
  });
  // 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 $0x238, %rsp            # imm = 0x238
xorl %ebx, %ebx
leaq 0xa8(%rsp), %rsi
movq %rbx, (%rsi)
movl $0x3, %r14d
movq %r14, 0x8(%rsi)
movabsq $-0x8000000000000000, %r15 # imm = 0x8000000000000000
movq %r15, 0x10(%rsi)
xorl %edi, %edi
callq 0xd09f
leaq 0x78(%rsp), %rsi
movq %rbx, -0x18(%rsi)
movq $0x8, -0x10(%rsi)
movq %r15, -0x8(%rsi)
movq %rbx, (%rsi)
movq $0x5, 0x8(%rsi)
movq %r15, 0x10(%rsi)
movq %rbx, 0x18(%rsi)
movq %r14, 0x20(%rsi)
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %rbx, %rdx
callq 0xc4eb
leaq 0x4(%rsp), %rax
movl $0x0, (%rax)
movq %rbx, 0x50(%rsp)
movq %rax, 0x58(%rsp)
movq 0x8(%rbx), %rax
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x8646a
movq 0x60(%rsp), %rax
movq %rax, 0x8(%rsp)
addq %rax, 0x30(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x38(%rsp)
testq %rax, %rax
je 0x86452
movq 0x78(%rsp), %rbx
addq %rbx, 0x38(%rsp)
movq 0x98(%rsp), %r12
testq %r12, %r12
je 0x86444
movq 0x90(%rsp), %rbp
movq 0x50(%rsp), %rax
movq 0x8(%rsp), %rcx
subq (%rax), %rcx
imulq 0x10(%rax), %rcx
movq %rbx, %r13
subq 0x18(%rax), %r13
imulq 0x28(%rax), %r13
movq 0x58(%rsp), %rdx
addq %rcx, %r13
subq 0x30(%rax), %r13
addq %rbp, %r13
movslq (%rdx), %r14
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq $0x1c, 0x40(%rsp)
leaq 0x10(%rsp), %r15
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
xorl %edx, %edx
callq 0x2310
movq %rax, 0x10(%rsp)
movq 0x40(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movups 0x382db(%rip), %xmm0    # 0xbe5df
movups %xmm0, 0xc(%rax)
movups 0x382c4(%rip), %xmm0    # 0xbe5d3
movups %xmm0, (%rax)
movq %rcx, 0x18(%rsp)
movq 0x10(%rsp), %rax
movb $0x0, (%rax,%rcx)
xorl %esi, %esi
cmpq %r14, %r13
sete %sil
leaq 0xa8(%rsp), %r14
movq %r14, %rdi
movq %r15, %rdx
callq 0xbf0a
leaq 0x1b311(%rip), %r15     # 0xa1654
movq %r14, %rdi
movq %r15, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x37933(%rip), %rsi     # 0xbdc8b
callq 0x18a4e
movq %rax, %rdi
leaq 0x1efc3(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r13
cmpb $0x1, 0x188(%rax)
jne 0x863ac
movq 0x50(%rsp), %rax
movq 0x8(%rsp), %rcx
subq (%rax), %rcx
imulq 0x10(%rax), %rcx
movq %rbx, %rsi
subq 0x18(%rax), %rsi
imulq 0x28(%rax), %rsi
addq %rcx, %rsi
subq 0x30(%rax), %rsi
addq %rbp, %rsi
movq %r13, %rdi
addq $0x10, %rdi
callq 0x21b0
movq %r13, %rdi
movq %r15, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x38257(%rip), %rsi     # 0xbe618
callq 0x4a210
movq %rax, %rdi
leaq 0x1ef5a(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r13
cmpb $0x1, 0x188(%rax)
jne 0x863f4
movq 0x58(%rsp), %rax
movq %r13, %rdi
addq $0x10, %rdi
movl (%rax), %esi
callq 0x22f0
movq %r13, %rdi
leaq 0x31f6b(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %r14, %rdi
callq 0xbf62
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x86427
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x58(%rsp), %rax
incl (%rax)
leaq 0x48(%rsp), %rdi
callq 0x1f92a
incq %rbp
decq %r12
jne 0x86297
incq %rbx
cmpq 0x38(%rsp), %rbx
jne 0x8627e
movq 0x8(%rsp), %rax
incq %rax
movq %rax, 0x8(%rsp)
cmpq 0x30(%rsp), %rax
jne 0x8625e
movl 0x4(%rsp), %ebx
leaq 0x20(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x36f29(%rip), %rsi     # 0xbd3a7
leaq 0x36f3d(%rip), %rdx     # 0xbd3c2
leaq 0x10(%rsp), %rdi
callq 0xd0b8
xorl %esi, %esi
cmpl $0x78, %ebx
sete %sil
leaq 0xa8(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0xbf0a
leaq 0x1b1a3(%rip), %rsi     # 0xa1654
leaq 0xa8(%rsp), %rdi
callq 0x18a16
leaq 0x38153(%rip), %rsi     # 0xbe618
movq %rax, %rdi
callq 0x4a210
leaq 0x1ee56(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x864f8
movq %rbx, %rdi
addq $0x10, %rdi
movl 0x4(%rsp), %esi
callq 0x22f0
leaq 0x1b155(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x36eb1(%rip), %rsi     # 0xbd3bf
movq %rax, %rdi
callq 0x19436
leaq 0x1ee0d(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x86542
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x78, %esi
callq 0x22f0
leaq 0x31e20(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0xa8(%rsp), %rdi
callq 0xbf62
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x86575
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x865e4
jmp 0x86593
movq %rax, %rbx
jmp 0x865a3
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0xbf62
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
jne 0x865d7
jmp 0x865e4
jmp 0x865ec
movq %rax, %rbx
jmp 0x865c8
jmp 0x865b8
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0xbf62
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x865e4
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc036