Result

WA

Duration

493ms

Code [DL]

section .data
section .text
global _start

write:
push ebp
mov ebp, esp
mov edx, 1
mov ecx, ebp
add ecx, 8
mov ebx, 1
mov eax, 4
int 0x80
leave
ret

pi:
push ebp
mov ebp, esp
mov eax, [ebp+8]
cmp eax, 10
jl NO
mov edx, 0
mov ecx, 10
div ecx
push edx
push eax
call pi
mov eax, [esp+4] ; mod
NO:
add eax, 0x30
push eax
call write
leave
ret

read:
push ebp
mov ebp, esp
push 0
push 0
mov edx, 1
mov ecx, esp
mov ebx, 0
mov eax, 3
int 0x80

mov edx, 1
mov ecx, esp
add ecx, 4
mov ebx, 0
mov eax, 3
int 0x80

mov eax, [esp]
sub eax, 0x30
mul 10
add eax, [esp+4]
sub eax, 0x30
leave
ret

_start:
push ebp
mov ebp, esp
call read
push eax
call pi
leave
ret

stdin

52 99 40
04 40 51
97 09 06
49 36 65

stdout

stderr

/tmp/code.asm:57: error: invalid combination of opcode and operands
gcc: error: /tmp/code.o: No such file or directory
gcc: fatal error: no input files
compilation terminated.
/bin/script: 16: /bin/script: /tmp/code: not found
rm: cannot remove '/tmp/code.o': No such file or directory
rm: cannot remove '/tmp/code': No such file or directory

strace