HW 2

Write the following functions in ARM32 or ARM64 assembly. FOLLOW ALL CALLING CONVENTIONS.


int add2(int x, int y) {
    return x + y;
}

int add4(int x, int y, int z, int a) {
    return add2(add2(x, y), add2(z, a));
}

int add8(int *z) {
    return add2(add4(z[0], z[1], z[2], z[3]),
                add4(z[4], z[5], z[6], z[7]));
}