// File: /workspace/github_cpp_makefile_star2_O1/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 $0x258, %rsp            # imm = 0x258
leaq 0x30(%rsp), %r13
leaq 0x278e(%rip), %r12      # 0xa1654
xorl %ecx, %ecx
leaq 0x2049d(%rip), %rax     # 0xbf36c
movq %rcx, 0x48(%rsp)
movslq (%rcx,%rax), %rax
movq %rax, 0x50(%rsp)
xorl %ecx, %ecx
leaq 0x204ce(%rip), %rax     # 0xbf3b4
movq %rcx, 0x58(%rsp)
movslq (%rcx,%rax), %rbx
xorl %ebp, %ebp
movq %rbp, 0xc8(%rsp)
movq 0x50(%rsp), %r14
movq %r14, 0xd0(%rsp)
movabsq $-0x8000000000000000, %r15 # imm = 0x8000000000000000
movq %r15, 0xd8(%rsp)
xorl %edi, %edi
leaq 0xc8(%rsp), %rsi
callq 0xd09f
leaq 0x70(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq %rbx, 0x90(%rsp)
leaq 0x68(%rsp), %rbx
movq %r15, 0x98(%rsp)
movq %rbp, 0xa0(%rsp)
movq %r14, 0xa8(%rsp)
movq %rbx, %rdi
callq 0x1c19e
movq %rbx, %rdi
callq 0x1c258
movq %rbp, 0x8(%rsp)
movq 0xa8(%rsp), %rax
cmpq $0x2, %rax
jle 0x9f2a5
movq 0xa0(%rsp), %rdx
leaq (%rdx,%rax), %rsi
leaq (%rdx,%rax), %r9
decq %r9
movq 0x88(%rsp), %rcx
movq 0x90(%rsp), %r10
cmpq $0x3, %r10
movl $0x3, %edi
cmovlq %r10, %rdi
leaq (%r10,%rcx), %r8
leaq -0x1(%r10,%rcx), %r11
movq %rcx, 0xc8(%rsp)
movq %rdi, 0xd0(%rsp)
movq %r11, 0xd8(%rsp)
movq %r8, 0xe0(%rsp)
movq $0x0, 0xe8(%rsp)
movq %r11, 0xf0(%rsp)
movq %rdx, 0xf8(%rsp)
movq %r9, 0x108(%rsp)
movq %rsi, 0x110(%rsp)
movq %r9, 0x120(%rsp)
movq %rbx, 0xb8(%rsp)
leaq 0x8(%rsp), %rdx
movq %rdx, 0xc0(%rsp)
leaq 0xb8(%rsp), %rdx
movq %rdx, 0x60(%rsp)
addq $0x2, %rax
movabsq $0x5555555555555556, %rdx # imm = 0x5555555555555556
imulq %rdx
movq %rdx, %rsi
testq %r10, %r10
jle 0x9f05d
notq %rcx
addq %r8, %rcx
addq %rdi, %rcx
movq %rcx, %rax
cqto
idivq %rdi
jmp 0x9f05f
xorl %eax, %eax
leaq 0xc8(%rsp), %rdx
leaq 0x10(%rsp), %r15
movq %rsi, %rcx
shrq $0x3f, %rcx
addq %rsi, %rcx
leaq 0x60(%rsp), %rsi
movq %rsi, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
movq %rcx, 0x10(%rsp)
movq %rax, 0x18(%rsp)
cmpq %rax, %rcx
cmovleq %rax, %rcx
movl $0x1, %eax
movq %rax, %r8
addq %rax, %rax
cmpq %rcx, %r8
jl 0x9f09b
sarq %r8
cmpq $0x2, %r8
movl $0x1, %eax
cmovlq %rax, %r8
movl $0x1, %ecx
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %r13, %r9
callq 0x9fc38
movq %r12, %r14
movq %r13, %r12
movq 0x90(%rsp), %rbp
movq 0xa8(%rsp), %rbx
movq %r15, %r13
movq 0x8(%rsp), %r15
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r13, %rdi
leaq 0x1ffc2(%rip), %rsi     # 0xbf0be
leaq 0x1ffd1(%rip), %rdx     # 0xbf0d4
callq 0xd0b8
imulq %rbx, %rbp
testq %rbp, %rbp
movl $0x0, %eax
cmovleq %rax, %rbp
xorl %esi, %esi
cmpq %r15, %rbp
setbe %sil
leaq 0xc8(%rsp), %r15
movq %r15, %rdi
movq %r13, %rdx
callq 0xbf0a
leaq 0x68(%rsp), %rbx
movq %r12, %r13
movq %r14, %r12
leaq 0x61e4(%rip), %r14      # 0xa532a
movq %r15, %rdi
movq %r12, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x1fbe8(%rip), %rsi     # 0xbed43
callq 0x19c24
movq %rax, %rdi
movq %r14, %rsi
callq 0x18a16
movq %rax, %rbp
cmpb $0x1, 0x188(%rax)
jne 0x9f1a0
movq 0xa8(%rsp), %rsi
imulq 0x90(%rsp), %rsi
testq %rsi, %rsi
movl $0x0, %eax
cmovleq %rax, %rsi
movq %rbp, %rdi
addq $0x10, %rdi
callq 0x2110
movq %rbp, %rdi
movq %r12, %rsi
callq 0x18a16
movq %rax, %rdi
leaq 0x1ff15(%rip), %rsi     # 0xbf0ca
callq 0x18abe
movq %rax, %rdi
movq %r14, %rsi
callq 0x18a16
movq %rax, %rbp
cmpb $0x1, 0x188(%rax)
jne 0x9f1e2
movq %rbp, %rdi
addq $0x10, %rdi
movq 0x8(%rsp), %rsi
callq 0x2110
movq %rbp, %rdi
leaq 0x1917d(%rip), %rsi     # 0xb8369
callq 0x18a16
movq %r15, %rdi
callq 0xbf62
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x9f215
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0xc8(%rsp)
leaq 0x70(%rsp), %rax
movups 0x18(%rax), %xmm0
movups 0x28(%rax), %xmm1
movups 0x38(%rax), %xmm2
leaq 0xd0(%rsp), %rdi
movups %xmm2, 0x20(%rdi)
movups %xmm1, 0x10(%rdi)
movups %xmm0, (%rdi)
movq %r15, 0x10(%rsp)
movq %r13, 0x18(%rsp)
leaq 0x10(%rsp), %rsi
callq 0x2051c
movq %rbx, %rdi
callq 0x1cd2c
movq 0x58(%rsp), %rcx
addq $0x4, %rcx
cmpq $0x20, %rcx
jne 0x9eedf
movq 0x48(%rsp), %rcx
addq $0x4, %rcx
cmpq $0x18, %rcx
jne 0x9eec8
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c016(%rip), %rdi     # 0xbb2c2
leaq 0x1e3a(%rip), %rsi      # 0xa10ed
leaq 0x1c022(%rip), %rcx     # 0xbb2dc
movl $0x269, %edx            # imm = 0x269
callq 0x2100
jmp 0x9f2ca
jmp 0x9f2ca
jmp 0x9f316
movq %rax, %rbx
jmp 0x9f302
movq %rax, %rbx
jmp 0x9f2e6
jmp 0x9f2d6
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0xbf62
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x9f302
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x68(%rsp), %rdi
callq 0x1cd2c
movq %rbx, %rdi
callq 0x2300
jmp 0x9f316
movq %rax, %rdi
callq 0xc036