Of course, Pigg flu is the expert on this subject but I think you should start off by having all your codes read by an impartial (NOT smog shop) OBD II reader. Some of your codes may be nothing or just indicate a cheap sensor needs replacing. Also, if you have been taking it to a regular garage, THEY should be able to honestly and properly diagnose it, fix what needs fixing as cheap as possible, clear the codes from it and take it to THEIR smog shop to get a certificate.
Under NO CIRCUMSTANCES should you take it to a “Test and Repair” smog station. They are generally ripoffs and can and will fvck with your car just to show you a report that it didn’t pass so they can “repair” it for X hundreds/thousands of dollars and pass you. If your vehicle has been flagged by the DMV for a Star Station smog test, there are Star Stations which are “Test Only.” You should have your regular German auto mechanic take it to one of those stations, NOT you. They do biz with them on a regular basis and likely WILL get it passed after adjusting/fixing whatever is necessary.
Having had several older cars in my life, I understand how the “system” works. My current vehicle is nearly 20 years old, runs like a champ and the CA DMV has been trying to get vehicles the age of mine off the road for a few years now.