// File: /workspace/github_cpp_makefile_star2_O1/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 $0x278, %rsp            # imm = 0x278
xorl %eax, %eax
leaq 0xb8(%rsp), %rdx
movq %rax, -0x18(%rdx)
movq $0x8, -0x10(%rdx)
movq $0x1, -0x8(%rdx)
movq %rax, (%rdx)
movq $0x5, 0x8(%rdx)
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
movq %rcx, 0x10(%rdx)
leaq 0xd0(%rsp), %rsi
movq %rax, (%rsi)
movq $0x3, 0x8(%rsi)
movq %rcx, 0x10(%rsi)
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
movq %rbx, %rcx
callq 0x1a487
leaq 0xc(%rsp), %rax
movl $0x0, (%rax)
movq (%rbx), %rcx
movq %rcx, 0x58(%rsp)
movq 0x8(%rbx), %rcx
movq %rcx, 0x60(%rsp)
movq 0x30(%rbx), %rcx
movq %rcx, 0x48(%rsp)
movq 0x38(%rbx), %rcx
movq %rcx, 0x50(%rsp)
movq 0x18(%rbx), %rcx
movq %rcx, 0x10(%rsp)
movq 0x20(%rbx), %rcx
movq %rbx, 0x88(%rsp)
movq %rax, 0x90(%rsp)
movq %rcx, 0x38(%rsp)
testq %rcx, %rcx
je 0x86940
movq 0x38(%rsp), %rax
addq 0x10(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x98(%rsp)
shlq $0x20, 0x58(%rsp)
cmpq $0x0, 0x50(%rsp)
je 0x86928
movslq 0x10(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpq $0x0, 0x60(%rsp)
je 0x8690d
movslq 0x40(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x58(%rsp), %rbp
movq 0x60(%rsp), %r15
movq %rbp, %r13
sarq $0x20, %r13
movq 0x88(%rsp), %rax
movq 0x70(%rsp), %rcx
subq 0x30(%rax), %rcx
imulq 0x40(%rax), %rcx
movq 0x90(%rsp), %rdx
movq 0x68(%rsp), %rsi
subq 0x18(%rax), %rsi
imulq 0x28(%rax), %rsi
addq %rcx, %rsi
movq %r13, %r14
subq (%rax), %r14
imulq 0x10(%rax), %r14
addq %rsi, %r14
movslq (%rdx), %rbx
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq $0x1c, 0x78(%rsp)
leaq 0x18(%rsp), %r12
movq %r12, %rdi
leaq 0x78(%rsp), %rsi
xorl %edx, %edx
callq 0x2310
movq %rax, 0x18(%rsp)
movq 0x78(%rsp), %rcx
movq %rcx, 0x28(%rsp)
movups 0x37e32(%rip), %xmm0    # 0xbe5df
movups %xmm0, 0xc(%rax)
movups 0x37e1b(%rip), %xmm0    # 0xbe5d3
movups %xmm0, (%rax)
movq %rcx, 0x20(%rsp)
movq 0x18(%rsp), %rax
movb $0x0, (%rax,%rcx)
xorl %esi, %esi
cmpq %rbx, %r14
sete %sil
leaq 0xe8(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rdx
callq 0xbf0a
leaq 0x1ae68(%rip), %r12     # 0xa1654
movq %rbx, %rdi
movq %r12, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x3748a(%rip), %rsi     # 0xbdc8b
callq 0x18a4e
movq %rax, %rdi
leaq 0x1eb1a(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x86862
movq 0x88(%rsp), %rax
movq 0x68(%rsp), %rcx
subq 0x18(%rax), %rcx
imulq 0x28(%rax), %rcx
movq 0x70(%rsp), %rdx
subq 0x30(%rax), %rdx
imulq 0x40(%rax), %rdx
subq (%rax), %r13
imulq 0x10(%rax), %r13
addq %rcx, %rdx
addq %rdx, %r13
movq %r14, %rdi
addq $0x10, %rdi
movq %r13, %rsi
callq 0x21b0
movq %r14, %rdi
movq %r12, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x37da1(%rip), %rsi     # 0xbe618
callq 0x4a210
movq %rax, %rdi
leaq 0x1eaa4(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x868ad
movq 0x90(%rsp), %rax
movq %r14, %rdi
addq $0x10, %rdi
movl (%rax), %esi
callq 0x22f0
movq %r14, %rdi
leaq 0x31ab2(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %rbx, %rdi
callq 0xbf62
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x868e0
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x90(%rsp), %rax
incl (%rax)
leaq 0x80(%rsp), %rdi
callq 0x1f92a
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %rbp
decq %r15
jne 0x86729
movq 0x40(%rsp), %rcx
incq %rcx
movq %rcx, 0x40(%rsp)
cmpq 0x98(%rsp), %rcx
jne 0x86709
movq 0x10(%rsp), %rcx
incq %rcx
movq %rcx, 0x10(%rsp)
cmpq 0x38(%rsp), %rcx
jne 0x866e9
movl 0xc(%rsp), %ebx
leaq 0x28(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x36a53(%rip), %rsi     # 0xbd3a7
leaq 0x36a67(%rip), %rdx     # 0xbd3c2
leaq 0x18(%rsp), %rdi
callq 0xd0b8
xorl %esi, %esi
cmpl $0x78, %ebx
sete %sil
leaq 0xe8(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0xbf0a
leaq 0x1accd(%rip), %rsi     # 0xa1654
leaq 0xe8(%rsp), %rdi
callq 0x18a16
leaq 0x37c7d(%rip), %rsi     # 0xbe618
movq %rax, %rdi
callq 0x4a210
leaq 0x1e980(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x869ce
movq %rbx, %rdi
addq $0x10, %rdi
movl 0xc(%rsp), %esi
callq 0x22f0
leaq 0x1ac7f(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x369db(%rip), %rsi     # 0xbd3bf
movq %rax, %rdi
callq 0x19436
leaq 0x1e937(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x86a18
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x78, %esi
callq 0x22f0
leaq 0x3194a(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0xe8(%rsp), %rdi
callq 0xbf62
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
je 0x86a4b
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21f0
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x86aba
jmp 0x86a69
movq %rax, %rbx
jmp 0x86a79
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0xbf62
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
jne 0x86aad
jmp 0x86aba
jmp 0x86ac2
movq %rax, %rbx
jmp 0x86a9e
jmp 0x86a8e
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0xbf62
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x86aba
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc036