I think the code does not work here:
_start:
pushl $24
call profit
movl %eax, %ebx
movl $1, %eax
int $0x80
profit:
popl %ebx
popl %eax
So, you push $24(4 bytes), and then call profitthat pushes eipand goes on profit. Then you add the value eipin ebxand the value $24in eax.
, , jg end end:, , ret . , pushl %ebx.
cmpl %ecx, %esi
jg end
pushl %ebx
ret
end:
mov %ecx, %eax
; `pushl %ebx` is needed here!
ret