// File: dsharlet[P]array/test/auto_allocator.cpp
// Function: nda::test_auto_array_body()
TEST(auto_array) {
  dense3d_int_auto_array auto_array({4, 3, 2});
  ASSERT(is_auto_allocation(auto_array));
  for_all_indices(auto_array.shape(), [&](int x, int y, int c) { auto_array(x, y, c) = x; });

  dense3d_int_auto_array copy_array(auto_array);
  ASSERT(is_auto_allocation(copy_array));
  for_all_indices(
      copy_array.shape(), [&](int x, int y, int c) { ASSERT_EQ(copy_array(x, y, c), x); });

  dense3d_int_auto_array assign_array;
  assign_array = auto_array;
  ASSERT(is_auto_allocation(assign_array));
  for_all_indices(
      assign_array.shape(), [&](int x, int y, int c) { ASSERT_EQ(assign_array(x, y, c), x); });

  dense3d_int_auto_array move_array(std::move(auto_array));
  ASSERT(is_auto_allocation(move_array));
  for_all_indices(
      move_array.shape(), [&](int x, int y, int c) { ASSERT_EQ(move_array(x, y, c), x); });

  dense3d_int_auto_array move_assign;
  move_assign = std::move(assign_array);
  ASSERT(is_auto_allocation(move_assign));
  for_all_indices(
      move_assign.shape(), [&](int x, int y, int c) { ASSERT_EQ(move_assign(x, y, c), x); });
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe30, %rsp            # imm = 0xE30
leaq -0x130(%rbp), %rdi
movq %rdi, -0xdb8(%rbp)
movl $0x4, %esi
movl $0x3, %edx
movl $0x2, %ecx
callq 0x34640
movq -0xdb8(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
movq %rdi, -0xdb0(%rbp)
callq 0xa99f0
movq -0xdb0(%rbp), %rdi
callq 0xa9ab0
movb %al, -0xda1(%rbp)
jmp 0xa5ebb
leaq -0x2f1(%rbp), %rdi
movq %rdi, -0xdc0(%rbp)
callq 0x33b0
movq -0xdc0(%rbp), %rdx
leaq 0x142d5b(%rip), %rsi    # 0x1e8c37
leaq -0x2f0(%rbp), %rdi
callq 0x10a90
jmp 0xa5eea
movb -0xda1(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x2c0(%rbp), %rdi
leaq -0x2f0(%rbp), %rdx
callq 0x10f80
jmp 0xa5f0b
leaq -0x2c0(%rbp), %rdi
callq 0x10ff0
jmp 0xa5f19
leaq -0x2f0(%rbp), %rdi
callq 0x3100
leaq -0x2f1(%rbp), %rdi
callq 0x3290
leaq -0xe8(%rbp), %rdi
callq 0xa9b40
movq %rax, -0xdc8(%rbp)
jmp 0xa5f46
movq -0xdc8(%rbp), %rdi
leaq -0xe8(%rbp), %rax
movq %rax, -0x300(%rbp)
leaq -0x300(%rbp), %rsi
callq 0xa6530
jmp 0xa5f69
leaq -0x3e8(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0xa9b60
jmp 0xa5f7e
leaq -0x3e8(%rbp), %rdi
callq 0xa9ab0
movb %al, -0xdc9(%rbp)
jmp 0xa5f92
leaq -0x599(%rbp), %rdi
movq %rdi, -0xdd8(%rbp)
callq 0x33b0
movq -0xdd8(%rbp), %rdx
leaq 0x142ca3(%rip), %rsi    # 0x1e8c56
leaq -0x598(%rbp), %rdi
callq 0x10a90
jmp 0xa5fc1
movb -0xdc9(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x578(%rbp), %rdi
leaq -0x598(%rbp), %rdx
callq 0x10f80
jmp 0xa5fe2
leaq -0x578(%rbp), %rdi
callq 0x10ff0
jmp 0xa5ff0
leaq -0x598(%rbp), %rdi
callq 0x3100
leaq -0x599(%rbp), %rdi
callq 0x3290
leaq -0x3e8(%rbp), %rdi
callq 0xa9b40
movq %rax, -0xde0(%rbp)
jmp 0xa601d
movq -0xde0(%rbp), %rdi
leaq -0x3e8(%rbp), %rax
movq %rax, -0x5a8(%rbp)
leaq -0x5a8(%rbp), %rsi
callq 0xa6560
jmp 0xa6040
leaq -0x690(%rbp), %rdi
callq 0xa9c00
jmp 0xa604e
leaq -0x690(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0xa9c30
jmp 0xa6063
leaq -0x690(%rbp), %rdi
callq 0xa9ab0
movb %al, -0xde1(%rbp)
jmp 0xa6077
leaq -0x841(%rbp), %rdi
movq %rdi, -0xdf0(%rbp)
callq 0x33b0
movq -0xdf0(%rbp), %rdx
leaq 0x142bdd(%rip), %rsi    # 0x1e8c75
leaq -0x840(%rbp), %rdi
callq 0x10a90
jmp 0xa60a6
movb -0xde1(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x820(%rbp), %rdi
leaq -0x840(%rbp), %rdx
callq 0x10f80
jmp 0xa60c7
leaq -0x820(%rbp), %rdi
callq 0x10ff0
jmp 0xa60d5
leaq -0x840(%rbp), %rdi
callq 0x3100
leaq -0x841(%rbp), %rdi
callq 0x3290
leaq -0x690(%rbp), %rdi
callq 0xa9b40
movq %rax, -0xdf8(%rbp)
jmp 0xa6102
movq -0xdf8(%rbp), %rdi
leaq -0x690(%rbp), %rax
movq %rax, -0x850(%rbp)
leaq -0x850(%rbp), %rsi
callq 0xa6590
jmp 0xa6125
leaq -0x938(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0xa9d30
jmp 0xa613a
leaq -0x938(%rbp), %rdi
callq 0xa9ab0
movb %al, -0xdf9(%rbp)
jmp 0xa614e
leaq -0xae9(%rbp), %rdi
movq %rdi, -0xe08(%rbp)
callq 0x33b0
movq -0xe08(%rbp), %rdx
leaq 0x142b27(%rip), %rsi    # 0x1e8c96
leaq -0xae8(%rbp), %rdi
callq 0x10a90
jmp 0xa617d
movb -0xdf9(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0xac8(%rbp), %rdi
leaq -0xae8(%rbp), %rdx
callq 0x10f80
jmp 0xa619e
leaq -0xac8(%rbp), %rdi
callq 0x10ff0
jmp 0xa61ac
leaq -0xae8(%rbp), %rdi
callq 0x3100
leaq -0xae9(%rbp), %rdi
callq 0x3290
leaq -0x938(%rbp), %rdi
callq 0xa9b40
movq %rax, -0xe10(%rbp)
jmp 0xa61d9
movq -0xe10(%rbp), %rdi
leaq -0x938(%rbp), %rax
movq %rax, -0xaf8(%rbp)
leaq -0xaf8(%rbp), %rsi
callq 0xa65c0
jmp 0xa61fc
leaq -0xbe0(%rbp), %rdi
callq 0xa9c00
jmp 0xa620a
leaq -0xbe0(%rbp), %rdi
leaq -0x690(%rbp), %rsi
callq 0xa9e20
jmp 0xa621f
leaq -0xbe0(%rbp), %rdi
callq 0xa9ab0
movb %al, -0xe11(%rbp)
jmp 0xa6233
leaq -0xd91(%rbp), %rdi
movq %rdi, -0xe20(%rbp)
callq 0x33b0
movq -0xe20(%rbp), %rdx
leaq 0x142a61(%rip), %rsi    # 0x1e8cb5
leaq -0xd90(%rbp), %rdi
callq 0x10a90
jmp 0xa6262
movb -0xe11(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0xd70(%rbp), %rdi
leaq -0xd90(%rbp), %rdx
callq 0x10f80
jmp 0xa6283
leaq -0xd70(%rbp), %rdi
callq 0x10ff0
jmp 0xa6291
leaq -0xd90(%rbp), %rdi
callq 0x3100
leaq -0xd91(%rbp), %rdi
callq 0x3290
leaq -0xbe0(%rbp), %rdi
callq 0xa9b40
movq %rax, -0xe28(%rbp)
jmp 0xa62be
movq -0xe28(%rbp), %rdi
leaq -0xbe0(%rbp), %rax
movq %rax, -0xda0(%rbp)
leaq -0xda0(%rbp), %rsi
callq 0xa65f0
jmp 0xa62e1
leaq -0xbe0(%rbp), %rdi
callq 0xa9f50
leaq -0x938(%rbp), %rdi
callq 0xa9f50
leaq -0x690(%rbp), %rdi
callq 0xa9f50
leaq -0x3e8(%rbp), %rdi
callq 0xa9f50
leaq -0xe8(%rbp), %rdi
callq 0xa9f50
addq $0xe30, %rsp            # imm = 0xE30
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c8(%rbp)
movl %eax, -0x2cc(%rbp)
jmp 0xa650d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c8(%rbp)
movl %eax, -0x2cc(%rbp)
jmp 0xa636f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c8(%rbp)
movl %eax, -0x2cc(%rbp)
leaq -0x2f0(%rbp), %rdi
callq 0x3100
leaq -0x2f1(%rbp), %rdi
callq 0x3290
jmp 0xa650d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c8(%rbp)
movl %eax, -0x2cc(%rbp)
jmp 0xa6501
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c8(%rbp)
movl %eax, -0x2cc(%rbp)
jmp 0xa63c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c8(%rbp)
movl %eax, -0x2cc(%rbp)
leaq -0x598(%rbp), %rdi
callq 0x3100
leaq -0x599(%rbp), %rdi
callq 0x3290
jmp 0xa6501
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c8(%rbp)
movl %eax, -0x2cc(%rbp)
jmp 0xa64f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c8(%rbp)
movl %eax, -0x2cc(%rbp)
jmp 0xa6423
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c8(%rbp)
movl %eax, -0x2cc(%rbp)
leaq -0x840(%rbp), %rdi
callq 0x3100
leaq -0x841(%rbp), %rdi
callq 0x3290
jmp 0xa64f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c8(%rbp)
movl %eax, -0x2cc(%rbp)
jmp 0xa64e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c8(%rbp)
movl %eax, -0x2cc(%rbp)
jmp 0xa647d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c8(%rbp)
movl %eax, -0x2cc(%rbp)
leaq -0xae8(%rbp), %rdi
callq 0x3100
leaq -0xae9(%rbp), %rdi
callq 0x3290
jmp 0xa64e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c8(%rbp)
movl %eax, -0x2cc(%rbp)
jmp 0xa64dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c8(%rbp)
movl %eax, -0x2cc(%rbp)
jmp 0xa64d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c8(%rbp)
movl %eax, -0x2cc(%rbp)
leaq -0xd90(%rbp), %rdi
callq 0x3100
leaq -0xd91(%rbp), %rdi
callq 0x3290
leaq -0xbe0(%rbp), %rdi
callq 0xa9f50
leaq -0x938(%rbp), %rdi
callq 0xa9f50
leaq -0x690(%rbp), %rdi
callq 0xa9f50
leaq -0x3e8(%rbp), %rdi
callq 0xa9f50
leaq -0xe8(%rbp), %rdi
callq 0xa9f50
movq -0x2c8(%rbp), %rdi
callq 0x33a0
nopw %cs:(%rax,%rax)