by@__dAi00
WA
635ms
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 mov ecx, 10 mul ecx add eax, [esp+4] sub eax, 0x30 leave ret _start: push ebp mov ebp, esp sub esp, 120 mov ecx, 12 loop: mov [esp+100], ecx call read mov ecx, 12 sub ecx, [esp+100] mov [esp+4*ecx], eax mov edx, 1 mov ecx, esp add ecx, 108 add ecx, 4 mov ebx, 0 mov eax, 3 int 0x80 mov ecx, [esp+100] LOOP loop mov ecx, 9 mov edx, 0 loop2: mov ebx, 12 sub ebx, ecx mov eax, [esp+4*ebx] sub eax, [esp+4*edx] mov [esp+4*ebx], eax add edx, 1 cmp edx, 3 jne NMOD mov edx, 0 NMOD: LOOP loop2 mov ebx, 0 mov eax, [esp+12] mov ecx, [esp+28] imul ecx mov ecx, [esp+40] imul ecx add ebx, eax mov eax, [esp+16] mov ecx, [esp+32] imul ecx mov ecx, [esp+36] imul ecx add ebx, eax mov eax, [esp+20] mov ecx, [esp+24] imul ecx mov ecx, [esp+40] imul ecx add ebx, eax mov eax, [esp+12] mov ecx, [esp+32] imul ecx mov ecx, [esp+40] imul ecx sub ebx, eax mov eax, [esp+16] mov ecx, [esp+24] imul ecx mov ecx, [esp+44] imul ecx sub ebx, eax mov eax, [esp+20] mov ecx, [esp+28] imul ecx mov ecx, [esp+36] imul ecx sub ebx, eax mov eax, ebx mov edx, 0 mov ecx, 6 idiv ecx push eax call pi leave ret
94 08 32 63 52 56 78 69 16 20 47 04
5441
Segmentation fault (core dumped)