comment-choose-indent is a compiled Lisp function in `newcomment.el'.

(comment-choose-indent &optional INDENT)

Choose the indentation to use for a right-hand-side comment.
The criteria are (in this order):
- try to keep the comment's text within `comment-fill-column'.
- try to align with surrounding comments.
- prefer INDENT (or `comment-column' if nil).
Point is expected to be at the start of the comment.