Partial translation of aff_tr.c