SlideShare a Scribd company logo
Implement an MPI program to perform matrix-matrix multiplication AB where A and B are both
128x128 random matrices with entries between 0 and 1. Run the code for 2, 4 and 8 processors.
Solution
Answer:
MIPS Assembly Language Code :
.zero 1
.LC0:
.string "Enter rows and columns for first matrix: "
.LC1:
.string "Enter rows and columns for second matrix: "
.LC2:
.string "Error! column of first matrix not equal to row of second."
.LC3:
.string "Enter elements of matrix 1:"
.LC4:
.string "Enter element a"
.LC5:
.string " : "
.LC6:
.string "Enter elements of matrix 2:"
.LC7:
.string "Enter element b"
.LC8:
.string "The Multiplication of matrix is: "
.LC9:
.string " "
main:
push rbp
mov rbp, rsp
push r12
push rbx
sub rsp, 1232
mov esi, OFFSET FLAT:.LC0
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
lea rax, [rbp-1236]
mov rsi, rax
mov edi, OFFSET FLAT:std::cin
call std::basic_istream >::operator>>(int&)
mov rdx, rax
lea rax, [rbp-1240]
mov rsi, rax
mov rdi, rdx
call std::basic_istream >::operator>>(int&)
mov esi, OFFSET FLAT:.LC1
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
lea rax, [rbp-1244]
mov rsi, rax
mov edi, OFFSET FLAT:std::cin
call std::basic_istream >::operator>>(int&)
mov rdx, rax
lea rax, [rbp-1248]
mov rsi, rax
mov rdi, rdx
call std::basic_istream >::operator>>(int&)
.L3:
mov edx, DWORD PTR [rbp-1240]
mov eax, DWORD PTR [rbp-1244]
cmp edx, eax
je .L2
mov esi, OFFSET FLAT:.LC2
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
mov esi, OFFSET FLAT:.LC0
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
lea rax, [rbp-1236]
mov rsi, rax
mov edi, OFFSET FLAT:std::cin
call std::basic_istream >::operator>>(int&)
mov rdx, rax
lea rax, [rbp-1240]
mov rsi, rax
mov rdi, rdx
call std::basic_istream >::operator>>(int&)
mov esi, OFFSET FLAT:.LC1
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
lea rax, [rbp-1244]
mov rsi, rax
mov edi, OFFSET FLAT:std::cin
call std::basic_istream >::operator>>(int&)
mov rdx, rax
lea rax, [rbp-1248]
mov rsi, rax
mov rdi, rdx
call std::basic_istream >::operator>>(int&)
jmp .L3
.L2:
mov esi, OFFSET FLAT:std::basic_ostream >& std::endl >(std::basic_ostream >&)
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&))
mov esi, OFFSET FLAT:.LC3
mov rdi, rax
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
mov esi, OFFSET FLAT:std::basic_ostream >& std::endl >(std::basic_ostream >&)
mov rdi, rax
call std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&))
mov DWORD PTR [rbp-20], 0
.L7:
mov eax, DWORD PTR [rbp-1236]
cmp DWORD PTR [rbp-20], eax
jge .L4
mov DWORD PTR [rbp-24], 0
.L6:
mov eax, DWORD PTR [rbp-1240]
cmp DWORD PTR [rbp-24], eax
jge .L5
mov eax, DWORD PTR [rbp-24]
lea ebx, [rax+1]
mov eax, DWORD PTR [rbp-20]
lea r12d, [rax+1]
mov esi, OFFSET FLAT:.LC4
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
mov esi, r12d
mov rdi, rax
call std::basic_ostream >::operator<<(int)
mov esi, ebx
mov rdi, rax
call std::basic_ostream >::operator<<(int)
mov esi, OFFSET FLAT:.LC5
mov rdi, rax
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
lea rcx, [rbp-432]
mov eax, DWORD PTR [rbp-24]
movsx rsi, eax
mov eax, DWORD PTR [rbp-20]
movsx rdx, eax
mov rax, rdx
sal rax, 2
add rax, rdx
add rax, rax
add rax, rsi
sal rax, 2
add rax, rcx
mov rsi, rax
mov edi, OFFSET FLAT:std::cin
call std::basic_istream >::operator>>(int&)
add DWORD PTR [rbp-24], 1
jmp .L6
.L5:
add DWORD PTR [rbp-20], 1
jmp .L7
.L4:
mov esi, OFFSET FLAT:std::basic_ostream >& std::endl >(std::basic_ostream >&)
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&))
mov esi, OFFSET FLAT:.LC6
mov rdi, rax
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
mov esi, OFFSET FLAT:std::basic_ostream >& std::endl >(std::basic_ostream >&)
mov rdi, rax
call std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&))
mov DWORD PTR [rbp-20], 0
.L11:
mov eax, DWORD PTR [rbp-1244]
cmp DWORD PTR [rbp-20], eax
jge .L8
mov DWORD PTR [rbp-24], 0
.L10:
mov eax, DWORD PTR [rbp-1248]
cmp DWORD PTR [rbp-24], eax
jge .L9
mov eax, DWORD PTR [rbp-24]
lea ebx, [rax+1]
mov eax, DWORD PTR [rbp-20]
lea r12d, [rax+1]
mov esi, OFFSET FLAT:.LC7
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
mov esi, r12d
mov rdi, rax
call std::basic_ostream >::operator<<(int)
mov esi, ebx
mov rdi, rax
call std::basic_ostream >::operator<<(int)
mov esi, OFFSET FLAT:.LC5
mov rdi, rax
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
lea rcx, [rbp-832]
mov eax, DWORD PTR [rbp-24]
movsx rsi, eax
mov eax, DWORD PTR [rbp-20]
movsx rdx, eax
mov rax, rdx
sal rax, 2
add rax, rdx
add rax, rax
add rax, rsi
sal rax, 2
add rax, rcx
mov rsi, rax
mov edi, OFFSET FLAT:std::cin
call std::basic_istream >::operator>>(int&)
add DWORD PTR [rbp-24], 1
jmp .L10
.L9:
add DWORD PTR [rbp-20], 1
jmp .L11
.L8:
mov DWORD PTR [rbp-20], 0
.L15:
mov eax, DWORD PTR [rbp-1236]
cmp DWORD PTR [rbp-20], eax
jge .L12
mov DWORD PTR [rbp-24], 0
.L14:
mov eax, DWORD PTR [rbp-1248]
cmp DWORD PTR [rbp-24], eax
jge .L13
mov eax, DWORD PTR [rbp-24]
movsx rcx, eax
mov eax, DWORD PTR [rbp-20]
movsx rdx, eax
mov rax, rdx
sal rax, 2
add rax, rdx
add rax, rax
add rax, rcx
mov DWORD PTR [rbp-1232+rax*4], 0
add DWORD PTR [rbp-24], 1
jmp .L14
.L13:
add DWORD PTR [rbp-20], 1
jmp .L15
.L12:
mov DWORD PTR [rbp-20], 0
.L21:
mov eax, DWORD PTR [rbp-1236]
cmp DWORD PTR [rbp-20], eax
jge .L16
mov DWORD PTR [rbp-24], 0
.L20:
mov eax, DWORD PTR [rbp-1248]
cmp DWORD PTR [rbp-24], eax
jge .L17
mov DWORD PTR [rbp-28], 0
.L19:
mov eax, DWORD PTR [rbp-1240]
cmp DWORD PTR [rbp-28], eax
jge .L18
mov eax, DWORD PTR [rbp-24]
movsx rcx, eax
mov eax, DWORD PTR [rbp-20]
movsx rdx, eax
mov rax, rdx
sal rax, 2
add rax, rdx
add rax, rax
add rax, rcx
mov ecx, DWORD PTR [rbp-1232+rax*4]
mov eax, DWORD PTR [rbp-28]
movsx rsi, eax
mov eax, DWORD PTR [rbp-20]
movsx rdx, eax
mov rax, rdx
sal rax, 2
add rax, rdx
add rax, rax
add rax, rsi
mov esi, DWORD PTR [rbp-432+rax*4]
mov eax, DWORD PTR [rbp-24]
movsx rdi, eax
mov eax, DWORD PTR [rbp-28]
movsx rdx, eax
mov rax, rdx
sal rax, 2
add rax, rdx
add rax, rax
add rax, rdi
mov eax, DWORD PTR [rbp-832+rax*4]
imul eax, esi
add ecx, eax
mov eax, DWORD PTR [rbp-24]
movsx rsi, eax
mov eax, DWORD PTR [rbp-20]
movsx rdx, eax
mov rax, rdx
sal rax, 2
add rax, rdx
add rax, rax
add rax, rsi
mov DWORD PTR [rbp-1232+rax*4], ecx
add DWORD PTR [rbp-28], 1
jmp .L19
.L18:
add DWORD PTR [rbp-24], 1
jmp .L20
.L17:
add DWORD PTR [rbp-20], 1
jmp .L21
.L16:
mov esi, OFFSET FLAT:std::basic_ostream >& std::endl >(std::basic_ostream >&)
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&))
mov esi, OFFSET FLAT:.LC8
mov rdi, rax
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
mov esi, OFFSET FLAT:std::basic_ostream >& std::endl >(std::basic_ostream >&)
mov rdi, rax
call std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&))
mov DWORD PTR [rbp-20], 0
.L26:
mov eax, DWORD PTR [rbp-1236]
cmp DWORD PTR [rbp-20], eax
jge .L22
mov DWORD PTR [rbp-24], 0
.L25:
mov eax, DWORD PTR [rbp-1248]
cmp DWORD PTR [rbp-24], eax
jge .L23
mov eax, DWORD PTR [rbp-24]
movsx rcx, eax
mov eax, DWORD PTR [rbp-20]
movsx rdx, eax
mov rax, rdx
sal rax, 2
add rax, rdx
add rax, rax
add rax, rcx
mov ebx, DWORD PTR [rbp-1232+rax*4]
mov esi, OFFSET FLAT:.LC9
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
mov esi, ebx
mov rdi, rax
call std::basic_ostream >::operator<<(int)
mov eax, DWORD PTR [rbp-1248]
sub eax, 1
cmp eax, DWORD PTR [rbp-24]
jne .L24
mov esi, OFFSET FLAT:std::basic_ostream >& std::endl >(std::basic_ostream >&)
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&))
.L24:
add DWORD PTR [rbp-24], 1
jmp .L25
.L23:
add DWORD PTR [rbp-20], 1
jmp .L26
.L22:
mov eax, 0
add rsp, 1232
pop rbx
pop r12
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 .L30
cmp DWORD PTR [rbp-8], 65535
jne .L30
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
.L30:
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
Write a program in MIPS that reads in a Roman form number from th.pdf
PDF
Write an MPI program that implements a shell-sort like parallel algo.pdf
PDF
Translate the following CC++ code into MIPS Assembly Codevoid ch.pdf
PDF
Write a Pep8 Assembly program that reads in and stores two integers .pdf
PDF
WCTF 2018 binja Editorial
PDF
Qemu JIT Code Generator and System Emulation
PDF
Please convert the following C code to assembly Y86int j,k; .....pdf
PPTX
Evgeniy Muralev, Mark Vince, Working with the compiler, not against it
Write a program in MIPS that reads in a Roman form number from th.pdf
Write an MPI program that implements a shell-sort like parallel algo.pdf
Translate the following CC++ code into MIPS Assembly Codevoid ch.pdf
Write a Pep8 Assembly program that reads in and stores two integers .pdf
WCTF 2018 binja Editorial
Qemu JIT Code Generator and System Emulation
Please convert the following C code to assembly Y86int j,k; .....pdf
Evgeniy Muralev, Mark Vince, Working with the compiler, not against it

