The function uses cdecl argument passing. The C mane when you compile this will be _mystery
.
int __attribute__((cdecl)) mystery(int * array, int length) {
// save the rpevious function stack
// pushl %ebp
// movl %esp, %ebp
// xorl %eax, %eax
int eax = 0;
// xorl %exc, %ecx
int ecx = 0;
// cmpl 12(%ebp), %ecx
// jge done
while (length > ecx) {
// addl (%edx, %ecx, 4), %eax
eax += array[ecx];
// incl %ecx
ecx++;
// jump begin
}
// restorre previous stack frame
// movl %ebp, %esp
// popl %ebp
// ret
return eax;
}
The function computes the sum over an array of integers.