Return from a function popping N bytes from the stack
    Use '__fastcall__' as 1st parameter, to just return
336045
def _leave(ins):
    
    global FLAG_use_function_exit

    output = []

    if ins.quad[1] == '__fastcall__':
        output.append('ret')
        return output

    nbytes = int(ins.quad[1])  # Number of bytes to pop (params size)

    if nbytes == 0:
        output.append('ld sp, ix')
        output.append('pop ix')
        output.append('ret')

        return output

    if nbytes == 1:
        output.append('ld sp, ix')
        output.append('pop ix')
        output.append('inc sp')  # "Pops" 1 byte
        output.append('ret')

        return output

    if nbytes <= 11:  # Number of bytes it worth the hassle to "pop" off the stack
        output.append('ld sp, ix')
        output.append('pop ix')
        output.append('exx')
        output.append('pop hl')
        for i in range((nbytes >> 1) - 1):
            output.append('pop bc')  # Removes (n * 2  - 2) bytes form the stack

        if nbytes & 1:  # Odd?
            output.append('inc sp')  # "Pops" 1 byte (This should never happens, since params are always even-sized)

        output.append('ex (sp), hl')  # Place back return address
        output.append('exx')
        output.append('ret')

        return output

    if not FLAG_use_function_exit:
        FLAG_use_function_exit = True  # Use standard exit
        output.append('exx')
        output.append('ld hl, %i' % nbytes)
        output.append('__EXIT_FUNCTION:')
        output.append('ld sp, ix')
        output.append('pop ix')
        output.append('pop de')
        output.append('add hl, sp')
        output.append('ld sp, hl')
        output.append('push de')
        output.append('exx')
        output.append('ret')
    else:
        output.append('exx')
        output.append('ld hl, %i' % nbytes)
        output.append('jp __EXIT_FUNCTION')

    return output
1292861
def tco_return_handle(tokens):
    """"""
    internal_assert(len(tokens) == 2, "invalid tail-call-optimizable return statement tokens", tokens)
    if tokens[1].startswith("()"):
        return "return _coconut_tail_call(" + tokens[0] + ")" + tokens[1][2:]  # tokens[1] contains \n
    else:
        return "return _coconut_tail_call(" + tokens[0] + ", " + tokens[1][1:]
918752
function recomputeCallback(){
  var len = TO_CALL.length;
  CALL_TIMEOUT = null;
  while(len--){
    (TO_CALL.shift() || NOOP).call();
  }

  TO_CALL.added = {};
}
529447
def call_fn(self, what, *args, **kwargs):
        
        logger.debug('f_{0}:{1}{2}({3})'.format(
            self.call_stack_level,
            ' ' * 4 * self.call_stack_level,
            what,
            arguments_as_string(args, kwargs)))
        port, fn_name = self._what(what)
        if port not in self['_initialized_ports']:
            self._call_fn(port, 'init_adapter')
            self['_initialized_ports'].append(port)
        return self._call_fn(port, fn_name, *args, **kwargs)
324963
def run_func(func, *args, **kwargs):
    """"""
    ray.init()

    func = ray.remote(func)

    # NOTE: kwargs not allowed for now
    result = ray.get(func.remote(*args))

    # Inspect the stack to get calling example
    caller = inspect.stack()[1][3]
    print("%s: %s" % (caller, str(result)))

    return result
181466
function callnTimes (object, methodName, count) {
    let returnValue
    while (count--) returnValue = object[methodName]()
    return returnValue
  }
1186320
def runcall(self, func, *args, **kw):
        
        # XXX where is this used ? can be removed ?
        self.enable_by_count()
        try:
            return func(*args, **kw)
        finally:
            self.disable_by_count()
244339
def call_cur(f):
  ""
  @functools.wraps(f)
  def f2(self, *args, **kwargs):
    with self.withcur() as cur:
      return f(self, cur, *args, **kwargs)
  return f2
647771
def _multi_call(function, contentkey, *args, **kwargs):
    '''
    
    '''
    ret = function(*args, **kwargs)
    position = ret.get('position')

    while position:
        more = function(*args, position=position, **kwargs)
        ret[contentkey].extend(more[contentkey])
        position = more.get('position')
    return ret.get(contentkey)
1175630
def profile(func):
    
    @inlineCallbacks
    def callme(*args, **kwargs):
        start = time.time()
        ret = yield func(*args, **kwargs)
        time_to_execute = time.time() - start
        log.msg('%s executed in %.3f seconds' % (func.__name__, time_to_execute))
        returnValue(ret)
    return callme
719907
def visit_FunctionCall(self, node):
        """"""
        call = self.memory[node.identifier.name]._node
        args = [self.visit(parameter) for parameter in node.parameters]

        if isinstance(call, AST):
            current_scope = self.memory.stack.current.current
            memory_functions = {
                key: current_scope[key]
                for key in current_scope
                if isinstance(current_scope[key], Function)
            }

            self.memory.append_frame()
            for i, arg in enumerate(args):
                self.memory[i] = arg

            for function in memory_functions:
                self.memory[function] = memory_functions[function]

            function_result = self.visit(call)

            self.memory.pop_frame()
            return function_result
        else:
            return bind_type(call(*args))
335459
def async_call(func, *args, callback=None):
    '''
    '''
    def do_call():
        result = None
        error = None

        try:
            result = func(*args)
        except Exception:
            error = traceback.format_exc()
            logger.error(error)
        if callback:
            GLib.idle_add(callback, result, error)

    thread = threading.Thread(target=do_call)
    thread.daemon = True
    thread.start()
871637
def call(self, func, *args, **kwargs):
        
        wrapped = self.wrap(func)
        return wrapped(*args, **kwargs)
1256666
def rec_apply(func, n):
    
    if n > 1:
        rec_func = rec_apply(func, n - 1)
        return lambda x: func(rec_func(x))
    return func
305196
def flip(f: Callable) -> Function:
    
    nargs_, nouts_, ndefs_ = nargs(f), nouts(f), ndefs(f)
    return WrappedFunction(lambda *args, **kwargs: f(args[1], args[0], *args[2:], **kwargs),
                           nargs=nargs_, nouts=nouts_, ndefs=ndefs_)
245554
def call(self, func, *args, **kwargs):
        
        t0 = time.time()
        try:
            recv = self.call_async(func, *args, **kwargs)
            return self._rethrow(recv)
        finally:
            LOG.debug('Call took %d ms: %r', 1000 * (time.time() - t0),
                      mitogen.parent.CallSpec(func, args, kwargs))
3881
def _api(fn):
        """"""
        @_functools.wraps(fn)
        def _fn(self, *args, **kwargs):
            self._throttle_wait()
            if not self._SID:
                raise RuntimeError('Session closed. Invoke connect() before.')
            return fn(self, *args, **kwargs)
        return _fn