Similar to Implement an MPI program to perform matrix-matrix multiplication AB .pdf (20)

PDF
R/C++ talk at earl 2014
PPTX
C++ and Assembly: Debugging and Reverse Engineering
PDF
Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]
PPT
Chapter Eight(3)
DOC
Function Call Optimization
PPTX
A scrupulous code review - 15 bugs in C++ code
PDF
Please convert the following C code to assembly Y86int i,j; ......pdf
PDF
Visual Studio를 이용한 어셈블리어 학습 part 2
PPTX
C++ Code as Seen by a Hypercritical Reviewer
PDF
Exploring the x64
PDF
An Example MIPS
ODP
The forgotten art of assembly
PDF
HHVM on AArch64 - BUD17-400K1
PDF
OptimizingARM
PDF
Scale17x buffer overflows
PDF
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
PDF
Debugging Ruby Systems
PDF
Virtual Machine for Regular Expressions
PDF
Extend R with Rcpp!!!
PDF
R/C++ talk at earl 2014
C++ and Assembly: Debugging and Reverse Engineering
Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]
Chapter Eight(3)
Function Call Optimization
A scrupulous code review - 15 bugs in C++ code
Please convert the following C code to assembly Y86int i,j; ......pdf
Visual Studio를 이용한 어셈블리어 학습 part 2
C++ Code as Seen by a Hypercritical Reviewer
Exploring the x64
An Example MIPS
The forgotten art of assembly
HHVM on AArch64 - BUD17-400K1
OptimizingARM
Scale17x buffer overflows
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
Debugging Ruby Systems
Virtual Machine for Regular Expressions
Extend R with Rcpp!!!
Ad

