Create a Common Lisp macro for the following transformation. Before code:
(defclause in (&whole form seq &rest args &key &allow-other-keys &environment env) "Iterates over a sequence. IN must be used in combination with FOR, GENERATING and similar macros (those that bind *ITERATION-VARIABLE*). In implementations with extensible sequences (currently ABCL and SBCL), native sequence iterators are used, and all sequence types are supported, not just lists and vectors. In other implementations, an iterator specialized for lists or vectors is used depending on the type of sequence. All `args` are passed down to make-sequence-iterator (see the extensible sequences API paper for details [Rhodes2007]). IN can perform destructuring." (if (symbolp *iteration-variable*) (let ((state (gensym "STATE")) (limit (gensym "LIMIT")) (from-end (gensym "FROM-END")) (step (gensym "STEP")) (endp (gensym "ENDP")) (elt (gensym "ELT")) (sequence (gensym "SEQUENCE"))) `((with (,sequence ,seq) ,state ,limit ,from-end ,step ,endp ,elt) (initially (multiple-value-setq (,state ,limit ,from-end ,step ,endp ,elt) (make-sequence-iterator ,sequence ,@args))) ,(make-step :form `(setf ,state (funcall ,step ,sequence ,state ,from-end))) ,(make-simple-iteration :precondition `(not (funcall ,endp ,sequence ,state ,limit ,from-end)) :init `(funcall ,elt ,sequence ,state) :step `(funcall ,elt ,sequence ,state)))) (expand-with-simple-destructuring form env)))

What needs to change: Macro call that should be transformed by defclause

Macro definition:
(defmacro defclause (name arglist &body body)
  "Same as cl:defmacro, but additionally records <name> in *clauses* as a known clause macro."
  `(progn
     (defmacro ,name ,arglist ,@body)
     (pushnew ',name *clauses*)))

Macroexpansion:
(progn (defmacro in (&whole form seq &rest args &key &allow-other-keys &environment env) "Iterates over a sequence. IN must be used in combination with FOR, GENERATING and similar macros (those that bind *ITERATION-VARIABLE*). In implementations with extensible sequences (currently ABCL and SBCL), native sequence iterators are used, and all sequence types are supported, not just lists and vectors. In other implementations, an iterator specialized for lists or vectors is used depending on the type of sequence. All `args` are passed down to make-sequence-iterator (see the extensible sequences API paper for details [Rhodes2007]). IN can perform destructuring." (if (symbolp *iteration-variable*) (let ((state (gensym "STATE")) (limit (gensym "LIMIT")) (from-end (gensym "FROM-END")) (step (gensym "STEP")) (endp (gensym "ENDP")) (elt (gensym "ELT")) (sequence (gensym "SEQUENCE"))) (sb-int:quasiquote ((with (#S(sb-impl::comma :expr sequence :kind 0) #S(sb-impl::comma :expr seq :kind 0)) #S(sb-impl::comma :expr state :kind 0) #S(sb-impl::comma :expr limit :kind 0) #S(sb-impl::comma :expr from-end :kind 0) #S(sb-impl::comma :expr step :kind 0) #S(sb-impl::comma :expr endp :kind 0) #S(sb-impl::comma :expr elt :kind 0)) (initially (multiple-value-setq (#S(sb-impl::comma :expr state :kind 0) #S(sb-impl::comma :expr limit :kind 0) #S(sb-impl::comma :expr from-end :kind 0) #S(sb-impl::comma :expr step :kind 0) #S(sb-impl::comma :expr endp :kind 0) #S(sb-impl::comma :expr elt :kind 0)) (make-sequence-iterator #S(sb-impl::comma :expr sequence :kind 0) #S(sb-impl::comma :expr args :kind 2)))) #S(sb-impl::comma :expr (make-step :form (sb-int:quasiquote (setf #S(sb-impl::comma :expr state :kind 0) (funcall #S(sb-impl::comma :expr step :kind 0) #S(sb-impl::comma :expr sequence :kind 0) #S(sb-impl::comma :expr state :kind 0) #S(sb-impl::comma :expr from-end :kind 0))))) :kind 0) #S(sb-impl::comma :expr (make-simple-iteration :precondition (sb-int:quasiquote (not (funcall #S(sb-impl::comma :expr endp :kind 0) #S(sb-impl::comma :expr sequence :kind 0) #S(sb-impl::comma :expr state :kind 0) #S(sb-impl::comma :expr limit :kind 0) #S(sb-impl::comma :expr from-end :kind 0)))) :init (sb-int:quasiquote (funcall #S(sb-impl::comma :expr elt :kind 0) #S(sb-impl::comma :expr sequence :kind 0) #S(sb-impl::comma :expr state :kind 0))) :step (sb-int:quasiquote (funcall #S(sb-impl::comma :expr elt :kind 0) #S(sb-impl::comma :expr sequence :kind 0) #S(sb-impl::comma :expr state :kind 0)))) :kind 0)))) (expand-with-simple-destructuring form env))) (pushnew (quote in) *clauses*))