How would you write this in MARIE assembly language?
int count = 0;
int number = 30;
int otherNum = 10;
while ( count <= number)
count += 3;
output = count/otherNum;
Solution
Answer:
.zero 1
main:
push rbp
mov rbp, rsp
mov DWORD PTR [rbp-4], 0
mov DWORD PTR [rbp-8], 30
mov DWORD PTR [rbp-12], 10
.L3:
mov eax, DWORD PTR [rbp-4]
cmp eax, DWORD PTR [rbp-8]
jg .L2
add DWORD PTR [rbp-4], 3
jmp .L3
.L2:
mov eax, DWORD PTR [rbp-4]
cdq
idiv DWORD PTR [rbp-12]
mov DWORD PTR [rbp-16], eax
mov eax, 0
pop rbp
ret
__static_initialization_and_destruction_0(int, int):
push rbp
mov rbp, rsp
sub rsp, 16
mov DWORD PTR [rbp-4], edi
mov DWORD PTR [rbp-8], esi
cmp DWORD PTR [rbp-4], 1
jne .L7
cmp DWORD PTR [rbp-8], 65535
jne .L7
mov edi, OFFSET FLAT:std::__ioinit
call std::ios_base::Init::Init()
mov edx, OFFSET FLAT:__dso_handle
mov esi, OFFSET FLAT:std::__ioinit
mov edi, OFFSET FLAT:std::ios_base::Init::~Init()
call __cxa_atexit
.L7:
nop
leave
ret
push rbp
mov rbp, rsp
mov esi, 65535
mov edi, 1
call __static_initialization_and_destruction_0(int, int)
pop rbp
ret

More Related Content

PDF
Convert the for loop Into MIPS Instructions. Use the sit instruction .pdf
PDF
Please convert the following C code to assembly Y86int i,j; ......pdf
PDF
Please convert the following C code to assembly Y86int j,k; .....pdf
PDF
Write a program in MIPS that reads in a Roman form number from th.pdf
PDF
Implement an MPI program to perform matrix-matrix multiplication AB .pdf
PDF
Write an MPI program that implements a shell-sort like parallel algo.pdf
PDF
WCTF 2018 binja Editorial
PDF
Translate the following CC++ code into MIPS Assembly Codevoid ch.pdf
Convert the for loop Into MIPS Instructions. Use the sit instruction .pdf
Please convert the following C code to assembly Y86int i,j; ......pdf
Please convert the following C code to assembly Y86int j,k; .....pdf
Write a program in MIPS that reads in a Roman form number from th.pdf
Implement an MPI program to perform matrix-matrix multiplication AB .pdf
Write an MPI program that implements a shell-sort like parallel algo.pdf
WCTF 2018 binja Editorial
Translate the following CC++ code into MIPS Assembly Codevoid ch.pdf

Similar to How would you write this in MARIE assembly languageint count = 0;.pdf (20)

PDF
OptimizingARM
PDF
Write a Pep8 Assembly program that reads in and stores two integers .pdf
PPTX
PPTX
Evgeniy Muralev, Mark Vince, Working with the compiler, not against it
PPT
커널코드분석 20140621(head.s restart)
PPT
Arm Cortex material Arm Cortex material3222886.ppt
PPTX
ARM instruction set
DOC
Function Call Optimization
PPT
Microcontroller 8051- soft.ppt
PPTX
Module 2 PPT of ES.pptx
DOCX
Linear programming wi̇th R
PDF
Fix assembly Code new peoblem on call printf gt .pdf
PDF
ARM AAE - Intrustion Sets
PDF
R/C++ talk at earl 2014
PPTX
Chapter_04_ARM_Assembly ARM assembly language is the low-level programming.pptx
PDF
1) (a) Write a code fragment which adds the 32-bit contents of $8100.pdf
PPTX
Predication
PPT
UNIT 2 ERTS.ppt
PDF
optimization c code on blackfin
PPT
Addressing mode and instruction set using 8051
OptimizingARM
Write a Pep8 Assembly program that reads in and stores two integers .pdf
Evgeniy Muralev, Mark Vince, Working with the compiler, not against it
커널코드분석 20140621(head.s restart)
Arm Cortex material Arm Cortex material3222886.ppt
ARM instruction set
Function Call Optimization
Microcontroller 8051- soft.ppt
Module 2 PPT of ES.pptx
Linear programming wi̇th R
Fix assembly Code new peoblem on call printf gt .pdf
ARM AAE - Intrustion Sets
R/C++ talk at earl 2014
Chapter_04_ARM_Assembly ARM assembly language is the low-level programming.pptx
1) (a) Write a code fragment which adds the 32-bit contents of $8100.pdf
Predication
UNIT 2 ERTS.ppt
optimization c code on blackfin
Addressing mode and instruction set using 8051
Ad

More from bermanbeancolungak45 (20)

