'Generate code in the following steps
1)  copy any closure variables determined thread-private
into temporaries
2)  allocate temps for start, stop and step
3)  generate a loop that calculates the total number of steps,
which then computes the target iteration variable for every step:
for i in prange(start, stop, step):
becomes
nsteps = (stop - start) / step;
i = start;
#pragma omp parallel for lastprivate(i)
for (temp = 0; temp < nsteps; temp++) {
i = start + step * temp;
Note that accumulation of \'i\' would have a data dependency
between iterations.
Also, you can\'t do this
for (i = start; i < stop; i += step)
as the \'<\' operator should become \'>\' for descending loops.
\'for i from x < i < y:\' does not suffer from this problem
as the relational operator is known at compile time!
4) release our temps and write back any private closure variables'

def generate_execution_code(self, code):

    self.declare_closure_privates(code)
    target_index_cname = self.target.entry.cname
    fmt_dict = {'target': target_index_cname, 'target_type': self.target.type.empty_declaration_code()}
    start_stop_step = (self.start, self.stop, self.step)
    defaults = ('0', '0', '1')
    for (node, name, default) in zip(start_stop_step, self.names, defaults):
        if (node is None):
            result = default
        elif node.is_literal:
            result = node.get_constant_c_result_code()
        else:
            node.generate_evaluation_code(code)
            result = node.result()
        fmt_dict[name] = result
    fmt_dict['i'] = code.funcstate.allocate_temp(self.index_type, False)
    fmt_dict['nsteps'] = code.funcstate.allocate_temp(self.index_type, False)
    code.putln(('if    (%(step)s    ==    0)    abort();' % fmt_dict))
    self.setup_parallel_control_flow_block(code)
    self.control_flow_var_code_point = code.insertion_point()
    code.putln(('%(nsteps)s    =    (%(stop)s    -    %(start)s    +    %(step)s    -    %(step)s/abs(%(step)s))    /    %(step)s;' % fmt_dict))
    code.putln(('if    (%(nsteps)s    >    0)' % fmt_dict))
    code.begin_block()
    self.generate_loop(code, fmt_dict)
    code.end_block()
    self.restore_labels(code)
    if self.else_clause:
        if self.breaking_label_used:
            code.put(('if    (%s    <    2)' % Naming.parallel_why))
        code.begin_block()
        code.putln('/*    else    */')
        self.else_clause.generate_execution_code(code)
        code.end_block()
    self.end_parallel_control_flow_block(code)
    for temp in (start_stop_step + (self.chunksize, self.num_threads)):
        if (temp is not None):
            temp.generate_disposal_code(code)
            temp.free_temps(code)
    code.funcstate.release_temp(fmt_dict['i'])
    code.funcstate.release_temp(fmt_dict['nsteps'])
    self.release_closure_privates(code)
