;; GCHANGE
;; does not remove %b when returning base types (i.e. !head%b returns !head%b
(define impc:ir:get-base-type
(lambda (str)
(let* ((r1 (car (regex:split str "##")))
(r2 (impc:ir:get-ptr-depth r1))
(r3 (string-append "^(.*)" (apply string-append (make-list r2 "\\*")) "$")))
;; (println str r2 "$1")
(regex:replace r1 r3 "$1"))))