Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Convert x86 to Y-86 I'm trying to figure out to convert this x86 assembly code to Y86 form: Given the c program: int sum(int x)

Convert x86 to Y-86

I'm trying to figure out to convert this x86 assembly code to Y86 form:

Given the c program:

 int sum(int x) { if (x == 0 || x ==1) { return 1; } else { return x + sum(x-1); } } 

The following x86-64 assembly code is generated:

sum: cmpl $1, %rdi ja .L8 movl $1, %eax ret .L8: pushq %rbx movl %edi, %ebx leal -1(%rdi), %edi call sum addl %ebx, %eax popq %rbx ret 

How can I convert this to Y86-64 assembly code that does the same thing?

Thank you!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

A Complete Guide To Data Science Essentials

Authors: Miguel

1st Edition

9358684992, 978-9358684995

More Books

Students also viewed these Databases questions