Separate functions into more logical groups

Move arithmatic functions to arith.c, all i/o into io.c, then allocating and
freeing into data.c, and endian swapping into endian.c