anchor.diff:                         (return-from clone-reference
                            (clone-reference (car input) (cdr input) kernel transformation))))))))
              buffer)
  -          (error "Invalid prune."))
  +          (error "Invalid prune:~%~S" *prune*))
           ;; If the buffer is not to be pruned, simply create a new load
           ;; instruction and register it with the kernel and the buffer.
           (cons
  
positive.code:            (loop for (other-buffer . nil) in other-entries do
               (insert-copy-kernel shape other-buffer main-buffer))))))))
  
  (defmethod convert-cluster
      ((cluster cluster)
       (lazy-multiple-value-map lazy-multiple-value-map))
    (let* ((shape-dendrites-alist (partition-dendrites (cluster-dendrites cluster)))
           ;; Create one set of buffers for each shape-dendrites-alist entry.
           (list-of-buffers
             (loop for (shape . dendrites) in shape-dendrites-alist
                   collect
                   ;; Remember that we abuse the ntype slot of a lazy
                   ;; multiple value map to store a list of ntypes.
                   (loop for ntype in (element-ntype lazy-multiple-value-map)
                         for index from 0
                         ;; Don't create buffers that are never referenced.
                         when (loop for dendrite in dendrites
                                    for value-n = (car (dendrite-cons dendrite))
                                      thereis (= index value-n))
                           collect (make-buffer
                                    :shape shape
                                    :ntype (petalisp.type-inference:generalize-ntype ntype))
                         else collect nil))))
      ;; Emit one load instruction for each dendrite.
      (loop for (shape . dendrites) in shape-dendrites-alist for buffers in list-of-buffers do
        (loop for dendrite in dendrites do
          (with-accessors ((cons dendrite-cons)
                           (kernel dendrite-kernel)
                           (transformation dendrite-transformation)) dendrite
            (let* ((buffer (nth (car cons) buffers)))
              (setf (car cons) 0)
              (setf (cdr cons) (make-load-instruction kernel buffer transformation))))))
      ;; Now subdivide the space of all buffers and emit one kernel per
      ;; resulting fragment, plus some copy kernels if the fragment is part
      ;; of the shapes of several buffers.
      (let ((fragments (subdivide-shapes (mapcar #'first shape-dendrites-alist))))
        (loop for (shape . bitmask) in fragments do
          ;; Initialize a vector of buffer lists with one entry per value
          ;; returned by the underlying lazy multiple value map operation.
          (let* ((n (lazy-map-number-of-values lazy-multiple-value-map))
                 (vector-of-buffers (make-sequence 'vector n :initial-element '())))
            (loop for buffers in list-of-buffers
                  for index from 0
                  when (logbitp index bitmask)
                    do (loop for buffer in buffers
                             for index from 0
                             unless (null buffer)
                               do (push buffer (svref vector-of-buffers index))))
            (let* ((main-buffers (map 'list #'first vector-of-buffers))
                   (dendrite (make-dendrite cluster shape main-buffers)))
              (grow-dendrite dendrite lazy-multiple-value-map))
            ;; Finally, emit copy kernels from the main buffers to all the
            ;; other buffers.
            (loop for index from 0
                  for buffers across vector-of-buffers
                  do (let ((main-buffer (first buffers))
                           (other-buffers (rest buffers)))
                       (loop for other-buffer in (rest other-buffers) do
                         (insert-copy-kernel shape other-buffer main-buffer)))))))))
  
  (defun select-masked-elements (list bitmask)
    (loop for element in list
  
negative.code: (defun dendrite-validp (dendrite)
    (declare (dendrite dendrite))
    (stem-validp (dendrite-stem dendrite)))
  
  (defun dendrite-value-n (dendrite)
    (car (dendrite-cons dendrite)))
  
  (defun make-dendrite (cluster shape buffers)
    (declare (cluster cluster) (shape shape) (list buffers))
  