Question

The objective of this project is to increase your understanding of data, address, memory contents, and...

The objective of this project is to increase your understanding of data, address, memory contents, and strings. You are tasked to use MIPS assembly language instructions, assembler directives and system call to find how many times the G, A, M, E, C, O, C, K, and S letters occur within an input sentence, and then output the result using the format shown below.

Sample Input is:

The South Carolina Gamecocks football program represents the University of South Carolina in the sport of American football. The Gamecocks compete in the Football Bowl Subdivision of the National Collegiate Athletic Association (NCAA) and the Eastern Division of the Southeastern Conference. Will Muschamp currently serves as the team's head coach. They play their home games at Williams-Brice Stadium. Currently, it is the 20th largest stadium in college football.

Sample output is:

G: 7

A: 36

M: 13

E: 43

C: 21

O: 33

C: 21

K: 2

S: 27

The submitted program shall provide outputs in exactly the sequence and format shown above. To receive full credit, no additional superfluous outputs shall occur.

Output a histogram of the number of the occurrences of the letters G, A, M, E, C, O, C, K, and S within an input sentence:

G:#######

A: ####################################

M: #############

E: ###########################################

C: #####################

O: #################################

C: #####################

K: ##

S: ###########################

0 0
Add a comment Improve this question Transcribed image text
Answer #1

main:

push rbp

mov rbp, rsp

push rbx

sub rsp, 168

lea rax, [rbp-64]

mov rdi, rax

call std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string() [complete object constructor]

lea rax, [rbp-64]

mov rsi, rax

mov edi, OFFSET FLAT:_ZSt3cin

call std::basic_istream<char, std::char_traits<char> >& std::operator>><char, std::char_traits<char>, std::allocator<char> >(std::basic_istream<char, std::char_traits<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)

lea rdx, [rbp-176]

mov eax, 0

mov ecx, 13

mov rdi, rdx

rep stosq

mov DWORD PTR [rbp-20], 0

.L3:

mov eax, DWORD PTR [rbp-20]

movsx rbx, eax

lea rax, [rbp-64]

mov rdi, rax

call std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::length() const

cmp rbx, rax

setb al

test al, al

je .L2

mov eax, DWORD PTR [rbp-20]

movsx rdx, eax

lea rax, [rbp-64]

mov rsi, rdx

mov rdi, rax

call std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned long)

movzx eax, BYTE PTR [rax]

movsx eax, al

sub eax, 48

movsx rdx, eax

mov edx, DWORD PTR [rbp-176+rdx*4]

add edx, 1

cdqe

mov DWORD PTR [rbp-176+rax*4], edx

add DWORD PTR [rbp-20], 1

jmp .L3

.L2:

mov DWORD PTR [rbp-24], 0

.L8:

cmp DWORD PTR [rbp-24], 25

jg .L4

mov eax, DWORD PTR [rbp-24]

cdqe

mov eax, DWORD PTR [rbp-176+rax*4]

test eax, eax

je .L5

mov DWORD PTR [rbp-28], 1

.L7:

mov eax, DWORD PTR [rbp-24]

cdqe

mov eax, DWORD PTR [rbp-176+rax*4]

cmp DWORD PTR [rbp-28], eax

jg .L6

mov esi, 35

mov edi, OFFSET FLAT:_ZSt4cout

call std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char)

add DWORD PTR [rbp-24], 1

jmp .L7

.L6:

mov esi, OFFSET FLAT:_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_

mov edi, OFFSET FLAT:_ZSt4cout

call std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))

.L5:

add DWORD PTR [rbp-24], 1

jmp .L8

.L4:

lea rax, [rbp-64]

mov rdi, rax

call std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() [complete object destructor]

mov eax, 0

jmp .L12

mov rbx, rax

lea rax, [rbp-64]

mov rdi, rax

call std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() [complete object destructor]

mov rax, rbx

mov rdi, rax

call _Unwind_Resume

.L12:

add rsp, 168

pop rbx

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 .L15

cmp DWORD PTR [rbp-8], 65535

jne .L15

mov edi, OFFSET FLAT:_ZStL8__ioinit

call std::ios_base::Init::Init() [complete object constructor]

mov edx, OFFSET FLAT:__dso_handle

mov esi, OFFSET FLAT:_ZStL8__ioinit

mov edi, OFFSET FLAT:_ZNSt8ios_base4InitD1Ev

call __cxa_atexit

.L15:

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