PDF
Write a program that randomly generates a maze in javaSolution.pdf
PDF
why is the idea of a standard network protocol such as the OSI refer.pdf
PDF
Which of the following potential problems need not be considered whe.pdf
PDF
Which of the following is true of mutations They are very common T.pdf
PDF
What type of security vulnerability are developers most likely to in.pdf
PDF
What is the purpose of database administration2. What is the purp.pdf
PDF
what is code to draw sun and earth and the moon in java OpenGLS.pdf
PDF
What factors do you think make them excellent project reports write.pdf
PDF
What aspects of todays information economy have influenced the imp.pdf
PDF
This week, we are going to work together as a class to assist the Lon.pdf
PDF
The phylogenetic species concept looks at environmental adaptations a.pdf
PDF
The percentage of high school students who drink and drive was 17.5.pdf
PDF
Take a position on this statement The media represent realistic ima.pdf
PDF
Suppose 60 different survey organizations visit eastern Tennessee to.pdf
PDF
Relate selected early morphological developments in the ancestors of.pdf
PDF
Question VI. In 1976, Hozumi and Tonegawa published an elegant paper.pdf
PDF
question - Jurassic Park (book and movie) proposed the concept of.pdf
PDF
Python programming question Assume that a file containing a serie.pdf
PDF
Prior to the development of anti-retroviral drugs, HIV infected pati.pdf
PDF
Please this is my second time posting. I really need the right answe.pdf
Write a program that randomly generates a maze in javaSolution.pdf
why is the idea of a standard network protocol such as the OSI refer.pdf
Which of the following potential problems need not be considered whe.pdf
Which of the following is true of mutations They are very common T.pdf
What type of security vulnerability are developers most likely to in.pdf
What is the purpose of database administration2. What is the purp.pdf
what is code to draw sun and earth and the moon in java OpenGLS.pdf
What factors do you think make them excellent project reports write.pdf
What aspects of todays information economy have influenced the imp.pdf
This week, we are going to work together as a class to assist the Lon.pdf
The phylogenetic species concept looks at environmental adaptations a.pdf
The percentage of high school students who drink and drive was 17.5.pdf
Take a position on this statement The media represent realistic ima.pdf
Suppose 60 different survey organizations visit eastern Tennessee to.pdf
Relate selected early morphological developments in the ancestors of.pdf
Question VI. In 1976, Hozumi and Tonegawa published an elegant paper.pdf
question - Jurassic Park (book and movie) proposed the concept of.pdf
Python programming question Assume that a file containing a serie.pdf
Prior to the development of anti-retroviral drugs, HIV infected pati.pdf
Please this is my second time posting. I really need the right answe.pdf
Ad

Recently uploaded (20)

PPTX
Education and Perspectives of Education.pptx
PDF
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 2).pdf
PDF
Journal of Dental Science - UDMY (2021).pdf
PPTX
Computer Architecture Input Output Memory.pptx
PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PDF
Hazard Identification & Risk Assessment .pdf
PDF
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
PPTX
Introduction to pro and eukaryotes and differences.pptx
PDF
Uderstanding digital marketing and marketing stratergie for engaging the digi...
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
PPTX
Module on health assessment of CHN. pptx
PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
PDF
Empowerment Technology for Senior High School Guide
PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
PDF
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
HVAC Specification 2024 according to central public works department
PDF
My India Quiz Book_20210205121199924.pdf
Education and Perspectives of Education.pptx
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 2).pdf
Journal of Dental Science - UDMY (2021).pdf
Computer Architecture Input Output Memory.pptx
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
Hazard Identification & Risk Assessment .pdf
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
Introduction to pro and eukaryotes and differences.pptx
Uderstanding digital marketing and marketing stratergie for engaging the digi...
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
Module on health assessment of CHN. pptx
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
Empowerment Technology for Senior High School Guide
FORM 1 BIOLOGY MIND MAPS and their schemes
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
Cambridge-Practice-Tests-for-IELTS-12.docx
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
HVAC Specification 2024 according to central public works department
My India Quiz Book_20210205121199924.pdf

How would you write this in MARIE assembly languageint count = 0;.pdf

  • 1. How would you write this in MARIE assembly language? int count = 0; int number = 30; int otherNum = 10; while ( count <= number) count += 3; output = count/otherNum; Solution Answer: .zero 1 main: push rbp mov rbp, rsp mov DWORD PTR [rbp-4], 0 mov DWORD PTR [rbp-8], 30 mov DWORD PTR [rbp-12], 10 .L3: mov eax, DWORD PTR [rbp-4] cmp eax, DWORD PTR [rbp-8] jg .L2 add DWORD PTR [rbp-4], 3 jmp .L3 .L2: mov eax, DWORD PTR [rbp-4] cdq idiv DWORD PTR [rbp-12] mov DWORD PTR [rbp-16], eax mov eax, 0 pop rbp ret __static_initialization_and_destruction_0(int, int): push rbp mov rbp, rsp
  • 2. sub rsp, 16 mov DWORD PTR [rbp-4], edi mov DWORD PTR [rbp-8], esi cmp DWORD PTR [rbp-4], 1 jne .L7 cmp DWORD PTR [rbp-8], 65535 jne .L7 mov edi, OFFSET FLAT:std::__ioinit call std::ios_base::Init::Init() mov edx, OFFSET FLAT:__dso_handle mov esi, OFFSET FLAT:std::__ioinit mov edi, OFFSET FLAT:std::ios_base::Init::~Init() call __cxa_atexit .L7: nop leave ret push rbp mov rbp, rsp mov esi, 65535 mov edi, 1 call __static_initialization_and_destruction_0(int, int) pop rbp ret