// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/z_order.cpp
// Function: nda::test_split_z_order_2d_body()
TEST(split_z_order_2d) {
  for (index_t w : {3, 4, 5, 6, 12, 20}) {
    for (index_t h : {1, 2, 3, 4, 5, 6, 12, 20}) {
      dense_array<int, 2> a({w, h});
      size_t total_size = 0;
      auto xs = split<3>(a.x());
      auto ys = split(a.y(), 3);
      for_all_in_z_order(std::make_tuple(xs, ys), [&](const auto& xo, const auto& yo) {
        auto a_inner = a(xo, yo);
        total_size += a_inner.size();
        fill_pattern(a_inner);
      });
      // The total number of items in the inner splits should be equal to the size
      // of the array (no overlap among inner splits).
      ASSERT_LE(a.size(), total_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), %rbp
leaq 0x70(%rsp), %rbx
leaq 0x8(%rsp), %r15
leaq 0x50(%rsp), %r13
leaq 0x10(%rsp), %r14
xorl %ecx, %ecx
cmpq $0x18, %rcx
je 0x8b176
leaq 0x21795(%rip), %rax     # 0xac644
movslq (%rcx,%rax), %rax
movq %rax, 0x28(%rsp)
xorl %edx, %edx
movq %rcx, 0x20(%rsp)
cmpq $0x20, %rdx
je 0x8b16d
leaq 0x217bc(%rip), %rax     # 0xac68c
movq %rdx, 0x30(%rsp)
movslq (%rdx,%rax), %rdx
movq %rbp, %rdi
movq 0x28(%rsp), %rsi
callq 0x8bc86
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x10768
andq $0x0, 0x8(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x8bca3
movq 0x90(%rsp), %rax
movq 0x98(%rsp), %r8
cmpq $0x3, %r8
pushq $0x3
popq %rsi
cmovlq %r8, %rsi
leaq (%r8,%rax), %rdx
leaq (%r8,%rax), %rcx
decq %rcx
movq %rax, 0xf0(%rsp)
movq %rsi, 0xf8(%rsp)
movq %rcx, 0x100(%rsp)
movq %rdx, 0x108(%rsp)
andq $0x0, 0x110(%rsp)
movq %rcx, 0x118(%rsp)
movups 0xc0(%rsp), %xmm0
movups 0xd0(%rsp), %xmm1
movups 0xe0(%rsp), %xmm2
leaq 0x120(%rsp), %rcx
movups %xmm2, 0x20(%rcx)
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
movq %rbx, 0x38(%rsp)
movq %r15, 0x40(%rsp)
leaq 0x38(%rsp), %rcx
movq %rcx, 0x48(%rsp)
movq 0x120(%rsp), %rdi
movq 0x138(%rsp), %rcx
testq %r8, %r8
jle 0x8afca
notq %rax
addq %rdx, %rax
addq %rsi, %rax
cqto
idivq %rsi
movq %rax, %rsi
jmp 0x8afcc
xorl %esi, %esi
subq %rdi, %rcx
addq $0x2, %rcx
movq %rcx, %rax
cqto
pushq $0x3
popq %rcx
idivq %rcx
leaq 0x48(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq %rbp, 0x18(%rsp)
movq %rax, 0x50(%rsp)
movq %rsi, 0x58(%rsp)
movq %r13, %rdi
leaq 0x60(%rsp), %rsi
callq 0x8bcf0
movq (%rax), %rdi
callq 0x8bce1
sarq %rax
cmpq $0x2, %rax
pushq $0x1
popq %rcx
cmovlq %rcx, %rax
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %rax, %r8
movq %r14, %r9
callq 0x8b8f6
movq %rbp, %r14
movq %rbx, %r15
movq 0x98(%rsp), %rbp
movq 0xb0(%rsp), %r12
movq 0x8(%rsp), %rbx
movq %r13, %rdi
leaq 0x2147c(%rip), %rsi     # 0xac4cd
leaq 0x38(%rsp), %rdx
callq 0x66a0
imulq %r12, %rbp
testq %rbp, %rbp
movl $0x0, %r12d
cmovleq %r12, %rbp
xorl %esi, %esi
cmpq %rbx, %rbp
setbe %sil
movq %r14, %rbp
movq %r14, %rdi
movq %r13, %rdx
callq 0x6894
movq %r15, %rbx
leaq 0x8(%rsp), %r15
leaq 0x10(%rsp), %r14
movq %rbp, %rdi
leaq 0x25ad(%rip), %rsi      # 0x8d647
callq 0x106fe
movq %rax, %rdi
leaq 0x20fdf(%rip), %rsi     # 0xac088
callq 0x118ac
movq %rax, %rdi
leaq 0x653a(%rip), %rsi      # 0x915f2
callq 0x106fe
movq 0x98(%rsp), %rcx
imulq 0xb0(%rsp), %rcx
testq %rcx, %rcx
cmovleq %r12, %rcx
movq %rcx, 0x10(%rsp)
movq %rax, %rdi
movq %r14, %rsi
callq 0x11052
movq %rax, %rdi
leaq 0x2558(%rip), %rsi      # 0x8d647
callq 0x106fe
movq %rax, %rdi
leaq 0x213db(%rip), %rsi     # 0xac4d9
callq 0x107d8
movq %rax, %rdi
leaq 0x64e5(%rip), %rsi      # 0x915f2
callq 0x106fe
movq %rax, %rdi
movq %r15, %rsi
callq 0x11052
movq %rax, %rdi
leaq 0x1a17b(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %rbp, %rdi
callq 0x68d4
movq %r13, %rdi
callq 0x2090
xorps %xmm0, %xmm0
movaps %xmm0, 0xf0(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x11c0c
movq %rbx, %rdi
callq 0x108fe
movq 0x30(%rsp), %rdx
addq $0x4, %rdx
movq 0x20(%rsp), %rcx
jmp 0x8aebf
addq $0x4, %rcx
jmp 0x8ae9e
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8b193
jmp 0x8b193
jmp 0x8b193
movq %rax, %rbx
jmp 0x8b1aa
movq %rax, %rbx
jmp 0x8b1b4
jmp 0x8b19a
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x68d4
leaq 0x50(%rsp), %rdi
callq 0x2090
leaq 0x70(%rsp), %rdi
callq 0x108fe
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba