Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given this c program and its assembly, modify the assembly code so that it returns 3*x + 7*y + 14*z using only shift and add

Given this c program and its assembly, modify the assembly code so that it returns 3*x + 7*y + 14*z using only shift and add (or subtract). Do not use the leal or imull instruction.

image text in transcribed

#include #include "calc . h" int calc(int x, int y, int z) return 3*x 2*y 15*z; //Assembly file "calc.c" .text globl calc .type calc, @function calc: pushl %ebp movl %esp, %ebp movl 8(%ebp), %edx movl 16(%ebp), %ecx leal (%edx,XedX, 2), %eax movl 12 (%ebp), %eax leal (%edx,%eax,2), %eax movi %ecx, %edx sall $4, %edx subl %ecx, %edx add! %edx, %eax popl %ebp ret .size calc, .-calc .ident "GCC: (Ubuntu 4.3.3-5ubuntu4) 4.3.3" .section .note.GNU-stack," ",@progbits

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_2

Step: 3

blur-text-image_3

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

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions