It is very possible that your Toyota Corolla's ignition timing being off (more than likely retarded a few degrees) was helping keep emissions low. Advanced timing will usually increase HC, CO and NO emissions. Retarding the ignition timing lowers these emissions, but fails the function portion of the smog test. There is a possibility that your Toyota Corolla's catalytic converter is defective. A CAT "snap" or "intrusive" test will tell for sure. If the CAT does need replacement you should be looking around $400.00 for parts and labor. A California legal catalytic converter for your Toyota Corolla should run between $250 - $300. The remainder you should expect to pay for labor. Keep in mind this does not include any diagnosis fee to ensure the CAT is causing your Toyota to fail the smog check. A smog repair station will usually charge 2 hours of labor to diagnose a smog check failure for a definitive answer on the failures cause.