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