.data pipe_array: .long 0, 0 pipe_string: .string "/bin/sort -n" format: .string "%d\n" arr: .zero 400 .text .globl main .type main, @function main: pushl $pipe_array pushl $pipe_string call p2open addl $8, %esp pushl $0 call srand addl $4, %esp movl $100, %ebx random: decl %ebx call rand movl $0,%edx movl $100, %ecx div %ecx pushl %edx pushl $format pushl pipe_array call fprintf addl $12, %esp cmpl $0, %ebx jne random pushl pipe_array call fclose addl $4, %esp pushl $10 movl $pipe_array, %ebx pushl 4(%ebx) pushl $400 movl $arr, %ebx out: pushl %ebx call fgets addl $4, %esp cmpl $0, %eax je end L1: cmpb $10, (%ebx) je L2 incl %ebx popl %eax decl %eax pushl %eax jmp L1 L2: movb $9, (%ebx) //space 32 incl %ebx movl 8(%esp), %eax decl %eax movl %eax, 8(%esp) cmpl $0, %eax jne out movb $0, -1(%ebx) pushl $arr call puts addl $4, %esp movl $10, 8(%esp) movl $arr, %ebx movl $400, (%esp) jmp out end: cmpl $10, 8(%esp) jne L2 addl $12, %esp ret