Question: # # Write a Y86 program calculates the number of times # 'value' appears in a list of integers. # The skeleton code is provided

# # Write a Y86 program calculates the number of times # 'value' appears in a list of integers. # The skeleton code is provided below. # The main function (given) calls your function, 'counter', passing it # the address of the list in %rdi, the value to be counted # in %rsi, and the number of items in the list in %rdx. # You should return the the number of times it occurs in %rax. # Your code should not depend on the specific list and value provided below. # .pos 0 main: irmovq stack,%rsp irmovq value,%rsi mrmovq (%rsi),%rsi irmovq listsize,%rdx mrmovq (%rdx),%rdx irmovq list,%rdi call counter halt

counter: # Your code follows...

ret #return--result should be in %rax

########## Leave this line here (used for auto-testing) ##################### .align 8 listsize: .quad 12 value: .quad 3 list: .quad -1 .quad 3 .quad 5 .quad 9 .quad 3 .quad -4 .quad 3 .quad 7 .quad 2 .quad 3 .quad -10 .quad -8 .pos 0x200 stack:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!