// File: /workspace/github_cpp_makefile_star2_O1/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 %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 0x853e9
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 0x853d1
movslq 0x10(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpq $0x0, 0x60(%rsp)
je 0x853b6
movslq 0x40(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x58(%rsp), %rbp
movq 0x60(%rsp), %r15
movq 0x88(%rsp), %rax
movq 0x70(%rsp), %rcx
subq 0x30(%rax), %rcx
movq 0x90(%rsp), %rdx
imulq 0x40(%rax), %rcx
movq 0x68(%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 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq $0x22, 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 0x39322(%rip), %xmm0    # 0xbe577
movups %xmm0, (%rax)
movups 0x39328(%rip), %xmm0    # 0xbe587
movups %xmm0, 0x10(%rax)
movw $0x7465, 0x20(%rax)     # imm = 0x7465
movq %rcx, 0x20(%rsp)
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 0x1c3bf(%rip), %r12     # 0xa1654
movq %rbx, %rdi
movq %r12, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x392f0(%rip), %rsi     # 0xbe59a
callq 0x18abe
movq %rax, %rdi
leaq 0x20071(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x8530b
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 0x392f8(%rip), %rsi     # 0xbe618
callq 0x4a210
movq %rax, %rdi
leaq 0x1fffb(%rip), %rsi     # 0xa532a
callq 0x18a16
movq %rax, %r14
cmpb $0x1, 0x188(%rax)
jne 0x85356
movq 0x90(%rsp), %rax
movq %r14, %rdi
addq $0x10, %rdi
movl (%rax), %esi
callq 0x22f0
movq %r14, %rdi
leaq 0x33009(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %rbx, %rdi
callq 0xbf62
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x85389
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 0x851d1
movq 0x40(%rsp), %rcx
incq %rcx
movq %rcx, 0x40(%rsp)
cmpq 0x98(%rsp), %rcx
jne 0x851b1
movq 0x10(%rsp), %rcx
incq %rcx
movq %rcx, 0x10(%rsp)
cmpq 0x38(%rsp), %rcx
jne 0x85191
movl 0xc(%rsp), %ebx
leaq 0x28(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x37faa(%rip), %rsi     # 0xbd3a7
leaq 0x37fbe(%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 0x1c224(%rip), %rsi     # 0xa1654
leaq 0xe8(%rsp), %rdi
callq 0x18a16
leaq 0x391d4(%rip), %rsi     # 0xbe618
movq %rax, %rdi
callq 0x4a210
leaq 0x1fed7(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x85477
movq %rbx, %rdi
addq $0x10, %rdi
movl 0xc(%rsp), %esi
callq 0x22f0
leaq 0x1c1d6(%rip), %rsi     # 0xa1654
movq %rbx, %rdi
callq 0x18a16
leaq 0x37f32(%rip), %rsi     # 0xbd3bf
movq %rax, %rdi
callq 0x19436
leaq 0x1fe8e(%rip), %rsi     # 0xa532a
movq %rax, %rdi
callq 0x18a16
movq %rax, %rbx
cmpb $0x1, 0x188(%rax)
jne 0x854c1
movq %rbx, %rdi
addq $0x10, %rdi
movl $0x78, %esi
callq 0x22f0
leaq 0x32ea1(%rip), %rsi     # 0xb8369
movq %rbx, %rdi
callq 0x18a16
leaq 0xe8(%rsp), %rdi
callq 0xbf62
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
je 0x854f4
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 0x85563
jmp 0x85512
movq %rax, %rbx
jmp 0x85522
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0xbf62
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
jne 0x85556
jmp 0x85563
jmp 0x8556b
movq %rax, %rbx
jmp 0x85547
jmp 0x85537
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0xbf62
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x85563
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x2300
movq %rax, %rdi
callq 0xc036