Below are the codes and what they mean-
The person who told you that neither code has anything to do with the engine performance problem was off the mark on code P0171
Below are the usual causes of a lean code, all of which will give symptoms that your car is having:
LEAN CONDITION CAUSES:
A lean fuel condition may exist if the engine is sucking in too much air and/or the fuel system is not delivering enough fuel. If bad enough, a lean fuel condition may cause lean misfire, a rough idle, hesitation or stumble when accelerating, and/or poor engine performance.
Unmetered air can enter the engine through a vacuum leak, a dirty airflow sensor that is not reading airflow accurately, an EGR valve is not closing and is leaking exhaust into the intake manifold, an EGR valve that is allowing too much flow (because the EGR differential pressure sensor that monitors EGR flow is faulty and is under-reporting EGR flow).
If the problem is not enough fuel, the underling cause may be a weak fuel pump, restricted fuel filter, leaky fuel pressure regulator or dirty fuel injectors.
visually inspect all the vacuum hoses and connections. Look for disconnected, loose or cracked hoses, broken fittings, etc. Vacuum leaks are often elusive, so take your time in checking each vacuum hose
Next, you need to check the intake manifold for sucking air. A good technique for finding intake manifold vacuum leaks is to get a bottle of propane and attach a length of rubber hose to the gas valve. Open the valve so you have a steady flow of gas. Then hold the hose near suspected leak points while the engine is idling. If there is a leak, propane will be siphoned in through the leak. The resulting "correction" in the engine's air/fuel ratio should cause a noticeable change in idle speed and/or smoothness (Note: on engines with computerized idle speed control, disconnect the idle speed control motor first). Aerosol carburetor cleaner can also be used the same way. Remember that both of these are flammable, so if you have sparking anywhere, or plug wires that arc, dont try these method.
Check the PCV valve hose for any sign of swelling or collapsing.
Thoroughly check the EGR valve for leaks, either at vacuum line or at the base of EGR valve. Pull EGR valve and checke for clogged passages and for broken diaphram.
IF this answer has helped please hit the ACCEPT BUTTON or ask for more help. Positive feedback is always appreciated