(defun goop ()
  (interactive "*")
  (make-local-variable 'old-fold)
  (setq old-fold case-fold-search)
  (setq case-fold-search nil)
  (message "Pass 3...")
  (goto-char (point-min))
  (while (search-forward "ASSERT" nil t)
    (search-forward ",")
    (setq x (1- (point)))
    (search-forward ")")
    (delete-region x (1- (point))))
  (message "Pass 4a...")
  (goto-char (point-min))
  (replace-string "(* Assert (" "(* Assert(")
  (message "Pass 4b...")
  (goto-char (point-min))
  (while (search-forward "(* Assert(" nil t)
    (replace-match "ASSERT(")
    (teco-fs " *)" ";"))
  (message "Pass 4c...")
  (goto-char (point-min))
  (replace-string ";;" ";")
  (setq case-fold-search old-fold)
  )

(defun teco-fs (from-string to-string &optional arg)
  "Perform the TECO \"fs\" (find and substitute) command.
Replaces one occurrence of FROM-STRING with TO-STRING -- the ARGth
occurrence, to be precise.  Negative ARG means search backward.

When calling from a program, nil means \"no arg\",
a number counts as a prefix arg."
  (interactive "*sFind: \nsFind \"%s\" and substitute with: \nP")
  (if (or (equal arg nil) (equal arg 0))
      (setq arg 1))
  (if (< arg 0)
      (search-backward from-string nil nil (- arg))
    (search-forward from-string nil nil arg)
    )
  (replace-match to-string t t)
  )

(global-set-key "" 'goop)
