nihonium
/
mipt_clang
Archived
1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

64 lines
738 B
NASM

global main
extern printf
extern scanf
extern qsort
section .text
main:
; read N
push n
push readn
call scanf
add esp ,8
; read loop for x
xor ebx, ebx
loop1:
cmp bx, word [n]
je nya1
lea eax, [x + 2 * ebx]
dbg1: push eax
push nya
call scanf
add esp, 8
dbg2: inc ebx
jmp loop1
nya1:
push compare
push dword 2
push dword [n]
push x
;push x
;push dword [n]
;push dword 2 ; size of element
;push compare
call qsort
add esp, 16
xor eax, eax
ret
compare:
;mov ebp, esp
;sub esp, 16
;pop eax
;pop ebx
;push ebp
;mov ebp, esp
mov eax, dword [esp + 4]
;lea ebx, [ebp - 2]
;mov ebx, [esp + 8]
sub eax, [esp + 8]
ret
section .data
nya db "%hu", 0
readn db "%d", 0
section .bss
n resd 1
x resw 10000