More from meerobertsonheyde608 (20)

PDF
Discuss the seven factors that analysts consider where selecting a f.pdf
PDF
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdf
PDF
Conduct some basic research on the recessive disorder Albinism.Des.pdf
PDF
calculate the next annual dividend payment for stock currently selli.pdf
PDF
Bookmark On the Isle of Man off the coast of Ireland, a curious cat .pdf
PDF
Answer the questions below based on the database model found on the n.pdf
PDF
You are reviewing basic network protocols with a new tech in your co.pdf
PDF
Why might a gene have more than 2 different allelesa.     DNA seq.pdf
PDF
Which of the following are true statementsI. sin2+cos2=1II. sec.pdf
PDF
What scientific mechanism for evolution did Charles Darwin and Alfred.pdf
PDF
What is the main difference between doing business process analysis .pdf
PDF
What are the genetic differences between a processed pseudogene and .pdf
PDF
True or False_____ Cells Composed of chemicals and structures, ma.pdf
PDF
The picture above shows the life cycle of a moss. Mark all true stat.pdf
PDF
The conversion of pyruvate to acetyl-CoA. A. requires the addition o.pdf
PDF
Suppose S is a set of n + 1 integers. Prove that there exist distinct.pdf
PDF
Structural features of fungi Complete the following paragraph to desc.pdf
PDF
State some successful predictions from Einsteins theory of special.pdf
PDF
QUESTION 7 Forward and futures markets provide insurance or hedging a.pdf
PDF
Problem 14-1A On January 1, 2017, Geffrey Corporation had the followi.pdf
Discuss the seven factors that analysts consider where selecting a f.pdf
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdf
Conduct some basic research on the recessive disorder Albinism.Des.pdf
calculate the next annual dividend payment for stock currently selli.pdf
Bookmark On the Isle of Man off the coast of Ireland, a curious cat .pdf
Answer the questions below based on the database model found on the n.pdf
You are reviewing basic network protocols with a new tech in your co.pdf
Why might a gene have more than 2 different allelesa.     DNA seq.pdf
Which of the following are true statementsI. sin2+cos2=1II. sec.pdf
What scientific mechanism for evolution did Charles Darwin and Alfred.pdf
What is the main difference between doing business process analysis .pdf
What are the genetic differences between a processed pseudogene and .pdf
True or False_____ Cells Composed of chemicals and structures, ma.pdf
The picture above shows the life cycle of a moss. Mark all true stat.pdf
The conversion of pyruvate to acetyl-CoA. A. requires the addition o.pdf
Suppose S is a set of n + 1 integers. Prove that there exist distinct.pdf
Structural features of fungi Complete the following paragraph to desc.pdf
State some successful predictions from Einsteins theory of special.pdf
QUESTION 7 Forward and futures markets provide insurance or hedging a.pdf
Problem 14-1A On January 1, 2017, Geffrey Corporation had the followi.pdf
Ad

