Improved codegen for loops with static schedule, etc.

Improved codegen for loops with static schedule and code outlining for parallel constructs

718a7e9ce873c2bdea40dfa5dd08aa2edadb6058 by Alexey Bataev