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. Do not use the leal

Given this c program and its assembly, modify the assembly code so that it returns 3*x + 7*y + 14*z. Do not use the leal instruction. Use the 2-operand imull instruction with immediate addressing.

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 movl %ecx, %edx sall $4, %edx subl %ecx, %edx addl %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

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

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions

Question

Discuss how technology impacts HRD evaluation

Answered: 1 week ago