long reverse_engineer (long a, long b, long c);

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter2: Problem Solving Using C++using
Section2.1: Introduction To C++
Problem 1E: (Practice) State whether the following are valid function names and if so, whether they’re mnemonic...
icon
Related questions
Question

Please Help ASAP!!!

 

For a function with prototype
long reverse_engineer (long a, long b, long c);
GCC generates the following assembly code:
reverse_engineer:
cmpq
jge
.L2:
.L1:
.L3:
cmpq
jle
movq
subq
ret
leaq
ret
cmpq
jle
movq
subq
ret
leaq
ret
%rsi, %rdi
.L1
%rdx, %rdi
.L2
%rdx, %rax
%rdi, %rax
(%rdi,%rdx), %rax
%rdx, %rsi
.L3
%rdx, %rax
%rsi, %rax
(%rsi,%rdx), %rax
Write idiomatic C code (i.e., without goto statements) for the function reverse_engineer that will have an effect
equivalent to the assembly code shown.
Transcribed Image Text:For a function with prototype long reverse_engineer (long a, long b, long c); GCC generates the following assembly code: reverse_engineer: cmpq jge .L2: .L1: .L3: cmpq jle movq subq ret leaq ret cmpq jle movq subq ret leaq ret %rsi, %rdi .L1 %rdx, %rdi .L2 %rdx, %rax %rdi, %rax (%rdi,%rdx), %rax %rdx, %rsi .L3 %rdx, %rax %rsi, %rax (%rsi,%rdx), %rax Write idiomatic C code (i.e., without goto statements) for the function reverse_engineer that will have an effect equivalent to the assembly code shown.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr