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.
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...
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.
Using the program below, identify the values of pid at lines A, B, C, and D....
Using the program below, identify the values of pid at lines A, B, C, and D. (Assume that the actual pids of the parent and child are 2600 and 2603, respectively.)   #include <sys/types.h>   #include <stdio.h>   #include <unistd.h>      int main()   {   pid_t pid, pid1;        /* fork a child process */     pid = fork();        if (pid lt; 0) { /* error occurred */       fprintf(stderr, "Fork Failed");       return 1;     }     else if (pid == 0) { /* child process */       pid1 = getpid();       ...
QUESTION 1 For the following recursive function, find f(5): int f(int n) { if (n ==...
QUESTION 1 For the following recursive function, find f(5): int f(int n) { if (n == 0)    return 0; else    return n * f(n - 1); } A. 120 B. 60 C. 1 D. 0 10 points    QUESTION 2 Which of the following statements could describe the general (recursive) case of a recursive algorithm? In the following recursive function, which line(s) represent the general (recursive) case? void PrintIt(int n ) // line 1 { // line 2...
Here is a bit of Java code: Thing t = new Thing(); t.method( (int i)-> i...
Here is a bit of Java code: Thing t = new Thing(); t.method( (int i)-> i + 1 ); Here is a skeleton for class Thing: class Thing { public interface Mystery { ????? } public void method( Mystery param ) { // body of method omitted } } Which text below would work where ????? is given above: a) void method( int i ); b) int method( int i ); c) abstract int method( int i ); d) abstract...
Write a C++ program that processes orders for our company Widgets and More. Your program will...
Write a C++ program that processes orders for our company Widgets and More. Your program will read the product code and quantity for all the products in an order from a file, order.txt. You will be given a sample order.txt with the starter code. There are two items on each line of the file the first is a letter that represents the product and the second is an integer representing the number bought. Based on the product and quantity, you...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g,...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g, char wordlist[][MAX_WORD_LENGTH], int numwords)] for a C program hangman game. (The existing code for other functions and the program is below, along with what the function needs to do) What int setup_game needs to do setup_game() does exactly what the name suggests. It sets up a new game of hangman. This means that it picks a random word from the supplied wordlist array and...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT