Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Translate the following code to x86. Assume standard conventions for passing par

ID: 3787617 • Letter: T

Question

Translate the following code to x86. Assume standard conventions for passing parameters and return values using registers. int minus Two (int n) {n = n - 2: return n;} Translate the following code to x86. Assume standard conventions for passing parameters and return values using registers. Use %rcx for n, and %rbx for m. n = 1 2; m = minusTwo (n); n = n + m; Assume your previous code from questions 5 and 6 both use the same register %rbx, to hold different values. Write code for minusTwo that demonstrates proper "filling" and "spilling" of %rbx to the stack.

Explanation / Answer

6)

main:

mov %rcx,#0CH

push %rcx

mov %rbx,[esp+4]

mov %rax,%rcx

add %rax,%rbx

mov %rcx,%rax

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote