Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a program that analyzes the vowels in a character string. Define a null-t

ID: 3798577 • Letter: C

Question


Create a program that analyzes the vowels in a character string. Define a null-terminated string of alphanumerical characters. For example "In phonetics, a vowel is a sound in spoken language, such as an English ah! Or oh!, pronounced with an open vocal tract". The program has to have the following subroutines: - only for ARM200: a printing subroutine that prints the entry and resulting string - a subroutine that takes a character and analyzes whether the character is a vowel If the character is a vowel, converts the vowel in uppercase and increments a count of vowels. A main e in sequence: - only for ARM200: first prints the origin string - calls the subroutine that parses the string -for every character calls the subroutine for vowel analysis - replaces the received character back in the string -only for ARM200: at the end prints the resulting string and the count of the vowels.

Explanation / Answer

Assembly Code is:

.LC0:
.string "Enter the string:"
.LC1:
.string " Number of vowels in string :"
main:
push rbp
mov rbp, rsp
sub rsp, 32
mov DWORD PTR [rbp-8], 0
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*)
lea rax, [rbp-32]
mov rsi, rax
mov edi, OFFSET FLAT:std::cin
call std::basic_istream<char, std::char_traits<char> >& std::operator>><char, std::char_traits<char> >(std::basic_istream<char, std::char_traits<char> >&, char*)
mov DWORD PTR [rbp-4], 0
.L8:
mov eax, DWORD PTR [rbp-4]
cdqe
movzx eax, BYTE PTR [rbp-32+rax]
test al, al
je .L2
mov eax, DWORD PTR [rbp-4]
cdqe
movzx eax, BYTE PTR [rbp-32+rax]
cmp al, 97
jne .L3
add DWORD PTR [rbp-8], 1
.L3:
mov eax, DWORD PTR [rbp-4]
cdqe
movzx eax, BYTE PTR [rbp-32+rax]
cmp al, 101
jne .L4
add DWORD PTR [rbp-8], 1
.L4:
mov eax, DWORD PTR [rbp-4]
cdqe
movzx eax, BYTE PTR [rbp-32+rax]
cmp al, 105
jne .L5
add DWORD PTR [rbp-8], 1
.L5:
mov eax, DWORD PTR [rbp-4]
cdqe
movzx eax, BYTE PTR [rbp-32+rax]
cmp al, 111
jne .L6
add DWORD PTR [rbp-8], 1
.L6:
mov eax, DWORD PTR [rbp-4]
cdqe
movzx eax, BYTE PTR [rbp-32+rax]
cmp al, 117
jne .L7
add DWORD PTR [rbp-8], 1
.L7:
add DWORD PTR [rbp-4], 1
jmp .L8
.L2:
mov esi, OFFSET FLAT:.LC1
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 .L12
cmp DWORD PTR [rbp-8], 65535
jne .L12
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
.L12:
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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote