Question: y86 is a assembly educational language Problem 2: Translate to Y86-64 The given C code is for a function that checks if all the elements

 y86 is a assembly educational language Problem 2: Translate to Y86-64

y86 is a assembly educational language

Problem 2: Translate to Y86-64 The given C code is for a function that checks if all the elements of a linked list add up to 100. struet 1inked 1ist long val struct linked list *next; int sum-to-100 (struct struct linked list *curr long total-; whilel current node !-NULL I linked-list start)( gtart total +-current_node->val; current node-current node->next total-100 return 1i else return 0i The x86-64 assembly given below was compiled with GCC from the C code given above. mto 100: mova so, trax 2 addg (trdi), B (tr %rax trdi L2 : trdi, 3 test trdi $100, rax $1, %rax mova ret 5: so, trax mova ret Write Y86-64 code that matches the given C and x86-64. You should mostly be able to translate instruction by instruction, but some x86-64 instruetions will need to be implemented by multiple Y86-64 instructions. Problem 2: Translate to Y86-64 The given C code is for a function that checks if all the elements of a linked list add up to 100. struet 1inked 1ist long val struct linked list *next; int sum-to-100 (struct struct linked list *curr long total-; whilel current node !-NULL I linked-list start)( gtart total +-current_node->val; current node-current node->next total-100 return 1i else return 0i The x86-64 assembly given below was compiled with GCC from the C code given above. mto 100: mova so, trax 2 addg (trdi), B (tr %rax trdi L2 : trdi, 3 test trdi $100, rax $1, %rax mova ret 5: so, trax mova ret Write Y86-64 code that matches the given C and x86-64. You should mostly be able to translate instruction by instruction, but some x86-64 instruetions will need to be implemented by multiple Y86-64 instructions

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!