// File: dsharlet[P]array/test/z_order.cpp
// Function: nda::test_split_z_order_3d_body()
TEST(split_z_order_3d) {
  for (index_t w : {2, 3, 4, 5, 12, 16, 20}) {
    for (index_t h : {1, 2, 3, 4, 5, 12, 16, 20}) {
      for (index_t d : {4, 5, 12, 16, 20}) {
        dense_array<int, 3> a({w, h, d});
        size_t total_size = 0;
        auto xs = split<2>(a.x());
        auto ys = split(a.y(), 3);
        auto zs = split<4>(a.z());
        for_all_in_z_order(std::make_tuple(xs, ys, zs), [&](const auto& xo, const auto& yo, const auto& zo) {
          auto a_inner = a(xo, yo, zo);
          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
movq %rsp, %rbp
subq $0x550, %rsp            # imm = 0x550
movq 0x2a502(%rip), %rax     # 0x1fdb04
movq %rax, -0x34(%rbp)
movq 0x2a4ff(%rip), %rax     # 0x1fdb0c
movq %rax, -0x2c(%rbp)
movq 0x2a4fc(%rip), %rax     # 0x1fdb14
movq %rax, -0x24(%rbp)
movl 0x2a4fa(%rip), %eax     # 0x1fdb1c
movl %eax, -0x1c(%rbp)
leaq -0x34(%rbp), %rax
movq %rax, -0x18(%rbp)
movq $0x7, -0x10(%rbp)
leaq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x11250
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
callq 0x11270
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x48(%rbp), %rax
je 0x1d3b72
movq -0x40(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x50(%rbp)
movq 0x2a4a9(%rip), %rax     # 0x1fdb20
movq %rax, -0x88(%rbp)
movq 0x2a4a3(%rip), %rax     # 0x1fdb28
movq %rax, -0x80(%rbp)
movq 0x2a4a0(%rip), %rax     # 0x1fdb30
movq %rax, -0x78(%rbp)
movq 0x2a49d(%rip), %rax     # 0x1fdb38
movq %rax, -0x70(%rbp)
leaq -0x88(%rbp), %rax
movq %rax, -0x68(%rbp)
movq $0x8, -0x60(%rbp)
leaq -0x68(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x11250
movq %rax, -0x90(%rbp)
movq -0x58(%rbp), %rdi
callq 0x11270
movq %rax, -0x98(%rbp)
movq -0x90(%rbp), %rax
cmpq -0x98(%rbp), %rax
je 0x1d3b5f
movq -0x90(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0xa0(%rbp)
movq 0x2a43a(%rip), %rax     # 0x1fdb40
movq %rax, -0xcc(%rbp)
movq 0x2a434(%rip), %rax     # 0x1fdb48
movq %rax, -0xc4(%rbp)
movl 0x2a42f(%rip), %eax     # 0x1fdb50
movl %eax, -0xbc(%rbp)
leaq -0xcc(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq $0x5, -0xb0(%rbp)
leaq -0xb8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x11250
movq %rax, -0xd8(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x11270
movq %rax, -0xe0(%rbp)
movq -0xd8(%rbp), %rax
cmpq -0xe0(%rbp), %rax
je 0x1d3b46
movq -0xd8(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0xe8(%rbp)
movq -0x50(%rbp), %rsi
movq -0xa0(%rbp), %rdx
movq -0xe8(%rbp), %rcx
leaq -0x198(%rbp), %rdi
movq %rdi, -0x4d0(%rbp)
callq 0x131ac0
movq -0x4d0(%rbp), %rsi
leaq -0x150(%rbp), %rdi
movq %rdi, -0x4c8(%rbp)
callq 0x10d10
movq -0x4c8(%rbp), %rdi
movq $0x0, -0x1a0(%rbp)
callq 0x1cc3d0
movq %rax, -0x4c0(%rbp)
jmp 0x1d37f8
movq -0x4c0(%rbp), %rsi
leaq -0x1d0(%rbp), %rdi
callq 0x1d7710
jmp 0x1d380d
leaq -0x150(%rbp), %rdi
callq 0x1cc340
movq %rax, -0x4d8(%rbp)
jmp 0x1d3822
movq -0x4d8(%rbp), %rsi
leaq -0x210(%rbp), %rdi
movl $0x3, %edx
callq 0x162910
jmp 0x1d383c
leaq -0x150(%rbp), %rdi
callq 0x1cc8c0
movq %rax, -0x4e0(%rbp)
jmp 0x1d3851
movq -0x4e0(%rbp), %rsi
leaq -0x240(%rbp), %rdi
callq 0x1cc610
jmp 0x1d3866
leaq -0x2d0(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
leaq -0x210(%rbp), %rdx
leaq -0x240(%rbp), %rcx
callq 0x1d7780
jmp 0x1d3889
leaq -0x150(%rbp), %rax
movq %rax, -0x2e0(%rbp)
leaq -0x1a0(%rbp), %rax
movq %rax, -0x2d8(%rbp)
leaq -0x2d0(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x1d3b90
jmp 0x1d38ba
leaq -0x150(%rbp), %rdi
callq 0x1cc980
movq %rax, -0x4e8(%rbp)
jmp 0x1d38cf
movq -0x4e8(%rbp), %rax
movq -0x1a0(%rbp), %rcx
subq %rcx, %rax
setbe %al
movb %al, -0x4f1(%rbp)
leaq -0x491(%rbp), %rdi
movq %rdi, -0x4f0(%rbp)
callq 0x33b0
movq -0x4f0(%rbp), %rdx
leaq 0x29fab(%rip), %rsi     # 0x1fd8b5
leaq -0x490(%rbp), %rdi
callq 0x10a90
jmp 0x1d3918
movb -0x4f1(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x470(%rbp), %rdi
leaq -0x490(%rbp), %rdx
callq 0x10f80
jmp 0x1d3939
leaq 0x8ea5(%rip), %rsi      # 0x1dc7e5
leaq -0x470(%rbp), %rdi
callq 0x34320
movq %rax, -0x500(%rbp)
jmp 0x1d3955
movq -0x500(%rbp), %rdi
leaq 0x29b0d(%rip), %rsi     # 0x1fd470
callq 0x36600
movq %rax, -0x508(%rbp)
jmp 0x1d3971
movq -0x508(%rbp), %rdi
leaq 0xce2d(%rip), %rsi      # 0x1e07ac
callq 0x34320
movq %rax, -0x510(%rbp)
jmp 0x1d398d
leaq -0x150(%rbp), %rdi
callq 0x1cc980
movq %rax, -0x518(%rbp)
jmp 0x1d39a2
movq -0x510(%rbp), %rdi
movq -0x518(%rbp), %rax
movq %rax, -0x4a0(%rbp)
leaq -0x4a0(%rbp), %rsi
callq 0x355c0
movq %rax, -0x520(%rbp)
jmp 0x1d39cc
movq -0x520(%rbp), %rdi
leaq 0x8e0b(%rip), %rsi      # 0x1dc7e5
callq 0x34320
movq %rax, -0x528(%rbp)
jmp 0x1d39e8
movq -0x528(%rbp), %rdi
leaq 0x29ecb(%rip), %rsi     # 0x1fd8c1
callq 0x34570
movq %rax, -0x530(%rbp)
jmp 0x1d3a04
movq -0x530(%rbp), %rdi
leaq 0xcd9a(%rip), %rsi      # 0x1e07ac
callq 0x34320
movq %rax, -0x538(%rbp)
jmp 0x1d3a20
movq -0x538(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x355c0
movq %rax, -0x540(%rbp)
jmp 0x1d3a3c
movq -0x540(%rbp), %rdi
leaq 0x22a31(%rip), %rsi     # 0x1f647b
callq 0x34320
jmp 0x1d3a51
leaq -0x470(%rbp), %rdi
callq 0x10ff0
jmp 0x1d3a5f
leaq -0x490(%rbp), %rdi
callq 0x3100
leaq -0x491(%rbp), %rdi
callq 0x3290
leaq -0x4b8(%rbp), %rdi
movq %rdi, -0x548(%rbp)
callq 0x35c10
movq -0x548(%rbp), %rsi
leaq -0x150(%rbp), %rdi
callq 0x35be0
jmp 0x1d3a9f
leaq -0x150(%rbp), %rdi
callq 0x11110
movq -0xd8(%rbp), %rax
addq $0x4, %rax
movq %rax, -0xd8(%rbp)
jmp 0x1d3774
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x1d3b38
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x1d3b2c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x1d3b20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
leaq -0x470(%rbp), %rdi
callq 0x10ff0
jmp 0x1d3b1e
jmp 0x1d3b20
leaq -0x490(%rbp), %rdi
callq 0x3100
leaq -0x491(%rbp), %rdi
callq 0x3290
leaq -0x150(%rbp), %rdi
callq 0x11110
jmp 0x1d3b7b
jmp 0x1d3b48
movq -0x90(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x90(%rbp)
jmp 0x1d36da
jmp 0x1d3b61
movq -0x40(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x40(%rbp)
jmp 0x1d3657
addq $0x550, %rsp            # imm = 0x550
popq %rbp
retq
movq -0x1d8(%rbp), %rdi
callq 0x33a0
movq %rax, %rdi
callq 0x116d0
nop