'Save the final state of a function, and merge it with existing ones if there are any.
:param FunctionKey function_key: The key to this function.
:param int function_address: Address of the function.
:param SimState state: Initial state of the function.
:return: None'

def _save_function_final_state(self, function_key, function_address, state):

    l.debug('Saving    the    final    state    for    function    %#08x    with    function    key    %s', function_address, function_key)
    if (function_key in self._function_final_states[function_address]):
        existing_state = self._function_final_states[function_address][function_key]
        merged_state = existing_state.merge(state, plugin_whitelist=self._mergeable_plugins)[0]
        self._function_final_states[function_address][function_key] = merged_state
    else:
        self._function_final_states[function_address][function_key] = state
