'Shrink the size of a node in CFG.
:param CFGNode node: The CFGNode to shrink
:param int new_size: The new size of the basic block
:param bool remove_function: If there is a function starting at `node`, should we remove that function or not.
:return: None'

def _shrink_node(self, node, new_size, remove_function=True):

    new_node = CFGNode(node.addr, new_size, self, function_address=(None if remove_function else node.function_address), instruction_addrs=[i for i in node.instruction_addrs if (node.addr <= i < (node.addr + new_size))])
    old_in_edges = self.graph.in_edges(node, data=True)
    for (src, _, data) in old_in_edges:
        self.graph.add_edge(src, new_node, **data)
    successor_node_addr = (node.addr + new_size)
    if (successor_node_addr in self._nodes):
        successor = self._nodes[successor_node_addr]
    else:
        successor = CFGNode(successor_node_addr, new_size, self, function_address=(successor_node_addr if remove_function else node.function_address), instruction_addrs=[i for i in node.instruction_addrs if (i >= (node.addr + new_size))])
    self.graph.add_edge(new_node, successor, jumpkind='Ijk_Boring')
    has_resolved_targets = any([(node_.addr != self._unresolvable_target_addr) for node_ in self.graph.successors(successor)])
    old_out_edges = self.graph.out_edges(node, data=True)
    for (_, dst, data) in old_out_edges:
        if ((has_resolved_targets and (dst.addr != self._unresolvable_target_addr)) or (not has_resolved_targets)):
            self.graph.add_edge(successor, dst, **data)
    if ((node.addr in self._nodes) and (self._nodes[node.addr] is node)):
        del self._nodes[node.addr]
    if ((node.addr in self._nodes_by_addr) and (node in self._nodes_by_addr[node.addr])):
        self._nodes_by_addr[node.addr].remove(node)
    self.graph.remove_node(node)
    self._nodes[new_node.addr] = new_node
    self._nodes_by_addr[new_node.addr].append(new_node)
    if (node.addr in self.kb.functions):
        del self.kb.functions[node.addr]
        if (not remove_function):
            self._function_add_node(node.addr, node.addr)
            successor_node = self.get_any_node(successor_node_addr)
            if (successor_node and (successor_node.function_address == node.addr)):
                if (not self.graph.predecessors(successor_node)):
                    self._function_add_node(successor_node_addr, successor_node_addr)
