// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/shape.cpp
// Function: nda::test_for_all_indices_3d_reordered_body()
TEST(for_all_indices_3d_reordered) {
  shape_of_rank<3> s(3, 5, {0, 8, 1});
  s.resolve();
  int expected_flat_offset = 0;
  move_only token;
  for_all_indices<2, 0, 1>(s, [&, token = std::move(token)](int x, int y, int z) {
    ASSERT_EQ(s(x, y, z), expected_flat_offset);
    expected_flat_offset++;
    assert_used(token);
  });
  // 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 $0x258, %rsp            # imm = 0x258
leaq 0x210(%rsp), %r14
andq $0x0, (%r14)
movq $0x8, 0x8(%r14)
movq $0x1, 0x10(%r14)
andq $0x0, 0x18(%r14)
movq $0x5, 0x20(%r14)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x28(%r14)
andq $0x0, 0x30(%r14)
movq $0x3, 0x38(%r14)
movq %rax, 0x40(%r14)
movq %r14, %rdi
callq 0x11e95
leaq 0x8(%rsp), %rax
andl $0x0, (%rax)
movl (%r14), %ecx
movl %ecx, 0xc(%rsp)
movq 0x8(%r14), %rcx
movq %rcx, 0x50(%rsp)
movq 0x30(%r14), %rcx
movq 0x18(%r14), %rdx
movq 0x20(%r14), %rsi
addq %rdx, %rsi
movq %rsi, 0x48(%rsp)
movq 0x38(%r14), %rsi
movq %rcx, 0x40(%rsp)
addq %rcx, %rsi
movq %rsi, 0x58(%rsp)
leaq 0x28(%rsp), %rcx
movq %r14, 0x8(%rcx)
movq %rax, 0x10(%rcx)
leaq 0x80(%rsp), %r14
leaq 0x1a3fe(%rip), %r15     # 0x8d647
cmpq 0x48(%rsp), %rdx
je 0x733aa
movq 0x40(%rsp), %rsi
movq %rdx, 0x10(%rsp)
cmpq 0x58(%rsp), %rsi
je 0x733a2
movq 0x50(%rsp), %r12
movl 0xc(%rsp), %ecx
movq %rsi, 0x18(%rsp)
subq $0x1, %r12
jb 0x7339a
movq 0x30(%rsp), %rdi
movl %ecx, 0x4(%rsp)
callq 0x160c0
movq %rax, %r13
movq 0x38(%rsp), %rax
movslq (%rax), %rbp
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
leaq 0x385a1(%rip), %rsi     # 0xab84a
leaq 0x3(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpq %rbp, %r13
sete %sil
movq %r14, %rdi
movq %rbx, %rdx
callq 0x6894
movq %r14, %rdi
movq %r15, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x38591(%rip), %rsi     # 0xab86d
callq 0x107d8
movq %rax, %rdi
leaq 0x1e307(%rip), %rsi     # 0x915f2
callq 0x106fe
movq %rax, %r13
movq 0x30(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdx
movl 0x4(%rsp), %ecx
callq 0x160c0
movq %rax, 0x20(%rsp)
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
callq 0x107ba
movq %rax, %rdi
movq %r15, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x385b9(%rip), %rsi     # 0xab8eb
callq 0x3bfc6
movq %rax, %rdi
leaq 0x1e2b1(%rip), %rsi     # 0x915f2
callq 0x106fe
movq 0x38(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
movq %rax, %rdi
leaq 0x31f45(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %r14, %rdi
callq 0x68d4
leaq 0x60(%rsp), %rdi
callq 0x2090
movq 0x38(%rsp), %rax
incl (%rax)
leaq 0x28(%rsp), %rdi
callq 0x172e2
movl 0x4(%rsp), %ecx
incl %ecx
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rsi
jmp 0x73277
incq %rsi
jmp 0x7325e
incq %rdx
jmp 0x73249
movl 0x8(%rsp), %ebx
leaq 0x3727d(%rip), %rsi     # 0xaa632
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl $0x78, %ebx
sete %sil
leaq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x6894
leaq 0x1a261(%rip), %rsi     # 0x8d647
leaq 0x80(%rsp), %rdi
callq 0x106fe
leaq 0x384f1(%rip), %rsi     # 0xab8eb
movq %rax, %rdi
callq 0x3bfc6
leaq 0x1e1e9(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
leaq 0x1a222(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x37216(%rip), %rsi     # 0xaa64a
movq %rax, %rdi
callq 0x1110a
leaq 0x1e1af(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x28(%rsp), %rsi
movl $0x78, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x31e3d(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x80(%rsp), %rdi
callq 0x68d4
leaq 0x60(%rsp), %rdi
callq 0x2090
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x734d4
jmp 0x7349f
jmp 0x734b3
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x68d4
jmp 0x734ca
jmp 0x734dc
movq %rax, %rbx
jmp 0x734ca
jmp 0x734ba
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x68d4
leaq 0x60(%rsp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba