SlideShare ist ein Scribd-Unternehmen logo
1 von 3
Downloaden Sie, um offline zu lesen
x86_64 Assembly program
output is 54321 want it to be 12345
section .data
msg db "0011223344556677..,,..,,..,,..,,0011223344556677..,,..,,..,,..,,"
atoi_buf db "0011223344556677..,,..,,..,,..,,0011223344556677..,,..,,..,,..,,"
newline db 0ah
num dq 0
section .text
global _start
put_newline:
push rax
push rdx
push rsi
push rdi
mov rax,1
mov rdi,1
mov rsi,newline
mov rdx,1
syscall
pop rdi
pop rsi
pop rdx
pop rax
ret
atoi_aux:
xor edx,edx
div ebx
push rax
mov rax, rdx
add al, '0'
mov [rdi], al
pop rax
inc rdi
ret
_start:
mov rdi,atoi_buf
mov rax,12345
mov ebx,10
loop:
call atoi_aux
cmp rax,0
jne loop
mov rdx,rdi
sub rdx,atoi_buf
mov rax,1
mov rdi,1
mov rsi,atoi_buf
syscall
exit_normal:
mov rax, 60
mov rdi, 0
syscall
put_qword_safe:
push rax
push rbx
push rcx
push rdx
push rsi
push rdi
mov rdi,msg
mov rcx,8
hex_qword:
mov rbx,num
add rbx,rcx
dec rbx
mov ah,[rbx]
call hex_byte
loop hex_qword
sub rdi,msg
mov rcx, rdi
mov rax, 1
mov rdi, 1
mov rsi, msg
mov rdx, rcx
syscall
pop rdi
pop rsi
pop rdx
pop rcx
pop rbx
pop rax
ret
hex_byte:
mov al,ah
shr al,10
call hex_digit
inc rdi
mov al,ah
and al,0fh
call hex_digit
inc rdi
ret
hex_digit:
cmp al,10
jnc alpha
add al,'0'
jmp w
alpha:
sub al,10
add al,'A'
w:
mov [rdi],al
ret
The program converts the value stored in rax into a string that is the decimal of the value. Does
the program generate a correct answer? If not, correct the program and submit the source code.

Weitere ähnliche Inhalte

Ähnlich wie x86_64 Assembly program output is 54321 want it to be 12345 section.pdf

Drizzle to MySQL, Stress Free Migration
Drizzle to MySQL, Stress Free MigrationDrizzle to MySQL, Stress Free Migration
Drizzle to MySQL, Stress Free MigrationAndrew Hutchings
 
Windows Debugging with WinDbg
Windows Debugging with WinDbgWindows Debugging with WinDbg
Windows Debugging with WinDbgArno Huetter
 
Evgeniy Muralev, Mark Vince, Working with the compiler, not against it
Evgeniy Muralev, Mark Vince, Working with the compiler, not against itEvgeniy Muralev, Mark Vince, Working with the compiler, not against it
Evgeniy Muralev, Mark Vince, Working with the compiler, not against itSergey Platonov
 
利用Init connect做mysql clients stat 用户审计
 利用Init connect做mysql clients stat 用户审计 利用Init connect做mysql clients stat 用户审计
利用Init connect做mysql clients stat 用户审计Dehua Yang
 
DEP/ASLR bypass without ROP/JIT
DEP/ASLR bypass without ROP/JITDEP/ASLR bypass without ROP/JIT
DEP/ASLR bypass without ROP/JITArtem I. Baranov
 
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksBeginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksJinTaek Seo
 
Finding Xori: Malware Analysis Triage with Automated Disassembly
Finding Xori: Malware Analysis Triage with Automated DisassemblyFinding Xori: Malware Analysis Triage with Automated Disassembly
Finding Xori: Malware Analysis Triage with Automated DisassemblyPriyanka Aash
 
WCTF 2018 binja Editorial
WCTF 2018 binja EditorialWCTF 2018 binja Editorial
WCTF 2018 binja EditorialCharo_IT
 
Accelerated Windows Malware Analysis with Memory Dumps
Accelerated Windows Malware Analysis with Memory DumpsAccelerated Windows Malware Analysis with Memory Dumps
Accelerated Windows Malware Analysis with Memory DumpsDmitry Vostokov
 
Tokyo APAC Groundbreakers tour - The Complete Java Developer
Tokyo APAC Groundbreakers tour - The Complete Java DeveloperTokyo APAC Groundbreakers tour - The Complete Java Developer
Tokyo APAC Groundbreakers tour - The Complete Java DeveloperConnor McDonald
 
Error based blind sqli
Error based blind sqliError based blind sqli
Error based blind sqliDarkZtone Zone
 
Swug July 2010 - windows debugging by sainath
Swug July 2010 - windows debugging by sainathSwug July 2010 - windows debugging by sainath
Swug July 2010 - windows debugging by sainathDennis Chung
 
Application of Radare2 Illustrated by Shylock and Snakso.A Analysis
Application of Radare2 Illustrated by Shylock and Snakso.A AnalysisApplication of Radare2 Illustrated by Shylock and Snakso.A Analysis
Application of Radare2 Illustrated by Shylock and Snakso.A AnalysisPositive Hack Days
 
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacket
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacketCsw2016 wheeler barksdale-gruskovnjak-execute_mypacket
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacketCanSecWest
 
Ceph Day SF 2015 - Big Data Applications and Tuning in Ceph
Ceph Day SF 2015 - Big Data Applications and Tuning in Ceph Ceph Day SF 2015 - Big Data Applications and Tuning in Ceph
Ceph Day SF 2015 - Big Data Applications and Tuning in Ceph Ceph Community
 
Extend Redis with Modules
Extend Redis with ModulesExtend Redis with Modules
Extend Redis with ModulesItamar Haber
 
FreeLix: Semplicità & Controllo
FreeLix: Semplicità & ControlloFreeLix: Semplicità & Controllo
FreeLix: Semplicità & ControlloValerio Balbi
 

Ähnlich wie x86_64 Assembly program output is 54321 want it to be 12345 section.pdf (20)

Drizzle to MySQL, Stress Free Migration
Drizzle to MySQL, Stress Free MigrationDrizzle to MySQL, Stress Free Migration
Drizzle to MySQL, Stress Free Migration
 
Windows Debugging with WinDbg
Windows Debugging with WinDbgWindows Debugging with WinDbg
Windows Debugging with WinDbg
 
Evgeniy Muralev, Mark Vince, Working with the compiler, not against it
Evgeniy Muralev, Mark Vince, Working with the compiler, not against itEvgeniy Muralev, Mark Vince, Working with the compiler, not against it
Evgeniy Muralev, Mark Vince, Working with the compiler, not against it
 
利用Init connect做mysql clients stat 用户审计
 利用Init connect做mysql clients stat 用户审计 利用Init connect做mysql clients stat 用户审计
利用Init connect做mysql clients stat 用户审计
 
DEP/ASLR bypass without ROP/JIT
DEP/ASLR bypass without ROP/JITDEP/ASLR bypass without ROP/JIT
DEP/ASLR bypass without ROP/JIT
 
Triggers and Stored Procedures
Triggers and Stored ProceduresTriggers and Stored Procedures
Triggers and Stored Procedures
 
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksBeginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
 
Finding Xori: Malware Analysis Triage with Automated Disassembly
Finding Xori: Malware Analysis Triage with Automated DisassemblyFinding Xori: Malware Analysis Triage with Automated Disassembly
Finding Xori: Malware Analysis Triage with Automated Disassembly
 
WCTF 2018 binja Editorial
WCTF 2018 binja EditorialWCTF 2018 binja Editorial
WCTF 2018 binja Editorial
 
Accelerated Windows Malware Analysis with Memory Dumps
Accelerated Windows Malware Analysis with Memory DumpsAccelerated Windows Malware Analysis with Memory Dumps
Accelerated Windows Malware Analysis with Memory Dumps
 
Tokyo APAC Groundbreakers tour - The Complete Java Developer
Tokyo APAC Groundbreakers tour - The Complete Java DeveloperTokyo APAC Groundbreakers tour - The Complete Java Developer
Tokyo APAC Groundbreakers tour - The Complete Java Developer
 
Error based blind sqli
Error based blind sqliError based blind sqli
Error based blind sqli
 
Swug July 2010 - windows debugging by sainath
Swug July 2010 - windows debugging by sainathSwug July 2010 - windows debugging by sainath
Swug July 2010 - windows debugging by sainath
 
Game.log
Game.logGame.log
Game.log
 
Application of Radare2 Illustrated by Shylock and Snakso.A Analysis
Application of Radare2 Illustrated by Shylock and Snakso.A AnalysisApplication of Radare2 Illustrated by Shylock and Snakso.A Analysis
Application of Radare2 Illustrated by Shylock and Snakso.A Analysis
 
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacket
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacketCsw2016 wheeler barksdale-gruskovnjak-execute_mypacket
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacket
 
Ceph Day SF 2015 - Big Data Applications and Tuning in Ceph
Ceph Day SF 2015 - Big Data Applications and Tuning in Ceph Ceph Day SF 2015 - Big Data Applications and Tuning in Ceph
Ceph Day SF 2015 - Big Data Applications and Tuning in Ceph
 
Extend Redis with Modules
Extend Redis with ModulesExtend Redis with Modules
Extend Redis with Modules
 
Joel Falcou, Boost.SIMD
Joel Falcou, Boost.SIMDJoel Falcou, Boost.SIMD
Joel Falcou, Boost.SIMD
 
FreeLix: Semplicità & Controllo
FreeLix: Semplicità & ControlloFreeLix: Semplicità & Controllo
FreeLix: Semplicità & Controllo
 

Mehr von AARVEEKNITWEAR

XYZ Corporation is a multinational organization that has several offic.pdf
XYZ Corporation is a multinational organization that has several offic.pdfXYZ Corporation is a multinational organization that has several offic.pdf
XYZ Corporation is a multinational organization that has several offic.pdfAARVEEKNITWEAR
 
XYZ Co- stock sells for $42 and just a paid a dividend of $2- Dividend.pdf
XYZ Co- stock sells for $42 and just a paid a dividend of $2- Dividend.pdfXYZ Co- stock sells for $42 and just a paid a dividend of $2- Dividend.pdf
XYZ Co- stock sells for $42 and just a paid a dividend of $2- Dividend.pdfAARVEEKNITWEAR
 
XCode Weather Forecast with Arrays Exercise I began revising similar c.pdf
XCode Weather Forecast with Arrays Exercise I began revising similar c.pdfXCode Weather Forecast with Arrays Exercise I began revising similar c.pdf
XCode Weather Forecast with Arrays Exercise I began revising similar c.pdfAARVEEKNITWEAR
 
XYZ Company is considering three different plans for financing their o.pdf
XYZ Company is considering three different plans for financing their o.pdfXYZ Company is considering three different plans for financing their o.pdf
XYZ Company is considering three different plans for financing their o.pdfAARVEEKNITWEAR
 
X-1 Corp's total assets at the end of last year were $480-000 and its.pdf
X-1 Corp's total assets at the end of last year were $480-000 and its.pdfX-1 Corp's total assets at the end of last year were $480-000 and its.pdf
X-1 Corp's total assets at the end of last year were $480-000 and its.pdfAARVEEKNITWEAR
 
X Most sensory neurons belong to what structural type of neurons- Sele.pdf
X Most sensory neurons belong to what structural type of neurons- Sele.pdfX Most sensory neurons belong to what structural type of neurons- Sele.pdf
X Most sensory neurons belong to what structural type of neurons- Sele.pdfAARVEEKNITWEAR
 
x This is teice the prosabity ol he reptat vifendes thingetsabilias ar.pdf
x This is teice the prosabity ol he reptat vifendes thingetsabilias ar.pdfx This is teice the prosabity ol he reptat vifendes thingetsabilias ar.pdf
x This is teice the prosabity ol he reptat vifendes thingetsabilias ar.pdfAARVEEKNITWEAR
 
X is a discrete random variable with probability density function f gi.pdf
X is a discrete random variable with probability density function f gi.pdfX is a discrete random variable with probability density function f gi.pdf
X is a discrete random variable with probability density function f gi.pdfAARVEEKNITWEAR
 
X and Y are independently distributed random variables- The marginal d (1).pdf
X and Y are independently distributed random variables- The marginal d (1).pdfX and Y are independently distributed random variables- The marginal d (1).pdf
X and Y are independently distributed random variables- The marginal d (1).pdfAARVEEKNITWEAR
 
X 3- What gets printed- 14.pdf
X 3- What gets printed- 14.pdfX 3- What gets printed- 14.pdf
X 3- What gets printed- 14.pdfAARVEEKNITWEAR
 
x AutoSave Ooff File for Midterm - Excel File Home Insert Draw Page L.pdf
x AutoSave Ooff  File for Midterm - Excel File Home Insert Draw Page L.pdfx AutoSave Ooff  File for Midterm - Excel File Home Insert Draw Page L.pdf
x AutoSave Ooff File for Midterm - Excel File Home Insert Draw Page L.pdfAARVEEKNITWEAR
 
Wynn Farms reported a net operating loss of $195-000 for financial rep.pdf
Wynn Farms reported a net operating loss of $195-000 for financial rep.pdfWynn Farms reported a net operating loss of $195-000 for financial rep.pdf
Wynn Farms reported a net operating loss of $195-000 for financial rep.pdfAARVEEKNITWEAR
 
Writing the Meanings of Word Parts Write the meanings of the following.pdf
Writing the Meanings of Word Parts Write the meanings of the following.pdfWriting the Meanings of Word Parts Write the meanings of the following.pdf
Writing the Meanings of Word Parts Write the meanings of the following.pdfAARVEEKNITWEAR
 
Write your standard C++ codes to do the following (for class both inte.pdf
Write your standard C++ codes to do the following (for class both inte.pdfWrite your standard C++ codes to do the following (for class both inte.pdf
Write your standard C++ codes to do the following (for class both inte.pdfAARVEEKNITWEAR
 
Write the SQL code to generate the total hours worked and the total ch.pdf
Write the SQL code to generate the total hours worked and the total ch.pdfWrite the SQL code to generate the total hours worked and the total ch.pdf
Write the SQL code to generate the total hours worked and the total ch.pdfAARVEEKNITWEAR
 
Write the pseudocode snippet to declare and initialise the following a.pdf
Write the pseudocode snippet to declare and initialise the following a.pdfWrite the pseudocode snippet to declare and initialise the following a.pdf
Write the pseudocode snippet to declare and initialise the following a.pdfAARVEEKNITWEAR
 
Write the java statement that should appear after the comments- (After.pdf
Write the java statement that should appear after the comments- (After.pdfWrite the java statement that should appear after the comments- (After.pdf
Write the java statement that should appear after the comments- (After.pdfAARVEEKNITWEAR
 

Mehr von AARVEEKNITWEAR (20)

XYZ Corporation is a multinational organization that has several offic.pdf
XYZ Corporation is a multinational organization that has several offic.pdfXYZ Corporation is a multinational organization that has several offic.pdf
XYZ Corporation is a multinational organization that has several offic.pdf
 
XYZ Co- stock sells for $42 and just a paid a dividend of $2- Dividend.pdf
XYZ Co- stock sells for $42 and just a paid a dividend of $2- Dividend.pdfXYZ Co- stock sells for $42 and just a paid a dividend of $2- Dividend.pdf
XYZ Co- stock sells for $42 and just a paid a dividend of $2- Dividend.pdf
 
XCode Weather Forecast with Arrays Exercise I began revising similar c.pdf
XCode Weather Forecast with Arrays Exercise I began revising similar c.pdfXCode Weather Forecast with Arrays Exercise I began revising similar c.pdf
XCode Weather Forecast with Arrays Exercise I began revising similar c.pdf
 
XYZ Company is considering three different plans for financing their o.pdf
XYZ Company is considering three different plans for financing their o.pdfXYZ Company is considering three different plans for financing their o.pdf
XYZ Company is considering three different plans for financing their o.pdf
 
x7x1-1.pdf
x7x1-1.pdfx7x1-1.pdf
x7x1-1.pdf
 
x-xp(x)dx-xe(x)22.pdf
x-xp(x)dx-xe(x)22.pdfx-xp(x)dx-xe(x)22.pdf
x-xp(x)dx-xe(x)22.pdf
 
x---.pdf
x---.pdfx---.pdf
x---.pdf
 
X-1 Corp's total assets at the end of last year were $480-000 and its.pdf
X-1 Corp's total assets at the end of last year were $480-000 and its.pdfX-1 Corp's total assets at the end of last year were $480-000 and its.pdf
X-1 Corp's total assets at the end of last year were $480-000 and its.pdf
 
X Most sensory neurons belong to what structural type of neurons- Sele.pdf
X Most sensory neurons belong to what structural type of neurons- Sele.pdfX Most sensory neurons belong to what structural type of neurons- Sele.pdf
X Most sensory neurons belong to what structural type of neurons- Sele.pdf
 
x This is teice the prosabity ol he reptat vifendes thingetsabilias ar.pdf
x This is teice the prosabity ol he reptat vifendes thingetsabilias ar.pdfx This is teice the prosabity ol he reptat vifendes thingetsabilias ar.pdf
x This is teice the prosabity ol he reptat vifendes thingetsabilias ar.pdf
 
X is a discrete random variable with probability density function f gi.pdf
X is a discrete random variable with probability density function f gi.pdfX is a discrete random variable with probability density function f gi.pdf
X is a discrete random variable with probability density function f gi.pdf
 
X and Y are independently distributed random variables- The marginal d (1).pdf
X and Y are independently distributed random variables- The marginal d (1).pdfX and Y are independently distributed random variables- The marginal d (1).pdf
X and Y are independently distributed random variables- The marginal d (1).pdf
 
X 3- What gets printed- 14.pdf
X 3- What gets printed- 14.pdfX 3- What gets printed- 14.pdf
X 3- What gets printed- 14.pdf
 
x AutoSave Ooff File for Midterm - Excel File Home Insert Draw Page L.pdf
x AutoSave Ooff  File for Midterm - Excel File Home Insert Draw Page L.pdfx AutoSave Ooff  File for Midterm - Excel File Home Insert Draw Page L.pdf
x AutoSave Ooff File for Midterm - Excel File Home Insert Draw Page L.pdf
 
Wynn Farms reported a net operating loss of $195-000 for financial rep.pdf
Wynn Farms reported a net operating loss of $195-000 for financial rep.pdfWynn Farms reported a net operating loss of $195-000 for financial rep.pdf
Wynn Farms reported a net operating loss of $195-000 for financial rep.pdf
 
Writing the Meanings of Word Parts Write the meanings of the following.pdf
Writing the Meanings of Word Parts Write the meanings of the following.pdfWriting the Meanings of Word Parts Write the meanings of the following.pdf
Writing the Meanings of Word Parts Write the meanings of the following.pdf
 
Write your standard C++ codes to do the following (for class both inte.pdf
Write your standard C++ codes to do the following (for class both inte.pdfWrite your standard C++ codes to do the following (for class both inte.pdf
Write your standard C++ codes to do the following (for class both inte.pdf
 
Write the SQL code to generate the total hours worked and the total ch.pdf
Write the SQL code to generate the total hours worked and the total ch.pdfWrite the SQL code to generate the total hours worked and the total ch.pdf
Write the SQL code to generate the total hours worked and the total ch.pdf
 
Write the pseudocode snippet to declare and initialise the following a.pdf
Write the pseudocode snippet to declare and initialise the following a.pdfWrite the pseudocode snippet to declare and initialise the following a.pdf
Write the pseudocode snippet to declare and initialise the following a.pdf
 
Write the java statement that should appear after the comments- (After.pdf
Write the java statement that should appear after the comments- (After.pdfWrite the java statement that should appear after the comments- (After.pdf
Write the java statement that should appear after the comments- (After.pdf
 

Kürzlich hochgeladen

mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 

Kürzlich hochgeladen (20)

mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 

x86_64 Assembly program output is 54321 want it to be 12345 section.pdf

  • 1. x86_64 Assembly program output is 54321 want it to be 12345 section .data msg db "0011223344556677..,,..,,..,,..,,0011223344556677..,,..,,..,,..,," atoi_buf db "0011223344556677..,,..,,..,,..,,0011223344556677..,,..,,..,,..,," newline db 0ah num dq 0 section .text global _start put_newline: push rax push rdx push rsi push rdi mov rax,1 mov rdi,1 mov rsi,newline mov rdx,1 syscall pop rdi pop rsi pop rdx pop rax ret atoi_aux: xor edx,edx div ebx push rax mov rax, rdx add al, '0' mov [rdi], al pop rax inc rdi ret _start: mov rdi,atoi_buf
  • 2. mov rax,12345 mov ebx,10 loop: call atoi_aux cmp rax,0 jne loop mov rdx,rdi sub rdx,atoi_buf mov rax,1 mov rdi,1 mov rsi,atoi_buf syscall exit_normal: mov rax, 60 mov rdi, 0 syscall put_qword_safe: push rax push rbx push rcx push rdx push rsi push rdi mov rdi,msg mov rcx,8 hex_qword: mov rbx,num add rbx,rcx dec rbx mov ah,[rbx] call hex_byte loop hex_qword sub rdi,msg mov rcx, rdi mov rax, 1 mov rdi, 1 mov rsi, msg mov rdx, rcx syscall pop rdi pop rsi
  • 3. pop rdx pop rcx pop rbx pop rax ret hex_byte: mov al,ah shr al,10 call hex_digit inc rdi mov al,ah and al,0fh call hex_digit inc rdi ret hex_digit: cmp al,10 jnc alpha add al,'0' jmp w alpha: sub al,10 add al,'A' w: mov [rdi],al ret The program converts the value stored in rax into a string that is the decimal of the value. Does the program generate a correct answer? If not, correct the program and submit the source code.