Recently uploaded (20)

PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
RMMM.pdf make it easy to upload and study
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
master seminar digital applications in india
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Cell Structure & Organelles in detailed.
PPTX
Lesson notes of climatology university.
PDF
01-Introduction-to-Information-Management.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
RMMM.pdf make it easy to upload and study
Sports Quiz easy sports quiz sports quiz
PPH.pptx obstetrics and gynecology in nursing
master seminar digital applications in india
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Microbial diseases, their pathogenesis and prophylaxis
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
VCE English Exam - Section C Student Revision Booklet
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Cell Structure & Organelles in detailed.
Lesson notes of climatology university.
01-Introduction-to-Information-Management.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf

Implement an MPI program to perform matrix-matrix multiplication AB .pdf

  • 1. Implement an MPI program to perform matrix-matrix multiplication AB where A and B are both 128x128 random matrices with entries between 0 and 1. Run the code for 2, 4 and 8 processors. Solution Answer: MIPS Assembly Language Code : .zero 1 .LC0: .string "Enter rows and columns for first matrix: " .LC1: .string "Enter rows and columns for second matrix: " .LC2: .string "Error! column of first matrix not equal to row of second." .LC3: .string "Enter elements of matrix 1:" .LC4: .string "Enter element a" .LC5: .string " : " .LC6: .string "Enter elements of matrix 2:" .LC7: .string "Enter element b" .LC8: .string "The Multiplication of matrix is: " .LC9: .string " " main: push rbp mov rbp, rsp push r12 push rbx sub rsp, 1232 mov esi, OFFSET FLAT:.LC0
  • 2. mov edi, OFFSET FLAT:std::cout call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) lea rax, [rbp-1236] mov rsi, rax mov edi, OFFSET FLAT:std::cin call std::basic_istream >::operator>>(int&) mov rdx, rax lea rax, [rbp-1240] mov rsi, rax mov rdi, rdx call std::basic_istream >::operator>>(int&) mov esi, OFFSET FLAT:.LC1 mov edi, OFFSET FLAT:std::cout call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) lea rax, [rbp-1244] mov rsi, rax mov edi, OFFSET FLAT:std::cin call std::basic_istream >::operator>>(int&) mov rdx, rax lea rax, [rbp-1248] mov rsi, rax mov rdi, rdx call std::basic_istream >::operator>>(int&) .L3: mov edx, DWORD PTR [rbp-1240] mov eax, DWORD PTR [rbp-1244] cmp edx, eax je .L2 mov esi, OFFSET FLAT:.LC2 mov edi, OFFSET FLAT:std::cout call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) mov esi, OFFSET FLAT:.LC0 mov edi, OFFSET FLAT:std::cout call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) lea rax, [rbp-1236] mov rsi, rax
  • 3. mov edi, OFFSET FLAT:std::cin call std::basic_istream >::operator>>(int&) mov rdx, rax lea rax, [rbp-1240] mov rsi, rax mov rdi, rdx call std::basic_istream >::operator>>(int&) mov esi, OFFSET FLAT:.LC1 mov edi, OFFSET FLAT:std::cout call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) lea rax, [rbp-1244] mov rsi, rax mov edi, OFFSET FLAT:std::cin call std::basic_istream >::operator>>(int&) mov rdx, rax lea rax, [rbp-1248] mov rsi, rax mov rdi, rdx call std::basic_istream >::operator>>(int&) jmp .L3 .L2: mov esi, OFFSET FLAT:std::basic_ostream >& std::endl >(std::basic_ostream >&) mov edi, OFFSET FLAT:std::cout call std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&)) mov esi, OFFSET FLAT:.LC3 mov rdi, rax call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) mov esi, OFFSET FLAT:std::basic_ostream >& std::endl >(std::basic_ostream >&) mov rdi, rax call std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&)) mov DWORD PTR [rbp-20], 0 .L7: mov eax, DWORD PTR [rbp-1236] cmp DWORD PTR [rbp-20], eax jge .L4 mov DWORD PTR [rbp-24], 0
  • 4. .L6: mov eax, DWORD PTR [rbp-1240] cmp DWORD PTR [rbp-24], eax jge .L5 mov eax, DWORD PTR [rbp-24] lea ebx, [rax+1] mov eax, DWORD PTR [rbp-20] lea r12d, [rax+1] mov esi, OFFSET FLAT:.LC4 mov edi, OFFSET FLAT:std::cout call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) mov esi, r12d mov rdi, rax call std::basic_ostream >::operator<<(int) mov esi, ebx mov rdi, rax call std::basic_ostream >::operator<<(int) mov esi, OFFSET FLAT:.LC5 mov rdi, rax call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) lea rcx, [rbp-432] mov eax, DWORD PTR [rbp-24] movsx rsi, eax mov eax, DWORD PTR [rbp-20] movsx rdx, eax mov rax, rdx sal rax, 2 add rax, rdx add rax, rax add rax, rsi sal rax, 2 add rax, rcx mov rsi, rax mov edi, OFFSET FLAT:std::cin call std::basic_istream >::operator>>(int&) add DWORD PTR [rbp-24], 1
  • 5. jmp .L6 .L5: add DWORD PTR [rbp-20], 1 jmp .L7 .L4: mov esi, OFFSET FLAT:std::basic_ostream >& std::endl >(std::basic_ostream >&) mov edi, OFFSET FLAT:std::cout call std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&)) mov esi, OFFSET FLAT:.LC6 mov rdi, rax call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) mov esi, OFFSET FLAT:std::basic_ostream >& std::endl >(std::basic_ostream >&) mov rdi, rax call std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&)) mov DWORD PTR [rbp-20], 0 .L11: mov eax, DWORD PTR [rbp-1244] cmp DWORD PTR [rbp-20], eax jge .L8 mov DWORD PTR [rbp-24], 0 .L10: mov eax, DWORD PTR [rbp-1248] cmp DWORD PTR [rbp-24], eax jge .L9 mov eax, DWORD PTR [rbp-24] lea ebx, [rax+1] mov eax, DWORD PTR [rbp-20] lea r12d, [rax+1] mov esi, OFFSET FLAT:.LC7 mov edi, OFFSET FLAT:std::cout call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) mov esi, r12d mov rdi, rax call std::basic_ostream >::operator<<(int) mov esi, ebx mov rdi, rax
  • 6. call std::basic_ostream >::operator<<(int) mov esi, OFFSET FLAT:.LC5 mov rdi, rax call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) lea rcx, [rbp-832] mov eax, DWORD PTR [rbp-24] movsx rsi, eax mov eax, DWORD PTR [rbp-20] movsx rdx, eax mov rax, rdx sal rax, 2 add rax, rdx add rax, rax add rax, rsi sal rax, 2 add rax, rcx mov rsi, rax mov edi, OFFSET FLAT:std::cin call std::basic_istream >::operator>>(int&) add DWORD PTR [rbp-24], 1 jmp .L10 .L9: add DWORD PTR [rbp-20], 1 jmp .L11 .L8: mov DWORD PTR [rbp-20], 0 .L15: mov eax, DWORD PTR [rbp-1236] cmp DWORD PTR [rbp-20], eax jge .L12 mov DWORD PTR [rbp-24], 0 .L14: mov eax, DWORD PTR [rbp-1248] cmp DWORD PTR [rbp-24], eax jge .L13 mov eax, DWORD PTR [rbp-24]
  • 7. movsx rcx, eax mov eax, DWORD PTR [rbp-20] movsx rdx, eax mov rax, rdx sal rax, 2 add rax, rdx add rax, rax add rax, rcx mov DWORD PTR [rbp-1232+rax*4], 0 add DWORD PTR [rbp-24], 1 jmp .L14 .L13: add DWORD PTR [rbp-20], 1 jmp .L15 .L12: mov DWORD PTR [rbp-20], 0 .L21: mov eax, DWORD PTR [rbp-1236] cmp DWORD PTR [rbp-20], eax jge .L16 mov DWORD PTR [rbp-24], 0 .L20: mov eax, DWORD PTR [rbp-1248] cmp DWORD PTR [rbp-24], eax jge .L17 mov DWORD PTR [rbp-28], 0 .L19: mov eax, DWORD PTR [rbp-1240] cmp DWORD PTR [rbp-28], eax jge .L18 mov eax, DWORD PTR [rbp-24] movsx rcx, eax mov eax, DWORD PTR [rbp-20] movsx rdx, eax mov rax, rdx sal rax, 2
  • 8. add rax, rdx add rax, rax add rax, rcx mov ecx, DWORD PTR [rbp-1232+rax*4] mov eax, DWORD PTR [rbp-28] movsx rsi, eax mov eax, DWORD PTR [rbp-20] movsx rdx, eax mov rax, rdx sal rax, 2 add rax, rdx add rax, rax add rax, rsi mov esi, DWORD PTR [rbp-432+rax*4] mov eax, DWORD PTR [rbp-24] movsx rdi, eax mov eax, DWORD PTR [rbp-28] movsx rdx, eax mov rax, rdx sal rax, 2 add rax, rdx add rax, rax add rax, rdi mov eax, DWORD PTR [rbp-832+rax*4] imul eax, esi add ecx, eax mov eax, DWORD PTR [rbp-24] movsx rsi, eax mov eax, DWORD PTR [rbp-20] movsx rdx, eax mov rax, rdx sal rax, 2 add rax, rdx add rax, rax add rax, rsi mov DWORD PTR [rbp-1232+rax*4], ecx
  • 9. add DWORD PTR [rbp-28], 1 jmp .L19 .L18: add DWORD PTR [rbp-24], 1 jmp .L20 .L17: add DWORD PTR [rbp-20], 1 jmp .L21 .L16: mov esi, OFFSET FLAT:std::basic_ostream >& std::endl >(std::basic_ostream >&) mov edi, OFFSET FLAT:std::cout call std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&)) mov esi, OFFSET FLAT:.LC8 mov rdi, rax call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) mov esi, OFFSET FLAT:std::basic_ostream >& std::endl >(std::basic_ostream >&) mov rdi, rax call std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&)) mov DWORD PTR [rbp-20], 0 .L26: mov eax, DWORD PTR [rbp-1236] cmp DWORD PTR [rbp-20], eax jge .L22 mov DWORD PTR [rbp-24], 0 .L25: mov eax, DWORD PTR [rbp-1248] cmp DWORD PTR [rbp-24], eax jge .L23 mov eax, DWORD PTR [rbp-24] movsx rcx, eax mov eax, DWORD PTR [rbp-20] movsx rdx, eax mov rax, rdx sal rax, 2 add rax, rdx add rax, rax
  • 10. add rax, rcx mov ebx, DWORD PTR [rbp-1232+rax*4] mov esi, OFFSET FLAT:.LC9 mov edi, OFFSET FLAT:std::cout call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) mov esi, ebx mov rdi, rax call std::basic_ostream >::operator<<(int) mov eax, DWORD PTR [rbp-1248] sub eax, 1 cmp eax, DWORD PTR [rbp-24] jne .L24 mov esi, OFFSET FLAT:std::basic_ostream >& std::endl >(std::basic_ostream >&) mov edi, OFFSET FLAT:std::cout call std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&)) .L24: add DWORD PTR [rbp-24], 1 jmp .L25 .L23: add DWORD PTR [rbp-20], 1 jmp .L26 .L22: mov eax, 0 add rsp, 1232 pop rbx pop r12 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 .L30
  • 11. cmp DWORD PTR [rbp-8], 65535 jne .L30 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 .L30: 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