'Add an exit representing a return from this function.
If this is not an inline call, grab a return address from the state and jump to it.
If this is not an inline call, set a return expression with the calling convention.'

def ret(self, expr=None):

    if (expr is not None):
        if (o.SIMPLIFY_RETS in self.state.options):
            l.debug('...    simplifying')
            l.debug('...    before:    %s', expr)
            expr = self.state.se.simplify(expr)
            l.debug('...    after:    %s', expr)
        if self.symbolic_return:
            size = len(expr)
            new_expr = self.state.se.Unconstrained(('symbolic_return_' + self.__class__.__name__), size)
            self.state.add_constraints((new_expr == expr))
            expr = new_expr
        self.ret_expr = expr
    ret_addr = None
    if self.use_state_arguments:
        ret_addr = self.cc.teardown_callsite(self.state, expr, arg_types=(([False] * self.num_args) if (self.cc.args is None) else None))
    if (not self.should_add_successors):
        l.debug("Returning    without    setting    exits    due    to    'internal'    call.")
        return
    if (self.ret_to is not None):
        ret_addr = self.ret_to
    if (ret_addr is None):
        raise SimProcedureError('No    source    for    return    address    in    ret()    call!')
    self._exit_action(self.state, ret_addr)
    self.successors.add_successor(self.state, ret_addr, self.state.se.true, 'Ijk_Ret')
