The output file for all the algorithms (except unix crypt) when not used in
bare mode is:

3 bytes as: NULL + "m" + \2
1 byte the algorithm (the algorithm's number is defined in lib/mcrypt.h)
1 byte the algorithm's mode (CBC, ECB, CFB, OFB) (also in lib/mcrypt.h)
1 byte storing the mode in which mcrypt read the key. (8bit, 4bit or hash) (0,1,2)
20 bytes a salt if hash key mode is used or nulls if other mode is used.
20 bytes nulls. (reserved for future extensions)
blocksize bytes the IV
 (if CBC,OFB, or CFB. In CBC the IV is encrypted, in OFB or CFB it is unencrypted)
x bytes encrypted data (x=k*blocksize, k=1,2...)
1 byte the number of bytes that didn't fit to the algorithm and were
  padded. (this byte does not exist in CFB and OFB modes) This
  number should be 0 <= x < blocksize
blocksize bytes the crc32 of the plaintext(encrypted using ECB)
  (the first 32 bits of the encrypted text are the crc32, the rest are
   random bits)

For the blocksize refer to lib/mcrypt.c
