// File: /workspace/github_cpp_makefile_star2_O3/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 0x48(%rsp), %r13
leaq 0xa8(%rsp), %r14
xorl %ecx, %ecx
leaq 0x20ad6(%rip), %rax     # 0xc0f34
movq %rcx, 0x28(%rsp)
movslq (%rcx,%rax), %rax
movq %rax, 0x30(%rsp)
xorl %ecx, %ecx
leaq 0x20abf(%rip), %rax     # 0xc0f34
movq %rcx, 0x38(%rsp)
movslq (%rcx,%rax), %rbx
xorl %ebp, %ebp
movq %rbp, 0xa8(%rsp)
movq 0x30(%rsp), %r12
movq %r12, 0xb0(%rsp)
movabsq $-0x8000000000000000, %r15 # imm = 0x8000000000000000
movq %r15, 0xb8(%rsp)
xorl %edi, %edi
movq %r14, %rsi
callq 0xd133
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r13)
movups %xmm0, (%r13)
movq %rbx, 0x68(%rsp)
movq %r15, 0x70(%rsp)
movq %rbp, 0x78(%rsp)
movq %r12, 0x80(%rsp)
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
callq 0x1c6ce
movq %rbx, %rdi
callq 0x1c796
movq %rbp, (%rsp)
movq 0x68(%rsp), %rax
movq 0x80(%rsp), %rcx
movq %rsp, %rdx
movq %rdx, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
leaq 0x8(%rsp), %rdx
movq %rdx, 0x90(%rsp)
movq %rcx, 0xa8(%rsp)
movq %rax, 0xb0(%rsp)
cmpq %rax, %rcx
cmovgq %rcx, %rax
movl $0x1, %ecx
movq %rcx, %r8
addq %rcx, %rcx
cmpq %rax, %r8
jl 0xa0531
sarq %r8
cmpq $0x2, %r8
movl $0x1, %eax
cmovlq %rax, %r8
movl $0x1, %ecx
leaq 0xa8(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x90(%rsp), %r12
movq %r12, %r9
callq 0xa1616
movq (%rsp), %rbp
movq 0x68(%rsp), %r15
movq 0x80(%rsp), %rbx
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x8(%rsp), %r13
movq %r13, %rdi
leaq 0x202fb(%rip), %rsi     # 0xc0895
leaq 0x2030a(%rip), %rdx     # 0xc08ab
callq 0xd14c
imulq %rbx, %r15
testq %r15, %r15
movl $0x0, %eax
cmovleq %rax, %r15
xorl %esi, %esi
cmpq %r15, %rbp
sete %sil
movq %r14, %rdi
movq %r13, %rdx
callq 0xbf80
movq %r13, %rbx
leaq 0x48(%rsp), %r13
leaq 0x30ab(%rip), %r15      # 0xa3684
movq %r14, %rdi
movq %r15, %rsi
callq 0x18fba
movq %rax, %rdi
leaq 0x2063c(%rip), %rsi     # 0xc0c2a
callq 0x19062
movq %rax, %rdi
leaq 0x6c59(%rip), %rsi      # 0xa7256
callq 0x18fba
movq %rax, %rbp
cmpb $0x1, 0x188(%rax)
jne 0xa061e
movq %rbp, %rdi
addq $0x10, %rdi
movq (%rsp), %rsi
callq 0x2110
movq %rbp, %rdi
movq %r15, %rsi
callq 0x18fba
movq %rax, %rdi
leaq 0x20270(%rip), %rsi     # 0xc08a3
callq 0x1a146
movq %rax, %rdi
leaq 0x6c14(%rip), %rsi      # 0xa7256
callq 0x18fba
movq %rax, %rbp
cmpb $0x1, 0x188(%rax)
jne 0xa0679
movq 0x80(%rsp), %rsi
imulq 0x68(%rsp), %rsi
testq %rsi, %rsi
movl $0x0, %eax
cmovleq %rax, %rsi
movq %rbp, %rdi
addq $0x10, %rdi
callq 0x2110
movq %rbp, %rdi
leaq 0x19c16(%rip), %rsi     # 0xba299
callq 0x18fba
movq %r14, %rdi
callq 0xbfd8
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xa06ac
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0xa8(%rsp)
movups 0x18(%r13), %xmm0
movups 0x28(%r13), %xmm1
movups 0x38(%r13), %xmm2
leaq 0xb0(%rsp), %rdi
movups %xmm2, 0x20(%rdi)
movups %xmm1, 0x10(%rdi)
movups %xmm0, (%rdi)
movq %r14, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movq %rbx, %rsi
callq 0x20f32
leaq 0x40(%rsp), %rdi
callq 0x1d1c4
movq 0x38(%rsp), %rcx
addq $0x4, %rcx
cmpq $0x20, %rcx
jne 0xa046e
movq 0x28(%rsp), %rcx
addq $0x4, %rcx
cmpq $0x20, %rcx
jne 0xa0457
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa073e
jmp 0xa078a
movq %rax, %rbx
jmp 0xa0776
jmp 0xa074a
movq %rax, %rbx
jmp 0xa075a
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0xbfd8
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xa0776
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x40(%rsp), %rdi
callq 0x1d1c4
movq %rbx, %rdi
callq 0x2300
jmp 0xa078a
movq %rax, %rdi
callq 0xc0a9