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
icon
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
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Header Files
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.
Similar questions
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education