Question: The given factorial code in ARM assembly is : factorial PUSH {R1, R2, LR} CMP R0, #1 BEQ ret ; return 1 MOV R1, R0
The given factorial code in ARM assembly is :
factorial PUSH {R1, R2, LR} CMP R0, #1 BEQ ret ; return 1 MOV R1, R0 ; kopiera R0 till R1 SUB R0, R0, #1 ; dec R0 BL factorial ; anropa factorial MUL R2, R1, R0 ; int result = fact(n-1)*n MOV R0, R2 ; R0 = result POP {R1, R2, LR} ; return ret MOV R0, #1 ;return 1 POP {R1, R2, LR} ; returnWrite a program in C that, when ran, asks the user for two values whose difference cannot exceed 12 - if it does, give a warning and request the value again. It will then compute the factorial of that sum and prints the result to the screen. The C program must have a prompt that requests input from the user and only exits on explicit user command The C program must find the difference of these two values from an assembly.S file (capital S) The C program must call the factorial function from an assembly.S file (capital S) In your README, answer why the difference of the two values must be less than 13
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
