import re


def cstringify(x):
    """Converts str `x` into a C string literal

    :param x str: input string
    :return: C string literal
    """
    return '"{0}"'.format(re.sub(r'[\\"]', r'\\\0', x))