// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/z_order.cpp
// Function: nda::test_for_each_in_z_order_3d_body()
TEST(for_each_in_z_order_3d) {
  for (index_t w : {1, 2, 3, 4, 5, 12, 16, 20}) {
    for (index_t h : {1, 2, 3, 4, 5, 12, 16, 20}) {
      for (index_t d : {1, 2, 3, 4, 5, 12, 16, 20}) {
        dense_array<int, 3> a({w, h, d});
        size_t total_size = 0;
        for_all_indices_in_z_order(a.shape().extent(), [&](index_t x, index_t y, index_t z) {
          total_size++;
          a(x, y, z) = pattern<int>(std::make_tuple(x, y, z));
        });
        // The total number of items in the inner splits should be equal to the size
        // of the array (no overlap among inner splits).
        ASSERT_EQ(total_size, a.size());
        check_pattern(a);
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
leaq 0xf0(%rsp), %r12
leaq 0x88(%rsp), %rbx
leaq 0x20(%rsp), %r14
leaq 0x30(%rsp), %r13
leaq 0x28(%rsp), %rbp
leaq 0x60(%rsp), %r15
xorl %eax, %eax
cmpq $0x20, %rax
je 0x8ae16
movq %rax, 0x18(%rsp)
leaq 0x21b23(%rip), %rax     # 0xac6ac
movq 0x18(%rsp), %rcx
movslq (%rcx,%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x18(%rsp), %rax
xorl %ecx, %ecx
cmpq $0x20, %rcx
je 0x8ae0d
leaq 0x21afd(%rip), %rax     # 0xac6ac
movslq (%rcx,%rax), %rax
movq %rax, 0x50(%rsp)
xorl %edx, %edx
movq %rcx, 0x48(%rsp)
cmpq $0x20, %rdx
je 0x8adff
leaq 0x21adc(%rip), %rax     # 0xac6ac
movq %rdx, 0x58(%rsp)
movslq (%rdx,%rax), %rcx
movq %r12, %rdi
movq 0x40(%rsp), %rsi
movq 0x50(%rsp), %rdx
callq 0x5cb2a
movq %rbx, %rdi
movq %r12, %rsi
callq 0x6750
andq $0x0, 0x20(%rsp)
movq 0xe0(%rsp), %rax
movq 0xb0(%rsp), %rcx
movq 0xc8(%rsp), %rdx
movq %r14, 0x30(%rsp)
movq %rbx, 0x38(%rsp)
movq %r13, 0x28(%rsp)
movq %rax, 0xf0(%rsp)
movq %rdx, 0xf8(%rsp)
movq %rcx, 0x100(%rsp)
movq %r12, %rdi
leaq 0x108(%rsp), %rsi
callq 0x8bcf0
movq (%rax), %rdi
callq 0x8bce1
sarq %rax
cmpq $0x2, %rax
pushq $0x1
popq %rcx
cmovlq %rcx, %rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
andq $0x0, 0x70(%rsp)
movq 0x70(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movaps 0x60(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r12, %rdi
pushq $0x2
popq %rsi
movq %rax, %rdx
movq %rbp, %rcx
callq 0x8b7d4
movq %r12, %r13
movq 0x20(%rsp), %rbx
movq 0xe0(%rsp), %r14
movq %rbp, %rdx
movq 0xb0(%rsp), %rbp
movq 0xc8(%rsp), %r12
movq %r15, %rdi
leaq 0x213ba(%rip), %rsi     # 0xac07a
callq 0x66a0
imulq %r14, %r12
imulq %rbp, %r12
testq %r12, %r12
movl $0x0, %eax
cmovleq %rax, %r12
xorl %esi, %esi
cmpq %r12, %rbx
sete %sil
movq %r13, %r12
movq %r13, %rdi
movq %r15, %rdx
callq 0x6894
leaq 0x88(%rsp), %rbx
leaq 0x20(%rsp), %r14
leaq 0x30(%rsp), %r13
leaq 0x28(%rsp), %rbp
movq %r12, %rdi
leaq 0x2936(%rip), %r15      # 0x8d647
movq %r15, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x217b6(%rip), %rsi     # 0xac4d9
callq 0x107d8
movq %rax, %rdi
leaq 0x68c0(%rip), %rsi      # 0x915f2
callq 0x106fe
movq %rax, %rdi
movq %r14, %rsi
callq 0x11052
movq %rax, %rdi
movq %r15, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x21331(%rip), %rsi     # 0xac088
callq 0x118ac
movq %rax, %rdi
leaq 0x688c(%rip), %rsi      # 0x915f2
callq 0x106fe
movq 0xc8(%rsp), %rcx
imulq 0xe0(%rsp), %rcx
imulq 0xb0(%rsp), %rcx
testq %rcx, %rcx
movl $0x0, %edx
cmovleq %rdx, %rcx
movq %rcx, 0x30(%rsp)
movq %rax, %rdi
movq %r13, %rsi
callq 0x11052
movq %rax, %rdi
leaq 0x1a4f7(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %r12, %rdi
callq 0x68d4
leaq 0x60(%rsp), %r15
movq %r15, %rdi
callq 0x2090
xorps %xmm0, %xmm0
movaps %xmm0, 0xf0(%rsp)
andq $0x0, 0x100(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1132f
movq %rbx, %rdi
callq 0x69c2
movq 0x58(%rsp), %rdx
addq $0x4, %rdx
movq 0x48(%rsp), %rcx
jmp 0x8abbf
addq $0x4, %rcx
movq 0x18(%rsp), %rax
jmp 0x8ab9e
addq $0x4, %rax
jmp 0x8ab73
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8ae2e
jmp 0x8ae2e
jmp 0x8ae38
movq %rax, %rbx
jmp 0x8ae52
movq %rax, %rbx
jmp 0x8ae48
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x68d4
leaq 0x60(%rsp), %rdi
callq 0x2090
leaq 0x88(%rsp), %rdi
callq 0x69c2
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba