Compiled for FreeBSD

Compiled with a minimum of changes for FreeBSD.  Also, compilation with
LLVM caught a number of errors, notably memset size typos, which is good
because those can obviously cause bug.