; ccallee0.asm
; arr, address – rdi
; len, dword value – esi
; sum, address – rdx
; ave, address - rcx
section .data
section .text
global ccallee0
ccallee0:
push r12            ;prologue
mov r12, 0          ;counter index
mov rax, 0
sumLoop:
add eax, dword[rdi+r12*4]  ; sum+=arr[i]
inc r12
cmp r12, rsi
jl sumLoop
mov dword[rdx], eax     ; return the sum 
cdq      ; convert dword edx in qword edx:eax
idiv esi ; eax=eax/esi, remainder in edx
mov dword[rcx], eax
pop r12
ret

