Converted md.c to C++

Removed unused variables, added missing headers, added missing
extern "C" specifiers. Removed assignments of unused values.

Made the code always call init_nlistheuristics(), in order to suppress
a clang-static-analyzer check that thinks (for example) MULTISIM(cr)
can change its value over MD loops. Calling that init function is
cheap, outside the MD loop, has no effect because those code paths are
always protected by a check for nstlist == -1, and probably those code
paths will go away shortly.

Change-Id: I8abb8ef28c121c7b5432bf38d958c0b2a55ed9da