It's annoying to have to maintain multiple, nearly identical chains of if statements which all set the same attributes.
Add a helper function, addFlagsUsingAttrFn which performs the attribute setting.
Then, use wrappers for that function in lowerCall and setArgFlags.
(Note that the flag-setting code in setArgFlags was missing the returned attribute. There's no selection for this yet, so no test. It's an example of the kind of thing this lets us avoid, though.)