completion--do-completion is a compiled Lisp function in `minibuffer.el'.

(completion--do-completion BEG END &optional TRY-COMPLETION-FUNCTION EXPECT-EXACT)

Do the completion and return a summary of what happened.
M = completion was performed, the text was Modified.
C = there were available Completions.
E = after completion we now have an Exact match.

000 0 no possible completion
001 1 was already an exact and unique completion
010 2 no completion happened
011 3 was already an exact completion
100 4 ??? impossible
101 5 ??? impossible
110 6 some completion happened
111 7 completed to an exact completion

TRY-COMPLETION-FUNCTION is a function to use in place of `try-completion'.
EXPECT-EXACT, if non-nil, means that there is no need to tell the user
when the buffer's text is already an exact match.