Question: 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.

Given this c program and its assembly, modify the assembly code so

#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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!