i annotate the assembly code use the line numbers in your annotations ii hence work out the c function that it was compiled from
(i)Annotate the assembly code (use the line numbers in your annotations).
(ii) Hence work out the C-function that it was compiled from.
1. pushq %rbp
2. movq %rsp, %rbp
3. movl %edi, -4(%rbp)
4. movl %esi, -8(%rbp)
5. movl -4(%rbp), %eax
6. cmpl -8(%rbp), %eax
7. jge .L2
8. movl -4(%rbp), %eax
9. jmp .L3
10. .L2:
11. movl -8(%rbp), %eax
12. .L3:
13. popq %rbp
14. ret
_________________________________________________________________________________
int fun1(int a, int b) {
if (b < a)
return b;
else
return a;
}
________________________________________________________________________________
int fun2(int a, int b){
if (a < b)
return a; else
return b;
}
_________________________________________________________________________________
int fun3(int a, int b) {
unsigned ua = (unsigned) a; if (ua < b)
return b;
else
return ua;
}

