Question: 4 . ( 1 9 Points ) Consider the following assembly program, ` ` ` TITLE factorial INCLUDE Irvine 3 2 . inc . DATA

4.(19 Points) Consider the following assembly program,
```
TITLE factorial
INCLUDE Irvine32.inc
.DATA
. CODE
main PROC
xor edx,edx
push 5
call Factorial
pop ebx
mul ebx
call WriteDec
call Crlf
exit
main ENDP
; Calculate a factorial
Factorial PROC
push ebp
mov ebp,esp
mov eax,[ebp+8]
cmp eax,1
ja L1
mov eax,1
pop ebp
ret
L1:
dec eax
push eax
call Factorial
pop ebx
mul ebx ; EDX:EAX = EAX * EBX
pop ebp
ret
Factorial ENDP
. END main
```
(factorial.asm)
Answer the following questions based on the above 'factorial' program.
a)[4 Points] Why STACK OVERFOW might occur in the above 'factorial' program?
[ANSWER]
b)[5 Points] List the statements (in line numbers) specifying the terminating condition of the above 'factorial' program? What is the terminating condition of the above 'factorial' procedure?
[ANSWER]
4 . ( 1 9 Points ) Consider the following

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!