def basic_block_leaf(G, node, ids_in_basic_block):
    """
    Test whether the node is a leaf node of a basic block
    :param G: Graph
    :param node: node to test
    :param ids_in_basic_block: list of IDs of other nodes in the basic block
    :return: boolean
    """
    bb_leaf = True
    if G.out_degree(node) > 0:
        for n in G.successors(node):
            if n in ids_in_basic_block:
                if G.node[n]['id'] != 'ad_hoc':
                    # Check whether the outgoing edge is a "store"
                    for e in G.out_edges(node, data=True):
                        if 'store' not in e[2]['stmt']:
                            bb_leaf = False
                            break
    return bb_leaf