Quiz on Chapter 5 Assembly Language 1. Why is it does it take two passes for the assembler to generate code for the following snippet: cmp [ebp+4],10 jle elsepart mov eax,1 jmp endifpart elsepart: mov eax,0 endifpart: 2. Write the assembly code to call a subroutine called SumOf3 with the following prototype: int SumOf3(int a,int b,int c); So that it mimicks the following C snippet: int x,y,ans; . . int ans=SumOf3(0,x,y); Use x,y, and ans in the assembly code to represent the address of x,y and ans in the C code. 3. Write an assembly version of SumOf3 which returns the sum of its arguments. In C it would be written as int SumOf3(int a,int b,int c) { return a+b+c; } 4. Write the assembly code to call a subroutine called USort2 with the following prototype: void USort2(unsigned *a,unsigned *b); So that it mimicks the following C snippet: unsigned x,y; . . USort2(&x,&y); As before, use x and y in the assembly code to represent the address of x and y in the C code. 5. Write an assembly version of the C snippet if (x > y) { int tmp=x; x=y; y=tmp; } Where x and y are unsigned int values. 6. Write an assembly version of the C snippet int i,sum; sum=0; for (i=1; i<100; ++i) sum += i; 7. Write an assembly version of the C snippet if (x>1 && y<3) z=0; assume x,y, and z are signed ints 8. Write an assembly version of the C snippet if (x<1 || y>3) z=0; assume x,y, and z are unsinged ints 9. In general order of priority, what are some things you should try as a developer to speed up the execution of an application that is running too slowly?