Mind the gap
Same idea, except now the function actually does something with its arguments instead of handing one straight back. The counting rule doesn't change: find the highest argument register the instruction names, and that's how many parameters there are — gaps and all.
Say an add takes its two sources from r3 and r6:
add r3, r3, r6
blr
r3 is the 1st argument and r6 is the 4th, so there are four parameters. The two in between, r4 and r5, arrive and get ignored — but you still have to declare them, or the value you need would never land in r6 in the first place:
int edge(int a, int b, int c, int d) {
return a + d;
}
Read your target, find its two source registers, and count from r3.
Your task
Write func_80030bc8 to reproduce the assembly above.