Arm/sum args

From ASMBits

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 

Write your solution here

Upload a source file...