Add a comment
Know the answer?
Add Answer to:
The objective of this project is to increase your understanding of data, address, memory contents, and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is a c++ question note: not using  namespace std; at the beginning of the program Writing...

    This is a c++ question note: not using  namespace std; at the beginning of the program Writing Data to a File This program will write a series of letters, starting with 'A', to an external file (letters.txt). The user will decide how many letters in total get saved to the file. ** IMPORTANT: The test cases will evaluate your code against .txt files that I uploaded. You do NOT have to upload your own txt files. Input: Including 'A', how many...

  • Please use Python def findSubstrings(s):     # Write your code here Consider a string, s = "abc"....

    Please use Python def findSubstrings(s):     # Write your code here Consider a string, s = "abc". An alphabetically-ordered sequence of substrings of s would be {"a", "ab", "abc", "b", "bc", "c"}. If the sequence is reduced to only those substrings that start with a vowel and end with a consonant, the result is {"ab", "abc"}. The alphabetically first element in this reduced list is "ab", and the alphabetically last element is "abc". As a reminder: • Vowels: a, e, i,...

  • You shall develop a grammar and implement a parser which recognizes valid statements as described below in the assignment specification. You may develop your code using C, C++. The test file include...

    You shall develop a grammar and implement a parser which recognizes valid statements as described below in the assignment specification. You may develop your code using C, C++. The test file include these expressions below. The first six should pass and the rest should fail: first = one1 + two2 - three3 / four4 ; second = one1 * (two2 * three3) ; second = one1 * (two2 * three3) ; third = ONE + twenty - three3 ; third...

  • Develop a Java application that uses a type of encrypted alphabet, called a random monoalphabetic cipher,...

    Develop a Java application that uses a type of encrypted alphabet, called a random monoalphabetic cipher, to encrypt and decrypt a message. Your encryption key and message are to be read in from two different files and then the encrypted message will be output to third file. Then the encrypted message is read in and decrypted to a fourth file. A monoalphabetic cipher starts with an encryption word, removes the redundant letters from the word, and assigns what’s left to...

  • Programming project in Java: You are allowed to use the following methods from the Java API:...

    Programming project in Java: You are allowed to use the following methods from the Java API: class String length charAt class StringBuilder length charAt append toString class Character any method Create a class called HW2 that contains the following methods: 1. isAlphabeticalOrder takes a String as input and returns a boolean: The method returns true if all the letters of the input string are in alphabetical order, regardless of case. The method returns false otherwise. Do not use arrays to...

  • LU 1 Copy Bad Check Cell Good Explanatory... Neutral Input Alignment Intern Styles Project 2 -...

    LU 1 Copy Bad Check Cell Good Explanatory... Neutral Input Alignment Intern Styles Project 2 - Read-Only - Excel File Home Insert Page Layout Formulas Data Review View Help Search A Xcut Calibri - 12 -A A === - Wrap Test General Normal Paste Format Painter BIUR O -A- S Merge & Center $ - % 9 8 99 Conditional Format as Calculation Formatting Table Clipboard Font Number A1 X Comparing injury rates by high school sport А LD E...

  • I don't know how to terminate the code in the second time that whether or not...

    I don't know how to terminate the code in the second time that whether or not the users want to continue to get a new number. PLEASE HELP. To make telephone numbers easier to remember, some companies use letters to show their telephone number. For example, using letters, the telephone number 438-5626 can be shown as GET LOAN. In some cases, to make a telephone number meaningful, companies might use more than seven letters. For example, 225-5466 can be displayed...

  • having trouble with the following swift 5 problem. It is just printing the number 4 twice...

    having trouble with the following swift 5 problem. It is just printing the number 4 twice and it seems to be ignoring camelCasePhraseTwo, please help if you can: /* Problem 4 Write a function that takes in a camel-case string and returns an integer representing the number of words in the string Notes: - Assume all input will contain only letters, and the string will be a valid camel-cased phrase - Do not loop through the array manually. */ func...

  • C++ help Format any numerical decimal values with 2 digits after the decimal point. Problem descr...

    C++ help Format any numerical decimal values with 2 digits after the decimal point. Problem description Write the following functions as prototyped below. Do not alter the function signatures. /// Returns a copy of the string with its first character capitalized and the rest lowercased. /// @example capitalize("hELLO wORLD") returns "Hello world" std::string capitalize(const std::string& str); /// Returns a copy of the string centered in a string of length 'width'. /// Padding is done using the specified 'fillchar' (default is...

  • only number 3 3 Southwestern University South Day Sweate AL One of m' demanding Wha wad....

    only number 3 3 Southwestern University South Day Sweate AL One of m' demanding Wha wad. With dance. WU to face the head on. Althoch alarm wing and some seriously Wisner, president of Southwester Unity deci to Adding thods of all, including of boxes, would not please everyone. The went argued the foreftad tory for his players and a place App the couch of a fare NCAA champion Bondag pobability of 1 The bow to get to de 2015 eded....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT