1 100 Pts Download Assign3 S From Class Webpage This Code Prints An Array Of Size 10 2839710

1. (100 pts) Download assign3.s from class webpage. This code prints an array of size 10 and the sum of the two largest elements in the array. Function1 in assign3.s has the following prototype int function1(int A[10]); and computes and returns the sum of two largest elements in the array. Body of function1 in assign3.s is missing. Complete the body of function1. Do NOT store local variables on the stack. Use registers instead. Sum of the two largest elements in the array should be 172. You can compile assign3.s as follows hen01> gcc assign3.s -o assign3 Note that eax, edx, ecx are caller-save registers and ebx, esi and edi are callee-save registers. If you use ebx, esi and edi in your program. You need to push them onto stack and pop them before return to restore the values. Submit your assign3.s using blackboard.


Connect with a professional writer in 5 simple steps

Please provide as many details about your writing struggle as possible

Academic level of your paper

Type of Paper

When is it due?

How many pages is this assigment?

Document Preview:

.file”assign3.c” .section.rodata .LC0: .string”B[%d]=%dn” .LC1: .string”Sum of 2 largest = %dn” .text .globlmain .typemain, @function main: pushl%ebp movl%esp, %ebp andl$-16, %esp subl$64, %esp movl$0, 20(%esp) jmp.L2 .L3: movl20(%esp), %eax imull20(%esp), %eax imull20(%esp), %eax leal50(%eax), %ecx movl$1374389535, %edx movl%ecx, %eax imull%edx sarl$5, %edx movl%ecx, %eax sarl$31, %eax subl%eax, %edx movl%edx, %eax imull$100, %eax, %eax subl%eax, %ecx movl%ecx, %eax movl20(%esp), %edx movl%eax, 24(%esp,%edx,4) addl$1, 20(%esp) .L2: cmpl$9, 20(%esp) jle.L3 movl$0, 20(%esp) jmp.L4 .L5: movl20(%esp), %eax movl24(%esp,%eax,4), %eax movl%eax, 8(%esp) movl20(%esp), %eax movl%eax, 4(%esp) movl$.LC0, (%esp) callprintf addl$1, 20(%esp) .L4: cmpl$9, 20(%esp) jle.L5 leal24(%esp), %eax movl%eax, (%esp) callfunction1 movl%eax, 4(%esp) movl$.LC1, (%esp) callprintf leave ret .sizemain, .-main .globlfunction1 .typefunction1, @function function1: pushl%ebp movl%esp, %ebp # INSERT YOUR CODE HERE # DO NOT STORE LOCAL VARIABLES ON STACK # USE REGISTERS FOR LOCAL VARIABLES popl%ebp ret .sizefunction1, .-function1 .ident”GCC: (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4″ .section.note.GNU-stack,””,@progbits