Question: Crat a function which taks four 64-bit intgr argumnts (g. W, X, Y, Z). Your function should comput (W + X) * (Y - Z),
Crat a function which taks four 64-bit intgr argumnts (g. W, X, Y, Z).
Your function should comput (W + X) * (Y - Z), and lav th rsult in RAX whn it rturns.
Your function should accpt th four argumnts using appropriat convntions (s rgistrs listd in th lctur slids).
rdi, rsi, rdx, rcx, r8, r9 should be th main reigsters you use
Your function should NOT print anything - it should ONLY prform th math, and rturn th rsult.
Us a loop to comput th abov function ovr an array of siz 16 (A[0], A[1], ..., A[15])
Dclar an array (in mmory) containing 16 rasonabl 64-bit intgr valus (of your choosing).
Us a loop to itrat ovr th lmnts of th array, and us your function (abov) to calculat th valu of vry four conscutiv array valus.
For xampl, rax = (A[0] + A[1]) * (A[2] - A[3]), thn rax = (A[1] + A[2]) * (A[3] - A[4]), tc.
For ach itration, print out th calculation, th rsult, and start a nwlin (xactly lik this): (5 + 2) * (3 - 4) = -7
Th last itration should comput rax = (A[12] + A[13]) * (A[14] - A[15]) ... (i.. don't calculat past th nd of th array!)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
