/* Code for a generic function 'f' will have the following
     structure (for IA32).
   --Dr. Zoppetti
*/	

f:
	// ** SETUP CODE **
	// Save old base pointer
	pushl %ebp
	// Make base pointer point to top of stack
	movl  %esp, %ebp
	// Save callee-save registers if using them (ebx, esi, edi)
	// Saving and restoring can be done with push and pop instructions
	...

	// ** Body of 'f' **
	...

	// If we're going to call another function, 'f' 
	//   becomes a caller, so save the caller-save registers
	//   if we want their values preserved (eax, ecx, edx)
	...
	call g
	// Restore caller-save registers which were saved
	...

	// ** FINISH CODE **
	// Restore callee-save registers which were saved
	...
	// Move stack pointer up
	movl %ebp, %esp
	// Restore old base pointer
	popl %ebp
	// Return to caller
	ret
