;fp_suav.asm
section .data
NULL equ 0
TRUE equ 1
FALSE equ 0
EXIT_SUCCESS equ 0
SYS_exit equ 60
fp_arr dq 23.45, 15.04, 5.01
ar_leng dd 3
ar_sum dq 0.00
ar_ave dq 0.00
section .text 
global _start
_start:
mov ecx, dword[ar_leng]      ;counter
mov rbx, fp_arr
mov rsi, 0                   ;i=0
movsd xmm1, qword[ar_sum]
sum_loop:
movsd xmm0, qword[rbx+rsi*8] ;fp_arr[i]
addsd xmm1, xmm0             ;update sum
inc rsi                      ;i++
loop sum_loop
movsd qword[ar_sum], xmm1   
cvtsi2sd xmm0, dword[ar_leng]
divsd xmm1, xmm0
movsd qword[ar_ave], xmm1
termina:
mov rax, SYS_exit
mov rbx, EXIT_SUCCESS
syscall

