Archived
1
0
Fork 0
This repository has been archived on 2022-06-20. You can view files and clone it, but cannot push or open issues or pull requests.
mipt_clang/nasm/P.asm
nihonium 89cd73673d
nya
2022-04-17 14:09:27 +03:00

88 lines
786 B
NASM

extern scanf
extern printf
global main
section .text
meow:
fld qword [x + 8 * ebx]
fld qword [n]
fcomp
fstsw ax
sahf
jnbe end
fld qword [n]
fxch
fsubr
fld qword [s]
fadd
fstp qword [s]
fld qword [x + 8 * ebx]
fld qword [q]
fxch
fdivr
inc ebx
fstp qword [x + 8 * ebx]
call meow
dec ebx
fld qword [x + 8 * ebx]
fld qword [w]
fxch
fdivr
inc ebx
fstp qword [x + 8 * ebx]
call meow
dec ebx
ret
end:
sub esp, 4
fstp dword [esp]
add esp, 4
ret
main:
xor ebx, ebx
push x
push i
call scanf
add esp, 8
call meow
fld qword [s]
sub esp, 8
fstp qword [esp]
push o
call printf
add esp, 12
xor eax, eax
ret
section .data
i db "%lf", 0
o db "%.10lf", 10, 13, 0
s dq 0.0
n dq 1.0
q dq 2.0
w dq 3.0
section .bss
x resq 100000