// File: /workspace/github_cpp_makefile_star2_O3/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 %r15d, %r15d
leaq 0xb8(%rsp), %rdx
movq %r15, -0x18(%rdx)
movq $0x8, -0x10(%rdx)
movq $0x1, -0x8(%rdx)
movq %r15, (%rdx)
movq $0x5, 0x8(%rdx)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x10(%rdx)
leaq 0xd0(%rsp), %rsi
movq %r15, (%rsi)
movq $0x3, 0x8(%rsi)
movq %rax, 0x10(%rsi)
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
movq %rbx, %rcx
callq 0x1a9f3
leaq 0xc(%rsp), %rax
movl $0x0, (%rax)
movq (%rbx), %rcx
movq 0x8(%rbx), %rdx
movq %rdx, 0x40(%rsp)
movq 0x30(%rbx), %rdx
movq 0x38(%rbx), %rsi
movq 0x18(%rbx), %rdi
movq 0x20(%rbx), %r8
movq %rbx, 0x68(%rsp)
movq %rax, 0x70(%rsp)
testq %r8, %r8
je 0x8891e
addq %rdi, %r8
movq %rdx, 0x78(%rsp)
leaq (%rsi,%rdx), %rax
movq %rax, 0x98(%rsp)
shlq $0x20, %rcx
movq %rcx, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movq %r8, 0x80(%rsp)
movq %rdi, 0x38(%rsp)
testq %rsi, %rsi
je 0x888f4
movslq 0x38(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x40(%rsp)
je 0x888d9
movslq 0x30(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x90(%rsp), %rbp
movq 0x40(%rsp), %r15
movq %rbp, %r13
sarq $0x20, %r13
movq 0x68(%rsp), %rax
movq 0x50(%rsp), %rcx
subq 0x30(%rax), %rcx
imulq 0x40(%rax), %rcx
movq 0x70(%rsp), %rdx
movq 0x48(%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 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq $0x1c, 0x58(%rsp)
leaq 0x10(%rsp), %r12
movq %r12, %rdi
leaq 0x58(%rsp), %rsi
xorl %edx, %edx
callq 0x2310
movq %rax, 0x10(%rsp)
movq 0x58(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movups 0x379ba(%rip), %xmm0    # 0xc013f
movups %xmm0, 0xc(%rax)
movups 0x379a3(%rip), %xmm0    # 0xc0133
movups %xmm0, (%rax)
movq %rcx, 0x18(%rsp)
movq 0x10(%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 0xbf80
leaq 0x1aec0(%rip), %r12     # 0xa3684
movq %rbx, %rdi
movq %r12, %rsi
callq 0x18fba
movq %rax, %rdi
leaq 0x37012(%rip), %rsi     # 0xbf7eb
callq 0x18ff2
movq %rax, %rdi
leaq 0x1ea6e(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x88837
movq 0x68(%rsp), %rax
movq 0x48(%rsp), %rcx
subq 0x18(%rax), %rcx
imulq 0x28(%rax), %rcx
movq 0x50(%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 0x18fba
movq %rax, %rdi
leaq 0x3792c(%rip), %rsi     # 0xc0178
callq 0x4ace2
movq %rax, %rdi
leaq 0x1e9fb(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x8887f
movq 0x70(%rsp), %rax
movq %r14, %rdi
addq $0x10, %rdi
movl (%rax), %esi
callq 0x22f0
movq %r14, %rdi
leaq 0x31a10(%rip), %rsi     # 0xba299
callq 0x18fba
movq %rbx, %rdi
callq 0xbfd8
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x888b2
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x70(%rsp), %rax
incl (%rax)
leaq 0x60(%rsp), %rdi
callq 0x203cc
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %rbp
decq %r15
jne 0x88707
movq 0x30(%rsp), %rcx
incq %rcx
movq %rcx, 0x30(%rsp)
cmpq 0x98(%rsp), %rcx
jne 0x886e4
movq 0x38(%rsp), %rdi
incq %rdi
movq 0x80(%rsp), %r8
cmpq %r8, %rdi
movq 0x88(%rsp), %rsi
jne 0x886c2
cmpl $0x78, 0xc(%rsp)
sete %r15b
leaq 0x20(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x365d9(%rip), %rsi     # 0xbef07
leaq 0x365ed(%rip), %rdx     # 0xbef22
leaq 0x10(%rsp), %rdi
callq 0xd14c
movzbl %r15b, %esi
leaq 0xe8(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0xbf80
leaq 0x1ad28(%rip), %rsi     # 0xa3684
leaq 0xe8(%rsp), %rdi
callq 0x18fba
leaq 0x37808(%rip), %rsi     # 0xc0178
movq %rax, %rdi
callq 0x4ace2
leaq 0x1e8d7(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x889a3
movq %rbx, %rdi
addq $0x10, %rdi
movl 0xc(%rsp), %esi
callq 0x22f0
leaq 0x1acda(%rip), %rsi     # 0xa3684
movq %rbx, %rdi
callq 0x18fba
leaq 0x36566(%rip), %rsi     # 0xbef1f
movq %rax, %rdi
callq 0x19a02
leaq 0x1e88e(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x889ed
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x78, %esi
callq 0x22f0
leaq 0x318a5(%rip), %rsi     # 0xba299
movq %rbx, %rdi
callq 0x18fba
leaq 0xe8(%rsp), %rdi
callq 0xbfd8
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x88a20
movq 0x20(%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 0x88a8f
jmp 0x88a3e
movq %rax, %rbx
jmp 0x88a4e
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0xbfd8
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
jne 0x88a82
jmp 0x88a8f
jmp 0x88a97
movq %rax, %rbx
jmp 0x88a73
jmp 0x88a63
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0xbfd8
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x88a8f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc0a9