LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/array.cpp
// Function: nda::test_array_dense_copy_body()
TEST(array_dense_copy) {
  array_of_rank<int, 3> source({dim<>(-3, 4, 2), 5, 6});
  fill_pattern(source);
  ASSERT(!source.is_compact());

  dense_array<int, 3> dense_copy = make_compact_copy(source);
  ASSERT(dense_copy.is_compact());
  check_pattern(dense_copy);
}

// Assembly:
pushq %rbx
subq $0x420, %rsp            # imm = 0x420
leaq 0x30(%rsp), %rsi
andq $0x0, (%rsi)
movq $0x6, 0x8(%rsi)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x10(%rsi)
andq $0x0, 0x18(%rsi)
movq $0x5, 0x20(%rsi)
movq %rax, 0x28(%rsi)
movq $-0x3, 0x30(%rsi)
movq $0x4, 0x38(%rsi)
movq $0x2, 0x40(%rsi)
leaq 0x98(%rsp), %rbx
movq %rbx, %rdi
callq 0x10b92
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10bbd
leaq 0xb8(%rsp), %rdi
callq 0x16f28
movl %eax, %ebx
leaq 0x80c62(%rip), %rsi     # 0x8f341
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x66a0
xorb $0x1, %bl
movzbl %bl, %esi
leaq 0x290(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x6894
leaq 0x290(%rsp), %rdi
callq 0x68d4
leaq 0x30(%rsp), %rdi
callq 0x2090
leaq 0x30(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x117e0
leaq 0x50(%rsp), %rdi
callq 0x16f50
movl %eax, %ebx
leaq 0x80c0f(%rip), %rsi     # 0x8f356
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x66a0
movzbl %bl, %esi
leaq 0x100(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x6894
leaq 0x100(%rsp), %rdi
callq 0x68d4
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x2090
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x1132f
leaq 0x30(%rsp), %rdi
callq 0x69c2
leaq 0x98(%rsp), %rdi
callq 0x10d02
addq $0x420, %rsp            # imm = 0x420
popq %rbx
retq
jmp 0xe7c3
jmp 0xe7c3
movq %rax, %rbx
jmp 0xe7d9
jmp 0xe7f4
jmp 0xe7f4
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2090
leaq 0x30(%rsp), %rdi
callq 0x69c2
jmp 0xe7f7
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x2090
jmp 0xe7f7
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x10d02
movq %rbx, %rdi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/array.cpp
// Function: nda::test_array_dense_move_body()
TEST(array_dense_move) {
  array_of_rank<int, 3> source({dim<>(-3, 4, 2), 5, 6});
  fill_pattern(source);
  ASSERT(!source.is_compact());

  dense_array<int, 3> dense_move = make_compact_move(source);
  ASSERT(dense_move.is_compact());
  check_pattern(dense_move);
}

// Assembly:
pushq %rbx
subq $0x420, %rsp            # imm = 0x420
leaq 0x30(%rsp), %rsi
andq $0x0, (%rsi)
movq $0x6, 0x8(%rsi)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x10(%rsi)
andq $0x0, 0x18(%rsi)
movq $0x5, 0x20(%rsi)
movq %rax, 0x28(%rsi)
movq $-0x3, 0x30(%rsi)
movq $0x4, 0x38(%rsi)
movq $0x2, 0x40(%rsi)
leaq 0x98(%rsp), %rbx
movq %rbx, %rdi
callq 0x10b92
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10bbd
leaq 0xb8(%rsp), %rdi
callq 0x16f28
movl %eax, %ebx
leaq 0x80ab5(%rip), %rsi     # 0x8f341
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x66a0
xorb $0x1, %bl
movzbl %bl, %esi
leaq 0x290(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x6894
leaq 0x290(%rsp), %rdi
callq 0x68d4
leaq 0x30(%rsp), %rdi
callq 0x2090
leaq 0x30(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x11813
leaq 0x50(%rsp), %rdi
callq 0x16f50
movl %eax, %ebx
leaq 0x80a8b(%rip), %rsi     # 0x8f37f
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x66a0
movzbl %bl, %esi
leaq 0x100(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x6894
leaq 0x100(%rsp), %rdi
callq 0x68d4
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x2090
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x1132f
leaq 0x30(%rsp), %rdi
callq 0x69c2
leaq 0x98(%rsp), %rdi
callq 0x10d02
addq $0x420, %rsp            # imm = 0x420
popq %rbx
retq
jmp 0xe970
jmp 0xe970
movq %rax, %rbx
jmp 0xe986
jmp 0xe9a1
jmp 0xe9a1
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2090
leaq 0x30(%rsp), %rdi
callq 0x69c2
jmp 0xe9a4
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x2090
jmp 0xe9a4
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x10d02
movq %rbx, %rdi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/array.cpp
// Function: nda::test_array_tricky_copy_body()
TEST(array_tricky_copy) {
  array_of_rank<int, 2> source({{0, 4, 6}, {0, 6, 1}});
  fill_pattern(source);

  array_of_rank<int, 2> dest({{0, 4, 6}, {0, 3, 2}});
  copy(source, dest);
  check_pattern(dest);
}

// Assembly:
pushq %rbx
subq $0xd0, %rsp
movq %rsp, %rsi
andq $0x0, (%rsi)
pushq $0x6
popq %rax
movq %rax, 0x8(%rsi)
movq $0x1, 0x10(%rsi)
andq $0x0, 0x18(%rsi)
movq $0x4, 0x20(%rsi)
movq %rax, 0x28(%rsi)
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
callq 0x69d2
movq %rbx, %rdi
xorl %esi, %esi
callq 0x11846
leaq 0xa0(%rsp), %rsi
andq $0x0, (%rsi)
movq $0x3, 0x8(%rsi)
movq $0x2, 0x10(%rsi)
andq $0x0, 0x18(%rsi)
movq $0x4, 0x20(%rsi)
movq $0x6, 0x28(%rsi)
movq %rsp, %rdi
callq 0x69d2
leaq 0x50(%rsp), %rdi
movq %rsp, %rsi
callq 0x6a3a
xorps %xmm0, %xmm0
leaq 0xa0(%rsp), %rsi
movaps %xmm0, (%rsi)
movq %rsp, %rdi
callq 0x11879
movq %rsp, %rdi
callq 0x6aca
leaq 0x50(%rsp), %rdi
callq 0x6aca
addq $0xd0, %rsp
popq %rbx
retq
jmp 0xea78
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6aca
jmp 0xea8a
jmp 0xea87
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x6aca
movq %rbx, %rdi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/array.cpp
// Function: nda::test_array_for_each_value_scalar_body()
TEST(array_for_each_value_scalar) {
  array_of_rank<int, 0> scalar;
  move_only token;
  scalar.for_each_value([token = std::move(token)](int& v) {
    v = 3;
    assert_used(token);
  });
  ASSERT_EQ(scalar(), 3);
}

// Assembly:
pushq %rbx
subq $0x1e0, %rsp            # imm = 0x1E0
leaq 0x8(%rsp), %rdi
callq 0x6b36
leaq 0x28(%rsp), %rdi
movq -0x8(%rdi), %rbx
callq 0x9eda
testq %rbx, %rbx
je 0xebbc
movl $0x3, (%rbx)
leaq 0x50(%rsp), %rdi
callq 0x172e2
movq 0x20(%rsp), %rax
movl (%rax), %ebx
leaq 0x808e2(%rip), %rsi     # 0x8f3c5
leaq 0x30(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl $0x3, %ebx
sete %sil
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x6894
leaq 0x7eb36(%rip), %rsi     # 0x8d647
leaq 0x50(%rsp), %rdi
callq 0x106fe
leaq 0x808b1(%rip), %rsi     # 0x8f3d3
movq %rax, %rdi
callq 0x118ac
leaq 0x82ac1(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq 0x20(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
leaq 0x7eafa(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x8938d(%rip), %rsi     # 0x97ee9
movq %rax, %rdi
callq 0x106fe
leaq 0x82a87(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x4(%rsp), %rsi
movl $0x3, (%rsi)
movq %rax, %rdi
callq 0x10736
leaq 0x96715(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x50(%rsp), %rdi
callq 0x68d4
leaq 0x30(%rsp), %rdi
callq 0x2090
leaq 0x8(%rsp), %rdi
callq 0x6baa
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbx
retq
leaq 0x7e6cc(%rip), %rdi     # 0x8d28f
leaq 0x7e507(%rip), %rsi     # 0x8d0d1
leaq 0x82d19(%rip), %rcx     # 0x918ea
movl $0x6a1, %edx            # imm = 0x6A1
callq 0x20e0
jmp 0xebdd
movq %rax, %rbx
jmp 0xec00
jmp 0xebe9
movq %rax, %rbx
jmp 0xebf6
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x68d4
leaq 0x30(%rsp), %rdi
callq 0x2090
leaq 0x8(%rsp), %rdi
callq 0x6baa
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/array.cpp
// Function: nda::test_array_move_reinterpret_shape_body()
TEST(array_move_reinterpret_shape) {
  array_of_rank<int, 3> a({9, {0, 5, 10}, 1});
  fill_pattern(a);

  auto b = move_reinterpret_shape<shape_of_rank<2>>(std::move(a));
  check_pattern(b);

  a = move_reinterpret_shape<shape_of_rank<3>>(std::move(b));
  check_pattern(a);
}

// Assembly:
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
movq %rsp, %rsi
andq $0x0, (%rsi)
movq $0x1, 0x8(%rsi)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x10(%rsi)
andq $0x0, 0x18(%rsi)
movq $0x5, 0x20(%rsi)
movq $0xa, 0x28(%rsi)
andq $0x0, 0x30(%rsi)
movq $0x9, 0x38(%rsi)
movq %rax, 0x40(%rsi)
leaq 0xb8(%rsp), %rbx
movq %rbx, %rdi
callq 0x10b92
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10bbd
leaq 0x68(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
xorl %edx, %edx
callq 0x11c3f
xorps %xmm0, %xmm0
movq %rsp, %rsi
movaps %xmm0, (%rsi)
leaq 0x68(%rsp), %rdi
callq 0x11879
movq %rsp, %rdi
leaq 0x68(%rsp), %rsi
xorl %edx, %edx
callq 0x11c84
leaq 0xb8(%rsp), %rdi
movq %rsp, %rsi
callq 0x10c78
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x10d02
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
leaq 0xb8(%rsp), %rdi
movq %rsp, %rsi
callq 0x113b4
leaq 0x68(%rsp), %rdi
callq 0x6aca
leaq 0xb8(%rsp), %rdi
callq 0x10d02
addq $0x120, %rsp            # imm = 0x120
popq %rbx
retq
jmp 0x10037
movq %rax, %rbx
movq %rsp, %rdi
callq 0x10d02
jmp 0x1003a
jmp 0x10037
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x6aca
jmp 0x1004b
jmp 0x10048
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x10d02
movq %rbx, %rdi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/include/array/array.h
// Function: nda::array<int, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, std::allocator<int>>::clear()
void clear() {
    deallocate();
    shape_ = Shape();
    allocate();
    construct();
  }

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x9268
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x48(%rbx)
movups %xmm0, 0x20(%rbx)
movq %rax, 0x30(%rbx)
movq %rbx, %rdi
callq 0x8d86
movq %rbx, %rdi
popq %rbx
jmp 0x8e02
nop
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/include/array/array.h
// Function: nda::array<nda::lifetime_counter, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, nda::auto_allocator<nda::lifetime_counter, 256ul, 1ul, std::allocator<nda::lifetime_counter>>>::operator=(nda::array<nda::lifetime_counter, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, nda::auto_allocator<nda::lifetime_counter, 256ul, 1ul, std::allocator<nda::lifetime_counter>>>&&)
array& operator=(array&& other) {
    using std::swap;
    if (base_ == other.base_) {
      if (base_) {
        assert(shape_ == other.shape_);
      } else {
        swap(shape_, other.shape_);
        assert(shape_.empty());
      }
      return *this;
    }

    if (std::allocator_traits<allocator_type>::propagate_on_container_move_assignment::value) {
      swap(alloc_, other.alloc_);
      swap_except_allocator(other);
    } else if (alloc_ == other.get_allocator()) {
      swap_except_allocator(other);
    } else {
      assign(std::move(other));
    }
    return *this;
  }

// Assembly:
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
movq 0x118(%rdi), %rcx
cmpq 0x118(%rsi), %rcx
je 0x37e6a
cmpb $0x0, 0x100(%rbx)
je 0x37eaa
cmpq %rsi, %rbx
jne 0x37eb8
jmp 0x37ec5
movl $0x120, %eax            # imm = 0x120
leaq (%rbx,%rax), %rdi
addq %rsi, %rax
testq %rcx, %rcx
je 0x37ed2
movq %rax, %rsi
callq 0x15a78
testb %al, %al
jne 0x37f60
leaq 0x55b14(%rip), %rdi     # 0x8d9a6
leaq 0x55238(%rip), %rsi     # 0x8d0d1
leaq 0x5f9d3(%rip), %rcx     # 0x97873
movl $0x9a0, %edx            # imm = 0x9A0
callq 0x20e0
cmpq %rsi, %rbx
je 0x37ec5
cmpb $0x0, 0x100(%rsi)
je 0x37ec5
movq %rbx, %rdi
callq 0x37f88
jmp 0x37f60
movq %rbx, %rdi
callq 0x369d4
jmp 0x37f60
movq 0x10(%rdi), %rcx
movq %rcx, 0x10(%rsp)
movups (%rdi), %xmm0
movaps %xmm0, (%rsp)
movq 0x148(%rbx), %rcx
movq %rcx, 0x28(%rsp)
movups 0x138(%rbx), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x148(%rsi), %rcx
movq %rcx, 0x148(%rbx)
movups 0x138(%rsi), %xmm0
movups %xmm0, 0x138(%rbx)
movq 0x10(%rax), %rcx
movq %rcx, 0x10(%rdi)
movups (%rax), %xmm0
movups %xmm0, (%rdi)
movups 0x18(%rsp), %xmm0
movups %xmm0, 0x138(%rsi)
movq 0x28(%rsp), %rcx
movq %rcx, 0x148(%rsi)
movq 0x10(%rsp), %rcx
movq %rcx, 0x10(%rax)
movaps (%rsp), %xmm0
movups %xmm0, (%rax)
movq 0x128(%rbx), %rax
imulq 0x140(%rbx), %rax
testq %rax, %rax
jg 0x37f69
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
retq
leaq 0x55242(%rip), %rdi     # 0x8d1b2
leaq 0x5515a(%rip), %rsi     # 0x8d0d1
leaq 0x5f8f5(%rip), %rcx     # 0x97873
movl $0x9a3, %edx            # imm = 0x9A3
callq 0x20e0
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/include/array/array.h
// Function: nda::array<nda::lifetime_counter, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, nda::custom_alloc<std::integral_constant<bool, true>>>::operator=(nda::array<nda::lifetime_counter, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, nda::custom_alloc<std::integral_constant<bool, true>>> const&)
array& operator=(const array& other) {
    if (base_ == other.base_) {
      if (base_) {
        assert(shape_ == other.shape_);
      } else {
        shape_ = other.shape_;
        assert(shape_.empty());
      }
      return *this;
    }

    if (alloc_traits::propagate_on_container_copy_assignment::value) {
      if (alloc_ != other.get_allocator()) { deallocate(); }
      alloc_ = other.get_allocator();
    }

    assign(other);
    return *this;
  }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rax
cmpq 0x18(%rsi), %rax
je 0x37717
movl (%rbx), %eax
cmpl (%r14), %eax
je 0x37708
movq %rbx, %rdi
callq 0x31ba8
movl (%r14), %eax
movl %eax, (%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x35280
jmp 0x3777f
testq %rax, %rax
je 0x3774f
leaq 0x20(%rbx), %rdi
addq $0x20, %r14
movq %r14, %rsi
callq 0x15a78
testb %al, %al
jne 0x3777f
leaq 0x5626f(%rip), %rdi     # 0x8d9a6
leaq 0x55993(%rip), %rsi     # 0x8d0d1
leaq 0x5f77b(%rip), %rcx     # 0x96ec0
movl $0x987, %edx            # imm = 0x987
callq 0x20e0
movq 0x48(%r14), %rax
movq %rax, 0x48(%rbx)
movups 0x38(%r14), %xmm0
movups %xmm0, 0x38(%rbx)
movups 0x20(%r14), %xmm0
movups %xmm0, 0x20(%rbx)
movq 0x30(%r14), %rax
movq %rax, 0x30(%rbx)
movq 0x28(%rbx), %rax
imulq 0x40(%rbx), %rax
testq %rax, %rax
jg 0x3778a
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x55a21(%rip), %rdi     # 0x8d1b2
leaq 0x55939(%rip), %rsi     # 0x8d0d1
leaq 0x5f721(%rip), %rcx     # 0x96ec0
movl $0x98a, %edx            # imm = 0x98A
callq 0x20e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/include/array/array.h
// Function: nda::array<int, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>>, std::allocator<int>>::assign(nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>>, int const&)
void assign(Shape shape, const T& value) {
    shape.resolve();
    if (shape_ == shape) {
      destroy();
    } else {
      deallocate();
      shape_ = shape;
      allocate();
    }
    construct(value);
  }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq %rsi, %rdi
callq 0x13ae7
leaq 0x20(%r14), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x1578c
movq %r14, %rdi
testb %al, %al
je 0x10efe
callq 0x144f0
jmp 0x10f2f
callq 0x144aa
movb 0x28(%r15), %al
movb %al, 0x48(%r14)
movups 0x18(%r15), %xmm0
movups %xmm0, 0x38(%r14)
movq 0x10(%r15), %rax
movq %rax, 0x10(%r12)
movups (%r15), %xmm0
movups %xmm0, (%r12)
movq %r14, %rdi
callq 0x139ec
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1573a
nop
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/include/array/array.h
// Function: nda::array<int, nda::shape<nda::dim<-9l, -9l, -9l>>, std::allocator<int>>::reshape(nda::shape<nda::dim<-9l, -9l, -9l>>)
void reshape(Shape new_shape) {
    new_shape.resolve();
    if (shape_ == new_shape) { return; }

    // Allocate an array with the new shape.
    array new_array(new_shape);

    // Move the common elements to the new array.
    Shape intersection =
        internal::clamp(new_shape.dims(), shape_.dims(), typename Shape::dim_indices());
    pointer intersection_base =
        internal::pointer_add(new_array.base_, new_shape[intersection.min()]);
    copy_shape_traits_type::for_each_value(
        shape_, base_, intersection, intersection_base, internal::move_assign<T, T>);

    *this = std::move(new_array);
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x173a7
leaq 0x20(%rbx), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x83b4
testb %al, %al
jne 0x119c9
movq %rsp, %rdi
movq %r15, %rsi
callq 0x118e4
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x177a2
leaq 0x38(%rsp), %rdx
movq (%rdx), %rax
subq (%r15), %rax
movq 0x18(%rsp), %rsi
imulq 0x10(%r15), %rax
testq %rsi, %rsi
leaq (%rsi,%rax,4), %rcx
cmoveq %rsi, %rcx
movq 0x18(%rbx), %rsi
leaq -0x7bb7(%rip), %r8      # 0x9df7
movq %r14, %rdi
callq 0x17628
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x176f4
movq %rsp, %rdi
callq 0x11a7a
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x119d5
movq %rax, %rbx
movq %rsp, %rdi
callq 0x11a7a
movq %rbx, %rdi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/test.h
// Function: std::ostream& nda::operator<<<long, long, long>(std::ostream&, std::tuple<long, long, long> const&)
std::ostream& operator<<(std::ostream& s, const std::tuple<Ts...>& t) {
  s << "{";
  ostream_tuple(s, t, std::make_index_sequence<sizeof...(Ts)>());
  s << "}";
  return s;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x7b22f(%rip), %rsi     # 0x915fe
callq 0x21c0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x163f9
leaq 0x7b21a(%rip), %rsi     # 0x91600
movq %r14, %rdi
callq 0x21c0
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/test.h
// Function: std::ostream& nda::operator<<<-9l, -9l, 1l>(std::ostream&, nda::dim<-9l, -9l, 1l> const&)
std::ostream& operator<<(std::ostream& s, const dim<Min, Extent, Stride>& d) {
  s << "dim<";
  if (internal::is_static(Stride)) {
    ostream_comma_separated_list(s, Min, Extent, Stride);
  } else if (internal::is_static(Extent)) {
    ostream_comma_separated_list(s, Min, Extent);
  } else if (internal::is_static(Min)) {
    s << Min;
  }
  s << ">(";
  ostream_comma_separated_list(s, d.min(), d.extent(), d.stride());
  s << ")";
  return s;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x7aa29(%rip), %rsi     # 0x916f5
callq 0x21c0
pushq $-0x9
popq %rdx
pushq $0x1
popq %r15
movq %rbx, %rdi
movq %rdx, %rsi
movq %r15, %rcx
callq 0x1640c
leaq 0x7aa0d(%rip), %rsi     # 0x916fa
movq %rbx, %rdi
callq 0x21c0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
movq %r15, %rcx
callq 0x1640c
leaq 0x784e6(%rip), %rsi     # 0x8f1f4
movq %rbx, %rdi
callq 0x21c0
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/include/array/array.h
// Function: nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>> nda::convert_shape<nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, void>(nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>> const&)
NDARRAY_HOST_DEVICE ShapeDst convert_shape(const ShapeSrc& src) {
  assert(
      internal::is_trivial_slice<ShapeDst::rank()>(src.dims(), typename ShapeSrc::dim_indices()));
  return internal::convert_dims<typename ShapeDst::dims_type>(
      src.dims(), typename ShapeDst::dim_indices());
}

// Assembly:
subq $0x38, %rsp
cmpq $0x1, 0x8(%rsi)
jne 0x181f9
movq 0x40(%rsi), %rax
movq %rax, 0x28(%rsp)
movups 0x30(%rsi), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x28(%rsi), %rax
movq %rax, 0x10(%rsp)
movups 0x18(%rsi), %xmm0
movaps %xmm0, (%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x20(%rdi)
movq 0x28(%rsp), %rax
movq %rax, 0x28(%rdi)
movups %xmm0, (%rdi)
movq 0x10(%rsp), %rax
movq %rax, 0x10(%rdi)
movq 0x18(%rsp), %rax
movq %rax, 0x18(%rdi)
movq %rdi, %rax
addq $0x38, %rsp
retq
leaq 0x79d36(%rip), %rdi     # 0x91f36
leaq 0x74eca(%rip), %rsi     # 0x8d0d1
leaq 0x79d83(%rip), %rcx     # 0x91f91
movl $0x682, %edx            # imm = 0x682
callq 0x20e0
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/include/array/array.h
// Function: nda::array<int, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, std::allocator<int>> nda::move_reinterpret_shape<nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, int, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, std::allocator<int>>(nda::array<int, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, std::allocator<int>>&&, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>> const&, long)
array<T, NewShape, Alloc> move_reinterpret_shape(
    array<T, OldShape, Alloc>&& from, const NewShape& new_shape, index_t offset = 0) {
  // TODO: Use enable_if to implement this check. It is difficult to do due to
  // the friend declaration.
  static_assert(
      std::is_trivial<T>::value, "move_reinterpret_shape is broken for non-trivial types.");
  using std::swap;

  assert(new_shape.is_subset_of(from.shape(), offset));
  array<T, NewShape, Alloc> result;
  // Consider this to be a move assignment.
  if (std::allocator_traits<Alloc>::propagate_on_container_move_assignment::value) {
    swap(result.alloc_, from.alloc_);
  } else {
    assert(result.alloc_ == from.get_allocator());
  }

  swap(result.buffer_, from.buffer_);
  swap(result.buffer_size_, from.buffer_size_);
  swap(result.base_, from.base_);
  result.shape_ = new_shape;
  from.shape_ = OldShape();
  result.base_ += offset;

  return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %r14
leaq 0x20(%rsi), %r12
movq %rdx, %rdi
movq %r12, %rsi
movq %rcx, %rdx
callq 0x182fc
testb %al, %al
je 0x182dc
movq %r14, %rdi
callq 0x11008
movq 0x8(%r14), %rax
movq 0x8(%r15), %rcx
movq %rcx, 0x8(%r14)
movq %rax, 0x8(%r15)
movq 0x10(%r14), %rax
movq 0x10(%r15), %rcx
movq %rcx, 0x10(%r14)
movq %rax, 0x10(%r15)
shlq $0x2, %rbx
addq 0x18(%r15), %rbx
movq 0x18(%r14), %rax
movq %rax, 0x18(%r15)
movq 0x28(%r13), %rax
movq %rax, 0x48(%r14)
movups 0x18(%r13), %xmm0
movups %xmm0, 0x38(%r14)
movups (%r13), %xmm0
movups %xmm0, 0x20(%r14)
movq 0x10(%r13), %rax
movq %rax, 0x30(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%r15)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x60(%r15)
movups %xmm0, 0x38(%r15)
movq %rax, 0x48(%r15)
movups %xmm0, (%r12)
movq %rax, 0x30(%r15)
movq %rbx, 0x18(%r14)
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x79d47(%rip), %rdi     # 0x9202a
leaq 0x74de7(%rip), %rsi     # 0x8d0d1
leaq 0x79d66(%rip), %rcx     # 0x92057
movl $0xbee, %edx            # imm = 0xBEE
callq 0x20e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/include/array/array.h
// Function: nda::auto_allocator<nda::lifetime_counter, 256ul, 1ul, std::allocator<nda::lifetime_counter>>::allocate(unsigned long)
value_type* allocate(size_t n) {
    if (!allocated && n <= N) {
      allocated = true;
      return reinterpret_cast<value_type*>(&buffer[0]);
    } else {
      return std::allocator_traits<BaseAlloc>::allocate(alloc, n);
    }
  }

// Assembly:
cmpq $0x100, %rsi            # imm = 0x100
ja 0x32195
cmpb $0x0, 0x100(%rdi)
jne 0x32195
movb $0x1, 0x100(%rdi)
movq %rdi, %rax
retq
addq $0x101, %rdi            # imm = 0x101
jmp 0x3176e
nop
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/include/array/array.h
// Function: nda::auto_allocator<int, 32ul, 4ul, std::allocator<int>>::deallocate(int*, unsigned long)
void deallocate(value_type* ptr, size_t n) noexcept {
    if (ptr == reinterpret_cast<value_type*>(&buffer[0])) {
      assert(allocated);
      allocated = false;
    } else {
      std::allocator_traits<BaseAlloc>::deallocate(alloc, ptr, n);
    }
  }

// Assembly:
cmpq %rdi, %rsi
je 0x4042c
shlq $0x2, %rdx
movq %rsi, %rdi
movq %rdx, %rsi
jmp 0x21e0
cmpb $0x0, 0x80(%rdi)
je 0x4043d
movb $0x0, 0x80(%rdi)
retq
pushq %rax
leaq 0x52ec3(%rip), %rdi     # 0x93308
leaq 0x4cc85(%rip), %rsi     # 0x8d0d1
leaq 0x595e6(%rip), %rcx     # 0x99a39
movl $0xc57, %edx            # imm = 0xC57
callq 0x20e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/include/array/array.h
// Function: nda::array<int, nda::shape<nda::dim<-9l, 4l, -9l>, nda::dim<-9l, 3l, 1l>>, nda::auto_allocator<int, 12ul, 4ul, std::allocator<int>>>::array(nda::array<int, nda::shape<nda::dim<-9l, 4l, -9l>, nda::dim<-9l, 3l, 1l>>, nda::auto_allocator<int, 12ul, 4ul, std::allocator<int>>>&&)
array(array&& other)
      : alloc_(get_allocator_for_move(other)), buffer_(nullptr), buffer_size_(0), base_(nullptr) {
    using std::swap;
    // If we already took other's allocator, it might be in an undefined state.
    // Just assume we can swap in that case.
    if (typename alloc_traits::propagate_on_container_move_assignment() ||
        alloc_ == other.get_allocator()) {
      swap_except_allocator(other);
    } else {
      shape_ = other.shape_;
      allocate();
      move_construct(other);
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movb $0x0, 0x30(%rdi)
leaq 0x50(%rdi), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rdi)
andq $0x0, 0x48(%rdi)
movq %r15, %rdi
callq 0x67996
cmpb $0x0, 0x30(%r14)
je 0x66f17
cmpq %rbx, %r14
jne 0x66f22
jmp 0x66f5b
cmpq %rbx, %r14
je 0x66f5b
cmpb $0x0, 0x30(%rbx)
je 0x66f5b
movq 0x70(%rbx), %rax
movq %rax, 0x70(%r14)
movups 0x60(%rbx), %xmm0
movups %xmm0, 0x60(%r14)
movzwl 0x58(%rbx), %eax
movw %ax, 0x8(%r15)
movq 0x50(%rbx), %rax
movq %rax, (%r15)
movq %r14, %rdi
callq 0x67a1c
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x683fc
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x6836c
nop
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/include/array/array.h
// Function: nda::array<nda::lifetime_counter, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, nda::custom_alloc<std::integral_constant<bool, false>>>::move_construct(nda::array<nda::lifetime_counter, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, nda::custom_alloc<std::integral_constant<bool, false>>>&)
void move_construct(array& other) {
    assert(base_ || shape_.empty());
    assert(shape_ == other.shape_);
    copy_shape_traits_type::for_each_value(
        other.shape_, other.base_, shape_, base_, [&](reference src, reference dst) {
          alloc_traits::construct(alloc_, &dst, std::move(src));
        });
  }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, 0x18(%rdi)
jne 0x366d5
movq 0x28(%rbx), %rax
imulq 0x40(%rbx), %rax
testq %rax, %rax
jg 0x36730
leaq 0x20(%rbx), %r15
leaq 0x20(%r14), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x15a78
testb %al, %al
je 0x36711
movq 0x18(%r14), %rsi
movq 0x18(%rbx), %rcx
movq %rsp, %r8
movq %rbx, (%r8)
movq %r12, %rdi
movq %r15, %rdx
callq 0x36750
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x5728e(%rip), %rdi     # 0x8d9a6
leaq 0x569b2(%rip), %rsi     # 0x8d0d1
leaq 0x5ff9d(%rip), %rcx     # 0x966c3
movl $0x906, %edx            # imm = 0x906
callq 0x20e0
leaq 0x56a72(%rip), %rdi     # 0x8d1a9
leaq 0x56993(%rip), %rsi     # 0x8d0d1
leaq 0x5ff7e(%rip), %rcx     # 0x966c3
movl $0x905, %edx            # imm = 0x905
callq 0x20e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/include/array/array.h
// Function: nda::array<nda::lifetime_counter, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, nda::auto_allocator<nda::lifetime_counter, 256ul, 1ul, std::allocator<nda::lifetime_counter>>>::assign(nda::array<nda::lifetime_counter, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, nda::auto_allocator<nda::lifetime_counter, 256ul, 1ul, std::allocator<nda::lifetime_counter>>>&&)
void assign(array&& other) {
    if (base_ == other.base_) {
      if (base_) {
        assert(shape_ == other.shape_);
      } else {
        shape_ = other.shape_;
        assert(shape_.empty());
      }
      return;
    }
    if (base_ && shape_ == other.shape_) {
      destroy();
    } else {
      deallocate();
      shape_ = other.shape_;
      allocate();
    }
    move_construct(other);
  }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x118(%rdi), %rax
cmpq 0x118(%rsi), %rax
je 0x38026
testq %rax, %rax
je 0x37fca
movl $0x120, %esi            # imm = 0x120
leaq (%rbx,%rsi), %rdi
addq %r14, %rsi
callq 0x15a78
testb %al, %al
je 0x37fca
movq %rbx, %rdi
callq 0x322de
jmp 0x38014
movq %rbx, %rdi
callq 0x3227a
movq 0x148(%r14), %rax
movq %rax, 0x148(%rbx)
movups 0x138(%r14), %xmm0
movups %xmm0, 0x138(%rbx)
movups 0x120(%r14), %xmm0
movups %xmm0, 0x120(%rbx)
movq 0x130(%r14), %rax
movq %rax, 0x130(%rbx)
movq %rbx, %rdi
callq 0x320a2
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x36ac2
testq %rax, %rax
je 0x38064
movl $0x120, %eax            # imm = 0x120
addq %rax, %rbx
addq %rax, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x15a78
testb %al, %al
jne 0x380b2
leaq 0x5595a(%rip), %rdi     # 0x8d9a6
leaq 0x5507e(%rip), %rsi     # 0x8d0d1
leaq 0x5f94f(%rip), %rcx     # 0x979a9
movl $0x9cc, %edx            # imm = 0x9CC
callq 0x20e0
movq 0x148(%r14), %rax
movq %rax, 0x148(%rbx)
movups 0x138(%r14), %xmm0
movups %xmm0, 0x138(%rbx)
movups 0x120(%r14), %xmm0
movups %xmm0, 0x120(%rbx)
movq 0x130(%r14), %rax
movq %rax, 0x130(%rbx)
movq 0x128(%rbx), %rax
imulq 0x140(%rbx), %rax
testq %rax, %rax
jg 0x380ba
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x550f1(%rip), %rdi     # 0x8d1b2
leaq 0x55009(%rip), %rsi     # 0x8d0d1
leaq 0x5f8da(%rip), %rcx     # 0x979a9
movl $0x9cf, %edx            # imm = 0x9CF
callq 0x20e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/include/array/array.h
// Function: nda::array<nda::lifetime_counter, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, std::allocator<nda::lifetime_counter>>::swap(nda::array<nda::lifetime_counter, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, std::allocator<nda::lifetime_counter>>&)
void swap(array& other) {
    using std::swap;

    if (alloc_traits::propagate_on_container_swap::value) {
      swap(alloc_, other.alloc_);
      swap_except_allocator(other);
    } else {
      // TODO: If the shapes are equal, we could swap each element without the
      // temporary allocation.
      array temp(std::move(other));
      other = std::move(*this);
      *this = std::move(temp);
    }
  }

// Assembly:
pushq %r14
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
callq 0x35fba
movq %r14, %rdi
movq %rbx, %rsi
callq 0x37a3e
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x37a3e
leaq 0x8(%rsp), %rdi
callq 0x3166c
addq $0x58, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3166c
movq %rbx, %rdi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/test.h
// Function: bool nda::assert_dim_eq<0l, -9l, 1l, 0l, -9l, 1l>(nda::dim<0l, -9l, 1l> const&, nda::dim<0l, -9l, 1l> const&)
bool assert_dim_eq(const dim<MinA, ExtentA, StrideA>& a, const dim<MinB, ExtentB, StrideB>& b) {
  static_assert(MinA == MinB, "");
  static_assert(ExtentA == ExtentB, "");
  static_assert(StrideA == StrideB, "");
  ASSERT_EQ(a, b);
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rax
xorl %ebp, %ebp
cmpq 0x8(%rsi), %rax
sete %bpl
leaq 0x50c6a(%rip), %rsi     # 0x8d087
leaq 0x8(%rsp), %r15
leaq 0x7(%rsp), %rdx
movq %r15, %rdi
callq 0x66a0
leaq 0x28(%rsp), %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x6894
leaq 0x51202(%rip), %rsi     # 0x8d647
leaq 0x28(%rsp), %rdi
callq 0x106fe
leaq 0x5d244(%rip), %rsi     # 0x9969a
movq %rax, %rdi
callq 0x106fe
leaq 0x5518d(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq %rax, %rdi
movq %r14, %rsi
callq 0x3e82a
leaq 0x511c8(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x52e3b(%rip), %rsi     # 0x8f2c9
movq %rax, %rdi
callq 0x106fe
leaq 0x55155(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3e82a
leaq 0x68deb(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x28(%rsp), %rdi
callq 0x68d4
leaq 0x8(%rsp), %rdi
callq 0x2090
movb $0x1, %al
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3c4f5
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x68d4
leaq 0x8(%rsp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba
nop
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/include/array/array.h
// Function: void nda::internal::assert_dim_compatible<nda::dim<0l, 1l, 0l>, nda::dim<-9l, -9l, -9l>>(unsigned long, nda::dim<-9l, -9l, -9l> const&)
NDARRAY_HOST_DEVICE void assert_dim_compatible(size_t dim_index, const DimSrc& src) {
  bool compatible = true;
  if (is_static(DimDst::Min) && src.min() != DimDst::Min) {
    NDARRAY_PRINT_ERR("Error converting dim %zu: expected static min " NDARRAY_INDEX_T_FMT
                      ", got " NDARRAY_INDEX_T_FMT "\n",
        dim_index, DimDst::Min, src.min());
    compatible = false;
  }
  if (is_static(DimDst::Extent) && src.extent() != DimDst::Extent) {
    NDARRAY_PRINT_ERR("Error converting dim %zu: expected static extent " NDARRAY_INDEX_T_FMT
                      ", got " NDARRAY_INDEX_T_FMT "\n",
        dim_index, DimDst::Extent, src.extent());
    compatible = false;
  }
  if (is_static(DimDst::Stride) && is_resolved(src.stride()) && src.stride() != DimDst::Stride) {
    NDARRAY_PRINT_ERR("Error converting dim %zu: expected static stride " NDARRAY_INDEX_T_FMT
                      ", got " NDARRAY_INDEX_T_FMT "\n",
        dim_index, DimDst::Stride, src.stride());
    compatible = false;
  }
  assert(compatible);
  (void)compatible;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %r15
testq %r15, %r15
jne 0x4a1a0
movabsq $0x7fffffffffffffff, %r12 # imm = 0x7FFFFFFFFFFFFFFF
movq 0x8(%r14), %r8
cmpq $0x1, %r8
jne 0x4a1c2
movq 0x10(%r14), %r8
testq %r12, %r8
jne 0x4a1e9
testq %r15, %r15
jne 0x4a206
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x97e29(%rip), %rax     # 0xe1fd0
movq (%rax), %rdi
leaq 0x4ecd9(%rip), %rsi     # 0x98e8a
movq %rbx, %rdx
xorl %ecx, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x2250
jmp 0x4a172
movq 0x97e07(%rip), %rax     # 0xe1fd0
movq (%rax), %rdi
leaq 0x4edb0(%rip), %rsi     # 0x98f83
pushq $0x1
popq %rcx
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2250
movq 0x10(%r14), %r8
testq %r12, %r8
je 0x4a206
movq 0x97de0(%rip), %rax     # 0xe1fd0
movq (%rax), %rdi
leaq 0x43410(%rip), %rsi     # 0x8d60a
movq %rbx, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x2250
leaq 0x43077(%rip), %rdi     # 0x8d284
leaq 0x42ebd(%rip), %rsi     # 0x8d0d1
leaq 0x52700(%rip), %rcx     # 0x9c91b
movl $0x3f5, %edx            # imm = 0x3F5
callq 0x20e0
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/auto_allocator.cpp
// Function: bool nda::is_auto_allocation<nda::array<int, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, nda::auto_allocator<int, 32ul, 4ul, std::allocator<int>>>>(nda::array<int, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, nda::auto_allocator<int, 32ul, 4ul, std::allocator<int>>> const&)
bool is_auto_allocation(const T& a) {
  const uint8_t* a_begin = reinterpret_cast<const uint8_t*>(&a);
  const uint8_t* a_end = a_begin + sizeof(T);
  const uint8_t* a_data_begin = reinterpret_cast<const uint8_t*>(a.data());
  const uint8_t* a_data_end = reinterpret_cast<const uint8_t*>(a.data() + a.shape().flat_extent());
  return a_begin <= a_data_begin && a_data_end <= a_end;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xe8(%rdi), %r12
callq 0x4045e
movq %rax, %r14
movq %rbx, %rdi
callq 0x4045e
movq %rax, %r15
leaq 0xa0(%rbx), %rdi
callq 0x6e3a
leaq (%r15,%rax,4), %rax
cmpq %rbx, %r14
setae %cl
cmpq %r12, %rax
setbe %al
andb %cl, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/ein_reduce.cpp
// Function: nda::test_make_ein_sum_trace_body()
TEST(make_ein_sum_trace) {
  constexpr index_t N = 64;
  matrix<int, N, N> A;
  fill_pattern(A);

  // Compute trace(A) = sum(diag(A))
  int tr = make_ein_sum<int>(ein<i, i>(A));

  int tr_ref = 0;
  for (index_t i : A.i()) {
    tr_ref += A(i, i);
  }
  ASSERT_EQ(tr, tr_ref);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0x46ac0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x46ae8
movq 0x40(%rsp), %r15
movq 0x48(%rsp), %rbp
movq 0x58(%rsp), %r14
movq 0x68(%rsp), %r13
leaq 0x10(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x98(%rsp), %rdi
leaq 0xf(%rsp), %rsi
leaq 0xe(%rsp), %rcx
callq 0x4776a
movq 0xb0(%rsp), %r12
leaq 0x18(%rsp), %rdi
pushq $0x40
popq %rbx
movq %r14, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x476ca
leaq 0x18(%rsp), %rdi
movq (%rdi), %rsi
callq 0x477b2
movq 0x18(%rsp), %rcx
movl (%r12), %eax
movq %rcx, %rdx
subq %r14, %rdx
imulq %r13, %rdx
shlq $0x2, %rcx
leaq (%rcx,%rdx,4), %rcx
shlq $0x2, %rbp
subq %rbp, %rcx
addq %rcx, %r15
leaq 0x4(,%r13,4), %rcx
subq $0x1, %rbx
jb 0x416e4
addl (%r15), %eax
movl %eax, (%r12)
addq %rcx, %r15
jmp 0x416d2
leaq 0x70(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x3cf8a
leaq 0x98(%rsp), %rdi
callq 0x6baa
leaq 0x70(%rsp), %rdi
movq 0x18(%rdi), %rax
movl (%rax), %ebx
callq 0x6baa
andl $0x0, 0x18(%rsp)
movl %ebx, 0x14(%rsp)
movq 0x48(%rsp), %rcx
movq 0x58(%rsp), %rax
shlq $0x2, %rax
shlq $0x2, %rcx
subq %rcx, %rax
addq 0x40(%rsp), %rax
movq 0x68(%rsp), %rcx
leaq 0x4(,%rcx,4), %rcx
xorl %ebp, %ebp
pushq $0x40
popq %rdx
subq $0x1, %rdx
jb 0x41759
addl (%rax), %ebp
movl %ebp, 0x18(%rsp)
addq %rcx, %rax
jmp 0x41748
leaq 0x58c82(%rip), %rsi     # 0x9a3e2
leaq 0x70(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x66a0
xorl %esi, %esi
cmpl %ebp, %ebx
sete %sil
leaq 0x98(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x6894
leaq 0x4beb7(%rip), %rsi     # 0x8d647
leaq 0x98(%rsp), %rdi
callq 0x106fe
leaq 0x58c4b(%rip), %rsi     # 0x9a3ef
movq %rax, %rdi
callq 0x10896
leaq 0x4fe3f(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x14(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
leaq 0x4be78(%rip), %rsi     # 0x8d647
movq %rax, %rdi
callq 0x106fe
leaq 0x58c0a(%rip), %rsi     # 0x9a3e8
movq %rax, %rdi
callq 0x46b68
leaq 0x4fe05(%rip), %rsi     # 0x915f2
movq %rax, %rdi
callq 0x106fe
leaq 0x18(%rsp), %rsi
movq %rax, %rdi
callq 0x10736
leaq 0x63a99(%rip), %rsi     # 0xa52a2
movq %rax, %rdi
callq 0x106fe
leaq 0x98(%rsp), %rdi
callq 0x68d4
leaq 0x70(%rsp), %rdi
callq 0x2090
leaq 0x28(%rsp), %rdi
callq 0x46b2e
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4184a
jmp 0x41854
jmp 0x4184a
movq %rax, %rbx
jmp 0x41880
movq %rax, %rbx
jmp 0x41876
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x6baa
jmp 0x41880
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x68d4
leaq 0x70(%rsp), %rdi
callq 0x2090
leaq 0x28(%rsp), %rdi
callq 0x46b2e
movq %rbx, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x6bba
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/include/array/array.h
// Function: void nda::shape_traits<nda::shape<nda::dim<-9l, 64l, 1l>>>::for_each_value<int*, nda::array<int, nda::shape<nda::dim<-9l, 64l, 1l>>, std::allocator<int>>::construct()::'lambda'(int&)&>(nda::shape<nda::dim<-9l, 64l, 1l>> const&, int*, nda::array<int, nda::shape<nda::dim<-9l, 64l, 1l>>, std::allocator<int>>::construct()::'lambda'(int&)&)
NDARRAY_UNIQUE NDARRAY_HOST_DEVICE void for_each_value_in_order(
    const Shape& shape, Ptr base, Fn&& fn) {
  if (!base) {
    assert(shape.empty());
    return;
  }
  // TODO: This is losing compile-time constant extents and strides info
  // (https://github.com/dsharlet/array/issues/1).
  auto base_and_stride = std::make_pair(base, shape.stride());
  internal::for_each_value_in_order<Shape::rank() - 1>(shape.extent(), fn, base_and_stride);
}

// Assembly:
testq %rsi, %rsi
je 0x4750a
xorl %eax, %eax
cmpq $0xff, %rax
ja 0x47509
andl $0x0, (%rsi,%rax)
addq $0x4, %rax
jmp 0x474f7
retq
pushq %rax
leaq 0x45d7d(%rip), %rdi     # 0x8d28f
leaq 0x45bb8(%rip), %rsi     # 0x8d0d1
leaq 0x53661(%rip), %rcx     # 0x9ab81
movl $0x6a1, %edx            # imm = 0x6A1
callq 0x20e0
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/include/array/array.h
// Function: auto nda::internal::make_compact_dims<1l, -9l, 20l, -9l, nda::dim<-9l, 12l, -9l>>(nda::dim<-9l, 20l, -9l> const&, nda::dim<-9l, 12l, -9l> const&)
NDARRAY_HOST_DEVICE auto make_compact_dims(
    const dim<Min, Extent, Stride>& dim0, const Dims&... dims) {

  // If we know the extent of this dimension, we can also provide
  // a constant stride for the next dimension.
  constexpr index_t NextStride = static_mul(CurrentStride, Extent);
  // Give this dimension the current stride if we don't have one already,
  // and don't give it a runtime stride. If CurrentStride is static, that
  // will be the stride. If not, it will be dynamic, and resolved later.
  constexpr index_t NewStride = is_static(Stride) ? Stride : CurrentStride;
  return std::tuple_cat(std::make_tuple(dim<Min, Extent, NewStride>(dim0.min(), dim0.extent())),
      make_compact_dims<NextStride>(dims...));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdx, %rbx
movq %rdi, %r14
movq (%rsi), %rsi
leaq 0x10(%rsp), %r15
pushq $0x14
popq %rdx
pushq $0x1
popq %rcx
movq %r15, %rdi
callq 0x47e4e
movups (%r15), %xmm0
movaps %xmm0, (%rsp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x47e7d
movaps (%rsp), %xmm0
movups %xmm0, 0x10(%r14)
movq %r14, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/image.cpp
// Function: nda::test_image_chunky_copy_body()
TEST(image_chunky_copy) {
  test_copy_all_types<chunky_image_shape<1>, chunky_image_shape<1>>(1);
  test_copy_all_types<chunky_image_shape<2>, chunky_image_shape<2>>(2);
  test_copy_all_types<chunky_image_shape<3>, chunky_image_shape<3>>(3);
  test_copy_all_types<chunky_image_shape<4>, chunky_image_shape<4>>(4);
}

// Assembly:
pushq %rax
pushq $0x1
popq %rdi
callq 0x50f52
pushq $0x2
popq %rdi
callq 0x50f6c
pushq $0x3
popq %rdi
callq 0x50f86
pushq $0x4
popq %rdi
popq %rax
jmp 0x50fa0
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/image.cpp
// Function: nda::test_image_interleave_body()
TEST(image_interleave) {
  test_copy_all_types<planar_image_shape, chunky_image_shape<1>>(1);
  test_copy_all_types<planar_image_shape, chunky_image_shape<2>>(2);
  test_copy_all_types<planar_image_shape, chunky_image_shape<3>>(3);
  test_copy_all_types<planar_image_shape, chunky_image_shape<4>>(4);
}

// Assembly:
pushq %rax
pushq $0x1
popq %rdi
callq 0x50fd4
pushq $0x2
popq %rdi
callq 0x50fee
pushq $0x3
popq %rdi
callq 0x51008
pushq $0x4
popq %rdi
popq %rax
jmp 0x51022
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/image.cpp
// Function: nda::test_image_deinterleave_body()
TEST(image_deinterleave) {
  test_copy_all_types<chunky_image_shape<1>, planar_image_shape>(1);
  test_copy_all_types<chunky_image_shape<2>, planar_image_shape>(2);
  test_copy_all_types<chunky_image_shape<3>, planar_image_shape>(3);
  test_copy_all_types<chunky_image_shape<4>, planar_image_shape>(4);
}

// Assembly:
pushq %rax
pushq $0x1
popq %rdi
callq 0x5103c
pushq $0x2
popq %rdi
callq 0x51056
pushq $0x3
popq %rdi
callq 0x51070
pushq $0x4
popq %rdi
popq %rax
jmp 0x5108a
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/image.cpp
// Function: nda::test_image_overload_shape_body()
TEST(image_overload_shape) {
  planar_image<int> planar({10, 20, 3});
  chunky_image<int> chunky({10, 20, 3});

  overload_shape(planar);
  overload_shape(chunky);

  chunky_image<int, 3> chunky3({10, 20, {}});
  general_chunky(chunky3.cref());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
leaq 0xb8(%rsp), %rbx
pushq $0xa
popq %rbp
pushq $0x14
popq %r14
pushq $0x3
popq %r15
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
movl %r15d, %ecx
callq 0x10810
leaq 0x170(%rsp), %rdi
movq %rbx, %rsi
callq 0x6750
leaq 0x20(%rsp), %rdi
movl %ebp, %esi
movl %r14d, %edx
movl %r15d, %ecx
callq 0x51304
leaq 0xb8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x51322
andq $0x0, 0x78(%rsp)
andq $0x0, 0x8(%rsp)
movq $0xa, 0x80(%rsp)
movq $0x14, 0x10(%rsp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x18(%rsp)
leaq 0x5(%rsp), %rdi
callq 0x5134e
leaq 0x120(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x5(%rsp), %rcx
callq 0x51356
leaq 0x20(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x513c2
movq 0x38(%rsp), %rax
leaq 0x78(%rsp), %rsi
movq %rax, (%rsi)
movups 0x40(%rsp), %xmm0
movups %xmm0, 0x8(%rsi)
movups 0x50(%rsp), %xmm0
movups %xmm0, 0x18(%rsi)
movups 0x60(%rsp), %xmm0
movups %xmm0, 0x28(%rsi)
movq 0x70(%rsp), %rax
movq %rax, 0x38(%rsi)
leaq 0x120(%rsp), %rdi
callq 0x51400
leaq 0x20(%rsp), %rdi
callq 0x5143e
leaq 0xb8(%rsp), %rdi
callq 0x5144e
leaq 0x170(%rsp), %rdi
callq 0x69c2
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x5143e
jmp 0x4d836
movq %rax, %rbx
jmp 0x4d843
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x5144e
leaq 0x170(%rsp), %rdi
callq 0x69c2
movq %rbx, %rdi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O2/dsharlet[P]array/test/image.cpp
// Function: nda::test_image_overload_chunky_body()
TEST(image_overload_chunky) {
  chunky_image<int, 1> chunky1({10, 20, {}});
  chunky_image<int, 3> chunky3({10, 20, {}});

  overload_chunky(chunky1);
  overload_chunky(chunky3);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
leaq 0x40(%rsp), %rbx
andq $0x0, (%rbx)
pushq $0xa
popq %rax
movq %rax, 0x8(%rbx)
leaq 0x28(%rsp), %r14
andq $0x0, (%r14)
pushq $0x14
popq %rbp
movq %rbp, 0x8(%r14)
movabsq $-0x8000000000000000, %r13 # imm = 0x8000000000000000
movq %r13, 0x10(%r14)
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x5145e
leaq 0x78(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x51466
leaq 0xd0(%rsp), %rdi
movq %r12, %rsi
callq 0x514d2
andq $0x0, (%r14)
andq $0x0, (%r15)
pushq $0xa
popq %rax
movq %rax, 0x8(%r14)
movq %rbp, 0x8(%r15)
movq %r13, 0x10(%r15)
leaq 0xd(%rsp), %rdi
callq 0x5134e
leaq 0x40(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0xd(%rsp), %rcx
callq 0x51356
leaq 0x78(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x513c2
leaq 0x78(%rsp), %rdi
callq 0x5143e
leaq 0xd0(%rsp), %rdi
callq 0x51510
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x51510
movq %rbx, %rdi
callq 0x22f0