Arm/sum args
From ASMBits
arm/callsavePrevious
Nextarm/max_args
Write a function with a variable number of arguments that returns the sum of all of its arguments. The first argument n tells you how many numbers to sum. The remaining n integers are the numbers to sum. The function will be called with exactly n+1 arguments.
Return the sum of all n numbers. Overflowing a 32-bit register should wrap around (i.e., no special handling).
int sum (int n, ... );
Expected solution length: Around 15 lines.
Sample Input
sum(2, 1, 2)
Sample Output
3
arm/callsavePrevious
Nextarm/max_args