I tried creating a very simple example: a conversion program, where one number is an int and the other is a double.
global _main
extern _printf
section .data
km_h dd 70
format db '%fmph=%dkm/h',10,13,0
km_mi dq 1.609
section .code
_main:
push ebp
mov ebp, esp
sub esp, 16 ;for the parameters
fld qword [km_mi]
fimul dword [km_h]
mov dword [esp], format
mov eax, dword [km_h]
mov [esp+12], eax
fstp qword [esp+4]
push format
call _printf
mov esp, ebp
pop ebp
ret
I tried cc -S on a C source and went as far as writing it with mov [esp+X]
instead of push
ing, but whatever I try, it outputs garbage.