Intake and exhaust system optimization of internal combustion engines