please proovide a buildable code and screenshots of output if possibe Asse mblya
ID: 3595144 • Letter: P
Question
please proovide a buildable code and screenshots of output if possibe
Asse mblyanquoex S Implement tnr itlouing c4t assembq lanquage se the block sucuedIF ond directives Assume WIHILE thot au variables are 32-bit intrgers int arraI3, ,5, 9, 2,6,5, 3 nt lower 3 nt upper int index 0 while (index Arroyze) SumEO Carray Ciodex 13 louer 98 a rray tindexlkupe) sum += ndex tt array L index] Your assembly languoge program must altso dispky os outpud the number o thtes a member o am uali he varnble sum' was. (Hird you moy houe to odd ardtheExplanation / Answer
.LC0:
.string "The sum is "
main:
push rbp
mov rbp, rsp
sub rsp, 112
mov DWORD PTR [rbp-112], 3
mov DWORD PTR [rbp-108], 1
mov DWORD PTR [rbp-104], 4
mov DWORD PTR [rbp-100], 1
mov DWORD PTR [rbp-96], 5
mov DWORD PTR [rbp-92], 9
mov DWORD PTR [rbp-88], 2
mov DWORD PTR [rbp-84], 6
mov DWORD PTR [rbp-80], 5
mov DWORD PTR [rbp-76], 3
mov DWORD PTR [rbp-72], 5
mov DWORD PTR [rbp-68], 8
mov DWORD PTR [rbp-64], 9
mov DWORD PTR [rbp-60], 7
mov DWORD PTR [rbp-56], 9
mov DWORD PTR [rbp-52], 3
mov DWORD PTR [rbp-48], 2
mov DWORD PTR [rbp-44], 3
mov DWORD PTR [rbp-40], 8
mov DWORD PTR [rbp-36], 4
mov DWORD PTR [rbp-12], 3
mov DWORD PTR [rbp-16], 8
mov DWORD PTR [rbp-20], 20
mov DWORD PTR [rbp-4], 0
mov DWORD PTR [rbp-8], 0
.L4:
mov eax, DWORD PTR [rbp-4]
cmp eax, DWORD PTR [rbp-20]
jge .L2
mov eax, DWORD PTR [rbp-4]
cdqe
mov eax, DWORD PTR [rbp-112+rax*4]
cmp eax, DWORD PTR [rbp-12]
jl .L3
mov eax, DWORD PTR [rbp-4]
cdqe
mov eax, DWORD PTR [rbp-112+rax*4]
cmp eax, DWORD PTR [rbp-16]
jg .L3
mov eax, DWORD PTR [rbp-4]
cdqe
mov eax, DWORD PTR [rbp-112+rax*4]
add DWORD PTR [rbp-8], eax
.L3:
add DWORD PTR [rbp-4], 1
jmp .L4
.L2:
mov esi, OFFSET FLAT:.LC0
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
mov rdx, rax
mov eax, DWORD PTR [rbp-8]
mov esi, eax
mov rdi, rdx
call std::basic_ostream<char, std::char_traits<char> >::operator<<(int)
mov eax, 0
leave
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 .L8
cmp DWORD PTR [rbp-8], 65535
jne .L8
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
.L8:
nop
leave
ret
_GLOBAL__sub_I_main:
push rbp
mov rbp, rsp
mov esi, 65535
mov edi, 1
call __static_initialization_and_destruction_0(int, int)
pop rbp
ret
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.