Kolbe Schmitt followed by methylation
Collecting my comment thoughts together, there is an early demethylation step in this synthesis. Structure 1 is the result of carboxylation while methylation provides ester N. Friedel-Crafts acylations of anisoles at the ortho-position can undergo demethylation via aluminum chelation. Magnesium chelate 2 is a candidate for demethylation by iodide ion. Phenol O undergoes thermal dehydration catalyzed by the acidic phenolic hydroxyl group. Steps P --> Q are straightforward. Step R --> S methylates the phenol hydroxyl and excess KOH insures that any ester that is formed is saponified. Clemmensen reduction of S and remethylation afford T. 
Addendum: The OP's comment reveals that T is a carboxylic acid, not a methyl ester. Presumably the Clemmensen reduction effected some demethylation which is the reason for the last methylation step.