// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/shape.cpp
// Function: nda::test_for_each_index_3d_reorderd_body()
TEST(for_each_index_3d_reorderd) {
  shape_of_rank<3> s(3, 5, {0, 8, 1});
  s.resolve();
  int expected_flat_offset = 0;
  move_only token;
  for_each_index<2, 0, 1>(s, [&, token = std::move(token)](std::tuple<int, int, int> 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 $0x2a8, %rsp            # imm = 0x2A8
leaq 0x260(%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 0x4(%rsp), %rax
andl $0x0, (%rax)
movq (%rbx), %rcx
movq 0x8(%rbx), %rdx
movq %rdx, 0x40(%rsp)
movq 0x30(%rbx), %rdx
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdi
addq %rsi, %rdi
movq %rdi, 0x38(%rsp)
movq 0x38(%rbx), %rdi
movq %rdx, 0x30(%rsp)
addq %rdx, %rdi
movq %rdi, 0x58(%rsp)
leaq 0x18(%rsp), %rdx
movq %rbx, 0x8(%rdx)
movq %rax, 0x10(%rdx)
shlq $0x20, %rcx
movq %rcx, 0x48(%rsp)
leaq 0xd0(%rsp), %rbp
leaq 0x193ac(%rip), %r15     # 0x8d647
cmpq 0x38(%rsp), %rsi
je 0x74474
movslq %esi, %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rax
movq %rsi, 0x50(%rsp)
cmpq 0x58(%rsp), %rax
je 0x7446c
movslq %eax, %rcx
movq %rcx, 0x10(%rsp)
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %r12
movq %rax, 0x60(%rsp)
subq $0x1, %rcx
jb 0x7445f
movq %rcx, 0x70(%rsp)
movq 0x20(%rsp), %rdi
movq %r12, 0x68(%rsp)
sarq $0x20, %r12
movq %r12, 0xb8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0xc8(%rsp)
leaq 0xb8(%rsp), %rsi
callq 0x127e0
movq %rax, %r13
movq 0x28(%rsp), %rax
movslq (%rax), %r14
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
leaq 0x37563(%rip), %rsi     # 0xab8a6
leaq 0x3(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpq %r14, %r13
sete %sil
movq %rbp, %rdi
movq %rbx, %rdx
callq 0x6894
movq %rbp, %rdi
movq %r15, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x36be8(%rip), %rsi     # 0xaaf5e
callq 0x1071a
movq %rax, %rdi
leaq 0x1d26d(%rip), %rsi     # 0x915f2
callq 0x106fe
movq %rax, %r13
movq 0x20(%rsp), %rdi
movq %r12, 0xa0(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0xb0(%rsp)
leaq 0xa0(%rsp), %rsi
callq 0x127e0
movq %rax, 0x78(%rsp)
movq %r13, %rdi
leaq 0x78(%rsp), %rsi
callq 0x107ba
movq %rax, %rdi
movq %r15, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x37503(%rip), %rsi     # 0xab8eb
callq 0x3bfc6
movq %rax, %rdi
leaq 0x1d1fb(%rip), %rsi     # 0x915f2
callq 0x106fe
movq 0x28(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
movq %rax, %rdi
leaq 0x30e8f(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %rbp, %rdi
callq 0x68d4
leaq 0x80(%rsp), %rdi
callq 0x2090
movq 0x28(%rsp), %rax
incl (%rax)
leaq 0x18(%rsp), %rdi
callq 0x172e2
movabsq $0x100000000, %rax      # imm = 0x100000000
movq 0x68(%rsp), %r12
addq %rax, %r12
movq 0x60(%rsp), %rax
movq 0x70(%rsp), %rcx
jmp 0x742da
incq %rax
movq 0x50(%rsp), %rsi
jmp 0x742b8
incq %rsi
jmp 0x7429b
movl 0x4(%rsp), %ebx
leaq 0x361b3(%rip), %rsi     # 0xaa632
leaq 0x80(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl $0x78, %ebx
sete %sil
leaq 0xd0(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x6894
leaq 0x1918e(%rip), %rsi     # 0x8d647
leaq 0xd0(%rsp), %rdi
callq 0x106fe
leaq 0x3741e(%rip), %rsi     # 0xab8eb
movq %rax, %rdi
callq 0x3bfc6
leaq 0x1d116(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x4(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
leaq 0x1914f(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x36143(%rip), %rsi     # 0xaa64a
movq %rax, %rdi
callq 0x1110a
leaq 0x1d0dc(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0xb8(%rsp), %rsi
movl $0x78, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x30d67(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0xd0(%rsp), %rdi
callq 0x68d4
leaq 0x80(%rsp), %rdi
callq 0x2090
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x745b0
jmp 0x74578
jmp 0x7458c
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x68d4
jmp 0x745a3
jmp 0x745b8
movq %rax, %rbx
jmp 0x745a3
jmp 0x74593
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x68d4
leaq 0x80(%rsp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba