align-mem.sh: more flexible rewrite