Write decoder based on comments in record-full.c