x86: promote arguments to C functions according to the ABI (#7383)

I don't think the x86-64 version is quite right, but this ought to be
enough to pass cgrun071.

This code is terrible and needs a complete refactor.  There's a lot of
duplication, and we ought to be specifying the ABI in a much more
abstract way (like LLVM).