There is a bug that causes invalid output when the input file is larger then the BLOCKLEN. Set BLOCKLEN to 4096 and run the program on the test input file [1] (compare with output file [2]), to see the problem on a smaller input file.
The bug happens when read_sequence() is called with partial data saved from the last sequence, since (size == read) the first fread() will be asked for 0 bytes which causes the read loop to end early (n == 0).
1. http://benchmarksgame.alioth.debian.org/u32/iofile.php?test=...
2. http://benchmarksgame.alioth.debian.org/u32/iofile.php?test=...