I already have the code just need question 3
# Execution begins at address 0 .pos 0 irmovq stack, %rsp # Set up stack pointer call main # Execute main program halt # Terminate program # Array of 4 elements .align 8 array: .quad 0x000004 .quad 0x000005 .quad 0x000006 .quad 0x000007 .quad 0x000008 cuadrado: .quad 0x000000 .quad 0x000000 .quad 0x000000 .quad 0x000000 .quad 0x000000 main: irmovq array,%rdi # Obtengo array irmovq $8, %r8 # Offset irmovq $5, %r9 # Itera 5 veces irmovq $0, %r11 # Para referencia a cuadrado mas adelante loop: xorq %rax, %rax # Comienza en 0 mrmovq (%rdi), %r10 # Obtiene array[1] rrmovq %r10, %rsi mul: addq %r10, %rax isubq $1, %rsi jne mul rmmovq %rax, 0x0040(%r11) # Mueve el resultado a la memoria addq %r8, %rdi # Incrementa addq %r8, %r11 # Incrementa isubq $1, %r9 # Itera hasta llegar a 0 jne loop ret # Stack starts here and grows to lower addresses .pos 0x200 stack: Code reference viernes, 11 de diciembre de 2020 19:13 Notas rápidas página 1 Problem 1 (ISA) Consider the following C program segment: ... int number [] = {4,5,6,7,8}; int squared [] = {0,0,0,0,0}; int main () { int i; for (i = 0; i <5; i="" ++)="" {="" square="" [i]="number" [i]="" *="" number="" [i];="" }="" ...="" }="" write="" an="" equivalent="" program="" in="" assembly="" y86="" 64="" using="" simulator="" (https://boginw.github.io/js-y86-64/)="" problem="" 2="" (datapath)="" (main)="" from="" the="" assembly="" program="" of="" your="" answer="" to="" problem="" 1="" select="" a="" sequence="" of="" instructions="" such="" that,="" when="" considering="" their="" execution="" using="" pipeline,="" there="" is="" an="" obvious="" dependency="" data="" or="" control.="" indicate="" which="" instructions="" were="" selected="" and="" then="" write="" the="" program="" covered="" using="" stalling="" to="" correct="" it="" viernes,="" 11="" de="" diciembre="" de="" 2020="" 18:52="" notas="" rápidas="" página="" 1="" https://boginw.github.io/js-y86-64/="" .align="" 8="" numero:="" .quad="" 0x4="" .quad="" 0x5="" .quad="" 0x6="" .quad="" 0x7="" .quad="" 0x8="" .align="" 8="" cuadrado:="" .quad="" 0x0="" .quad="" 0x0="" .quad="" 0x0="" .quad="" 0x0="" .quad="" 0x0="" main:="" irmovq="" numero,="" %rdi="" #get="" the="" array="" irmovq="" cuadrado,="" %rsi="" #get="" the="" array="" irmovq="" $0,="" %rax="" #int="" i="" irmovq="" $1,="" %rcx="" #const="" 1="" irmovq="" $8,="" %rdx="" #const="" 8="" loop:="" mrmovq="" (%rdi),="" %r10="" #="" square[i]="number[i]" rrmovq="" %r10,="" %r9="" #to="" get="" sums="" rrmovq="" %r10,="" %r8="" #indicate="" how="" many="" timer="" do="" a="" sum="" subq="" %rcx,="" %r8="" square:="" #realiza="" la="" suma="" %r8="" times,="" means,="" get="" the="" square="" addq="" %r9,="" %r10="" subq="" %rcx,="" %r8="" jne="" square="" #="" if="" %r8=""> 0 cont: rmmovq %r10, (%rdi) addq %rdx, %rdi addq %rdx, %rsi addq %rcx, %rax irmovq $5, %rbx subq %rax, %rbx jne loop jmp fin fin: Code reference viernes, 11 de diciembre de 2020 19:13 Notas rápidas página 15;>