tools: simplify pgt_blocks_to_blocks() algorithm