def process_output(init_dict, dict_, x0, flag):
    """The function checks if the criteria function value is smaller for the
    optimization output as for the start values.
    """
    x = min(dict_['crit'], key=dict_['crit'].get)
    if flag == 'adjustment':
        if dict_['crit'][str(x)] < init_dict['AUX']['criteria']:
            x0 = dict_['parameter'][str(x)].tolist()
            crit = dict_['crit'][str(x)]
            warning = """The optimization algorithm has failed to provide the parametrization that leads to the minimal criterion function value. 
                                           The estimation output is automatically adjusted and provides the parameterization with the smallest criterion function value 
                                           that was reached during the optimization.
"""
    elif flag == 'notfinite':
        x0 = init_dict['AUX']['starting_values']
        crit = init_dict['AUX']['criteria']
        warning = (
            'Tho optimization process is not able to provide finite values. This is probably due to perfect separation.'
            )
    return x0, crit, warning
