(Solved) : 10 Question 4 Armv8 Assembly Programmer Created Code Keeps Producing Incorrect Results Inc Q43960402 . . .
![[10] Question 4 - ARMv8 Assembly A programmer created some code that keeps producing incorrect results. Very incorrect result](https://media.cheggcdn.com/media/598/5987e871-ab53-49c3-9ef3-93ed7278bcce/phpKfuxNh.png)
[10] Question 4 – ARMv8 Assembly A programmer created some code that keeps producing incorrect results. Very incorrect results. It almost seems like random numbers are being returned. permutations: sub sp, sp, #8 // calling other fn’s str Ir, (sp,#0] // Need to save LR sub x9, x0, x1 // X9 <-N-K The programmer was building a function to calculate the number of permutations of K objects chosen out of N objects. This function is expected to have two arguments, N and K, in that order. It is expected to return. bl factorial // XO <- factorial(N) mov x10, XO // Put N! in x10 It is making use of a factorial function that already exists and is already proven to work. All numbers will be unsigned numbers. N is always greater than or equal to K. mov x0, x9 // XO <-N-K bl factorial // XO <-factorial(N-K) udiv x0, x10, xo // X0 = N!/(N-K)! Why is the code for this function returning incorrect results? What needs to be done to fix it? Idr Ir, (sp,#0] // Restore LR add sp, sp, #8 // Reset the stack ret Show transcribed image text [10] Question 4 – ARMv8 Assembly A programmer created some code that keeps producing incorrect results. Very incorrect results. It almost seems like random numbers are being returned. permutations: sub sp, sp, #8 // calling other fn’s str Ir, (sp,#0] // Need to save LR sub x9, x0, x1 // X9
Expert Answer
Answer to [10] Question 4 – ARMv8 Assembly A programmer created some code that keeps producing incorrect results. Very incorrect r…
OR