Create a Common Lisp macro for the following transformation. Before code:
(integer-reader 8)

What needs to change: Macro call that should be transformed by integer-reader

Macro definition:
(defmacro integer-reader (bytes)
  "Create a function to read integers from a binary stream."
  (let ((bits (* bytes 8)))
    (labels ((return-form (signed)
               (if signed
                   `(if (logbitp ,(1- bits) result)
                        (dpb result (byte ,(1- bits) 0) -1)
                        result)
                   `result))
             (generate-reader (signed)
               `(defun ,(integer-reader-name bytes signed) (socket)
                  (declare (type stream socket)
                           #.*optimize*)
                  ,(if (= bytes 1)
                       `(let ((result (the (unsigned-byte 8) (read-byte socket))))
                          (declare (type (unsigned-byte 8) result))
                          ,(return-form signed))
                       `(let ((result 0))
                          (declare (type (unsigned-byte ,bits) result))
                          ,@(loop :for byte :from (1- bytes) :downto 0
                                  :collect `(setf (ldb (byte 8 ,(* 8 byte))
                                                       result)
                                                  (the (unsigned-byte 8)
                                                       (read-byte socket))))
                          ,(return-form signed))))))
      `(progn
         ;; This causes weird errors on SBCL in some circumstances. Disabled for now.
         ;;         (declaim (inline ,(integer-reader-name bytes t)
         ;;                          ,(integer-reader-name bytes nil)))
         (declaim (ftype (function (t) (signed-byte ,bits))
                         ,(integer-reader-name bytes t)))
         ,(generate-reader t)
         (declaim (ftype (function (t) (unsigned-byte ,bits))
                         ,(integer-reader-name bytes nil)))
         ,(generate-reader nil)))))

Macroexpansion:
(progn (declaim (ftype (function (t) (signed-byte 64)) read-int8)) (defun read-int8 (socket) (declare (type stream socket) (optimize (speed 3) (safety 0) (space 1) (debug 1) (compilation-speed 0))) (let ((result 0)) (declare (type (unsigned-byte 64) result)) (setf (ldb (byte 8 56) result) (the (unsigned-byte 8) (read-byte socket))) (setf (ldb (byte 8 48) result) (the (unsigned-byte 8) (read-byte socket))) (setf (ldb (byte 8 40) result) (the (unsigned-byte 8) (read-byte socket))) (setf (ldb (byte 8 32) result) (the (unsigned-byte 8) (read-byte socket))) (setf (ldb (byte 8 24) result) (the (unsigned-byte 8) (read-byte socket))) (setf (ldb (byte 8 16) result) (the (unsigned-byte 8) (read-byte socket))) (setf (ldb (byte 8 8) result) (the (unsigned-byte 8) (read-byte socket))) (setf (ldb (byte 8 0) result) (the (unsigned-byte 8) (read-byte socket))) (if (logbitp 63 result) (dpb result (byte 63 0) -1) result))) (declaim (ftype (function (t) (unsigned-byte 64)) read-uint8)) (defun read-uint8 (socket) (declare (type stream socket) (optimize (speed 3) (safety 0) (space 1) (debug 1) (compilation-speed 0))) (let ((result 0)) (declare (type (unsigned-byte 64) result)) (setf (ldb (byte 8 56) result) (the (unsigned-byte 8) (read-byte socket))) (setf (ldb (byte 8 48) result) (the (unsigned-byte 8) (read-byte socket))) (setf (ldb (byte 8 40) result) (the (unsigned-byte 8) (read-byte socket))) (setf (ldb (byte 8 32) result) (the (unsigned-byte 8) (read-byte socket))) (setf (ldb (byte 8 24) result) (the (unsigned-byte 8) (read-byte socket))) (setf (ldb (byte 8 16) result) (the (unsigned-byte 8) (read-byte socket))) (setf (ldb (byte 8 8) result) (the (unsigned-byte 8) (read-byte socket))) (setf (ldb (byte 8 0) result) (the (unsigned-byte 8) (read-byte socket))) result)))