Command line arguments are passed to int main(int argc, char** argv) as arguments argc and argv . You should assume that argc is at ebp+8 and argv is at ebp+12. This program is invoked from the...


Command line arguments are passed toint main(int argc, char** argv) as argumentsargc andargv. You should assume thatargc is at ebp+8 andargv
is at ebp+12.


This program is invoked from the command line as shown:


./program 5 7


The procedure namedwhat is called frommain, and returns tomain with the value:



Options:


a) 11


b) 66


20<br>21 <main><br>22 <main+4><br>Өx4(%esp),%eсx<br>$0xfffffff0,%esp<br>-0x4 (%eсx)<br>%ebp<br>%esp,%ebp<br>lea<br>and<br>23 <main+7><br>pushl<br>24 <main+10> push<br>25 <main+11><br>26 <main+13><br>mov<br>push<br>push<br>%ebx<br>27 <main+14><br>%есх<br>28 <main+15><br>$0x10,%esp<br>%есх,%ebx<br>Өx4(%ebx),%eаx<br>$0x4,%eax<br>(%eax),%eaх<br>$0xc,%esp<br>sub<br>29 <main+18><br>mov<br>30 <main+20><br>31 <main+23><br>mov<br>add<br>32 <main+26><br>mov<br>33 <main+28><br>sub<br>34 <main+31><br>35 <main+32><br>push<br>%eax<br><atoi@plt><br>$0x10,%esp<br>%eax,-0xc(%ebp)<br>Оx4(%ebx),%eax<br>$0x8,%eax<br>(%eax),%eax<br>$0xc,%esp<br>call<br>36 <main+37><br>add<br>37 <main+40><br>mov<br>38 <main+43><br>mov<br>39 <main+46><br>40 <main+49><br>add<br>mov<br>41 <main+51><br>sub<br>push<br>call<br>42 <main+54><br>%eax<br>43 <main+55><br>44 <main+60><br><atoi@plt><br>$0x10,%esp<br>%eax,-0x10(%ebp)<br>-0x10 (%ebp),%eax<br>Өx1(%eаx),%edx<br>-0xс(%ebp), %eax<br>$0x2,%eax<br>$0x8,%esp<br>add<br>45 <main+63><br>mov<br>46 <main+66><br>mov<br>47 <main+69><br>48 <main+72><br>lea<br>mov<br>49 <main+75><br>add<br>50 <main+78><br>sub<br>51 <main+81><br>push<br>push<br>call<br>%edx<br>52 <main+82><br>53 <main+83><br>%eax<br><what><br>54 <main+88><br>$0x10,%esp<br>%eax,-0x14(%ebp)<br>$0x0,%eax<br>-0x8(%ebp),%esp<br>add<br>55 <main+91><br>mov<br>56 <main+94><br>mov<br>57 <main+99><br>58 <main+102> рор<br>59 <main+103> роp<br>60 <main+104> роp<br>lea<br>%ecx<br>%ebx<br>%ebp<br>-0x4(%eсx),%esp<br>61 <main+105> lea<br>62 <main+108> ret<br>63 |<br>

Extracted text: 20 21
22 Өx4(%esp),%eсx $0xfffffff0,%esp -0x4 (%eсx) %ebp %esp,%ebp lea and 23 pushl 24 push 25 26 mov push push %ebx 27 %есх 28 $0x10,%esp %есх,%ebx Өx4(%ebx),%eаx $0x4,%eax (%eax),%eaх $0xc,%esp sub 29 mov 30 31 mov add 32 mov 33 sub 34 35 push %eax $0x10,%esp %eax,-0xc(%ebp) Оx4(%ebx),%eax $0x8,%eax (%eax),%eax $0xc,%esp call 36 add 37 mov 38 mov 39 40 add mov 41 sub push call 42 %eax 43 44 $0x10,%esp %eax,-0x10(%ebp) -0x10 (%ebp),%eax Өx1(%eаx),%edx -0xс(%ebp), %eax $0x2,%eax $0x8,%esp add 45 mov 46 mov 47 48 lea mov 49 add 50 sub 51 push push call %edx 52 53 %eax 54 $0x10,%esp %eax,-0x14(%ebp) $0x0,%eax -0x8(%ebp),%esp add 55 mov 56 mov 57 58 рор 59 роp 60 роp lea %ecx %ebx %ebp -0x4(%eсx),%esp 61 lea 62 ret 63 |
1 <what><br>%ebp<br>%esp,%ebp<br>$0x10,%esp<br>Өx8(%ebp),%eax<br>$0x4,%eax<br>%eax,-0x4(%ebp)<br>Оx8(%ebp),%eax<br>Оxc(%ebp),%eax<br>%eax,-0x8(%ebp)<br>Оx8(%ebp),%eax<br>Өxc (%ebp),%eax<br>%eax,-0xc(%ebp)<br>-0x4(%ebp),%edx<br>-өx8(%ebp),%eax<br>%eax,%edx<br>-0хс (%ebp), %eax<br>%edx,%eax<br>push<br>2 <what+1><br>mov<br>3 <what+3><br>sub<br>4 <what+6><br>mov<br>5 <what+9><br>add<br>6 <what+12><br>mov<br>7 <what+15><br>mov<br>8 <what+18> imul<br>9 <what+22><br>mov<br>10 <what+25><br>mov<br>11 <what+28><br>sub<br>12 <what+31><br>mov<br>13 <what+34><br>mov<br>14 <what+37><br>mov<br>15 <what+40><br>add<br>16 <what+42><br>mov<br>17 <what+45><br>add<br>18 <what+47> leave<br>19 <what+48><br>ret<br>20<br>

Extracted text: 1 %ebp %esp,%ebp $0x10,%esp Өx8(%ebp),%eax $0x4,%eax %eax,-0x4(%ebp) Оx8(%ebp),%eax Оxc(%ebp),%eax %eax,-0x8(%ebp) Оx8(%ebp),%eax Өxc (%ebp),%eax %eax,-0xc(%ebp) -0x4(%ebp),%edx -өx8(%ebp),%eax %eax,%edx -0хс (%ebp), %eax %edx,%eax push 2 mov 3 sub 4 mov 5 add 6 mov 7 mov 8 imul 9 mov 10 mov 11 sub 12 mov 13 mov 14 mov 15 add 16 mov 17 add 18 leave 19 ret 20
Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here