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.
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.
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
Question
![A Tul
1eave
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.
Ox401050
<what>:
push
šebp
Ox401051
<what+1>:
mov
šesp, šebp
Soxc, sesp
Ox8 (Sebp),šeax
0x401053
<what+3>:
sub
Ox401056
<what+6>:
mov
Ox401059
<what+9>:
add
S0x4, šeax
Sear
Seax, Oxfffffffc (sebp)
Ox40105c
<what+12>:
mov
Ox40105I
<what+15>:
Ox8 (Sebp), $eax
mov
Oxc (sebp), seax
Seax, OxffffffE8 (tebp)
Ox401062
<what+18>:
imul
ょううく、.
Ox401066
<what+22>:
mov
Oxc (tebp), tedx
Ox8 (tebp), teax
Ox401069
<what+25>:
mov
Ox40106c
<what+28>:
mov
Ox40106f
<what+31>:
sub
šedx, teax
Ox401071
<what+33>:
šeax, Oxfffffff4 (sebp)
mov
Ox401074
Oxfffffff8 (sebp), teax
Oxfffffffc (tebp), teax
Oxfffffff4 (Sebp), teax
<what+36>:
mov
Ox401077
<what+39>:
add
Ox40107a
<what+42>:
add
Ox40107d
<what+45>:
leave
Ox40107e
<what+46>:
ret
tebp
tesp, tebp
Ox401089
<main>:
push
Ox40108a
<main+1>:
;くT+UTRU>
sub
לווב
mov
Ox40108c
<main+3>:
S0x18, šesp
S0xfffffff0, tesp
$0x0, šeax
Ox40108f
<main+6>:
and
Ox401092
<main+9>:
mov
Ox401097
Ox40109a
<main+14>:
seax, Oxfffffff0 (sebp)
OxfffffEEO (tebp), $eax
mov
<main+17>:
mov
Ox40109d
<main+20>:
call
Ox401420 < alloca>
Ox4014b0 < main>
Oxc (šebp), teax
$0x4, šeax
Ox4010a2
<main+25>:
call
Ox4010a7
<main+30>:
mov
Ox4010aa
<main+33>:
add
(šeax), šeax
šeax, (sesp)
Ox4010ad
<main+36>:
mov
Ox4010af
<main+38>:
mov
Ox4010b2
<main+41>:
call
Ox4014d0 <atoi>
šeax, Oxfffffffc (sebp)
Oxc (sebp), šeax
$0x8, seax
(šeax), teax
seax, (tesp)
Ox4010b7
<main+46>:
mov
Ox4010ba
<main+49>:
mov
Ox4010bd
<main+52>:
add
Ox4010c0
<main+55>:
mov
Ox4010c2
<main+57>:
mov
Ox4010c5
<main+60>:
call
Ox4014d0 <atoi>
šeax, OxffffffE8 (Sebp)
Oxfffffff8 (Sebp), teax
Ox4010ca
<main+65>:
mov
Ox4010cd
<main+68>:
mov
Ox4010d0
<main+71>:
inc
Seax
Ox4010d1
<main+72>:
mov
seax, Ox4 ($esp)
Ox4010d5
<main+76>:
Oxfffffffc (tebp), šeax
mov
Ox4010d8
<main+79>:
add
S0x2, teax
Ox4010db
<main+82>:
mov
šeax, (sesp)
Ox4010de
<main+85>:
call
Ox401050 <what>
šeax, Oxfffffff4 (sebp)
Oxfffffff4 (šebp), teax
Ox4010e3
<main+90>:
mov
Ox4010e6
<main+93>:
mov
(šesp)
seax, Ox4
S0x40107f, (šesp)
Ox4010e9
<main+96>:
mov
Ox4010ed
<main+100>:
movl
Ox4010f4
<main+107>:
call
Ox4014c0 <printf>
Ox401019
<main+112>:
Sox0, teax
mov
Ox4010fe
<main+117>:
leave
Ox4010ff
<main+118>:
ret
This program is invoked from the command line as shown:
./program 5 7
The procedure named what is called from main, and returns to main with the value:
1) 11
2) 24
3) 42
4) 66](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fd8683c92-e7f9-4e50-91a7-0296f64df474%2F3afc8dba-a00c-4de6-90c8-f66466fe0c97%2F8h7btjk_processed.jpeg&w=3840&q=75)
Transcribed Image Text:A Tul
1eave
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.
Ox401050
<what>:
push
šebp
Ox401051
<what+1>:
mov
šesp, šebp
Soxc, sesp
Ox8 (Sebp),šeax
0x401053
<what+3>:
sub
Ox401056
<what+6>:
mov
Ox401059
<what+9>:
add
S0x4, šeax
Sear
Seax, Oxfffffffc (sebp)
Ox40105c
<what+12>:
mov
Ox40105I
<what+15>:
Ox8 (Sebp), $eax
mov
Oxc (sebp), seax
Seax, OxffffffE8 (tebp)
Ox401062
<what+18>:
imul
ょううく、.
Ox401066
<what+22>:
mov
Oxc (tebp), tedx
Ox8 (tebp), teax
Ox401069
<what+25>:
mov
Ox40106c
<what+28>:
mov
Ox40106f
<what+31>:
sub
šedx, teax
Ox401071
<what+33>:
šeax, Oxfffffff4 (sebp)
mov
Ox401074
Oxfffffff8 (sebp), teax
Oxfffffffc (tebp), teax
Oxfffffff4 (Sebp), teax
<what+36>:
mov
Ox401077
<what+39>:
add
Ox40107a
<what+42>:
add
Ox40107d
<what+45>:
leave
Ox40107e
<what+46>:
ret
tebp
tesp, tebp
Ox401089
<main>:
push
Ox40108a
<main+1>:
;くT+UTRU>
sub
לווב
mov
Ox40108c
<main+3>:
S0x18, šesp
S0xfffffff0, tesp
$0x0, šeax
Ox40108f
<main+6>:
and
Ox401092
<main+9>:
mov
Ox401097
Ox40109a
<main+14>:
seax, Oxfffffff0 (sebp)
OxfffffEEO (tebp), $eax
mov
<main+17>:
mov
Ox40109d
<main+20>:
call
Ox401420 < alloca>
Ox4014b0 < main>
Oxc (šebp), teax
$0x4, šeax
Ox4010a2
<main+25>:
call
Ox4010a7
<main+30>:
mov
Ox4010aa
<main+33>:
add
(šeax), šeax
šeax, (sesp)
Ox4010ad
<main+36>:
mov
Ox4010af
<main+38>:
mov
Ox4010b2
<main+41>:
call
Ox4014d0 <atoi>
šeax, Oxfffffffc (sebp)
Oxc (sebp), šeax
$0x8, seax
(šeax), teax
seax, (tesp)
Ox4010b7
<main+46>:
mov
Ox4010ba
<main+49>:
mov
Ox4010bd
<main+52>:
add
Ox4010c0
<main+55>:
mov
Ox4010c2
<main+57>:
mov
Ox4010c5
<main+60>:
call
Ox4014d0 <atoi>
šeax, OxffffffE8 (Sebp)
Oxfffffff8 (Sebp), teax
Ox4010ca
<main+65>:
mov
Ox4010cd
<main+68>:
mov
Ox4010d0
<main+71>:
inc
Seax
Ox4010d1
<main+72>:
mov
seax, Ox4 ($esp)
Ox4010d5
<main+76>:
Oxfffffffc (tebp), šeax
mov
Ox4010d8
<main+79>:
add
S0x2, teax
Ox4010db
<main+82>:
mov
šeax, (sesp)
Ox4010de
<main+85>:
call
Ox401050 <what>
šeax, Oxfffffff4 (sebp)
Oxfffffff4 (šebp), teax
Ox4010e3
<main+90>:
mov
Ox4010e6
<main+93>:
mov
(šesp)
seax, Ox4
S0x40107f, (šesp)
Ox4010e9
<main+96>:
mov
Ox4010ed
<main+100>:
movl
Ox4010f4
<main+107>:
call
Ox4014c0 <printf>
Ox401019
<main+112>:
Sox0, teax
mov
Ox4010fe
<main+117>:
leave
Ox4010ff
<main+118>:
ret
This program is invoked from the command line as shown:
./program 5 7
The procedure named what is called from main, and returns to main with the value:
1) 11
2) 24
3) 42
4) 66
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 with 1 images
![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