// File: /workspace/github_cpp_makefile_star2_O1/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 $0x278, %rsp            # imm = 0x278
xorl %ebp, %ebp
leaq 0x20(%rsp), %r15
xorl %ecx, %ecx
leaq 0x2091d(%rip), %rax     # 0xbf3d4
movq %rcx, 0x50(%rsp)
movslq (%rcx,%rax), %rax
movq %rax, 0x60(%rsp)
xorl %ecx, %ecx
leaq 0x20906(%rip), %rax     # 0xbf3d4
movq %rcx, 0x58(%rsp)
movslq (%rcx,%rax), %rax
movq %rax, 0x68(%rsp)
xorl %ecx, %ecx
leaq 0x208ef(%rip), %rax     # 0xbf3d4
movq %rcx, 0x70(%rsp)
movslq (%rcx,%rax), %r14
movq %rbp, 0xe8(%rsp)
movq 0x60(%rsp), %r13
movq %r13, 0xf0(%rsp)
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
movq %r12, 0xf8(%rsp)
xorl %edi, %edi
leaq 0xe8(%rsp), %rbx
movq %rbx, %rsi
callq 0xd09f
leaq 0x88(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq %r14, 0xa8(%rsp)
movq %r12, 0xb0(%rsp)
movq %rbp, 0xb8(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq %r12, 0xc8(%rsp)
movq %rbp, 0xd0(%rsp)
movq %r13, 0xd8(%rsp)
leaq 0x80(%rsp), %r14
movq %r14, %rdi
callq 0xc2a2
movq %r14, %rdi
callq 0xc38a
movq %rbp, 0x18(%rsp)
movq 0xd8(%rsp), %rax
movq 0xa8(%rsp), %rcx
movq 0xc0(%rsp), %rdx
leaq 0x18(%rsp), %rsi
movq %rsi, 0x40(%rsp)
movq %r14, 0x48(%rsp)
leaq 0x40(%rsp), %rsi
movq %rsi, 0x78(%rsp)
movq %rax, 0xe8(%rsp)
movq %rdx, 0xf0(%rsp)
movq %rcx, 0xf8(%rsp)
movl $0x8, %eax
movq %rbx, %rcx
movq (%rcx), %rdx
cmpq 0xe8(%rsp,%rax), %rdx
jge 0x9ebfc
leaq (%rsp,%rax), %rcx
addq $0xe8, %rcx
addq $0x8, %rax
cmpq $0x18, %rax
jne 0x9ebe4
movq (%rcx), %rax
movl $0x1, %ecx
movq %rcx, %rdx
addq %rcx, %rcx
cmpq %rax, %rdx
jl 0x9ec0e
sarq %rdx
cmpq $0x2, %rdx
movl $0x1, %eax
cmovlq %rax, %rdx
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups %xmm0, (%rsp)
movl $0x2, %esi
movq %rbx, %rdi
leaq 0x78(%rsp), %rcx
callq 0x9fa91
movq 0x18(%rsp), %r13
movq 0xd8(%rsp), %r14
movq 0xa8(%rsp), %rbp
movq 0xc0(%rsp), %r12
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r15, %rdi
leaq 0x200aa(%rip), %rsi     # 0xbed35
leaq 0x200b9(%rip), %rdx     # 0xbed4b
callq 0xd0b8
imulq %r14, %r12
imulq %rbp, %r12
testq %r12, %r12
movl $0x0, %ebp
cmovleq %rbp, %r12
xorl %esi, %esi
cmpq %r12, %r13
sete %sil
movq %rbx, %rdi
movq %r15, %rdx
callq 0xbf0a
movq %rbx, %r14
leaq 0x298b(%rip), %rbx      # 0xa1654
leaq 0x665a(%rip), %r12      # 0xa532a
movq %r14, %rdi
movq %rbx, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x203e5(%rip), %rsi     # 0xbf0ca
callq 0x18abe
movq %rax, %rdi
movq %r12, %rsi
callq 0x18a16
movq %rax, %r13
cmpb $0x1, 0x188(%rax)
jne 0x9ed12
movq %r13, %rdi
addq $0x10, %rdi
movq 0x18(%rsp), %rsi
callq 0x2110
movq %r13, %rdi
movq %rbx, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x2001c(%rip), %rsi     # 0xbed43
callq 0x19c24
movq %rax, %rdi
movq %r12, %rsi
callq 0x18a16
movq %rax, %r13
cmpb $0x1, 0x188(%rax)
jne 0x9ed70
movq 0xd8(%rsp), %rsi
imulq 0xc0(%rsp), %rsi
imulq 0xa8(%rsp), %rsi
testq %rsi, %rsi
cmovleq %rbp, %rsi
movq %r13, %rdi
addq $0x10, %rdi
callq 0x2110
movq %r13, %rdi
leaq 0x195ef(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %r14, %rdi
callq 0xbf62
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x9eda3
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21f0
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0xe8(%rsp)
movl $0x9, %ecx
leaq 0xf0(%rsp), %rax
movq %rax, %rdi
leaq 0xa0(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, 0x40(%rsp)
movq %r15, 0x48(%rsp)
movq %rax, %rdi
leaq 0x40(%rsp), %rsi
callq 0x1e56e
leaq 0x80(%rsp), %rdi
callq 0xd16c
movq 0x70(%rsp), %rcx
addq $0x4, %rcx
cmpq $0x20, %rcx
jne 0x9eade
movq 0x58(%rsp), %rcx
addq $0x4, %rcx
cmpq $0x20, %rcx
jne 0x9eac7
movq 0x50(%rsp), %rcx
addq $0x4, %rcx
cmpq $0x20, %rcx
jne 0x9eab0
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9ee52
jmp 0x9eea1
movq %rax, %rbx
jmp 0x9ee8a
jmp 0x9ee5e
movq %rax, %rbx
jmp 0x9ee6e
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0xbf62
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x9ee8a
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x80(%rsp), %rdi
callq 0xd16c
movq %rbx, %rdi
callq 0x2300
jmp 0x9eea1
movq %rax, %rdi
callq 0xc036