// File: /workspace/github_cpp_makefile_star2_O3/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 0x2ac6(%rip), %r12      # 0xa3684
xorl %ecx, %ecx
leaq 0x20305(%rip), %rax     # 0xc0ecc
movq %rcx, 0x48(%rsp)
movslq (%rcx,%rax), %rax
movq %rax, 0x50(%rsp)
xorl %ecx, %ecx
leaq 0x20336(%rip), %rax     # 0xc0f14
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 0xd133
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 0x1c6ce
movq %rbx, %rdi
callq 0x1c796
movq %rbp, 0x8(%rsp)
movq 0xa8(%rsp), %rax
cmpq $0x2, %rax
jle 0xa0f9d
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 0xa0d55
notq %rcx
addq %r8, %rcx
addq %rdi, %rcx
movq %rcx, %rax
cqto
idivq %rdi
jmp 0xa0d57
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 0xa0d93
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 0xa18b1
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 0x1fe2a(%rip), %rsi     # 0xc0c1e
leaq 0x1fe39(%rip), %rdx     # 0xc0c34
callq 0xd14c
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 0xbf80
leaq 0x68(%rsp), %rbx
movq %r12, %r13
movq %r14, %r12
leaq 0x6418(%rip), %r14      # 0xa7256
movq %r15, %rdi
movq %r12, %rsi
callq 0x18fba
movq %rax, %rdi
leaq 0x1fa50(%rip), %rsi     # 0xc08a3
callq 0x1a146
movq %rax, %rdi
movq %r14, %rsi
callq 0x18fba
movq %rax, %rbp
cmpb $0x1, 0x188(%rax)
jne 0xa0e98
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 0x18fba
movq %rax, %rdi
leaq 0x1fd7d(%rip), %rsi     # 0xc0c2a
callq 0x19062
movq %rax, %rdi
movq %r14, %rsi
callq 0x18fba
movq %rax, %rbp
cmpb $0x1, 0x188(%rax)
jne 0xa0eda
movq %rbp, %rdi
addq $0x10, %rdi
movq 0x8(%rsp), %rsi
callq 0x2110
movq %rbp, %rdi
leaq 0x193b5(%rip), %rsi     # 0xba299
callq 0x18fba
movq %r15, %rdi
callq 0xbfd8
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xa0f0d
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 0x20f32
movq %rbx, %rdi
callq 0x1d1c4
movq 0x58(%rsp), %rcx
addq $0x4, %rcx
cmpq $0x20, %rcx
jne 0xa0bd7
movq 0x48(%rsp), %rcx
addq $0x4, %rcx
cmpq $0x18, %rcx
jne 0xa0bc0
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c077(%rip), %rdi     # 0xbd01b
leaq 0x2172(%rip), %rsi      # 0xa311d
leaq 0x1c083(%rip), %rcx     # 0xbd035
movl $0x269, %edx            # imm = 0x269
callq 0x2100
jmp 0xa0fc2
jmp 0xa0fc2
jmp 0xa100e
movq %rax, %rbx
jmp 0xa0ffa
movq %rax, %rbx
jmp 0xa0fde
jmp 0xa0fce
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0xbfd8
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xa0ffa
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x68(%rsp), %rdi
callq 0x1d1c4
movq %rbx, %rdi
callq 0x2300
jmp 0xa100e
movq %rax, %rdi
callq 0xc0a9