def get_reset_state_name(t_fsm):
    """
    Returns the name of the reset state.

    If an .r keyword is specified, that is the name of the reset state.
    If the .r keyword is not present, the first state defined 
    in the transition table is the reset state.

    :param t_fsm: blifparser.BlifParser().blif.fsm object
    :return str reset_state: name of the reset state
    """
    reset_state = None
    if t_fsm.r is None:
        if len(t_fsm.transtable) > 0:
            reset_state = t_fsm.transtable[0][1]
    else:
        reset_state = t_fsm.r.name
    
    return reset_state