The whole ABI in one function
This is the chapter finale: a single function that exercises every ABI rule you have learned. It allocates a frame, preserves the link register, keeps two parameters alive across a call in r31/r30, marshals another parameter into the callee's argument register, and then does arithmetic combining both survivors with the returned result.
Consider mash(p, q, r), which calls blendfn(p, r) and computes q - blendfn(...) * p:
stwu r1,-16(r1)
mflr r0
stw r0,20(r1)
stw r31,12(r1)
mr r31,r4 # q survives the call -> r31
mr r4,r5 # marshal r into the 2nd arg slot
stw r30,8(r1)
mr r30,r3 # p survives too -> r30 (and p is also the 1st arg, in r3)
bl blendfn # blendfn(p, r)
mullw r0,r3,r30 # result * p
subf r3,r0,r31 # q - (result * p)
lwz r0,20(r1)
lwz r31,12(r1)
lwz r30,8(r1)
mtlr r0
addi r1,r1,16
blr
Every layer is visible: prologue/epilogue, two saved-register slots, survival moves (q→r31, p→r30), one argument marshal (r→r4, while p is already in r3 for the first arg), the bl, and finally the two-instruction arithmetic weaving the result with both preserved values. p does double duty — first argument to the call and survivor needed afterward — so it sits in r3 for the call and in r30 for the arithmetic.
The target for func_8004287c has the same shape, but the parameter-to-role mapping differs: a different parameter is the survivor used in the multiply, a different one is added at the end, and the marshalling is arranged differently — note which parameter has to be moved into r3 for the call rather than already being there. Trace each register from its argument origin, through its saved-register home, to its final use, and reconstruct the expression.
Your task
Write func_8004287c, which calls work and combines the result with two surviving parameters, to reproduce the target assembly. work is declared for you.