Lab # 06 Nested Functions Lab Objective: Implementation of nested functions in Assembly language Lab Description: Control flow in C: Invoking a function changes the control flow of a program twice. 1.Calling the function 2.Returning from the function Each time function is called, the CPU has to remember the appropriate return address. Notice that main itself is also a function! It is called by the operating system when you run the program. Control Flow in MIPS: MIPS uses the jump-and-link instruction jal to call functions. —The jal saves the return address (the address of the nextinstruction) in the dedicated register $ra, before jumping to the function. —jal is the only MIPS instruction that can access the value of the program counter, so it can store the return address PC+4 in $ra. jal Fact To transfer control back to the caller, the function just has to jump to the address that was stored in $ra.