USE ARM ASSEMBLY LANGUAGE Write an ARM function subroutine t

USE ARM ASSEMBLY LANGUAGE!

Write an ARM function (subroutine) to count the number of odd integers in an integer array. The function signature is: A number is odd if the LSB is set (value = 1) and even if the LSB is reset (value = 0).

Solution

Answer:

Assembly Language Code:

.LC0:
.string \"Number of odd numbers:\"
main:
push rbp
mov rbp, rsp
sub rsp, 64
mov DWORD PTR [rbp-52], edi
mov QWORD PTR [rbp-64], rsi
mov DWORD PTR [rbp-48], 2
mov DWORD PTR [rbp-44], 3
mov DWORD PTR [rbp-40], 1025
mov DWORD PTR [rbp-36], 3024
mov DWORD PTR [rbp-32], 4057
mov DWORD PTR [rbp-28], -3
mov DWORD PTR [rbp-24], -1025
mov DWORD PTR [rbp-20], -3578
mov DWORD PTR [rbp-4], 8
mov edx, DWORD PTR [rbp-4]
lea rax, [rbp-48]
mov esi, edx
mov rdi, rax
call numodd(int*, int)
mov DWORD PTR [rbp-8], eax
mov eax, DWORD PTR [rbp-8]
mov esi, eax
mov edi, OFFSET FLAT:.LC0
mov eax, 0
call printf
mov edi, 0
call exit

USE ARM ASSEMBLY LANGUAGE! Write an ARM function (subroutine) to count the number of odd integers in an integer array. The function signature is: A number is od

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site