// File: 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
movq %rsp, %rbp
subq $0x440, %rsp            # imm = 0x440
movq 0x2aeca(%rip), %rax     # 0x1fda6c
movq %rax, -0x38(%rbp)
movq 0x2aec7(%rip), %rax     # 0x1fda74
movq %rax, -0x30(%rbp)
movq 0x2aec4(%rip), %rax     # 0x1fda7c
movq %rax, -0x28(%rbp)
movq 0x2aec1(%rip), %rax     # 0x1fda84
movq %rax, -0x20(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x18(%rbp)
movq $0x8, -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 0x1d30b6
movq -0x40(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x50(%rbp)
movq 0x2ae73(%rip), %rax     # 0x1fda8c
movq %rax, -0x88(%rbp)
movq 0x2ae6d(%rip), %rax     # 0x1fda94
movq %rax, -0x80(%rbp)
movq 0x2ae6a(%rip), %rax     # 0x1fda9c
movq %rax, -0x78(%rbp)
movq 0x2ae67(%rip), %rax     # 0x1fdaa4
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 0x1d30a3
movq -0x90(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0xa0(%rbp)
movq 0x2ae04(%rip), %rax     # 0x1fdaac
movq %rax, -0xd8(%rbp)
movq 0x2adfe(%rip), %rax     # 0x1fdab4
movq %rax, -0xd0(%rbp)
movq 0x2adf8(%rip), %rax     # 0x1fdabc
movq %rax, -0xc8(%rbp)
movq 0x2adf2(%rip), %rax     # 0x1fdac4
movq %rax, -0xc0(%rbp)
leaq -0xd8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq $0x8, -0xb0(%rbp)
leaq -0xb8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x11250
movq %rax, -0xe0(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x11270
movq %rax, -0xe8(%rbp)
movq -0xe0(%rbp), %rax
cmpq -0xe8(%rbp), %rax
je 0x1d308a
movq -0xe0(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0xf0(%rbp)
movq -0x50(%rbp), %rsi
movq -0xa0(%rbp), %rdx
movq -0xf0(%rbp), %rcx
leaq -0x1a0(%rbp), %rdi
movq %rdi, -0x3d0(%rbp)
callq 0x131ac0
movq -0x3d0(%rbp), %rsi
leaq -0x158(%rbp), %rdi
movq %rdi, -0x3c8(%rbp)
callq 0x10d10
movq -0x3c8(%rbp), %rdi
movq $0x0, -0x1a8(%rbp)
callq 0x35e20
movq %rax, -0x3c0(%rbp)
jmp 0x1d2daa
movq -0x3c0(%rbp), %rsi
leaq -0x1c0(%rbp), %rdi
callq 0x132b0
jmp 0x1d2dbf
leaq -0x1a8(%rbp), %rax
movq %rax, -0x1e0(%rbp)
leaq -0x158(%rbp), %rax
movq %rax, -0x1d8(%rbp)
leaq -0x1c0(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x1d30e0
jmp 0x1d2df0
movq -0x1a8(%rbp), %rax
movq %rax, -0x3e0(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x1cc980
movq %rax, -0x3d8(%rbp)
jmp 0x1d2e13
movq -0x3d8(%rbp), %rcx
movq -0x3e0(%rbp), %rax
subq %rcx, %rax
sete %al
movb %al, -0x3e9(%rbp)
leaq -0x391(%rbp), %rdi
movq %rdi, -0x3e8(%rbp)
callq 0x33b0
movq -0x3e8(%rbp), %rdx
leaq 0x2a614(%rip), %rsi     # 0x1fd462
leaq -0x390(%rbp), %rdi
callq 0x10a90
jmp 0x1d2e5c
movb -0x3e9(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x370(%rbp), %rdi
leaq -0x390(%rbp), %rdx
callq 0x10f80
jmp 0x1d2e7d
leaq 0x9961(%rip), %rsi      # 0x1dc7e5
leaq -0x370(%rbp), %rdi
callq 0x34320
movq %rax, -0x3f8(%rbp)
jmp 0x1d2e99
movq -0x3f8(%rbp), %rdi
leaq 0x2aa1a(%rip), %rsi     # 0x1fd8c1
callq 0x34570
movq %rax, -0x400(%rbp)
jmp 0x1d2eb5
movq -0x400(%rbp), %rdi
leaq 0xd8e9(%rip), %rsi      # 0x1e07ac
callq 0x34320
movq %rax, -0x408(%rbp)
jmp 0x1d2ed1
movq -0x408(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x355c0
movq %rax, -0x410(%rbp)
jmp 0x1d2eed
movq -0x410(%rbp), %rdi
leaq 0x98ea(%rip), %rsi      # 0x1dc7e5
callq 0x34320
movq %rax, -0x418(%rbp)
jmp 0x1d2f09
movq -0x418(%rbp), %rdi
leaq 0x2a559(%rip), %rsi     # 0x1fd470
callq 0x36600
movq %rax, -0x420(%rbp)
jmp 0x1d2f25
movq -0x420(%rbp), %rdi
leaq 0xd879(%rip), %rsi      # 0x1e07ac
callq 0x34320
movq %rax, -0x428(%rbp)
jmp 0x1d2f41
leaq -0x158(%rbp), %rdi
callq 0x1cc980
movq %rax, -0x430(%rbp)
jmp 0x1d2f56
movq -0x428(%rbp), %rdi
movq -0x430(%rbp), %rax
movq %rax, -0x3a0(%rbp)
leaq -0x3a0(%rbp), %rsi
callq 0x355c0
movq %rax, -0x438(%rbp)
jmp 0x1d2f80
movq -0x438(%rbp), %rdi
leaq 0x234ed(%rip), %rsi     # 0x1f647b
callq 0x34320
jmp 0x1d2f95
leaq -0x370(%rbp), %rdi
callq 0x10ff0
jmp 0x1d2fa3
leaq -0x390(%rbp), %rdi
callq 0x3100
leaq -0x391(%rbp), %rdi
callq 0x3290
leaq -0x3b8(%rbp), %rdi
movq %rdi, -0x440(%rbp)
callq 0x35c10
movq -0x440(%rbp), %rsi
leaq -0x158(%rbp), %rdi
callq 0x35be0
jmp 0x1d2fe3
leaq -0x158(%rbp), %rdi
callq 0x11110
movq -0xe0(%rbp), %rax
addq $0x4, %rax
movq %rax, -0xe0(%rbp)
jmp 0x1d2d26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
jmp 0x1d307c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
jmp 0x1d3070
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
jmp 0x1d3064
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
leaq -0x370(%rbp), %rdi
callq 0x10ff0
jmp 0x1d3062
jmp 0x1d3064
leaq -0x390(%rbp), %rdi
callq 0x3100
leaq -0x391(%rbp), %rdi
callq 0x3290
leaq -0x158(%rbp), %rdi
callq 0x11110
jmp 0x1d30bf
jmp 0x1d308c
movq -0x90(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x90(%rbp)
jmp 0x1d2c7c
jmp 0x1d30a5
movq -0x40(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x40(%rbp)
jmp 0x1d2bf9
addq $0x440, %rsp            # imm = 0x440
popq %rbp
retq
movq -0x1c8(%rbp), %rdi
callq 0x33a0
movq %rax, %rdi
callq 0x116d0
nopw %cs:(%rax,%rax)