
Untitled
By: a guest on
Sep 22nd, 2010 | syntax:
ASM (NASM) | size: 5.36 KB | hits: 93 | expires: Never
; This code has been generated by the 7Basic
; compiler <http://launchpad.net/7basic>
extern printf
extern scanf
extern read
extern strlen
extern strcat
extern strcpy
extern strcmp
extern malloc
extern free
; Initialized data
SECTION .data
f_0 dq 4.500000000
f_1 dq 78.999000549
f_2 dq 12.344400406
f_3 dq 4.500000000
f_4 dq 78.999000549
f_5 dq 12.344400406
f_6 dq 4.500000000
f_7 dq 78.999000549
f_8 dq 12.344400406
s_9 db "All done!",0
printf_i: db "%d",10,0
printf_s: db "%s",10,0
printf_f: db "%f",10,0
scanf_i: db "%d",0
scanf_f: db "%lf",0
; Uninitialized data
SECTION .bss
v_0 resb 4
v_4 resb 4
v_8 resb 8
tstr resb 4
tfl resb 8
SECTION .text
; Code
global main
main:
finit
push ebp
mov ebp,esp
push 0
pop eax
mov [v_0], eax
push 0
pop eax
mov [v_4], eax
l_0:
mov eax, [v_0]
push eax
push 5000000
pop ebx
pop eax
cmp eax,ebx
jl l_2
push 0
jmp l_3
l_2:
push 1
jmp l_3
l_3:
pop eax
cmp eax,0
jne l_4
jmp l_1
l_4:
mov eax, [v_4]
push eax
push 100000
pop ebx
pop eax
cmp eax,ebx
je l_5
push 0
jmp l_6
l_5:
push 1
jmp l_6
l_6:
pop eax
cmp eax,0
jne l_8
jmp l_7
l_8:
mov eax, [v_0]
push eax
push printf_i
call printf
add esp,8
push 0
pop eax
mov [v_4], eax
l_7:
push 3
push dword [f_0+4]
push dword [f_0]
pop ebx
pop ecx
pop dword [tfl]
fild dword [tfl]
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
push ecx
push ebx
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
fmulp ST1,ST0
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
push 12
pop dword [tfl]
fild dword [tfl]
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
fdivrp ST1,ST0
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
push 34
push dword [f_1+4]
push dword [f_1]
pop ebx
pop ecx
pop dword [tfl]
fild dword [tfl]
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
push ecx
push ebx
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
fmulp ST1,ST0
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
push dword [f_2+4]
push dword [f_2]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
fdivrp ST1,ST0
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
faddp ST1,ST0
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
pop dword [v_8]
pop dword [v_8+4]
push 3
push dword [f_3+4]
push dword [f_3]
pop ebx
pop ecx
pop dword [tfl]
fild dword [tfl]
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
push ecx
push ebx
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
fmulp ST1,ST0
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
push 12
pop dword [tfl]
fild dword [tfl]
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
fdivrp ST1,ST0
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
push 34
push dword [f_4+4]
push dword [f_4]
pop ebx
pop ecx
pop dword [tfl]
fild dword [tfl]
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
push ecx
push ebx
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
fmulp ST1,ST0
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
push dword [f_5+4]
push dword [f_5]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
fdivrp ST1,ST0
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
faddp ST1,ST0
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
pop dword [v_8]
pop dword [v_8+4]
push 3
push dword [f_6+4]
push dword [f_6]
pop ebx
pop ecx
pop dword [tfl]
fild dword [tfl]
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
push ecx
push ebx
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
fmulp ST1,ST0
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
push 12
pop dword [tfl]
fild dword [tfl]
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
fdivrp ST1,ST0
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
push 34
push dword [f_7+4]
push dword [f_7]
pop ebx
pop ecx
pop dword [tfl]
fild dword [tfl]
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
push ecx
push ebx
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
fmulp ST1,ST0
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
push dword [f_8+4]
push dword [f_8]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
fdivrp ST1,ST0
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
pop dword [tfl]
pop dword [tfl+4]
fld qword [tfl]
faddp ST1,ST0
fstp qword [tfl]
push dword [tfl+4]
push dword [tfl]
pop dword [v_8]
pop dword [v_8+4]
mov eax, [v_0]
push eax
push 1
pop ebx
pop eax
add eax,ebx
push eax
pop eax
mov [v_0], eax
mov eax, [v_4]
push eax
push 1
pop ebx
pop eax
add eax,ebx
push eax
pop eax
mov [v_4], eax
jmp l_0
l_1:
push s_9
push printf_s
call printf
add esp,8
mov esp,ebp
pop ebp
mov eax,0
ret