First off Welcome to all things XS650.
Second off, the more information about yourself, or more precisely, your experience around bikes, mechanical and electrical, the better for us to understand if a reply to an answer is based on knowledge or an assumption or hunch.
A saying carved in wood from one of the most experienced members, (RIP Griz'd1), used to say Fuel problems should not be confused with electrical problems and 90% of fuel problems are electrical. Don't dismiss advice because your mind is leaning/blinkered towards another reason, 5Twins does know his stuff. Maybe wrong in this case but to not check and eliminate his answer because you don't think it is the reason is not a reason to and we do not know what knowledge/experience level your at
A recent members problem similar to yours where the bike would die on deceleration ended up being an electrical issue with a loose connection that only seemed to show up on deceleration.
From your pic.....................Your speedo is from an 80-83 model...............the engine side-cover is from a 70 or 71 model. Early 71 model have a smaller oil pump which Yamaha increased. Something to keep in mind...................I see fuel has been leaking on to the top of the carb.......................You header ha an unusual amount of disscoulouring caused by???? Factory headers are double walled and should never stain unless the inner wall has rusted through or the carbs are in very poor tune................I see no hose clip on the vacuum hose on the manifold barb. I have had a hose heat up, get loose causing the bike to stop by not using a hose clamp.............
There are things that have been changed on the bike, so can't take things for granted.
Nice bike, I love those Blue 78's, should be a lot of fun once sorted