// File: /workspace/github_cpp_makefile_star2_O3/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 $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 0x873e2
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 0x873b8
movslq 0x38(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x40(%rsp)
je 0x8739d
movslq 0x30(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x90(%rsp), %rbp
movq 0x40(%rsp), %r15
movq 0x68(%rsp), %rax
movq 0x50(%rsp), %rcx
subq 0x30(%rax), %rcx
movq 0x70(%rsp), %rdx
imulq 0x40(%rax), %rcx
movq 0x48(%rsp), %rsi
subq 0x18(%rax), %rsi
imulq 0x28(%rax), %rsi
addq %rcx, %rsi
movq %rbp, %r13
sarq $0x20, %r13
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 $0x22, 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 0x38e8f(%rip), %xmm0    # 0xc00d7
movups %xmm0, (%rax)
movups 0x38e95(%rip), %xmm0    # 0xc00e7
movups %xmm0, 0x10(%rax)
movw $0x7465, 0x20(%rax)     # imm = 0x7465
movq %rcx, 0x18(%rsp)
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 0x1c3fc(%rip), %r12     # 0xa3684
movq %rbx, %rdi
movq %r12, %rsi
callq 0x18fba
movq %rax, %rdi
leaq 0x38e5d(%rip), %rsi     # 0xc00fa
callq 0x19062
movq %rax, %rdi
leaq 0x1ffaa(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x872fb
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 0x38e68(%rip), %rsi     # 0xc0178
callq 0x4ace2
movq %rax, %rdi
leaq 0x1ff37(%rip), %rsi     # 0xa7256
callq 0x18fba
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x87343
movq 0x70(%rsp), %rax
movq %r14, %rdi
addq $0x10, %rdi
movl (%rax), %esi
callq 0x22f0
movq %r14, %rdi
leaq 0x32f4c(%rip), %rsi     # 0xba299
callq 0x18fba
movq %rbx, %rdi
callq 0xbfd8
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x87376
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 0x871ca
movq 0x30(%rsp), %rcx
incq %rcx
movq %rcx, 0x30(%rsp)
cmpq 0x98(%rsp), %rcx
jne 0x871a7
movq 0x38(%rsp), %rdi
incq %rdi
movq 0x80(%rsp), %r8
cmpq %r8, %rdi
movq 0x88(%rsp), %rsi
jne 0x87185
cmpl $0x78, 0xc(%rsp)
sete %r15b
leaq 0x20(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x37b15(%rip), %rsi     # 0xbef07
leaq 0x37b29(%rip), %rdx     # 0xbef22
leaq 0x10(%rsp), %rdi
callq 0xd14c
movzbl %r15b, %esi
leaq 0xe8(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0xbf80
leaq 0x1c264(%rip), %rsi     # 0xa3684
leaq 0xe8(%rsp), %rdi
callq 0x18fba
leaq 0x38d44(%rip), %rsi     # 0xc0178
movq %rax, %rdi
callq 0x4ace2
leaq 0x1fe13(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x87467
movq %rbx, %rdi
addq $0x10, %rdi
movl 0xc(%rsp), %esi
callq 0x22f0
leaq 0x1c216(%rip), %rsi     # 0xa3684
movq %rbx, %rdi
callq 0x18fba
leaq 0x37aa2(%rip), %rsi     # 0xbef1f
movq %rax, %rdi
callq 0x19a02
leaq 0x1fdca(%rip), %rsi     # 0xa7256
movq %rax, %rdi
callq 0x18fba
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x874b1
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x78, %esi
callq 0x22f0
leaq 0x32de1(%rip), %rsi     # 0xba299
movq %rbx, %rdi
callq 0x18fba
leaq 0xe8(%rsp), %rdi
callq 0xbfd8
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x874e4
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 0x87553
jmp 0x87502
movq %rax, %rbx
jmp 0x87512
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0xbfd8
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
jne 0x87546
jmp 0x87553
jmp 0x8755b
movq %rax, %rbx
jmp 0x87537
jmp 0x87527
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0xbfd8
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x87553
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc0a9