// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/z_order.cpp
// Function: nda::test_for_each_in_z_order_2d_body()
TEST(for_each_in_z_order_2d) {
  for (index_t w : {1, 2, 3, 4, 5, 12, 16, 20}) {
    for (index_t h : {1, 2, 3, 4, 5, 12, 16, 20}) {
      dense_array<int, 2> a({w, h});
      size_t total_size = 0;
      for_all_indices_in_z_order(a.shape().extent(), [&](index_t x, index_t y) {
        total_size++;
        a(x, y) = pattern<int>(std::make_tuple(x, y));
      });
      // 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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
leaq 0xa0(%rsp), %rbp
leaq 0x50(%rsp), %rbx
leaq 0x8(%rsp), %r13
leaq 0x30(%rsp), %r14
leaq 0x10(%rsp), %r12
xorl %r15d, %r15d
cmpq $0x20, %r15
je 0x8aae6
leaq 0x21dbf(%rip), %rax     # 0xac6ac
movslq (%r15,%rax), %rax
movq %rax, 0x20(%rsp)
xorl %ecx, %ecx
movq %r15, 0x18(%rsp)
cmpq $0x20, %rcx
je 0x8aadd
leaq 0x21d9e(%rip), %rax     # 0xac6ac
movq %rcx, 0x28(%rsp)
movslq (%rcx,%rax), %rdx
movq %rbp, %rdi
movq 0x20(%rsp), %rsi
callq 0x8bc86
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x10768
andq $0x0, 0x8(%rsp)
movq 0x78(%rsp), %rax
movq 0x90(%rsp), %rcx
movq %r13, 0x30(%rsp)
movq %rbx, 0x38(%rsp)
movq %r14, 0x10(%rsp)
movq %rcx, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
movq %rbp, %rdi
leaq 0xb0(%rsp), %rsi
callq 0x8bcf0
movq %rbx, %r13
movq (%rax), %rdi
callq 0x8bce1
sarq %rax
cmpq $0x2, %rax
pushq $0x1
popq %rcx
cmovlq %rcx, %rax
movq %rbp, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %rax, %r8
movq %r12, %r9
callq 0x8b6d9
movq %rbp, %r12
movq 0x8(%rsp), %rbp
movq 0x78(%rsp), %rbx
movq 0x90(%rsp), %r15
movq %r14, %rdi
leaq 0x216bf(%rip), %rsi     # 0xac07a
leaq 0x7(%rsp), %rdx
callq 0x66a0
imulq %r15, %rbx
testq %rbx, %rbx
movl $0x0, %eax
cmovleq %rax, %rbx
xorl %esi, %esi
cmpq %rbx, %rbp
sete %sil
movq %r12, %rdi
movq %r14, %r15
movq %r14, %rdx
callq 0x6894
movq %r13, %rbx
leaq 0x8(%rsp), %r13
movq %r12, %rbp
leaq 0x10(%rsp), %r12
movq %rbp, %rdi
leaq 0x2c41(%rip), %r14      # 0x8d647
movq %r14, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x21ac1(%rip), %rsi     # 0xac4d9
callq 0x107d8
movq %rax, %rdi
leaq 0x6bcb(%rip), %rsi      # 0x915f2
callq 0x106fe
movq %rax, %rdi
movq %r13, %rsi
callq 0x11052
movq %rax, %rdi
movq %r14, %rsi
callq 0x106fe
movq %rax, %rdi
leaq 0x2163c(%rip), %rsi     # 0xac088
callq 0x118ac
movq %rax, %rdi
leaq 0x6b97(%rip), %rsi      # 0x915f2
callq 0x106fe
movq 0x78(%rsp), %rcx
imulq 0x90(%rsp), %rcx
testq %rcx, %rcx
movl $0x0, %edx
cmovleq %rdx, %rcx
movq %rcx, 0x10(%rsp)
movq %rax, %rdi
movq %r12, %rsi
callq 0x11052
movq %rax, %rdi
leaq 0x1a80e(%rip), %rsi     # 0xa52a2
callq 0x106fe
movq %rbp, %rdi
callq 0x68d4
movq %r15, %r14
movq %r15, %rdi
callq 0x2090
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x11c0c
movq %rbx, %rdi
callq 0x108fe
movq 0x28(%rsp), %rcx
addq $0x4, %rcx
movq 0x18(%rsp), %r15
jmp 0x8a8fd
addq $0x4, %r15
jmp 0x8a8dc
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8aafc
jmp 0x8aafc
movq %rax, %rbx
jmp 0x8ab22
jmp 0x8ab08
movq %rax, %rbx
jmp 0x8ab18
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x68d4
leaq 0x30(%rsp), %rdi
callq 0x2090
leaq 0x50(%rsp), %rdi
callq 0x108fe
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba