In the third step, compound A may be reduced using any suitable reducing agent to give tetrahydroberberine compound B. Typically, borohydrides may be used as the reducing agent, such as sodium borohydride, sodium cyanoborohydride, or sodium triacetoxyborohydride.