Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Examine the code below. According to the code, three functions are called from the main. Select any one of the functions called from the main

Examine the code below. According to the code, three functions are called from the main. Select any one of the functions called from the main code (function1, function2, and function3). Using the GDB debugger, analyse the assembly code when the selected function is called by the main program for a 32-bit system. The assembly code of the selected function should be explained. Repeat the same process (assembly code analysis) when the code is compiled for a 64-bit system. Compare how the stack and registers are used for the 32 and 64-bit systems. Comparative analysis should also include how function arguments are passed. #include #include #include int function1(int x, int y, int z) { int result_func1; result_func1 = x + y + z; return result_func1; } int function2(int x, int y, char* input_string) { int result_func2; char buffer[20]; strcpy(buffer, input_string); printf("Your input string %s is copied in the buffer ", input_string); result_func2 = x - y; return result_func2; } void function3(int result1, int result2) { printf("The result of function 1 is %d ", result1); printf("The result of function 2 is %d ", result2); } void function4(void) { printf("This function never gets called "); exit(-1); } int main(int argc, char* argv[]) { int result1; int result2; result1 = function1(5, 10, 15); result2 = function2(20, 8, argv[1]); function3(result1, result2); }

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions

Question

Explain the purpose of the procedure shown in Figure 10C-69.

Answered: 1 week ago