def METHOD_NAME(ast, memo=None):
    if isinstance(ast, SimActionObject):
        ast = ast.ast
    if not isinstance(ast, claripy.ast.Base):
        return 0
    if memo is None:
        memo = {}
    result = memo.get(ast.cache_key, None)
    if result is not None:
        return result
    result = 1 + sum(METHOD_NAME(arg, memo) for arg in ast.args)
    memo[ast.cache_key] = result
    return result