'Get the state to start the analysis for function.
:param int function_start: Address of the function
:param SimState state: The program state to base on.'

def _prepare_initial_state(self, function_start, state):

    if (state is None):
        state = self.project.factory.blank_state(mode='static', remove_options=self._state_options_to_remove)
    sp = state.regs.sp
    sp_val = state.se.exactly_int(sp)
    state.memory.set_stack_address_mapping(sp_val, (state.memory.stack_id(function_start) + '_pre'), 0)
    state.registers.store('sp', (sp - 256))
    state.memory.set_stack_size(state.arch.stack_size)
    initial_sp = state.se.any_int(state.regs.sp)
    initial_sp -= state.arch.bytes
    state.memory.set_stack_address_mapping(initial_sp, state.memory.stack_id(function_start), function_start)
    return state
