compileToComplexFunction: Rewrite the irToJS stage, add lots of comments.