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. 00000000 : 0: push %ebp 1: mov %esp,%ebp 3: sub $0x10,%esp 6: mov 0x8(%ebp),%eax
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. 00000000 : 0: push %ebp 1: mov %esp,%ebp 3: sub $0x10,%esp 6: mov 0x8(%ebp),%eax
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Topic Video
Question
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.
00000000 <what>:0: push %ebp
1: mov %esp,%ebp
3: sub $0x10,%esp
6: mov 0x8(%ebp),%eax
9: add $0x4,%eax
c: mov %eax,-0x4(%ebp)
f: mov 0x8(%ebp),%eax
12: imul 0xc(%ebp),%eax
16: mov %eax,-0x8(%ebp)
19: mov 0x8(%ebp),%eax
1c: sub 0xc(%ebp),%eax
1f: mov %eax,-0xc(%ebp)
22: mov -0x4(%ebp),%edx
25: mov -0x8(%ebp),%eax
28: add %eax,%edx
2a: mov -0xc(%ebp),%eax
2d: add %edx,%eax
2f: leave
30: ret
00000031 <main>:
31: lea 0x4(%esp),%ecx
35: and $0xfffffff0,%esp
38: pushl -0x4(%ecx)
3b: push %ebp
3c: mov %esp,%ebp
3e: push %ebx
3f: push %ecx
40: sub $0x10,%esp
43: mov %ecx,%ebx
45: mov 0x4(%ebx),%eax
48: add $0x4,%eax
4b: mov (%eax),%eax
4d: sub $0xc,%esp
50: push %eax
51: call 52 <main+0x21>
56: add $0x10,%esp
59: mov %eax,-0xc(%ebp)
5c: mov 0x4(%ebx),%eax
5f: add $0x8,%eax
62: mov (%eax),%eax
64: sub $0xc,%esp
67: push %eax
68: call 69 <main+0x38>
6d: add $0x10,%esp
70: mov %eax,-0x10(%ebp)
73: mov -0x10(%ebp),%eax
76: lea 0x1(%eax),%edx
79: mov -0xc(%ebp),%eax
7c: add $0x2,%eax
7f: sub $0x8,%esp
82: push %edx
83: push %eax
84: call 85 <main+0x54>
89: add $0x10,%esp
8c: mov %eax,-0x14(%ebp)
8f: sub $0x8,%esp
92: pushl -0x14(%ebp)
95: push $0x0
9a: call 9b <main+0x6a>
9f: add $0x10,%esp
a2: mov $0x0,%eax
a7: lea -0x8(%ebp),%esp
aa: pop %ecx
ab: pop %ebx
ac: pop %ebp
ad: lea -0x4(%ecx),%esp
b0: ret
This program is invoked from the command line as shown:
./program 5 7The procedure named what is called from main, and returns to main with the value:
Question options:
|
|
||
|
|
||
|
|
||
|
|
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education