
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Consider the following C functions and assembly code:

Transcribed Image Text:int fun1(int a, int b)
{
}
int
{
}
int
{
if (a < b)
else
return a;
return b;
fun2(int a, int b)
if (b < a)
else
return b;
else
return a;
fun3(int a, int b)
unsigned ua = (unsigned) a;
if (ua < b)
return b;
return ua;
push1 %ebp
mov1 %esp,%ebp
movl 8(%ebp),%edx
movl 12 (%ebp),%eax
cmp1 %eax,%edx
jge .L9
mov1 %edx, %eax
.L9:
movl %ebp,%esp
pop1 %ebp
ret
}
Which of the functions compiled into the assembly code shown?
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images

Knowledge Booster
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
- Convert the following c++ code into pep9 assembly language. #include <iostream> using namespace std; void times(int& prod, int mpr, int mcand) { prod = 0; while (mpr != 0) { if (mpr % 2 == 1) prod = prod + mcand; mpr /= 2; mcand *= 2; } } int main(){ int product, n, m; cout << "Enter two numbers: "; cin >> n >> m; times(product, n, m); cout << "Product: " << product << endl; return 0; }arrow_forwardStep 1: Convert the assembly code into C++ code. Step 2: Explain the function of the converted C++ code. Assembly Code movl -8(%rbp), %eax $3, %eax $3, %eax %eax, -4(%rbp) movl -8(%rbp), %eax $2, %eax $1, %eax 7(%rax), %edx %eax, %eax cmovs %edx, %eax $3, %eax %eax, -4(%rbp) movl -8(%rbp), %eax 7(%rax), %edx C++ Code Explanation of Functionality sall subl movl sall subl leal testl sarl movl leal testl %eax, %eax cmovs %edx, %eax sarl $3, %eax movl -8(%rbp), %edx sall addl $2, %edx %edx, %eax movl %eax, -4(%rbp)arrow_forwardConvert the following c++ code into pep9 assembly language. #include <iostream> using namespace std; void times(int& prod, int mpr, int mcand) { prod = 0; while (mpr != 0) { if (mpr % 2 == 1) prod = prod + mcand; mpr /= 2; mcand *= 2; } } int main(){ int product, n, m; cout << "Enter two numbers: "; cin >> n >> m; times(product, n, m); cout << "Product: " << product << endl; return 0; }arrow_forward
- What are the potential challenges in serializing function objects, especially when transitioning across heterogeneous systems?arrow_forwardConvert the following c++ code into pep9 assembly language #include <iostream> using namespace std; void times(int& prod, int mpr, int mcand) { prod = 0; while (mpr != 0) { if (mpr % 2 == 1) prod = prod + mcand; mpr /= 2; mcand *= 2; } } int main(){ int product, n, m; cout << "Enter two numbers: "; cin >> n >> m; times(product, n, m); cout << "Product: " << product << endl; return 0; }arrow_forwardWrite and explain any two preprocessor directives in C.arrow_forward
- How do I present a complete and syntactically correct example of C/C++ code that prevents wrap around when adding, subtracting, OR multiplying either unsigned char, unsigned short, OR unsigned long data types (select one operation and one data type).arrow_forwardPlease help me answer the questionsarrow_forwardShow the function header for a void function that takes a 2-dimensional character array of 3 rows and 4 columns in C++. Choose another language that passes the array in a different manner.arrow_forward
- Convert the following C++ programs into Pep/9 assembly #include <iostream> using namespace std; void times(int& prod, int mpr, int mcand) { prod = 0; while (mpr != 0) { if (mpr % 2 == 1) prod = prod + mcand; mpr /= 2; mcand *= 2; } } int main(){ int product, n, m; cout << "Enter two numbers: "; cin >> n >> m; times(product, n, m); cout << "Product: " << product << endl; return 0; } Submit: Pep/9 source code along with screen capture showing it running in the Pep simulatorarrow_forwardDefine a Haskell data type to represent λ-terms. Give the data type definitions and show how you can represent the λ-term λxf.fx using your data type.arrow_forward15. Translate the following C program to Pep/9 assembly language. #include int main() { int numitms, j, data, sum; scanf("%d", &numItms); sum = 0; for (j = 1; j <= numitms; j++) { scanf("%d", &data); sum += data; } printf ("Sum: %d\n", sum); return 0; } Sample Input 48-376 Sample Output Sum: 18arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education