; main_0.asm
; ascending sorted values array
; arr, address – rdi
; len, dword value – esi
; lower median, address - rcx
; upper median, address - r8
; min, address – rdx
; max, address - r9
; sum, address – stack (rbp+16)
; ave, address – stack (rbp+24)
;
section .data
LF equ 10               ; \n
NULL equ 0              ; end of string
TRUE equ 1
FALSE equ 0
EXIT_SUCCESS equ 0
SYS_exit equ 60
arr dd 1, 2, 3, 4, 5, 7, 9, 11, 24, 30
arrlen dd 10
;
section .bss
sum resd 1
ave resd 1
lowermed0 resd 1
uppermed0 resd 1
mini resd 1
maxi resd 1
;
extern sum_0
extern ave_0
extern min_0
extern max_0
extern uppermed
extern lowermed
;
section .text
;
global main
main: 
;
push rbp
mov rbp, rsp
push r12
push r13
push r14
push r15
push rbx
push r11
;
mov rdi, arr            ; rdi 1st argument ADDRESS
mov esi, dword[arrlen]  ;low rsi 2nd arg., VALUE
mov rdx, sum
call sum_0
mov rcx, ave
call ave_0
mov rcx, lowermed0
call lowermed
mov rcx, uppermed0
call uppermed
mov rdx, mini
call min_0
mov r9, maxi
call max_0
pop r11
pop rbx
pop r15
pop r14
pop r13
pop r12
pop rbp
;
Exit_Label:
mov rax, SYS_exit
mov rdi, EXIT_SUCCESS
syscall


