def add_builtin_typedefs(source: str) -> str:
    """Add built-in typedefs to the source code (m2c emits those, so it makes
    sense to pre-define them to simplify hand-written C contexts)."""
    typedefs = {
        "u8": "unsigned char",
        "s8": "char",
        "u16": "unsigned short",
        "s16": "short",
        "u32": "unsigned int",
        "s32": "int",
        "u64": "unsigned long long",
        "s64": "long long",
        "f32": "float",
        "f64": "double",
    }
    line = " ".join(f"typedef {v} {k};" for k, v in typedefs.items())
    return line + "\n" + source