A Formal Semantics of C with Applications: Technical Report