LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: iZhangHui[P]CppPrimer/CH12_DynamicMemory/examples/weak.cc
// Function: main
int main()
{
	auto p = make_shared<int>(42);

	weak_ptr<int> wp(p);  // wp weakly shares with p; use count in p is unchanged

	p.reset(); // assuming p.unique() was true, the int is deleted

	if (shared_ptr<int> np = wp.lock()) { // true if np is not null
		// inside the if, np shares its object with p
		cout << "np is not null." << endl;
	}

	cout << "np is null." << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl $0x0, -0x4(%rbp)
movl $0x2a, -0x1c(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x1340
leaq -0x30(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x13b0
leaq -0x18(%rbp), %rdi
callq 0x13e0
leaq -0x40(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1420
leaq -0x40(%rbp), %rdi
callq 0x1450
testb $0x1, %al
jne 0x1285
jmp 0x12c9
movq 0x4d4c(%rip), %rdi      # 0x5fd8
leaq 0x1d71(%rip), %rsi      # 0x3004
callq 0x1080
movq %rax, -0x58(%rbp)
jmp 0x129e
movq -0x58(%rbp), %rdi
movq 0x4d17(%rip), %rsi      # 0x5fc0
callq 0x10b0
jmp 0x12b0
jmp 0x12c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x1470
jmp 0x1324
leaq -0x40(%rbp), %rdi
callq 0x1470
movq 0x4cff(%rip), %rdi      # 0x5fd8
leaq 0x1d34(%rip), %rsi      # 0x3014
callq 0x1080
movq %rax, -0x60(%rbp)
jmp 0x12eb
movq -0x60(%rbp), %rdi
movq 0x4cca(%rip), %rsi      # 0x5fc0
callq 0x10b0
jmp 0x12fd
leaq -0x30(%rbp), %rdi
callq 0x1490
leaq -0x18(%rbp), %rdi
callq 0x1470
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x1490
leaq -0x18(%rbp), %rdi
callq 0x1470
movq -0x48(%rbp), %rdi
callq 0x10e0
nop
// File: dsharlet[P]array/test/algorithm.cpp
// Function: nda::test_algorithm_copy_scalar_body()
TEST(algorithm_copy_scalar) {
  array_of_rank<int, 0> a;
  generate(a, rand);

  array_of_rank<int, 0> b;
  copy(a, b);
  ASSERT(a == b);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
leaq -0x28(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x11530
movq -0x220(%rbp), %rdi
movq 0x2868d7(%rip), %rsi    # 0x291fa0
callq 0x11560
jmp 0xb6d0
leaq -0x60(%rbp), %rdi
callq 0x11530
jmp 0xb6db
leaq -0x28(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x11590
jmp 0xb6ea
leaq -0x28(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x115d0
movb %al, -0x221(%rbp)
jmp 0xb6ff
leaq -0x211(%rbp), %rdi
movq %rdi, -0x230(%rbp)
callq 0x33b0
movq -0x230(%rbp), %rdx
leaq 0x1d0977(%rip), %rsi    # 0x1dc097
leaq -0x210(%rbp), %rdi
callq 0x10a90
jmp 0xb72e
movb -0x221(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x1f0(%rbp), %rdi
leaq -0x210(%rbp), %rdx
callq 0x10f80
jmp 0xb74f
leaq -0x1f0(%rbp), %rdi
callq 0x10ff0
jmp 0xb75d
leaq -0x210(%rbp), %rdi
callq 0x3100
leaq -0x211(%rbp), %rdi
callq 0x3290
leaq -0x60(%rbp), %rdi
callq 0x11610
leaq -0x28(%rbp), %rdi
callq 0x11610
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0xb7e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0xb7de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0xb7d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x3100
leaq -0x211(%rbp), %rdi
callq 0x3290
leaq -0x60(%rbp), %rdi
callq 0x11610
leaq -0x28(%rbp), %rdi
callq 0x11610
movq -0x30(%rbp), %rdi
callq 0x33a0
nopl (%rax)
// File: dsharlet[P]array/test/algorithm.cpp
// Function: nda::test_algorithm_move_scalar_body()
TEST(algorithm_move_scalar) {
  array_of_rank<int, 0> a;
  move_only token;
  generate(a, [token = std::move(token)]() {
    unused(token);
    return rand();
  });

  array_of_rank<int, 0> b;
  copy(a, b);
  ASSERT(a == b);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
leaq -0x28(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x11530
movq -0x228(%rbp), %rdi
leaq -0x2a(%rbp), %rsi
callq 0xb960
jmp 0xb82d
leaq -0x68(%rbp), %rdi
callq 0x11530
jmp 0xb838
leaq -0x28(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x11590
jmp 0xb847
leaq -0x28(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x115d0
movb %al, -0x229(%rbp)
jmp 0xb85c
leaq -0x219(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0x33b0
movq -0x238(%rbp), %rdx
leaq 0x1d081a(%rip), %rsi    # 0x1dc097
leaq -0x218(%rbp), %rdi
callq 0x10a90
jmp 0xb88b
movb -0x229(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x1f8(%rbp), %rdi
leaq -0x218(%rbp), %rdx
callq 0x10f80
jmp 0xb8ac
leaq -0x1f8(%rbp), %rdi
callq 0x10ff0
jmp 0xb8ba
leaq -0x218(%rbp), %rdi
callq 0x3100
leaq -0x219(%rbp), %rdi
callq 0x3290
leaq -0x68(%rbp), %rdi
callq 0x11610
leaq -0x28(%rbp), %rdi
callq 0x11610
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb944
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb93b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb92f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x3100
leaq -0x219(%rbp), %rdi
callq 0x3290
leaq -0x68(%rbp), %rdi
callq 0x11610
leaq -0x28(%rbp), %rdi
callq 0x11610
movq -0x38(%rbp), %rdi
callq 0x33a0
nopw %cs:(%rax,%rax)
// File: dsharlet[P]array/include/array/array.h
// Function: void nda::for_each_value_in_order<nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, int*, nda::array<int, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, std::allocator<int>>::construct()::'lambda'(int&)&, void>(nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>> const&, int*, nda::array<int, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, 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:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x40(%rbp)
movq %rsi, -0x48(%rbp)
movq %rdx, -0x50(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0xbb43
movq -0x40(%rbp), %rdi
callq 0x14440
testb $0x1, %al
jne 0xbb1d
jmp 0xbb1f
jmp 0xbb3e
leaq 0x1d08bf(%rip), %rdi    # 0x1dc3e5
leaq 0x1d05b4(%rip), %rsi    # 0x1dc0e1
movl $0x6a1, %edx            # imm = 0x6A1
leaq 0x1d08ba(%rip), %rcx    # 0x1dc3f3
callq 0x3130
jmp 0xbbfe
movq -0x40(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x144b0
leaq -0x70(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x14470
movq -0x40(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x144e0
movq -0x50(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rcx, -0xc0(%rbp)
movq -0x68(%rbp), %rcx
movq %rcx, -0xb8(%rbp)
movq -0x60(%rbp), %rcx
movq %rcx, -0xb0(%rbp)
movq -0x58(%rbp), %rcx
movq %rcx, -0xa8(%rbp)
leaq -0xa0(%rbp), %rcx
movq %rcx, -0x8(%rbp)
movq %rax, -0x10(%rbp)
leaq -0xc0(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0xc0(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq -0x38(%rbp), %rdx
callq 0xbc10
addq $0xc0, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: dsharlet[P]array/include/array/array.h
// Function: void nda::internal::for_each_value_in_order_impl<2ul, std::tuple<long, long, long>, void (&)(int const&, int&), std::pair<int const*, std::tuple<long, long, long>>, std::pair<int*, std::tuple<long, long, long>>>(std::integral_constant<bool, false>, std::tuple<long, long, long> const&, void (&)(int const&, int&), std::pair<int const*, std::tuple<long, long, long>>, std::pair<int*, std::tuple<long, long, long>>)
NDARRAY_UNIQUE NDARRAY_HOST_DEVICE void for_each_value_in_order_impl(
    std::false_type, const ExtentType& extent, Fn&& fn, Ptrs... ptrs) {
  index_t extent_d = std::get<D>(extent);
  for (index_t i = 0; i < extent_d; i++) {
    using is_inner_loop = std::conditional_t<D == 1, std::true_type, std::false_type>;
    for_each_value_in_order_impl<D - 1>(is_inner_loop(), extent, fn, ptrs...);
    advance<D>(ptrs...);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdx, -0xa0(%rbp)
movq %rcx, -0x98(%rbp)
movq %rdi, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
movq %rdx, -0x30(%rbp)
movq %rcx, -0x38(%rbp)
movq -0x20(%rbp), %rdi
callq 0x13320
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x40(%rbp), %rax
jge 0xc29a
movq -0x98(%rbp), %rax
movq -0xa0(%rbp), %rcx
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq (%rcx), %rdx
movq %rdx, -0x70(%rbp)
movq 0x8(%rcx), %rdx
movq %rdx, -0x68(%rbp)
movq 0x10(%rcx), %rdx
movq %rdx, -0x60(%rbp)
movq 0x18(%rcx), %rcx
movq %rcx, -0x58(%rbp)
movq (%rax), %rcx
movq %rcx, -0x90(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x88(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x80(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x78(%rbp)
leaq -0x70(%rbp), %rdx
leaq -0x90(%rbp), %rcx
callq 0xc2b0
movq -0xa0(%rbp), %rcx
movq -0x98(%rbp), %rax
movq %rcx, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x16360
movq %rax, %rdi
callq 0x14920
movq (%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x8(%rbp), %rdi
callq 0x16380
movq -0xb0(%rbp), %rcx
shlq $0x2, %rcx
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
callq 0x14770
movq %rax, %rdi
callq 0x14920
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x14790
movq -0xa8(%rbp), %rcx
shlq $0x2, %rcx
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0xc191
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: dsharlet[P]array/include/array/array.h
// Function: void nda::internal::for_each_value_in_order_impl<0ul, std::tuple<long, long, long>, void (&)(int const&, int&), std::pair<int const*, std::tuple<long, long, long>>, std::pair<int*, std::tuple<long, long, long>>>(std::integral_constant<bool, true>, std::tuple<long, long, long> const&, void (&)(int const&, int&), std::pair<int const*, std::tuple<long, long, long>>, std::pair<int*, std::tuple<long, long, long>>)
NDARRAY_UNIQUE NDARRAY_HOST_DEVICE void for_each_value_in_order_impl(
    std::true_type, const ExtentType& extent, Fn&& fn, Ptrs... ptrs) {
  index_t extent_d = std::get<0>(extent);
  if (all(std::get<0>(std::get<1>(ptrs)) == 1 ...)) {
    for_each_value_in_order_inner_dense(extent_d, fn, std::get<0>(ptrs)...);
  } else {
    for (index_t i = 0; i < extent_d; i++) {
      fn(*std::get<0>(ptrs)...);
      advance<0>(ptrs...);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdx, -0x60(%rbp)
movq %rcx, -0x58(%rbp)
movq %rdi, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
movq %rdx, -0x30(%rbp)
movq %rcx, -0x38(%rbp)
movq -0x20(%rbp), %rdi
callq 0x132e0
movq -0x60(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x40(%rbp)
callq 0x16360
movq %rax, %rdi
callq 0x14750
movq -0x58(%rbp), %rdi
cmpq $0x1, (%rax)
sete %al
movb %al, -0x49(%rbp)
callq 0x14770
movq %rax, %rdi
callq 0x14750
movb -0x49(%rbp), %cl
cmpq $0x1, (%rax)
sete %al
movzbl %cl, %edi
andl $0x1, %edi
movzbl %al, %esi
andl $0x1, %esi
callq 0x16300
testb $0x1, %al
jne 0xc490
jmp 0xc4d2
movq -0x60(%rbp), %rdi
movq -0x40(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x70(%rbp)
callq 0x16380
movq -0x58(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x68(%rbp)
callq 0x14790
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq (%rax), %rcx
callq 0xc5c0
jmp 0xc5ac
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x40(%rbp), %rax
jge 0xc5aa
movq -0x60(%rbp), %rdi
movq -0x28(%rbp), %rax
movq %rax, -0x90(%rbp)
callq 0x16380
movq -0x58(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x98(%rbp)
callq 0x14790
movq -0x98(%rbp), %rdi
movq %rax, %rcx
movq -0x90(%rbp), %rax
movq (%rcx), %rsi
callq *%rax
movq -0x60(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x16360
movq %rax, %rdi
callq 0x14750
movq (%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
callq 0x16380
movq -0x88(%rbp), %rcx
shlq $0x2, %rcx
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
callq 0x14770
movq %rax, %rdi
callq 0x14750
movq (%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rdi
callq 0x14790
movq -0x80(%rbp), %rcx
shlq $0x2, %rcx
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0xc4da
jmp 0xc5ac
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: dsharlet[P]array/include/array/array.h
// Function: auto nda::make_compact<nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>>(nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>> const&)
NDARRAY_HOST_DEVICE auto make_compact(const Shape& s) {
  auto static_compact =
      make_shape_from_tuple(internal::make_compact_dims(s.dims(), typename Shape::dim_indices()));
  static_compact.resolve();
  return static_compact;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0xb8(%rbp)
movq %rdi, %rax
movq %rax, -0xb0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x13bf0
movq %rax, %rsi
leaq -0xa0(%rbp), %rdi
callq 0x169c0
leaq -0x58(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x16990
leaq -0x58(%rbp), %rdi
callq 0x11be0
movq -0xb8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x16720
movq -0xb0(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: dsharlet[P]array/include/array/array.h
// Function: nda::array<int, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, std::allocator<int>>::allocate()
void allocate() {
    assert(!buffer_);
    shape_.resolve();
    size_type flat_extent = shape_.flat_extent();
    if (flat_extent > 0) {
      buffer_size_ = flat_extent;
      buffer_ = alloc_traits::allocate(alloc_, buffer_size_);
    }
    base_ = buffer_ - shape_.flat_min();
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, 0x8(%rax)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x11ab4
jmp 0x11ab6
jmp 0x11ad5
leaq 0x1ca61b(%rip), %rdi    # 0x1dc0d8
leaq 0x1ca61d(%rip), %rsi    # 0x1dc0e1
movl $0x8eb, %edx            # imm = 0x8EB
leaq 0x1ca627(%rip), %rcx    # 0x1dc0f7
callq 0x3130
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
callq 0x11be0
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
callq 0x11c00
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jbe 0x11b1a
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, 0x10(%rdi)
movq 0x10(%rdi), %rsi
callq 0x11c60
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rdi
movq 0x8(%rdi), %rax
movq %rax, -0x20(%rbp)
addq $0x20, %rdi
callq 0x11c90
movq -0x20(%rbp), %rcx
movq %rax, %rsi
movq -0x18(%rbp), %rax
xorl %edx, %edx
subq %rsi, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
movq %rcx, 0x18(%rax)
addq $0x20, %rsp
popq %rbp
retq
// File: dsharlet[P]array/include/array/array.h
// Function: void nda::internal::resolve_unknown_strides<std::tuple<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>(std::tuple<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>&, nda::dim<-9l, -9l, 1l>&, nda::dim<-9l, -9l, -9l>&, nda::dim<-9l, -9l, -9l>&)
NDARRAY_HOST_DEVICE void resolve_unknown_strides(AllDims& all_dims, Dim0& dim0, Dims&... dims) {
  if (is_unresolved(dim0.stride())) {
    constexpr size_t rank = std::tuple_size<AllDims>::value;
    dim0.set_stride(find_stride(dim0.extent(), all_dims, make_index_sequence<rank>()));
  }
  resolve_unknown_strides(all_dims, dims...);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x48(%rbp)
movq %rsi, -0x50(%rbp)
movq %rdx, -0x58(%rbp)
movq %rcx, -0x60(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x10(%rbp)
movq $0x1, -0x40(%rbp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
cmpq %rax, -0x40(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
cmpq $0x0, %rax
je 0x11dfd
movq $0x3, -0x68(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x48(%rbp), %rsi
callq 0x11e80
movq -0x78(%rbp), %rcx
movq %rcx, -0x28(%rbp)
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x20(%rbp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
cmpq %rax, -0x20(%rbp)
sete %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x6a(%rbp)
jne 0x11dd5
cmpq $0x1, -0x30(%rbp)
sete %al
movb %al, -0x6a(%rbp)
movb -0x6a(%rbp), %al
testb $0x1, %al
jne 0x11dfb
leaq 0x1ca3d6(%rip), %rdi    # 0x1dc1b9
leaq 0x1ca2f7(%rip), %rsi    # 0x1dc0e1
movl $0x1da, %edx            # imm = 0x1DA
leaq 0x1ca3f8(%rip), %rcx    # 0x1dc1ee
callq 0x3130
jmp 0x11dfd
movq -0x48(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x60(%rbp), %rdx
callq 0x12140
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: dsharlet[P]array/include/array/array.h
// Function: long nda::internal::filter_stride<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>(long, long, nda::dim<-9l, -9l, 1l> const&, nda::dim<-9l, -9l, -9l> const&, nda::dim<-9l, -9l, -9l> const&)
NDARRAY_HOST_DEVICE index_t filter_stride(index_t stride, index_t extent, const Dims&... dims) {
  if (all(is_stride_ok(stride, extent, dims)...)) {
    return stride;
  } else {
    return std::numeric_limits<index_t>::max();
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x12580
movb %al, -0x32(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x127c0
movb %al, -0x31(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x127c0
movb -0x32(%rbp), %dl
movb -0x31(%rbp), %cl
movzbl %dl, %edi
andl $0x1, %edi
movzbl %cl, %esi
andl $0x1, %esi
movzbl %al, %edx
andl $0x1, %edx
callq 0x12500
testb $0x1, %al
jne 0x12278
jmp 0x12282
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1228b
callq 0x124f0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: dsharlet[P]array/include/array/array.h
// Function: long nda::internal::candidate_stride<nda::dim<-9l, -9l, -9l>>(nda::dim<-9l, -9l, -9l> const&)
NDARRAY_HOST_DEVICE index_t candidate_stride(const Dim& dim) {
  if (is_unresolved(dim.stride())) {
    return std::numeric_limits<index_t>::max();
  } else {
    return max<index_t>(1, abs(dim.stride()) * dim.extent());
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
cmpq %rax, -0x40(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
cmpq $0x0, %rax
je 0x12422
callq 0x124f0
movq %rax, -0x48(%rbp)
jmp 0x1249c
movq $0x1, -0x58(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jl 0x1245a
movq -0x30(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x12464
xorl %eax, %eax
subq -0x30(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq -0x50(%rbp), %rcx
movq %rcx, -0x38(%rbp)
movq -0x38(%rbp), %rcx
addq $0x8, %rcx
movq %rcx, -0x8(%rbp)
movq -0x8(%rbp), %rcx
imulq (%rcx), %rax
movq %rax, -0x60(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x12b00
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: dsharlet[P]array/include/array/array.h
// Function: void nda::copy<int const, int, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, void>(nda::array_ref<int const, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>> const&, nda::array_ref<int, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>> const&)
void copy(const array_ref<TSrc, ShapeSrc>& src, const array_ref<TDst, ShapeDst>& dst) {
  if (dst.shape().empty()) { return; }

  assert(src.shape().is_in_range(dst.shape().min()) && src.shape().is_in_range(dst.shape().max()));

  copy_shape_traits<ShapeSrc, ShapeDst>::for_each_value(
      src.shape(), src.base(), dst.shape(), dst.base(), internal::copy_assign<TSrc, TDst>);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x14ba0
movq %rax, %rdi
callq 0x13170
testb $0x1, %al
jne 0x14a67
jmp 0x14a6c
jmp 0x14b50
movq -0x8(%rbp), %rdi
callq 0x118d0
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0x14ba0
movq %rax, %rsi
leaq -0x28(%rbp), %rdi
callq 0x14bf0
movq -0x50(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x14bc0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x41(%rbp)
jne 0x14aa9
jmp 0x14adb
movq -0x8(%rbp), %rdi
callq 0x118d0
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
callq 0x14ba0
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
callq 0x14c20
movq -0x58(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x14bc0
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x14ae4
jmp 0x14ae6
jmp 0x14b05
leaq 0x1c79bb(%rip), %rdi    # 0x1dc4a8
leaq 0x1c75ed(%rip), %rsi    # 0x1dc0e1
movl $0xad0, %edx            # imm = 0xAD0
leaq 0x1c7a01(%rip), %rcx    # 0x1dc501
callq 0x3130
movq -0x8(%rbp), %rdi
callq 0x118d0
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
callq 0x14ce0
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
callq 0x14ba0
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
callq 0x14d00
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq %rax, %rcx
leaq 0x1d5(%rip), %r8        # 0x14d20
callq 0x14c50
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: dsharlet[P]array/include/array/array.h
// Function: void nda::copy_shape_traits<nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>>::for_each_value<void (&)(int const&, int&), int const*, int*>(nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>> const&, int const*, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>> const&, int*, void (&)(int const&, int&))
NDARRAY_HOST_DEVICE static void for_each_value(
      const ShapeSrc& shape_src, TSrc src, const ShapeDst& shape_dst, TDst dst, Fn&& fn) {
    // For this function, we don't care about the order in which the callback is
    // called. Optimize the shapes for memory access order.
    auto opt_shape = internal::optimize_copy_shapes(shape_src, shape_dst);
    const auto& opt_shape_src = opt_shape.first;
    const auto& opt_shape_dst = opt_shape.second;

    for_each_value_in_order(opt_shape_dst, opt_shape_src, src, opt_shape_dst, dst, fn);
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0xb8(%rbp), %rdi
callq 0x150f0
leaq -0xb8(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq -0xb8(%rbp), %rax
addq $0x48, %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0xc8(%rbp), %rcx
movq -0x20(%rbp), %r8
movq -0x28(%rbp), %r9
callq 0xbef0
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: dsharlet[P]array/include/array/array.h
// Function: nda::array<int, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, std::allocator<int>>::swap_except_allocator(nda::array<int, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, std::allocator<int>>&)
void swap_except_allocator(array& other) {
    using std::swap;
    swap(buffer_, other.buffer_);
    swap(buffer_size_, other.buffer_size_);
    swap(base_, other.base_);
    swap(shape_, other.shape_);
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
addq $0x8, %rdi
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
callq 0x16660
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movq -0x10(%rbp), %rsi
addq $0x10, %rsi
callq 0x166a0
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
addq $0x18, %rsi
callq 0x16660
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
movq -0x10(%rbp), %rsi
addq $0x20, %rsi
callq 0x166e0
addq $0x20, %rsp
popq %rbp
retq
nop
// File: dsharlet[P]array/include/array/array.h
// Function: auto nda::internal::make_compact_dims<std::tuple<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, 0ul, 1ul, 2ul>(std::tuple<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>> const&, std::integer_sequence<unsigned long, 0ul, 1ul, 2ul>)
NDARRAY_HOST_DEVICE auto make_compact_dims(const Dims& dims, index_sequence<Is...>) {
  // Currently, the algorithm is:
  // - If any dimension has a static stride greater than one, don't give any
  //   static strides.
  // - If all dimensions are dynamic, use 1 as the next stride.
  // - If a dimension has static stride 1, use its Extent as the next stride.
  // This is very conservative, but the only thing I can figure out how to
  // express as constexpr with C++14 that doesn't risk doing dumb things.
  constexpr index_t MinStride =
      variadic_max(std::tuple_element<Is, Dims>::type::Stride == 1
                       ? static_abs(std::tuple_element<Is, Dims>::type::Extent)
                       : dynamic...);
  constexpr bool AnyStrideGreaterThanOne = any((std::tuple_element<Is, Dims>::type::Stride > 1)...);
  constexpr bool AllDynamic = all(is_dynamic(std::tuple_element<Is, Dims>::type::Stride)...);
  constexpr index_t NextStride = AnyStrideGreaterThanOne ? dynamic : (AllDynamic ? 1 : MinStride);
  return make_compact_dims<NextStride>(std::get<Is>(dims)...);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x50(%rbp)
movq %rdi, %rax
movq %rax, -0x38(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x18(%rbp)
movq $-0x9, -0x20(%rbp)
movb $0x0, -0x21(%rbp)
movb $0x0, -0x22(%rbp)
movq $-0x9, -0x30(%rbp)
movq -0x18(%rbp), %rdi
callq 0x122a0
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
callq 0x122c0
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
callq 0x122e0
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rax, %rcx
callq 0x16c30
movq -0x38(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: dsharlet[P]array/include/array/array.h
// Function: auto nda::internal::make_compact_dims<-9l, -9l, -9l, 1l, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>(nda::dim<-9l, -9l, 1l> const&, nda::dim<-9l, -9l, -9l> const&, nda::dim<-9l, -9l, -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 %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0xc0(%rbp)
movq %rdi, %rax
movq %rax, -0xb8(%rbp)
movq %rdi, -0x28(%rbp)
movq %rsi, -0x30(%rbp)
movq %rdx, -0x38(%rbp)
movq %rcx, -0x40(%rbp)
movq $-0x9, -0x48(%rbp)
movq $0x1, -0x50(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x30(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq -0x80(%rbp), %rdi
movl $0x1, %ecx
callq 0x16d70
leaq -0x68(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x16d40
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
leaq -0xb0(%rbp), %rdi
callq 0x16dc0
movq -0xc0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0x16d00
movq -0xb8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: dsharlet[P]array/include/array/array.h
// Function: auto nda::internal::make_array_ref_at<int*, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>(int*, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>> const&, std::tuple<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>> const&)
NDARRAY_HOST_DEVICE auto make_array_ref_at(
    T base, const Shape& shape, const std::tuple<Args...>& args) {
  auto new_shape = shape[args];
  auto new_mins = mins_of_intervals(args, shape.dims(), make_index_sequence<sizeof...(Args)>());
  auto old_min_offset = shape[new_mins];
  return make_array_ref_no_resolve(internal::pointer_add(base, old_min_offset), new_shape);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x80(%rbp)
movq %rdi, %rax
movq %rax, -0x78(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x17980
movq -0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x18(%rbp), %rdi
callq 0x17a80
movq -0x88(%rbp), %rsi
movq %rax, %rdx
leaq -0x60(%rbp), %rdi
callq 0x179f0
movq -0x18(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x17a90
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x17b00
movq -0x80(%rbp), %rdi
movq %rax, %rsi
leaq -0x50(%rbp), %rdx
callq 0x17ac0
movq -0x78(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)
// File: dsharlet[P]array/include/array/array.h
// Function: nda::array<int, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, std::allocator<int>>::deallocate()
void deallocate() {
    if (base_) {
      destroy();
      base_ = nullptr;
      shape_ = Shape();
      alloc_traits::deallocate(alloc_, buffer_, buffer_size_);
      buffer_ = nullptr;
    }
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, 0x18(%rax)
je 0x18b27
movq -0x58(%rbp), %rdi
callq 0x18b30
movq -0x58(%rbp), %rax
movq $0x0, 0x18(%rax)
leaq -0x50(%rbp), %rdi
callq 0x16440
movq -0x58(%rbp), %rdi
addq $0x20, %rdi
leaq -0x50(%rbp), %rsi
callq 0x16750
movq -0x58(%rbp), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rdx
callq 0x18bb0
movq -0x58(%rbp), %rax
movq $0x0, 0x8(%rax)
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)
// File: dsharlet[P]array/include/array/array.h
// Function: nda::array<int, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, std::allocator<int>>::assign(nda::array<int, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, std::allocator<int>> const&)
void assign(const 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();
    }
    copy_construct(other);
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jne 0x18ee0
movq -0x18(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x18e93
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
movq -0x10(%rbp), %rsi
addq $0x20, %rsi
callq 0x18f50
testb $0x1, %al
jne 0x18e70
jmp 0x18e72
jmp 0x18e91
leaq 0x1c3ccb(%rip), %rdi    # 0x1dcb44
leaq 0x1c3261(%rip), %rsi    # 0x1dc0e1
movl $0x9b9, %edx            # imm = 0x9B9
leaq 0x1c3ccf(%rip), %rcx    # 0x1dcb5b
callq 0x3130
jmp 0x18ede
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x20, %rsi
addq $0x20, %rdi
callq 0x18f90
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
callq 0x13170
testb $0x1, %al
jne 0x18ebb
jmp 0x18ebd
jmp 0x18edc
leaq 0x1c3388(%rip), %rdi    # 0x1dc24c
leaq 0x1c3216(%rip), %rsi    # 0x1dc0e1
movl $0x9bc, %edx            # imm = 0x9BC
leaq 0x1c3c84(%rip), %rcx    # 0x1dcb5b
callq 0x3130
jmp 0x18ede
jmp 0x18f45
movq -0x18(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x18f11
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
movq -0x10(%rbp), %rsi
addq $0x20, %rsi
callq 0x18f50
testb $0x1, %al
jne 0x18f06
jmp 0x18f11
movq -0x18(%rbp), %rdi
callq 0x18b30
jmp 0x18f38
movq -0x18(%rbp), %rdi
callq 0x18ac0
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x20, %rsi
addq $0x20, %rdi
callq 0x18f90
movq -0x18(%rbp), %rdi
callq 0x11a90
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x18fc0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: dsharlet[P]array/include/array/array.h
// Function: nda::array<int, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, std::allocator<int>>::copy_construct(nda::array<int, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, std::allocator<int>> const&)
void copy_construct(const array& other) {
    assert(base_ || shape_.empty());
    assert(shape_ == other.shape_);
    copy_shape_traits_type::for_each_value(other.shape_, other.base_, shape_, base_,
        [&](const_reference src, reference dst) { alloc_traits::construct(alloc_, &dst, src); });
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rcx
movq %rcx, -0x28(%rbp)
movb $0x1, %al
cmpq $0x0, 0x18(%rcx)
movb %al, -0x19(%rbp)
jne 0x18ff4
movq -0x28(%rbp), %rdi
addq $0x20, %rdi
callq 0x13170
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %al
testb $0x1, %al
jne 0x18ffd
jmp 0x18fff
jmp 0x1901e
leaq 0x1c323d(%rip), %rdi    # 0x1dc243
leaq 0x1c30d4(%rip), %rsi    # 0x1dc0e1
movl $0x8ff, %edx            # imm = 0x8FF
leaq 0x1c3c20(%rip), %rcx    # 0x1dcc39
callq 0x3130
movq -0x28(%rbp), %rdi
addq $0x20, %rdi
movq -0x10(%rbp), %rsi
addq $0x20, %rsi
callq 0x18f50
testb $0x1, %al
jne 0x19039
jmp 0x1903b
jmp 0x1905a
leaq 0x1c3b02(%rip), %rdi    # 0x1dcb44
leaq 0x1c3098(%rip), %rsi    # 0x1dc0e1
movl $0x900, %edx            # imm = 0x900
leaq 0x1c3be4(%rip), %rcx    # 0x1dcc39
callq 0x3130
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rsi
movq %rax, %rdx
addq $0x20, %rdx
movq 0x18(%rax), %rcx
movq %rax, -0x18(%rbp)
leaq -0x18(%rbp), %r8
callq 0x194e0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: dsharlet[P]array/include/array/array.h
// Function: nda::array_ref<int const, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>>::operator!=(nda::array_ref<int const, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>> const&) const
NDARRAY_HOST_DEVICE bool operator!=(const array_ref& other) const {
    if (shape_ != other.shape_) { return true; }

    // TODO: This currently calls operator!= on all elements of the array_ref,
    // even after we find a non-equal element
    // (https://github.com/dsharlet/array/issues/4).
    bool result = false;
    copy_shape_traits<Shape, Shape>::for_each_value(
        shape_, base_, other.shape_, other.base_, [&](const_reference a, const_reference b) {
          if (a != b) { result = true; }
        });
    return result;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x30(%rbp)
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
callq 0x19730
testb $0x1, %al
jne 0x196df
jmp 0x196e5
movb $0x1, -0x1(%rbp)
jmp 0x1971f
movq -0x30(%rbp), %rax
movb $0x0, -0x19(%rbp)
movq %rax, %rdi
addq $0x8, %rdi
movq (%rax), %rsi
movq -0x18(%rbp), %rdx
addq $0x8, %rdx
movq -0x18(%rbp), %rax
movq (%rax), %rcx
leaq -0x19(%rbp), %rax
movq %rax, -0x28(%rbp)
leaq -0x28(%rbp), %r8
callq 0x19770
movb -0x19(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: dsharlet[P]array/include/array/array.h
// Function: bool nda::equal<int const, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, int const, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>>(nda::array_ref<int const, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>> const&, nda::array_ref<int const, nda::shape<nda::dim<-9l, -9l, 1l>, nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>> const&)
NDARRAY_HOST_DEVICE bool equal(const array_ref<TA, ShapeA>& a, const array_ref<TB, ShapeB>& b) {
  if (a.shape().min() != b.shape().min() || a.shape().extent() != b.shape().extent()) {
    return false;
  }

  bool result = true;
  copy_shape_traits<ShapeA, ShapeB>::for_each_value(
      a.shape(), a.base(), b.shape(), b.base(), [&](const TA& a, const TB& b) {
        if (a != b) { result = false; }
      });
  return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x118d0
movq %rax, %rsi
leaq -0x30(%rbp), %rdi
callq 0x14bf0
movq -0x18(%rbp), %rdi
callq 0x118d0
movq %rax, %rsi
leaq -0x48(%rbp), %rdi
callq 0x14bf0
leaq -0x30(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x199d0
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x89(%rbp)
jne 0x19906
movq -0x10(%rbp), %rdi
callq 0x118d0
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x132b0
movq -0x18(%rbp), %rdi
callq 0x118d0
movq %rax, %rsi
leaq -0x78(%rbp), %rdi
callq 0x132b0
leaq -0x60(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x199d0
movb %al, -0x89(%rbp)
movb -0x89(%rbp), %al
testb $0x1, %al
jne 0x19912
jmp 0x19918
movb $0x0, -0x1(%rbp)
jmp 0x1998c
movb $0x1, -0x79(%rbp)
movq -0x10(%rbp), %rdi
callq 0x118d0
movq %rax, -0xa8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x14ce0
movq %rax, -0xa0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x118d0
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rdi
callq 0x14ce0
movq -0xa8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq %rax, %rcx
leaq -0x79(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x88(%rbp), %r8
callq 0x19a00
movb -0x79(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xb0, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: dsharlet[P]array/include/array/array.h
// Function: void nda::move<int, int, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>, void>(nda::array_ref<int, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>> const&, nda::array_ref<int, nda::shape<nda::dim<-9l, -9l, -9l>, nda::dim<-9l, -9l, -9l>>> const&)
void move(const array_ref<TSrc, ShapeSrc>& src, const array_ref<TDst, ShapeDst>& dst) {
  if (dst.shape().empty()) { return; }

  assert(src.shape().is_in_range(dst.shape().min()) && src.shape().is_in_range(dst.shape().max()));

  copy_shape_traits<ShapeSrc, ShapeDst>::for_each_value(
      src.shape(), src.base(), dst.shape(), dst.base(), internal::move_assign<TSrc, TDst>);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1bbd0
movq %rax, %rdi
callq 0x1a8a0
testb $0x1, %al
jne 0x1d1e7
jmp 0x1d1ec
jmp 0x1d2d0
movq -0x8(%rbp), %rdi
callq 0x1bbd0
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1bbd0
movq %rax, %rsi
leaq -0x20(%rbp), %rdi
callq 0x1bc40
movq -0x40(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1bc10
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x31(%rbp)
jne 0x1d229
jmp 0x1d25b
movq -0x8(%rbp), %rdi
callq 0x1bbd0
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1bbd0
movq %rax, %rsi
leaq -0x30(%rbp), %rdi
callq 0x1bc70
movq -0x48(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1bc10
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x1d264
jmp 0x1d266
jmp 0x1d285
leaq 0x1bf23b(%rip), %rdi    # 0x1dc4a8
leaq 0x1bee6d(%rip), %rsi    # 0x1dc0e1
movl $0xb17, %edx            # imm = 0xB17
leaq 0x1c0686(%rip), %rcx    # 0x1dd906
callq 0x3130
movq -0x8(%rbp), %rdi
callq 0x1bbd0
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1bd50
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1bbd0
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1bd50
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq %rax, %rcx
leaq 0xa5(%rip), %r8         # 0x1d370
callq 0x1d2e0
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
xorl %eax, %eax
movl %eax, -0x184(%rbp)
movl %eax, %esi
movq %rsi, -0x1b8(%rbp)
leaq -0x98(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
movl $0x4, %edx
movl $0x6, %ecx
movq %rcx, -0x1b0(%rbp)
callq 0x10c60
movq -0x1b8(%rbp), %rsi
movq -0x1b0(%rbp), %rdx
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x1a0(%rbp)
movl $0x1, %ecx
callq 0x10c60
movq -0x1a8(%rbp), %rsi
movq -0x1a0(%rbp), %rdx
leaq -0x80(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0x11310
movq -0x198(%rbp), %rsi
leaq -0x50(%rbp), %rdi
movq %rdi, -0x190(%rbp)
callq 0x11190
movq -0x190(%rbp), %rdi
movl -0x184(%rbp), %esi
callq 0x36570
jmp 0x27d2f
xorl %eax, %eax
movl %eax, %esi
leaq -0x158(%rbp), %rdi
movl $0x4, %edx
movl $0x6, %ecx
callq 0x10c60
jmp 0x27d4b
xorl %eax, %eax
movl %eax, %esi
leaq -0x170(%rbp), %rdi
movl $0x3, %edx
movl $0x2, %ecx
callq 0x10c60
jmp 0x27d67
leaq -0x140(%rbp), %rdi
leaq -0x158(%rbp), %rsi
leaq -0x170(%rbp), %rdx
callq 0x11310
jmp 0x27d83
leaq -0x110(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x11190
jmp 0x27d98
leaq -0x50(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x11360
jmp 0x27daa
leaq -0x180(%rbp), %rdi
movq %rdi, -0x1c0(%rbp)
callq 0x365d0
movq -0x1c0(%rbp), %rsi
leaq -0x110(%rbp), %rdi
callq 0x365a0
jmp 0x27dd2
leaq -0x110(%rbp), %rdi
callq 0x114a0
leaq -0x50(%rbp), %rdi
callq 0x114a0
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x27e22
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x114a0
leaq -0x50(%rbp), %rdi
callq 0x114a0
movq -0xb8(%rbp), %rdi
callq 0x33a0
nopw (%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
leaq -0x28(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x11530
movq -0x200(%rbp), %rdi
leaq -0x2a(%rbp), %rsi
callq 0x280b0
jmp 0x27e6d
leaq -0x28(%rbp), %rdi
callq 0x11650
movq %rax, -0x208(%rbp)
jmp 0x27e7f
movq -0x208(%rbp), %rax
movl (%rax), %eax
subl $0x3, %eax
sete %al
movb %al, -0x211(%rbp)
leaq -0x1f1(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0x33b0
movq -0x210(%rbp), %rdx
leaq 0x1b6754(%rip), %rsi    # 0x1de609
leaq -0x1f0(%rbp), %rdi
callq 0x10a90
jmp 0x27ec3
movb -0x211(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x1d0(%rbp), %rdi
leaq -0x1f0(%rbp), %rdx
callq 0x10f80
jmp 0x27ee4
leaq 0x1b48fa(%rip), %rsi    # 0x1dc7e5
leaq -0x1d0(%rbp), %rdi
callq 0x34320
movq %rax, -0x220(%rbp)
jmp 0x27f00
movq -0x220(%rbp), %rdi
leaq 0x1b6709(%rip), %rsi    # 0x1de617
callq 0x36600
movq %rax, -0x228(%rbp)
jmp 0x27f1c
movq -0x228(%rbp), %rdi
leaq 0x1b8882(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0x230(%rbp)
jmp 0x27f38
leaq -0x28(%rbp), %rdi
callq 0x11650
movq %rax, -0x238(%rbp)
jmp 0x27f4a
movq -0x238(%rbp), %rsi
movq -0x230(%rbp), %rdi
callq 0x343a0
movq %rax, -0x240(%rbp)
jmp 0x27f66
movq -0x240(%rbp), %rdi
leaq 0x1b4871(%rip), %rsi    # 0x1dc7e5
callq 0x34320
movq %rax, -0x248(%rbp)
jmp 0x27f82
movq -0x248(%rbp), %rdi
leaq 0x1bf2ca(%rip), %rsi    # 0x1e725a
callq 0x34320
movq %rax, -0x250(%rbp)
jmp 0x27f9e
movq -0x250(%rbp), %rdi
leaq 0x1b8800(%rip), %rsi    # 0x1e07ac
callq 0x34320
movq %rax, -0x258(%rbp)
jmp 0x27fba
movq -0x258(%rbp), %rdi
movl $0x3, -0x1f8(%rbp)
leaq -0x1f8(%rbp), %rsi
callq 0x343a0
movq %rax, -0x260(%rbp)
jmp 0x27fe0
movq -0x260(%rbp), %rdi
leaq 0x1ce48d(%rip), %rsi    # 0x1f647b
callq 0x34320
jmp 0x27ff5
leaq -0x1d0(%rbp), %rdi
callq 0x10ff0
jmp 0x28003
leaq -0x1f0(%rbp), %rdi
callq 0x3100
leaq -0x1f1(%rbp), %rdi
callq 0x3290
leaq -0x28(%rbp), %rdi
callq 0x11610
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2808b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2807f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x28073
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x10ff0
jmp 0x28071
jmp 0x28073
leaq -0x1f0(%rbp), %rdi
callq 0x3100
leaq -0x1f1(%rbp), %rdi
callq 0x3290
leaq -0x28(%rbp), %rdi
callq 0x11610
movq -0x38(%rbp), %rdi
callq 0x33a0
movq %rax, %rdi
callq 0x116d0
nopw %cs:(%rax,%rax)