// File: dsharlet[P]array/test/z_order.cpp
// Function: nda::test_for_each_in_z_order_1d_body()
TEST(for_each_in_z_order_1d) {
  // A 1-d z order traversal is useless, but it should work.
  dense_array<int, 1> a({12}, 0);
  size_t total_size = 0;
  for_all_indices_in_z_order(a.shape().extent(), [&](index_t x) {
    total_size++;
    a(x) = pattern<int>(std::make_tuple(x));
  });
  // 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 $0x2e0, %rsp            # imm = 0x2E0
leaq -0x50(%rbp), %rdi
movq %rdi, -0x268(%rbp)
movl $0xc, %esi
callq 0x34210
movq -0x268(%rbp), %rsi
movl $0x0, -0x54(%rbp)
leaq -0x38(%rbp), %rdi
movq %rdi, -0x260(%rbp)
leaq -0x54(%rbp), %rdx
callq 0x34cc0
movq -0x260(%rbp), %rdi
movq $0x0, -0x60(%rbp)
callq 0x1d7570
movq %rax, -0x258(%rbp)
jmp 0x1d23ff
movq -0x258(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x3faa0
jmp 0x1d2411
leaq -0x60(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x1d26b0
jmp 0x1d2436
movq -0x60(%rbp), %rax
movq %rax, -0x278(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x1d7590
movq %rax, -0x270(%rbp)
jmp 0x1d2453
movq -0x270(%rbp), %rcx
movq -0x278(%rbp), %rax
subq %rcx, %rax
sete %al
movb %al, -0x281(%rbp)
leaq -0x239(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0x33b0
movq -0x280(%rbp), %rdx
leaq 0x2afd4(%rip), %rsi     # 0x1fd462
leaq -0x238(%rbp), %rdi
callq 0x10a90
jmp 0x1d249c
movb -0x281(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x218(%rbp), %rdi
leaq -0x238(%rbp), %rdx
callq 0x10f80
jmp 0x1d24bd
leaq 0xa321(%rip), %rsi      # 0x1dc7e5
leaq -0x218(%rbp), %rdi
callq 0x34320
movq %rax, -0x290(%rbp)
jmp 0x1d24d9
movq -0x290(%rbp), %rdi
leaq 0x2b3da(%rip), %rsi     # 0x1fd8c1
callq 0x34570
movq %rax, -0x298(%rbp)
jmp 0x1d24f5
movq -0x298(%rbp), %rdi
leaq 0xe2a9(%rip), %rsi      # 0x1e07ac
callq 0x34320
movq %rax, -0x2a0(%rbp)
jmp 0x1d2511
movq -0x2a0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x355c0
movq %rax, -0x2a8(%rbp)
jmp 0x1d252a
movq -0x2a8(%rbp), %rdi
leaq 0xa2ad(%rip), %rsi      # 0x1dc7e5
callq 0x34320
movq %rax, -0x2b0(%rbp)
jmp 0x1d2546
movq -0x2b0(%rbp), %rdi
leaq 0x2af1c(%rip), %rsi     # 0x1fd470
callq 0x36600
movq %rax, -0x2b8(%rbp)
jmp 0x1d2562
movq -0x2b8(%rbp), %rdi
leaq 0xe23c(%rip), %rsi      # 0x1e07ac
callq 0x34320
movq %rax, -0x2c0(%rbp)
jmp 0x1d257e
leaq -0x38(%rbp), %rdi
callq 0x1d7590
movq %rax, -0x2c8(%rbp)
jmp 0x1d2590
movq -0x2c0(%rbp), %rdi
movq -0x2c8(%rbp), %rax
movq %rax, -0x248(%rbp)
leaq -0x248(%rbp), %rsi
callq 0x355c0
movq %rax, -0x2d0(%rbp)
jmp 0x1d25ba
movq -0x2d0(%rbp), %rdi
leaq 0x23eb3(%rip), %rsi     # 0x1f647b
callq 0x34320
jmp 0x1d25cf
leaq -0x218(%rbp), %rdi
callq 0x10ff0
jmp 0x1d25dd
leaq -0x238(%rbp), %rdi
callq 0x3100
leaq -0x239(%rbp), %rdi
callq 0x3290
leaq -0x250(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
callq 0x36b10
movq -0x2d8(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x1d75b0
jmp 0x1d261a
leaq -0x38(%rbp), %rdi
callq 0x34990
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x1d268a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x1d267e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x1d2672
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x10ff0
jmp 0x1d2670
jmp 0x1d2672
leaq -0x238(%rbp), %rdi
callq 0x3100
leaq -0x239(%rbp), %rdi
callq 0x3290
leaq -0x38(%rbp), %rdi
callq 0x34990
movq -0x70(%rbp), %rdi
callq 0x33a0
movq %rax, %rdi
callq 0x116d0
nopw %cs:(%rax,%rax)