%include "io.inc" section .data i dd 1 section .text FUNC: mov esi, 1 pop ecx LOOP2: cmp ecx, 0 je .end mov ebx, 1 mov edi, 2 LOOP1: cmp edi, esi jge .next mov eax, esi cdq div edi cmp edx, 0 jne .exit add ebx, edi inc edi .exit: inc edi jmp LOOP1 .next: cmp esi, ebx jge .L1 dec ecx .L1: inc esi jmp LOOP2 .end: mov eax, esi xor esi, esi xor edi, edi xor ebx, ebx ret global CMAIN CMAIN: GET_DEC 4, [i] push ebp mov ebp, esp push ecx mov ecx, i call FUNC PRINT_DEC 4, eax xor eax, eax ret