<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def compile(*files, exe_name=None, cc=CC, **cflags):
 """ Compile C source files. :param files: filenames to be compiled :param exe_name: name of resulting executable :param cc: compiler to use (:data:`check50.c.CC` by default) :param cflags: additional flags to pass to the compiler :raises check50.Failure: if compilation failed (i.e., if the compiler returns a non-zero exit status). :raises RuntimeError: if no filenames are specified If ``exe_name`` is None, :func:`check50.c.compile` will default to the first file specified sans the ``.c`` extension:: check50.c.compile("foo.c", "bar.c") # clang foo.c bar.c -o foo -std=c11 -ggdb -lm Additional CFLAGS may be passed as keyword arguments like so:: check50.c.compile("foo.c", "bar.c", lcs50=True) # clang foo.c bar.c -o foo -std=c11 -ggdb -lm -lcs50 In the same vein, the default CFLAGS may be overriden via keyword arguments:: check50.c.compile("foo.c", "bar.c", std="c99", lm=False) # clang foo.c bar.c -o foo -std=c99 -ggdb """


    if not files:
        raise RuntimeError(_("compile requires at least one file"))

    if exe_name is None and files[0].endswith(".c"):
        exe_name = Path(files[0]).stem

    files = " ".join(files)

    flags = CFLAGS.copy()
    flags.update(cflags)
    flags = " ".join((f"-{flag}" + (f"={value}" if value is not True else "")).replace("_", "-")
                     for flag, value in flags.items() if value)

    out_flag = f" -o {exe_name} " if exe_name is not None else " "

    run(f"{cc} {files}{out_flag}{flags}").exit(0)