Question

Here is a “snippet,” a few lines, taken from a C language program. int a, b,...

Here is a “snippet,” a few lines, taken from a C language program.

int a, b, c;

float d, e, f;

c = a + b;

d = e + f;

How many distinct opcodes will appear in the machine code compiled from this C snippet and why?

Homework Answers

Answer #1

for different architecture the values are different.

2 for mov. From memory to cpu reg.

1 to add the cpu reg nd save result to Accumulator.

1 for store from cpu reg 'Accumulator' to memory .

4 for integer addition.

So there are 4  distinct opcodes will appear in the machine code compiled from this C snippet.

basically it also depends on architecture of machine for which you are compiling the program because if there Floating point register support  it will be more.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Create three address code from the program snippet below. int a = 2, b = 8,...
Create three address code from the program snippet below. int a = 2, b = 8, c = 4, d; for (j = 0; j <= 10; j ++) ( a = a * (j * (b / c)); d = a * (j * (b / c)); }
C PROGRAMMING LANGUAGE The following code written in C programming language was run and displays 997705320....
C PROGRAMMING LANGUAGE The following code written in C programming language was run and displays 997705320. Explain why and how this program outputs this number. int main(void) { int a = 5, b =20; int* ptr = &a; int** ptr2 = &ptr; printf("%d\n", ((int)*ptr * (int)*ptr2)); return 0; }
How would I write the following program in C programming language? Function header: int sumsort(int *a,...
How would I write the following program in C programming language? Function header: int sumsort(int *a, int *b, int *c) This function should arrange the 3 values in the memory locations pointed to by a, b, and c in ascending order and also return the sum of the contents of the memory locations a, b, and c.
C program. Given the following code: int add_and_double(int a, int b) { int result = (a...
C program. Given the following code: int add_and_double(int a, int b) { int result = (a + b) * 2; return result; } int main() {   int val; val = add_and_double(12, 40); return 0; } where the function main() (i.e. the caller) calls the function add_and_double() (i.e. the callee). Which of the following actions are taken when main() calls the function add_and_double()?  Select all that apply. a. Once the callee returns, the caller frees the stack memory for the callee's function...
Consider the following variable definitions: char a, *b, *c; int d[2], *e; int i, *j; How...
Consider the following variable definitions: char a, *b, *c; int d[2], *e; int i, *j; How many total bytes does this code allocate for variables?  Assume a 32-bit representation for integer and pointer values. a     sizeof(char) b     sizeof(char *) c     sizeof(char *) d    2*sizeof(int) e     sizeof(int *) i     sizeof(int) j     sizeof(int *) Total number of bytes ? What is the output of the following piece of code? (Use the above variable definitions). j = &i; *j = 50;                      /* i = 50 */ e = &d[0]; *e...
please explain how does the following C code work. a) double ldexp(double x, int exponent) is...
please explain how does the following C code work. a) double ldexp(double x, int exponent) is a C math function that returns x multiplied by 2 raised to the power of exponent. How many narrowing and how many promotions happen automatically in the following code line? Name them one by one and explain each one separately. float f = 2.2f * ldexp(24.4, 3.0 * 2) - 4.4; b) int function1(int num1, int num2) { int num = num1 ^ num2;...
C - Language Write an expression that executes the loop while the user enters a number...
C - Language Write an expression that executes the loop while the user enters a number greater than or equal to 0. Note: These activities may test code with different test values. This activity will perform three tests, with user input of 9, 5, 2, -1, then with user input of 0, -17, then with user input of -1. Also note: If the submitted code has an infinite loop, the system will stop running the code after a few seconds,...
Consider the following C++ program: #include <iostream> #define PRIORITY 10 void main() {             int tableInd =...
Consider the following C++ program: #include <iostream> #define PRIORITY 10 void main() {             int tableInd = 20;             int arrayInd = 30;             cin >> tableInd;             if (tableInd > 50)                arrayInd = PRIORITY;             else                arrayInd = setindex(PRIORITY);             cout << arrayInd; } Answer the following questions: a) At what time is the keyword void bound to its meaning? Language design         Language implementation     Compile          Link    Load    Run b) At what time is the value of PRIORITY bound? Language design         Language implementation     Compile          Link    Load    Run c) At what...
How many “words” are there of length 4, with distinct letters, from the letters {a, b,...
How many “words” are there of length 4, with distinct letters, from the letters {a, b, c, d, e, f}, in which the letters appear in increasing order alphabetically. A word is any ordering of the six letters, not necessarily an English word.
Consider the following program listing that is written in the C Language: #include <msp430.h> void main(void);...
Consider the following program listing that is written in the C Language: #include <msp430.h> void main(void); { WDTCTL = WDTPW|WDTHOLD; unsigned char a=0x14; unsigned char b=0xDC; unsigned char c,d,e,f; c = a^b; d = a|b; e = ~d; f = ~e; while(1); } 1) Are the declared data types local or global variables? 2) Perform bitwise logical analysis to determine the unknown values of the given logic expressions. 3) Show the correct addresses and contents for all variables in the...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT