The code saves arguments and return addresses on the stack before calling functions. It calls the dofsum function, passing arguments 2 and 3, saves the return value, and restores arguments and return addresses when returning. The dofsum function saves its return address, calls the sum function, returns the result and restores its return address.