UPDATE:
I solved this for now by hardcoding in opt_mitosis a bailout condition for that specific function.
Wouldn't it be useful to use a function marker for this, along the lines of {inline|unsafe} markers?
Something like:
blocking command myfunction(...);
and then disable mitosis for all blocking functions (i.e. functions that need to consume their whole input)?
On the same topic, I also noticed that mitosis currently isn't disabled on unsafe functions. Is that correct? If a function is unsafe, calling it multiple times could be... .. well ... unsafe? ;-)
Roberto