```
(defun info-toc-to-org ()
  "Transform the Info buffer's table of contents to an Org-mode tree."
  (interactive)
  (let ((tree nil))
    ;; Move to the beginning of the TOC.
    (goto-char (point-min))
    ;; Skip the title and section headings.
    (re-search-forward "^Table of Contents$")
    (re-search-forward "^* ")
    ;; Parse the tree.
    (while (re-search-forward "^\\([*]+\\) \\(.+\\)$" nil t)
      (let ((level (length (match-string 1)))
            (text (match-string 2)))
        ;; Add the current item to the tree.
        (setq tree (append tree (list (cons text level)))))
    ;; Convert the tree to Org-mode syntax.
    (let ((org-tree (format-org-tree tree)))
      (kill-region (point-min) (point-max))
      (insert org-tree))))

(defun format-org-tree (tree &optional level)
  "Format a tree as an Org-mode tree."
  (let ((level (or level 0))
        (indent (make-string (* level 2) ?\s))
        (org-tree ""))
    (dolist (item tree)
      (let ((text (car item))
            (subtree (cdr item)))
        (setq org-tree
              (concat org-tree
                      indent
                      (if (> level 0) " " "")
                      (format "* %s\n" text)
                      (when subtree
                        (format-org-tree subtree (1+ level)))))))
    org-tree))
```
(defun info-toc-to-org ()
  "Transform the Info buffer's table of contents to an Org-mode tree."
  (interactive)
  (let ((tree nil))
    ;; Move to the beginning of the TOC.
    (goto-char (point-min))
    ;; Skip the title and section headings.
    (re-search-forward "^Table of Contents$")
    (re-search-forward "^* ")
    ;; Parse the tree.
    (while (re-search-forward "^\\([*]+\\) \\(.+\\)$" nil t)
      (let ((level (length (match-string 1)))
            (text (match-string 2)))
        ;; Add the current item to the tree.
        (setq tree (append tree (list (cons text level)))))
    ;; Convert the tree to Org-mode syntax.
    (let ((org-tree (format-org-tree tree)))
      (kill-region (point-min) (point-max))
      (insert org-tree))))

(defun format-org-tree (tree &optional level)
  "Format a tree as an Org-mode tree."
  (let ((level (or level 0))
        (indent (make-string (* level 2) ?\s))
        (org-tree ""))
    (dolist (item tree)
      (let ((text (car item))
            (subtree (cdr item)))
        (setq org-tree
              (concat org-tree
                      indent
                      (if (> level 0) " " "")
                      (format "* %s\n" text)
                      (when subtree
                        (format-org-tree subtree (1+ level)))))))
    org-tree))