nihonium
/
mipt_clang
Archived
1
0
Fork 0
master
nihonium 2 years ago
parent 402d412e92
commit bd66b63a05
No known key found for this signature in database
GPG Key ID: 0924047F4136012C

@ -0,0 +1,59 @@
global main
extern printf
extern scanf
section .text
main:
; read N
push n
push read
call scanf
add esp ,8
; read loop for x
xor ebx, ebx
;mov bx, word [n]
loop1:
cmp bx, word [n]
je nya1
lea eax, [x + 2 * ebx]
dbg1: push eax
push read
call scanf
add esp, 8
dbg2: inc ebx
jmp loop1
nya1:
xor ebx, ebx
mov bx, word [n]
dec ebx
loop2:
cmp bx, 0
jl nya2
lea eax, [x + 2 * ebx]
;push word [eax]
mov dx, word [eax]
push edx
push write
call printf
add esp, 8
dec ebx
jmp loop2
nya2:
push EOL
call printf
add esp, 4
xor eax, eax
ret
section .data
read db "%hu", 0
write db "%hu ", 0
EOL db 10, 0
section .bss
n resw 1
x resw 10000

@ -0,0 +1,12 @@
global main
extern printf
extern scanf
section .text
xor eax, eax
ret
section .data
in "%f", 0
out "%f", 10, 0

@ -2,6 +2,7 @@ global main
extern scanf
extern printf
<<<<<<< Updated upstream
section .text
main:
@ -66,3 +67,64 @@ t db "%d", 10, 0
section .bss
a resw 8
b resw 8
=======
section .text
main:
xor ebx, ebx
loop1:
cmp ebx, 8
je nya1
lea eax, [a + ebx]
push eax
push input
call scanf
add esp, 8
inc ebx
jmp loop1
nya1:
xor ebx, ebx
loop2:
cmp ebx, 8
je nya2
lea eax, [b + ebx]
push eax
push input
call scanf
add esp, 8
inc ebx
jmp loop2
nya2:
movq mm0, [a]
movq mm1, [b]
paddsb mm0, mm1
movq [a], mm0
xor ebx, ebx
loop3:
cmp ebx, 8
je nya3
lea eax, [a + ebx]
mov dl, byte [eax]
push edx
push output
call printf
add esp, 8
inc ebx
jmp loop3
nya3:
push EOL
call printf
add esp, 4
dbg: xor eax, eax
ret
section .data
input dd "%hhu", 0
output dd "%hhu ", 0
EOL dd 10
section .bss
a resb 8
b resb 8
>>>>>>> Stashed changes